summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-05-31 03:40:36 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-05-31 03:40:36 +0000
commit6a2a50f81fb4f93d0436034ca7d1dc41ff790ba6 (patch)
tree4d9245602bd2a5ac86be698e651db21740a48a7c /libavformat/mpegts.c
parentf42d1d824ec6543ceacc0c01aef1d40ca3028510 (diff)
factorize
Originally committed as revision 19007 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 15c997926a..5d2567109a 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -521,6 +521,14 @@ static const StreamType REGD_types[] = {
{ 0 },
};
+/* descriptor present */
+static const StreamType DESC_types[] = {
+ { 0x6a, CODEC_TYPE_AUDIO, CODEC_ID_AC3 }, /* AC-3 descriptor */
+ { 0x7a, CODEC_TYPE_AUDIO, CODEC_ID_AC3 },
+ { 0x7b, CODEC_TYPE_AUDIO, CODEC_ID_DTS },
+ { 0x59, CODEC_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
+};
+
static void mpegts_find_stream_type(AVStream *st,
uint32_t stream_type, const StreamType *types)
{
@@ -665,21 +673,12 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
dprintf(ts->stream, "tag: 0x%02x len=%d\n",
desc_tag, desc_len);
+ if (st->codec->codec_id == CODEC_ID_PROBE &&
+ stream_type == STREAM_TYPE_PRIVATE_DATA)
+ mpegts_find_stream_type(st, desc_tag, DESC_types);
+
switch(desc_tag) {
- case 0x6a: /* AC-3 descriptor */
- case 0x7a: /* AC-3 descriptor */
- st->codec->codec_type = CODEC_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_AC3;
- break;
- case 0x7b:
- st->codec->codec_type = CODEC_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_DTS;
- break;
case 0x59: /* subtitling descriptor */
- if (stream_type == STREAM_TYPE_PRIVATE_DATA) {
- st->codec->codec_type = CODEC_TYPE_SUBTITLE;
- st->codec->codec_id = CODEC_ID_DVB_SUBTITLE;
- }
language[0] = get8(&p, desc_end);
language[1] = get8(&p, desc_end);
language[2] = get8(&p, desc_end);