[SCM] libav/experimental: Allow AC-3 parser to modify codec_id. Patch by Joakim Plate (elupus A ecce D se).

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:38:50 UTC 2013


The following commit has been merged in the experimental branch:
commit 4cff8dc88fb9932ad797e03e6df9aef91272b46e
Author: Joakim Plate <elupus at ecce.se>
Date:   Thu Feb 19 00:28:19 2009 +0000

    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

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index fedabdf..ab3269f 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -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 &&
diff --git a/libavcodec/aac_ac3_parser.h b/libavcodec/aac_ac3_parser.h
index c4b81a8..04fd8f1 100644
--- a/libavcodec/aac_ac3_parser.h
+++ b/libavcodec/aac_ac3_parser.h
@@ -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,
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 63c0a48..e78deb2 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -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);

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list