[FFmpeg-cvslog] mpegts: use avcodec_get_type() to set codec_type

wm4 git at videolan.org
Tue Sep 29 13:45:59 CEST 2015


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Sat Sep 26 18:42:51 2015 +0200| [cc8db760616a7ec3bd39b22ca45888c01326db13] | committer: Anton Khirnov

mpegts: use avcodec_get_type() to set codec_type

Note that this slightly changes behavior: it sets AVMEDIA_TYPE_UNKNOWN
if the codec type is unknown. This should be ok.

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc8db760616a7ec3bd39b22ca45888c01326db13
---

 libavformat/mpegts.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 3a27343..e9e3288 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1311,14 +1311,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
                 st->codec->extradata_size > 0)
                 st->need_parsing = 0;
 
-            if (st->codec->codec_id <= AV_CODEC_ID_NONE) {
-                // do nothing
-            } else if (st->codec->codec_id < AV_CODEC_ID_FIRST_AUDIO)
-                st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            else if (st->codec->codec_id < AV_CODEC_ID_FIRST_SUBTITLE)
-                st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            else if (st->codec->codec_id < AV_CODEC_ID_FIRST_UNKNOWN)
-                st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+            st->codec->codec_type = avcodec_get_type(st->codec->codec_id);
         }
     }
     for (i = 0; i < mp4_descr_count; i++)



More information about the ffmpeg-cvslog mailing list