cccombiner: fix s334-1a in place conversion

The code wants to prepend one byte to every byte pair. It correctly did
so by working backwards pair-wise, but then didn't work backwards
instead of each individual pair / future triplet, overwriting
information before attempting to read it.

The code also failed to update the len pointer after prepending.

This fixes both issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4100>
This commit is contained in:
Mathieu Duponchelle 2023-03-02 17:23:44 +01:00 committed by GStreamer Marge Bot
parent 44ddd17884
commit d55c5a3eec

View file

@ -170,10 +170,12 @@ prepend_s334_to_cea608 (guint field, guint8 * data, guint * len,
g_assert (*len / 2 * 3 <= alloc_len);
for (i = *len / 2; i >= 0; i--) {
data[i * 3 + 0] = field == 0 ? 0x80 : 0x00;
data[i * 3 + 1] = data[i * 2 + 0];
data[i * 3 + 2] = data[i * 2 + 1];
data[i * 3 + 1] = data[i * 2 + 0];
data[i * 3 + 0] = field == 0 ? 0x80 : 0x00;
}
*len = *len * 3 / 2;
}
static void