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
67 CC_FORMAT_A53_PART4,67 CC_FORMAT_A53_PART4,
68 CC_FORMAT_SCTE20,68 CC_FORMAT_SCTE20,
69 CC_FORMAT_DVD,69 CC_FORMAT_DVD,
70 CC_FORMAT_DVB_050270 CC_FORMAT_DISH
71};71};
72 72
73typedef struct Mpeg1Context {73typedef struct Mpeg1Context {
@@ -2064,39 +2064,39 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, · 1990 unmodified lines
2064 mpeg_set_cc_format(avctx, CC_FORMAT_DVD, "DVD");2064 mpeg_set_cc_format(avctx, CC_FORMAT_DVD, "DVD");
2065 }2065 }
2066 return 1;2066 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) &&
2068 buf_size >= 12 &&2068 buf_size >= 12 &&
2069 p[0] == 0x05 && p[1] == 0x02) {2069 p[0] == 0x05 && p[1] == 0x02) {
2070 /* extract DVB 0502 CC data */2070 /* extract Dish Network CC data */
2071 const uint8_t cc_header = 0xf8 | 0x04 /* valid */ | 0x00 /* line 21 field 1 */;2071 const uint8_t cc_header = 0xf8 | 0x04 /* valid */ | 0x00 /* line 21 field 1 */;
2072 uint8_t cc_data[4] = {0};2072 uint8_t cc_data[4] = {0};
2073 int cc_count = 0;2073 int cc_count = 0;
2074 uint8_t dvb_cc_type = p[7];2074 uint8_t cc_type = p[7];
2075 p += 8;2075 p += 8;
2076 buf_size -= 8;2076 buf_size -= 8;
2077 2077
2078 if (dvb_cc_type == 0x05 && buf_size >= 7) {2078 if (cc_type == 0x05 && buf_size >= 7) {
2079 dvb_cc_type = p[6];2079 cc_type = p[6];
2080 p += 7;2080 p += 7;
2081 buf_size -= 7;2081 buf_size -= 7;
2082 }2082 }
2083 2083
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 */
2085 cc_count = 1;2085 cc_count = 1;
2086 cc_data[0] = p[1];2086 cc_data[0] = p[1];
2087 cc_data[1] = p[2];2087 cc_data[1] = p[2];
2088 dvb_cc_type = p[3];2088 cc_type = p[3];
2089 2089
2090 /* Only repeat characters when the next type flag2090 /* Only repeat characters when the next type flag
2091 * is 0x04 and the characters are repeatable (i.e., less than2091 * is 0x04 and the characters are repeatable (i.e., less than
2092 * 32 with the parity stripped).2092 * 32 with the parity stripped).
2093 */2093 */
2094 if (dvb_cc_type == 0x04 && (cc_data[0] & 0x7f) < 32) {2094 if (cc_type == 0x04 && (cc_data[0] & 0x7f) < 32) {
2095 cc_count = 2;2095 cc_count = 2;
2096 cc_data[2] = cc_data[0];2096 cc_data[2] = cc_data[0];
2097 cc_data[3] = cc_data[1];2097 cc_data[3] = cc_data[1];
2098 }2098 }
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 */
2100 cc_count = 2;2100 cc_count = 2;
2101 cc_data[0] = p[1];2101 cc_data[0] = p[1];
2102 cc_data[1] = p[2];2102 cc_data[1] = p[2];
@@ -2124,7 +2124,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, · 21 unmodified lines
2124 }2124 }
2125 }2125 }
2126 2126
2127 mpeg_set_cc_format(avctx, CC_FORMAT_DVB_0502, "DVB 0502");2127 mpeg_set_cc_format(avctx, CC_FORMAT_DISH, "Dish Network");
2128 }2128 }
2129 return 1;2129 return 1;
2130 }2130 }
@@ -2687,7 +2687,7 @@ const FFCodec ff_mpeg1video_decoder = { · 556 unmodified lines
2687static const AVOption mpeg2video_options[] = {2687static const AVOption mpeg2video_options[] = {
2688 { "cc_format", "extract a specific Closed Captions format",2688 { "cc_format", "extract a specific Closed Captions format",
2689 M2V_OFFSET(cc_format), AV_OPT_TYPE_INT, { .i64 = CC_FORMAT_AUTO },2689 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" },
2691 2691
2692 { "auto", "pick first seen CC substream", 0, AV_OPT_TYPE_CONST,2692 { "auto", "pick first seen CC substream", 0, AV_OPT_TYPE_CONST,
2693 { .i64 = CC_FORMAT_AUTO }, .flags = M2V_PARAM, .unit = "cc_format" },2693 { .i64 = CC_FORMAT_AUTO }, .flags = M2V_PARAM, .unit = "cc_format" },
@@ -2697,8 +2697,8 @@ static const AVOption mpeg2video_options[] = { · 3 unmodified lines
2697 { .i64 = CC_FORMAT_SCTE20 }, .flags = M2V_PARAM, .unit = "cc_format" },2697 { .i64 = CC_FORMAT_SCTE20 }, .flags = M2V_PARAM, .unit = "cc_format" },
2698 { "dvd", "pick DVD CC substream", 0, AV_OPT_TYPE_CONST,2698 { "dvd", "pick DVD CC substream", 0, AV_OPT_TYPE_CONST,
2699 { .i64 = CC_FORMAT_DVD }, .flags = M2V_PARAM, .unit = "cc_format" },2699 { .i64 = CC_FORMAT_DVD }, .flags = M2V_PARAM, .unit = "cc_format" },
2700 { "dvb_0502", "pick DVB 0502 CC substream", 0, AV_OPT_TYPE_CONST,2700 { "dish", "pick Dish Network CC substream", 0, AV_OPT_TYPE_CONST,
2701 { .i64 = CC_FORMAT_DVB_0502 }, .flags = M2V_PARAM, .unit = "cc_format" },2701 { .i64 = CC_FORMAT_DISH }, .flags = M2V_PARAM, .unit = "cc_format" },
2702 { NULL }2702 { NULL }
2703};2703};
2704 2704

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