Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avcodec/mpeg12enc: Fix writing closed captions
Date: Fri, 16 May 2025 03:11:15 +0200
Message-ID: <AS8P250MB07444C362B166BCD785DD1CA8F93A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 63 bytes --]

Patch attached. Will apply it soon. Sorry for this.

- Andreas

[-- Attachment #2: 0001-avcodec-mpeg12enc-Fix-writing-closed-captions.patch --]
[-- Type: text/x-patch, Size: 1368 bytes --]

From d76c32a88bfe9dc3b7a1fbf3dab49d1e69414d71 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Fri, 16 May 2025 03:03:58 +0200
Subject: [PATCH] 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>
---
 libavcodec/mpeg12enc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 {
-- 
2.45.2


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

                 reply	other threads:[~2025-05-16  1:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB07444C362B166BCD785DD1CA8F93A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git