Browse code

Allow AC-3 parser to modify codec_id. Patch by Joakim Plate (elupus A ecce D se).

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

Joakim Plate authored on 2009/02/19 09:28:19
Showing 3 changed files
... ...
@@ -72,6 +72,9 @@ get_next:
72 72
 
73 73
     /* update codec info */
74 74
     avctx->sample_rate = s->sample_rate;
75
+    if(s->codec_id)
76
+        avctx->codec_id = s->codec_id;
77
+
75 78
     /* allow downmixing to stereo (or mono for AC-3) */
76 79
     if(avctx->request_channels > 0 &&
77 80
             avctx->request_channels < s->channels &&
... ...
@@ -53,6 +53,7 @@ typedef struct AACAC3ParseContext {
53 53
     uint64_t state;
54 54
 
55 55
     int need_next_header;
56
+    enum CodecID codec_id;
56 57
 } AACAC3ParseContext;
57 58
 
58 59
 int ff_aac_ac3_parse(AVCodecParserContext *s1,
... ...
@@ -175,6 +175,10 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
175 175
     hdr_info->bit_rate = hdr.bit_rate;
176 176
     hdr_info->channels = hdr.channels;
177 177
     hdr_info->samples = AC3_FRAME_SIZE;
178
+    if(hdr.bitstream_id>10)
179
+        hdr_info->codec_id = CODEC_ID_EAC3;
180
+    else
181
+        hdr_info->codec_id = CODEC_ID_AC3;
178 182
 
179 183
     *need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);
180 184
     *new_frame_start  = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);