History

avcodec/mpeg12dec: rename 0x0502 CC format

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.

Scott Theisen committed 1 year ago

Commit 33daef51 parent b37606e1 file · +14 −14Browse files

Unified · Split

libavcodec/mpeg12dec.c+14−14
@@ -67,7 +67,7 @@ enum Mpeg2ClosedCaptionsFormat { · 66 unmodified lines
6767 CC_FORMAT_A53_PART4,
6868 CC_FORMAT_SCTE20,
6969 CC_FORMAT_DVD,
70− CC_FORMAT_DVB_0502
70+ CC_FORMAT_DISH
7171 };
7272
7373 typedef struct Mpeg1Context {
@@ -2064,39 +2064,39 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, · 1990 unmodified lines
20642064 mpeg_set_cc_format(avctx, CC_FORMAT_DVD, "DVD");
20652065 }
20662066 return 1;
2067− } else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_DVB_0502) &&
2067+ } else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_DISH) &&
20682068 buf_size >= 12 &&
20692069 p[0] == 0x05 && p[1] == 0x02) {
2070− /* extract DVB 0502 CC data */
2070+ /* extract Dish Network CC data */
20712071 const uint8_t cc_header = 0xf8 | 0x04 /* valid */ | 0x00 /* line 21 field 1 */;
20722072 uint8_t cc_data[4] = {0};
20732073 int cc_count = 0;
2074− uint8_t dvb_cc_type = p[7];
2074+ uint8_t cc_type = p[7];
20752075 p += 8;
20762076 buf_size -= 8;
20772077
2078− if (dvb_cc_type == 0x05 && buf_size >= 7) {
2079− dvb_cc_type = p[6];
2078+ if (cc_type == 0x05 && buf_size >= 7) {
2079+ cc_type = p[6];
20802080 p += 7;
20812081 buf_size -= 7;
20822082 }
20832083
2084− if (dvb_cc_type == 0x02 && buf_size >= 4) { /* 2-byte caption, can be repeated */
2084+ if (cc_type == 0x02 && buf_size >= 4) { /* 2-byte caption, can be repeated */
20852085 cc_count = 1;
20862086 cc_data[0] = p[1];
20872087 cc_data[1] = p[2];
2088− dvb_cc_type = p[3];
2088+ cc_type = p[3];
20892089
20902090 /* Only repeat characters when the next type flag
20912091 * is 0x04 and the characters are repeatable (i.e., less than
20922092 * 32 with the parity stripped).
20932093 */
2094− if (dvb_cc_type == 0x04 && (cc_data[0] & 0x7f) < 32) {
2094+ if (cc_type == 0x04 && (cc_data[0] & 0x7f) < 32) {
20952095 cc_count = 2;
20962096 cc_data[2] = cc_data[0];
20972097 cc_data[3] = cc_data[1];
20982098 }
2099− } else if (dvb_cc_type == 0x04 && buf_size >= 5) { /* 4-byte caption, not repeated */
2099+ } else if (cc_type == 0x04 && buf_size >= 5) { /* 4-byte caption, not repeated */
21002100 cc_count = 2;
21012101 cc_data[0] = p[1];
21022102 cc_data[1] = p[2];
@@ -2124,7 +2124,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, · 21 unmodified lines
21242124 }
21252125 }
21262126
2127− mpeg_set_cc_format(avctx, CC_FORMAT_DVB_0502, "DVB 0502");
2127+ mpeg_set_cc_format(avctx, CC_FORMAT_DISH, "Dish Network");
21282128 }
21292129 return 1;
21302130 }
@@ -2687,7 +2687,7 @@ const FFCodec ff_mpeg1video_decoder = { · 556 unmodified lines
26872687 static const AVOption mpeg2video_options[] = {
26882688 { "cc_format", "extract a specific Closed Captions format",
26892689 M2V_OFFSET(cc_format), AV_OPT_TYPE_INT, { .i64 = CC_FORMAT_AUTO },
2690− CC_FORMAT_AUTO, CC_FORMAT_DVB_0502, M2V_PARAM, .unit = "cc_format" },
2690+ CC_FORMAT_AUTO, CC_FORMAT_DISH, M2V_PARAM, .unit = "cc_format" },
26912691
26922692 { "auto", "pick first seen CC substream", 0, AV_OPT_TYPE_CONST,
26932693 { .i64 = CC_FORMAT_AUTO }, .flags = M2V_PARAM, .unit = "cc_format" },
@@ -2697,8 +2697,8 @@ static const AVOption mpeg2video_options[] = { · 3 unmodified lines
26972697 { .i64 = CC_FORMAT_SCTE20 }, .flags = M2V_PARAM, .unit = "cc_format" },
26982698 { "dvd", "pick DVD CC substream", 0, AV_OPT_TYPE_CONST,
26992699 { .i64 = CC_FORMAT_DVD }, .flags = M2V_PARAM, .unit = "cc_format" },
2700− { "dvb_0502", "pick DVB 0502 CC substream", 0, AV_OPT_TYPE_CONST,
2701− { .i64 = CC_FORMAT_DVB_0502 }, .flags = M2V_PARAM, .unit = "cc_format" },
2700+ { "dish", "pick Dish Network CC substream", 0, AV_OPT_TYPE_CONST,
2701+ { .i64 = CC_FORMAT_DISH }, .flags = M2V_PARAM, .unit = "cc_format" },
27022702 { NULL }
27032703 };
27042704

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t