]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mpegts.c
avcodec/vp8: remove double ;;
[ffmpeg] / libavformat / mpegts.c
index 74ae4fafe44bb73e50336cf8fd7e1437720b3f30..6fb186e62726e1c2e6681d854fb7720eaf3e7d30 100644 (file)
@@ -674,6 +674,7 @@ static const StreamType ISO_types[] = {
     { 0x11, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC_LATM   }, /* LATM syntax */
 #endif
     { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264       },
+    { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264       },
     { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC       },
     { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS       },
     { 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC      },
@@ -1515,6 +1516,10 @@ static const uint8_t opus_coupled_stream_cnt[9] = {
     1, 0, 1, 1, 2, 2, 2, 3, 3
 };
 
+static const uint8_t opus_stream_cnt[9] = {
+    1, 1, 1, 2, 2, 3, 4, 4, 5,
+};
+
 static const uint8_t opus_channel_map[8][8] = {
     { 0 },
     { 0,1 },
@@ -1555,6 +1560,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
     switch (desc_tag) {
     case 0x1E: /* SL descriptor */
         desc_es_id = get16(pp, desc_end);
+        if (desc_es_id < 0)
+            break;
         if (ts && ts->pids[pid])
             ts->pids[pid]->es_id = desc_es_id;
         for (i = 0; i < mp4_descr_count; i++)
@@ -1573,7 +1580,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
             }
         break;
     case 0x1F: /* FMC descriptor */
-        get16(pp, desc_end);
+        if (get16(pp, desc_end) < 0)
+            break;
         if (mp4_descr_count > 0 &&
             (st->codec->codec_id == AV_CODEC_ID_AAC_LATM || st->request_probe > 0) &&
             mp4_descr->dec_config_descr_len && mp4_descr->es_id == pid) {
@@ -1757,11 +1765,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
                     return AVERROR_INVALIDDATA;
                 if (channel_config_code <= 0x8) {
                     st->codec->extradata[9]  = channels = channel_config_code ? channel_config_code : 2;
-                    st->codec->extradata[18] = channels > 2;
-                    st->codec->extradata[19] = channels - opus_coupled_stream_cnt[channel_config_code];
-                    if (channel_config_code == 0) { /* Dual Mono */
-                        st->codec->extradata[18] = 255; /* Mapping */
-                    }
+                    st->codec->extradata[18] = channel_config_code ? (channels > 2) : /* Dual Mono */ 255;
+                    st->codec->extradata[19] = opus_stream_cnt[channel_config_code];
                     st->codec->extradata[20] = opus_coupled_stream_cnt[channel_config_code];
                     memcpy(&st->codec->extradata[21], opus_channel_map[channels - 1], channels);
                 } else {