mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
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:
parent
44ddd17884
commit
d55c5a3eec
1 changed files with 4 additions and 2 deletions
|
@ -170,10 +170,12 @@ prepend_s334_to_cea608 (guint field, guint8 * data, guint * len,
|
||||||
g_assert (*len / 2 * 3 <= alloc_len);
|
g_assert (*len / 2 * 3 <= alloc_len);
|
||||||
|
|
||||||
for (i = *len / 2; i >= 0; i--) {
|
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 + 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
|
static void
|
||||||
|
|
Loading…
Reference in a new issue