From: Scott Theisen <scott.the.elm@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2] libavcodec/mpeg12dec.c: rename 0x0502 CC format Date: Sun, 2 Feb 2025 13:55:03 -0500 Message-ID: <20250202185547.142728-1-scott.the.elm@gmail.com> (raw) In-Reply-To: <CA+28BfAAsZok5ZUkyjCjoaKKbFLmBk5Nk3RfshL13Th_PEfj8w@mail.gmail.com> The format is used by at least Dish Network, but is not defined in any DVB standard, so remove references to DVB. This is a simple rename, no functional change. --- libavcodec/mpeg12dec.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 9bb995b5be..0002f016e9 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -67,7 +67,7 @@ enum Mpeg2ClosedCaptionsFormat { CC_FORMAT_A53_PART4, CC_FORMAT_SCTE20, CC_FORMAT_DVD, - CC_FORMAT_DVB_0502 + CC_FORMAT_DISH }; typedef struct Mpeg1Context { @@ -2064,39 +2064,39 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, mpeg_set_cc_format(avctx, CC_FORMAT_DVD, "DVD"); } return 1; - } else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_DVB_0502) && + } else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_DISH) && buf_size >= 12 && p[0] == 0x05 && p[1] == 0x02) { - /* extract DVB 0502 CC data */ + /* extract Dish Network CC data */ const uint8_t cc_header = 0xf8 | 0x04 /* valid */ | 0x00 /* line 21 field 1 */; uint8_t cc_data[4] = {0}; int cc_count = 0; - uint8_t dvb_cc_type = p[7]; + uint8_t cc_type = p[7]; p += 8; buf_size -= 8; - if (dvb_cc_type == 0x05 && buf_size >= 7) { - dvb_cc_type = p[6]; + if (cc_type == 0x05 && buf_size >= 7) { + cc_type = p[6]; p += 7; buf_size -= 7; } - if (dvb_cc_type == 0x02 && buf_size >= 4) { /* 2-byte caption, can be repeated */ + if (cc_type == 0x02 && buf_size >= 4) { /* 2-byte caption, can be repeated */ cc_count = 1; cc_data[0] = p[1]; cc_data[1] = p[2]; - dvb_cc_type = p[3]; + cc_type = p[3]; /* Only repeat characters when the next type flag * is 0x04 and the characters are repeatable (i.e., less than * 32 with the parity stripped). */ - if (dvb_cc_type == 0x04 && (cc_data[0] & 0x7f) < 32) { + if (cc_type == 0x04 && (cc_data[0] & 0x7f) < 32) { cc_count = 2; cc_data[2] = cc_data[0]; cc_data[3] = cc_data[1]; } - } else if (dvb_cc_type == 0x04 && buf_size >= 5) { /* 4-byte caption, not repeated */ + } else if (cc_type == 0x04 && buf_size >= 5) { /* 4-byte caption, not repeated */ cc_count = 2; cc_data[0] = p[1]; cc_data[1] = p[2]; @@ -2124,7 +2124,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, } } - mpeg_set_cc_format(avctx, CC_FORMAT_DVB_0502, "DVB 0502"); + mpeg_set_cc_format(avctx, CC_FORMAT_DISH, "Dish Network"); } return 1; } @@ -2687,7 +2687,7 @@ const FFCodec ff_mpeg1video_decoder = { static const AVOption mpeg2video_options[] = { { "cc_format", "extract a specific Closed Captions format", M2V_OFFSET(cc_format), AV_OPT_TYPE_INT, { .i64 = CC_FORMAT_AUTO }, - CC_FORMAT_AUTO, CC_FORMAT_DVB_0502, M2V_PARAM, .unit = "cc_format" }, + CC_FORMAT_AUTO, CC_FORMAT_DISH, M2V_PARAM, .unit = "cc_format" }, { "auto", "pick first seen CC substream", 0, AV_OPT_TYPE_CONST, { .i64 = CC_FORMAT_AUTO }, .flags = M2V_PARAM, .unit = "cc_format" }, @@ -2697,8 +2697,8 @@ static const AVOption mpeg2video_options[] = { { .i64 = CC_FORMAT_SCTE20 }, .flags = M2V_PARAM, .unit = "cc_format" }, { "dvd", "pick DVD CC substream", 0, AV_OPT_TYPE_CONST, { .i64 = CC_FORMAT_DVD }, .flags = M2V_PARAM, .unit = "cc_format" }, - { "dvb_0502", "pick DVB 0502 CC substream", 0, AV_OPT_TYPE_CONST, - { .i64 = CC_FORMAT_DVB_0502 }, .flags = M2V_PARAM, .unit = "cc_format" }, + { "dish", "pick Dish Network CC substream", 0, AV_OPT_TYPE_CONST, + { .i64 = CC_FORMAT_DISH }, .flags = M2V_PARAM, .unit = "cc_format" }, { NULL } }; -- 2.43.0 _______________________________________________ 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".
next prev parent reply other threads:[~2025-02-02 18:56 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-01-25 20:26 [FFmpeg-devel] [PATCH] " Scott Theisen 2025-01-25 20:39 ` Marton Balint 2025-01-25 22:52 ` Marth64 2025-01-25 23:28 ` Kieran Kunhya via ffmpeg-devel 2025-01-25 23:53 ` Scott Theisen 2025-01-26 0:07 ` Soft Works 2025-01-26 0:13 ` Marth64 2025-01-26 0:30 ` Soft Works 2025-01-26 10:04 ` Kieran Kunhya via ffmpeg-devel 2025-01-26 23:00 ` Soft Works 2025-01-26 23:11 ` Kieran Kunhya via ffmpeg-devel 2025-01-27 0:34 ` Marth64 2025-02-02 18:55 ` Scott Theisen [this message] 2025-02-03 2:40 ` [FFmpeg-devel] [PATCH v2] " Marth64
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=20250202185547.142728-1-scott.the.elm@gmail.com \ --to=scott.the.elm@gmail.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