mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-24 09:00:35 +00:00
cdgparse: mark palette commands as HEADER
Fix rendering with decodebin3 which is dropping the first input buffers until it find a header or key frame.
This commit is contained in:
parent
1ae57967ae
commit
e5244fc36a
|
@ -23,6 +23,8 @@ use crate::constants::{
|
||||||
};
|
};
|
||||||
|
|
||||||
const CDG_CMD_MEMORY_PRESET: u8 = 1;
|
const CDG_CMD_MEMORY_PRESET: u8 = 1;
|
||||||
|
const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_1: u8 = 30;
|
||||||
|
const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_2: u8 = 31;
|
||||||
|
|
||||||
struct CdgParse;
|
struct CdgParse;
|
||||||
|
|
||||||
|
@ -173,7 +175,7 @@ impl BaseParseImpl for CdgParse {
|
||||||
return Ok((gst::FlowSuccess::Ok, skip));
|
return Ok((gst::FlowSuccess::Ok, skip));
|
||||||
}
|
}
|
||||||
|
|
||||||
let keyframe = {
|
let (keyframe, header) = {
|
||||||
let map = input.map_readable().ok_or_else(|| {
|
let map = input.map_readable().ok_or_else(|| {
|
||||||
gst_element_error!(
|
gst_element_error!(
|
||||||
element,
|
element,
|
||||||
|
@ -184,8 +186,15 @@ impl BaseParseImpl for CdgParse {
|
||||||
})?;
|
})?;
|
||||||
let data = map.as_slice();
|
let data = map.as_slice();
|
||||||
|
|
||||||
// consider memory preset as keyframe as it clears the screen
|
match data[1] & CDG_MASK {
|
||||||
data[1] & CDG_MASK == CDG_CMD_MEMORY_PRESET
|
// consider memory preset as keyframe as it clears the screen
|
||||||
|
CDG_CMD_MEMORY_PRESET => (true, false),
|
||||||
|
// mark palette commands as headers
|
||||||
|
CDG_CMD_MEMORY_LOAD_COLOR_TABLE_1 | CDG_CMD_MEMORY_LOAD_COLOR_TABLE_2 => {
|
||||||
|
(false, true)
|
||||||
|
}
|
||||||
|
_ => (false, false),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let pts = bytes_to_time(Bytes(Some(frame.get_offset())));
|
let pts = bytes_to_time(Bytes(Some(frame.get_offset())));
|
||||||
|
@ -195,6 +204,9 @@ impl BaseParseImpl for CdgParse {
|
||||||
if !keyframe {
|
if !keyframe {
|
||||||
buffer.set_flags(gst::BufferFlags::DELTA_UNIT);
|
buffer.set_flags(gst::BufferFlags::DELTA_UNIT);
|
||||||
}
|
}
|
||||||
|
if header {
|
||||||
|
buffer.set_flags(gst::BufferFlags::HEADER);
|
||||||
|
}
|
||||||
|
|
||||||
gst_debug!(CAT, obj: element, "Found frame pts={}", pts);
|
gst_debug!(CAT, obj: element, "Found frame pts={}", pts);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue