]> git.sesse.net Git - ffmpeg/commitdiff
Allow AC-3 parser to modify codec_id.
authorJoakim Plate <elupus@ecce.se>
Thu, 19 Feb 2009 00:28:19 +0000 (00:28 +0000)
committerJustin Ruggles <justin.ruggles@gmail.com>
Thu, 19 Feb 2009 00:28:19 +0000 (00:28 +0000)
Patch by Joakim Plate (elupus A ecce D se).

Originally committed as revision 17447 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/aac_ac3_parser.c
libavcodec/aac_ac3_parser.h
libavcodec/ac3_parser.c

index fedabdf8153cb42353c4644be5cd4fdbd2b7cce9..ab3269f2db46df526b5aa1687607b6bc041c257a 100644 (file)
@@ -72,6 +72,9 @@ get_next:
 
     /* update codec info */
     avctx->sample_rate = s->sample_rate;
+    if(s->codec_id)
+        avctx->codec_id = s->codec_id;
+
     /* allow downmixing to stereo (or mono for AC-3) */
     if(avctx->request_channels > 0 &&
             avctx->request_channels < s->channels &&
index c4b81a86c613068333fbcdd5214095aa4e1dfab3..04fd8f197459172a6107817ae595a1d2eeabdaab 100644 (file)
@@ -53,6 +53,7 @@ typedef struct AACAC3ParseContext {
     uint64_t state;
 
     int need_next_header;
+    enum CodecID codec_id;
 } AACAC3ParseContext;
 
 int ff_aac_ac3_parse(AVCodecParserContext *s1,
index 63c0a48c3a991f04156ac0c37d1bb45a56fa4c57..e78deb20eb27d6aee86f33add918bff320955652 100644 (file)
@@ -175,6 +175,10 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
     hdr_info->bit_rate = hdr.bit_rate;
     hdr_info->channels = hdr.channels;
     hdr_info->samples = AC3_FRAME_SIZE;
+    if(hdr.bitstream_id>10)
+        hdr_info->codec_id = CODEC_ID_EAC3;
+    else
+        hdr_info->codec_id = CODEC_ID_AC3;
 
     *need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);
     *new_frame_start  = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);