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@khirnov.net>
This commit is contained in:
wm4 2015-09-26 18:42:51 +02:00 committed by Anton Khirnov
parent a5d58fea68
commit cc8db76061

View File

@ -1311,14 +1311,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
st->codec->extradata_size > 0) st->codec->extradata_size > 0)
st->need_parsing = 0; st->need_parsing = 0;
if (st->codec->codec_id <= AV_CODEC_ID_NONE) { st->codec->codec_type = avcodec_get_type(st->codec->codec_id);
// 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;
} }
} }
for (i = 0; i < mp4_descr_count; i++) for (i = 0; i < mp4_descr_count; i++)