ceax08overlay: fix field lookup for s334-1a

As stated in the spec:

> Bit b7 of the LINE value is the field number (0 for field 2;
> 1 for field 1). Bits b6 and b5 are 0. Bits b4-b0 form a 5-bit unsigned
> integer which represents the offset [..]

Here, b7 is the most significant bit, this is what both cccombiner
and ccconverter agree on.

The overlay elements previously looked at the least significant bit,
which led to garbled text when both fields were actually present
in the CC meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2069>
This commit is contained in:
Mathieu Duponchelle 2025-02-11 14:01:28 +01:00 committed by GStreamer Marge Bot
parent f08b99dcd3
commit cece286fe8
2 changed files with 7 additions and 5 deletions

View file

@ -185,15 +185,17 @@ impl Cea608Overlay {
}
for triple in data.chunks_exact(3) {
let cc_type = triple[0] & 0x01;
let field = if (triple[0] & 0x80) == 0x80 { 0 } else { 1 };
if state.selected_field.is_none() {
state.selected_field = Some(cc_type);
gst::info!(CAT, imp = self, "Selected field {} automatically", cc_type);
state.selected_field = Some(field);
gst::info!(CAT, imp = self, "Selected field {field} automatically");
}
if Some(cc_type) != state.selected_field {
if Some(field) != state.selected_field {
continue;
};
match state.renderer.push_pair([triple[1], triple[2]]) {
Err(e) => {
gst::warning!(

View file

@ -295,7 +295,7 @@ impl Cea708Overlay {
}
for triple in data.chunks_exact(3) {
let field = if triple[0] & 0x01 == 0x0 {
let field = if (triple[0] & 0x80) == 0x80 {
cea608_types::tables::Field::ONE
} else {
cea608_types::tables::Field::TWO