* [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
@ 2025-01-25 20:26 Scott Theisen
2025-01-25 20:39 ` Marton Balint
0 siblings, 1 reply; 14+ messages in thread
From: Scott Theisen @ 2025-01-25 20:26 UTC (permalink / raw)
To: ffmpeg-devel
The format is used by at least one DVB-S provider, but is not defined in any DVB
standard, so remove references to DVB. Since I don't have any standard that
does define this format, using the magic number as the name seems most
appropriate.
This is a simple rename, no functional change.
----
This renaming was discussed briefly on the mailing list on 28 December 2024,
but I never saw a patch to rename it.
---
libavcodec/mpeg12dec.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 9bb995b5be..f28d900cc9 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_0x0502
};
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_0x0502) &&
buf_size >= 12 &&
p[0] == 0x05 && p[1] == 0x02) {
- /* extract DVB 0502 CC data */
+ /* extract 0x0502 format 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_0x0502, "0x0502");
}
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_0x0502, 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" },
+ { "0x0502", "pick 0x0502 format CC substream", 0, AV_OPT_TYPE_CONST,
+ { .i64 = CC_FORMAT_0x0502 }, .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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-25 20:26 [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format Scott Theisen
@ 2025-01-25 20:39 ` Marton Balint
2025-01-25 22:52 ` Marth64
0 siblings, 1 reply; 14+ messages in thread
From: Marton Balint @ 2025-01-25 20:39 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, 25 Jan 2025, Scott Theisen wrote:
> The format is used by at least one DVB-S provider, but is not defined in any DVB
> standard, so remove references to DVB. Since I don't have any standard that
> does define this format, using the magic number as the name seems most
> appropriate.
>
> This is a simple rename, no functional change.
>
> ----
>
> This renaming was discussed briefly on the mailing list on 28 December 2024,
> but I never saw a patch to rename it.
> ---
> libavcodec/mpeg12dec.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 9bb995b5be..f28d900cc9 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_0x0502
> };
>
> 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_0x0502) &&
> buf_size >= 12 &&
> p[0] == 0x05 && p[1] == 0x02) {
> - /* extract DVB 0502 CC data */
> + /* extract 0x0502 format 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_0x0502, "0x0502");
> }
> 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_0x0502, 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" },
> + { "0x0502", "pick 0x0502 format CC substream", 0, AV_OPT_TYPE_CONST,
> + { .i64 = CC_FORMAT_0x0502 }, .flags = M2V_PARAM, .unit = "cc_format" },
Named constants which are also numbers are not a good idea.
Maybe the simplest would be to keep the constant name, because constant
names should not be changed without deprecation anyway.
Regards,
Marton
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-25 20:39 ` Marton Balint
@ 2025-01-25 22:52 ` Marth64
2025-01-25 23:28 ` Kieran Kunhya via ffmpeg-devel
0 siblings, 1 reply; 14+ messages in thread
From: Marth64 @ 2025-01-25 22:52 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Kieran Kunhya
Hello,
I am to blame here for suggesting DVB_0502 as the name.
I realize it was not the best choice and apologize for wasting your
cycles on this.
Looping in Keiran as we had discussed this over IRC briefly a few weeks back.
As I don't know how many networks actually use this in the wild, it
could be one or more,
How does something like this sound? CC_FORMAT_USERDATA_0502
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-25 22:52 ` Marth64
@ 2025-01-25 23:28 ` Kieran Kunhya via ffmpeg-devel
2025-01-25 23:53 ` Scott Theisen
0 siblings, 1 reply; 14+ messages in thread
From: Kieran Kunhya via ffmpeg-devel @ 2025-01-25 23:28 UTC (permalink / raw)
To: Marth64; +Cc: Kieran Kunhya, FFmpeg development discussions and patches
On Sat, 25 Jan 2025, 22:53 Marth64, <marth64@proxyid.net> wrote:
> Hello,
>
> I am to blame here for suggesting DVB_0502 as the name.
> I realize it was not the best choice and apologize for wasting your
> cycles on this.
>
> Looping in Keiran as we had discussed this over IRC briefly a few weeks
> back.
> As I don't know how many networks actually use this in the wild, it
> could be one or more,
>
> How does something like this sound? CC_FORMAT_USERDATA_0502
>
I believe it's Dish Network:
https://github.com/CCExtractor/ccextractor/blob/master/src/lib_ccx/es_userdata.c#L275
Kieran
>
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-25 23:28 ` Kieran Kunhya via ffmpeg-devel
@ 2025-01-25 23:53 ` Scott Theisen
2025-01-26 0:07 ` Soft Works
0 siblings, 1 reply; 14+ messages in thread
From: Scott Theisen @ 2025-01-25 23:53 UTC (permalink / raw)
To: ffmpeg-devel
On 1/25/25 18:28, Kieran Kunhya via ffmpeg-devel wrote:
> On Sat, 25 Jan 2025, 22:53 Marth64, <marth64@proxyid.net> wrote:
>
>> Hello,
>>
>> I am to blame here for suggesting DVB_0502 as the name.
>> I realize it was not the best choice and apologize for wasting your
>> cycles on this.
>>
>> Looping in Keiran as we had discussed this over IRC briefly a few weeks
>> back.
>> As I don't know how many networks actually use this in the wild, it
>> could be one or more,
>>
>> How does something like this sound? CC_FORMAT_USERDATA_0502
>>
> I believe it's Dish Network:
>
> https://github.com/CCExtractor/ccextractor/blob/master/src/lib_ccx/es_userdata.c#L275
>
> Kieran
I had originally used CC_FORMAT_DISH because ccextractor said Dish
Network, but Marth64 didn't want it referencing a specific provider [
https://ffmpeg.org//pipermail/ffmpeg-devel/2024-November/336384.html ].
CC_FORMAT_USERDATA_0502 is fine with me, but I'm not sure if Marton
Balint's objection was because the new name was only a number or if the
additional USERDATA string is sufficient.
Regards,
Scott Theisen
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-25 23:53 ` Scott Theisen
@ 2025-01-26 0:07 ` Soft Works
2025-01-26 0:13 ` Marth64
0 siblings, 1 reply; 14+ messages in thread
From: Soft Works @ 2025-01-26 0:07 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Scott Theisen
> Sent: Sunday, January 26, 2025 12:54 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename
> 0x0502 CC format
>
> On 1/25/25 18:28, Kieran Kunhya via ffmpeg-devel wrote:
> > On Sat, 25 Jan 2025, 22:53 Marth64, <marth64@proxyid.net> wrote:
> >
> >> Hello,
> >>
> >> I am to blame here for suggesting DVB_0502 as the name.
> >> I realize it was not the best choice and apologize for wasting
> your
> >> cycles on this.
> >>
> >> Looping in Keiran as we had discussed this over IRC briefly a few
> weeks
> >> back.
> >> As I don't know how many networks actually use this in the wild,
> it
> >> could be one or more,
> >>
> >> How does something like this sound? CC_FORMAT_USERDATA_0502
> >>
> > I believe it's Dish Network:
> >
> >
> https://github.com/CCExtractor/ccextractor/blob/master/src/lib_ccx/es
> _userdata.c#L275
> >
> > Kieran
>
> I had originally used CC_FORMAT_DISH because ccextractor said Dish
> Network, but Marth64 didn't want it referencing a specific provider [
> https://ffmpeg.org//pipermail/ffmpeg-devel/2024-November/336384.html
> ].
>
> CC_FORMAT_USERDATA_0502 is fine with me, but I'm not sure if Marton
> Balint's objection was because the new name was only a number or if
> the
> additional USERDATA string is sufficient.
When it's Dish, then there's no need to change it, because they are broadcasting using a variation of DVB-S (there is no US standard for sat tv), so the current naming is actually valid.
sw
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-26 0:07 ` Soft Works
@ 2025-01-26 0:13 ` Marth64
2025-01-26 0:30 ` Soft Works
0 siblings, 1 reply; 14+ messages in thread
From: Marth64 @ 2025-01-26 0:13 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> they are broadcasting using a variation of DVB-S (there is no US standard for sat tv), so the current naming is actually valid.
This is my understanding also, but I do believe there was 1 other
network that used the same variation.
Hence why I suggested a generic name. The counter argument from Kieran
was that it's not a DVB standard either so DVB 0502 not a great name.
Hence I thought to meet in the middle with CC_FORMAT_USERDATA_0502.
The only samples I have are ancient (~2000s) so I don't know if this
is still in use today.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-26 0:13 ` Marth64
@ 2025-01-26 0:30 ` Soft Works
2025-01-26 10:04 ` Kieran Kunhya via ffmpeg-devel
0 siblings, 1 reply; 14+ messages in thread
From: Soft Works @ 2025-01-26 0:30 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Marth64
> Sent: Sunday, January 26, 2025 1:14 AM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename
> 0x0502 CC format
>
> > they are broadcasting using a variation of DVB-S (there is no US
> standard for sat tv), so the current naming is actually valid.
>
> This is my understanding also, but I do believe there was 1 other
> network that used the same variation.
> Hence why I suggested a generic name. The counter argument from
> Kieran
> was that it's not a DVB standard either so DVB 0502 not a great name.
It's "user data", so there doesn't necessarily need to be a standard. It's inconsistent anyway:
SCTE-20 (5.7) defines a single byte:
"user_data_type_code—An eight-bit code for picture user data, 0x03"
while ATSC/A53-Part 4 (6.2.3) mandates a
"user_data_identifier – This is a 32 bit code"
Which is supposed to be registered with SMPTE:
https://web.archive.org/web/20150324170029/http://www.smpte-ra.org/mpegreg/mpegreg.html
Then followed by 03 as type code.
(this aligns with the implementation)
I haven't found the corresponding in the DVB specs, it must have a different name there.
sw
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-26 0:30 ` Soft Works
@ 2025-01-26 10:04 ` Kieran Kunhya via ffmpeg-devel
2025-01-26 23:00 ` Soft Works
0 siblings, 1 reply; 14+ messages in thread
From: Kieran Kunhya via ffmpeg-devel @ 2025-01-26 10:04 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Kieran Kunhya
On Sun, 26 Jan 2025, 00:31 Soft Works, <softworkz-at-hotmail.com@ffmpeg.org>
wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Marth64
> > Sent: Sunday, January 26, 2025 1:14 AM
> > To: FFmpeg development discussions and patches <ffmpeg-
> > devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename
> > 0x0502 CC format
> >
> > > they are broadcasting using a variation of DVB-S (there is no US
> > standard for sat tv), so the current naming is actually valid.
> >
> > This is my understanding also, but I do believe there was 1 other
> > network that used the same variation.
> > Hence why I suggested a generic name. The counter argument from
> > Kieran
> > was that it's not a DVB standard either so DVB 0502 not a great name.
>
> It's "user data", so there doesn't necessarily need to be a standard. It's
> inconsistent anyway:
>
> SCTE-20 (5.7) defines a single byte:
>
> "user_data_type_code—An eight-bit code for picture user data, 0x03"
>
> while ATSC/A53-Part 4 (6.2.3) mandates a
>
> "user_data_identifier – This is a 32 bit code"
>
> Which is supposed to be registered with SMPTE:
>
>
> https://web.archive.org/web/20150324170029/http://www.smpte-ra.org/mpegreg/mpegreg.html
>
> Then followed by 03 as type code.
>
> (this aligns with the implementation)
>
>
> I haven't found the corresponding in the DVB specs, it must have a
> different name there.
>
DVB (TS 101 154) mandates a particular way of transporting captions (that
the Dish method predates). There are other operators that do their own
thing too.
Kieran
>
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
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
0 siblings, 1 reply; 14+ messages in thread
From: Soft Works @ 2025-01-26 23:00 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Kieran Kunhya
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Kieran Kunhya via ffmpeg-devel
> Sent: Sunday, January 26, 2025 11:05 AM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Cc: Kieran Kunhya <kieran618@googlemail.com>
> Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename
> 0x0502 CC format
>
> On Sun, 26 Jan 2025, 00:31 Soft Works, <softworkz-at-
> hotmail.com@ffmpeg.org>
> wrote:
>
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > Marth64
> > > Sent: Sunday, January 26, 2025 1:14 AM
> > > To: FFmpeg development discussions and patches <ffmpeg-
> > > devel@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c:
> rename
> > > 0x0502 CC format
> > >
> > > > they are broadcasting using a variation of DVB-S (there is no
> US
> > > standard for sat tv), so the current naming is actually valid.
> > >
> > > This is my understanding also, but I do believe there was 1 other
> > > network that used the same variation.
> > > Hence why I suggested a generic name. The counter argument from
> > > Kieran
> > > was that it's not a DVB standard either so DVB 0502 not a great
> name.
> >
> > It's "user data", so there doesn't necessarily need to be a
> standard. It's
> > inconsistent anyway:
> >
> > SCTE-20 (5.7) defines a single byte:
> >
> > "user_data_type_code—An eight-bit code for picture user data, 0x03"
> >
> > while ATSC/A53-Part 4 (6.2.3) mandates a
> >
> > "user_data_identifier – This is a 32 bit code"
> >
> > Which is supposed to be registered with SMPTE:
> >
> >
> > https://web.archive.org/web/20150324170029/http://www.smpte-
> ra.org/mpegreg/mpegreg.html
> >
> > Then followed by 03 as type code.
> >
> > (this aligns with the implementation)
> >
> >
> > I haven't found the corresponding in the DVB specs, it must have a
> > different name there.
> >
>
> DVB (TS 101 154) mandates a particular way of transporting captions
> (that
> the Dish method predates). There are other operators that do their
> own
> thing too.
Yea, you're right. This "particular way" actually copies the ATSC definition from A/53 Part 4 with a user data identifier of "GA94" followed by 0x03, calling it "North American-style closed captions" and has been added in V1.8.1 (2007). The timeline also explains the inconsistency of specs.
IMO
- It doesn't matter whether the stream is ATSC or DVB flavor because there is no directly related descriptor (which could be different depending on the stream flavor) to indicate the presence of CC data (of any type). The only (indirect) indication I'm aware of is via the "ATSC Caption Service" descriptor in the EPG tables, so it's not much relevant whether there's 'DVB' in the name.
- I would call it CC_FORMAT_DISH (no strong opinion though)
- The option should be named accordingly, like
"dvb_0502", "pick DVB 0502 CC substream" => "dish", "pick Dish CC substream"
Or is there any reason to not call it what it is (Dish)? There are Sega or Nintendo audio decoders and other examples and a cryptic description like "DVB 0502" renders it useless for almost everybody.
sw
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-26 23:00 ` Soft Works
@ 2025-01-26 23:11 ` Kieran Kunhya via ffmpeg-devel
2025-01-27 0:34 ` Marth64
0 siblings, 1 reply; 14+ messages in thread
From: Kieran Kunhya via ffmpeg-devel @ 2025-01-26 23:11 UTC (permalink / raw)
To: Soft Works; +Cc: Kieran Kunhya, FFmpeg development discussions and patches
>
> Or is there any reason to not call it what it is (Dish)? There are Sega or
> Nintendo audio decoders and other examples and a cryptic description like
> "DVB 0502" renders it useless for almost everybody.
>
Agreed.
Kieran
>
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-26 23:11 ` Kieran Kunhya via ffmpeg-devel
@ 2025-01-27 0:34 ` Marth64
2025-02-02 18:55 ` [FFmpeg-devel] [PATCH v2] " Scott Theisen
0 siblings, 1 reply; 14+ messages in thread
From: Marth64 @ 2025-01-27 0:34 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Soft Works, Kieran Kunhya
> Agreed.
I'm good too, thanks for the input.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH v2] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-01-27 0:34 ` Marth64
@ 2025-02-02 18:55 ` Scott Theisen
2025-02-03 2:40 ` Marth64
0 siblings, 1 reply; 14+ messages in thread
From: Scott Theisen @ 2025-02-02 18:55 UTC (permalink / raw)
To: ffmpeg-devel
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] libavcodec/mpeg12dec.c: rename 0x0502 CC format
2025-02-02 18:55 ` [FFmpeg-devel] [PATCH v2] " Scott Theisen
@ 2025-02-03 2:40 ` Marth64
0 siblings, 0 replies; 14+ messages in thread
From: Marth64 @ 2025-02-03 2:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Will push
_______________________________________________
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".
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-02-03 2:41 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-25 20:26 [FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: rename 0x0502 CC format 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 ` [FFmpeg-devel] [PATCH v2] " Scott Theisen
2025-02-03 2:40 ` Marth64
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