diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-05-16 03:03:58 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-05-16 12:20:18 +0200 |
commit | 45daaf2caaa3dc8bf8c505a9fc61a61b989721dc (patch) | |
tree | 040de9f40c73eae2280827ccaad6ac7cb776a053 | |
parent | 79e2a845cd162696c7652bbb6cd407bfa24b738b (diff) | |
download | ffmpeg-45daaf2caaa3dc8bf8c505a9fc61a61b989721dc.tar.gz |
avcodec/mpeg12enc: Fix writing closed captions
Broken in 6e225123d8583fdce55037b85eaef5453f201959, because
ff_copy_bits() expects the amount of bits, not bytes to write.
And because it relies on the buffer to be padded, using
side_data->size * 8 is not possible. So partially revert
said commit.
Fixes ticket #11591.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/mpeg12enc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index b89619312e..9d0a8e4170 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -472,7 +472,8 @@ static int mpeg1_encode_picture_header(MPVMainEncContext *const m) (side_data->size / 3 & A53_MAX_CC_COUNT) | 0x40); // flags, cc_count put_bits(&s->pb, 8, 0xff); // em_data - ff_copy_bits(&s->pb, side_data->data, side_data->size); + for (int i = 0; i < side_data->size; i++) + put_bits(&s->pb, 8, side_data->data[i]); put_bits(&s->pb, 8, 0xff); // marker_bits } else { |