diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2008-05-02 21:29:49 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2008-05-02 21:29:49 +0000 |
commit | a128cc91f3dbc889d006f2cfebaf08aabc6dac95 (patch) | |
tree | 5c3b4c8c5141d24ad510d727e275de9290427d71 | |
parent | b7d1cd02e315999a616048b5cf9ea755cbd3b7e3 (diff) | |
download | ffmpeg-a128cc91f3dbc889d006f2cfebaf08aabc6dac95.tar.gz |
change function parameters for metadata_streaminfo()
Originally committed as revision 13033 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/flac.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c index b849e7fd01..bb92bb05e0 100644 --- a/libavcodec/flac.c +++ b/libavcodec/flac.c @@ -94,7 +94,7 @@ static int64_t get_utf8(GetBitContext *gb){ return val; } -static void metadata_streaminfo(FLACContext *s); +static void metadata_streaminfo(AVCodecContext *avctx, FLACContext *s, const uint8_t *buffer); static void allocate_buffers(FLACContext *s); static int metadata_parse(FLACContext *s); @@ -107,7 +107,7 @@ static av_cold int flac_decode_init(AVCodecContext * avctx) /* initialize based on the demuxer-supplied streamdata header */ init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8); if (avctx->extradata_size == FLAC_STREAMINFO_SIZE) { - metadata_streaminfo(s); + metadata_streaminfo(avctx, s, avctx->extradata); allocate_buffers(s); } else { metadata_parse(s); @@ -143,26 +143,30 @@ static void allocate_buffers(FLACContext *s){ s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); } -static void metadata_streaminfo(FLACContext *s) +static void metadata_streaminfo(AVCodecContext *avctx, FLACContext *s, + const uint8_t *buffer) { + GetBitContext gb; + init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8); + /* mandatory streaminfo */ - s->min_blocksize = get_bits(&s->gb, 16); - s->max_blocksize = get_bits(&s->gb, 16); + s->min_blocksize = get_bits(&gb, 16); + s->max_blocksize = get_bits(&gb, 16); - skip_bits(&s->gb, 24); /* skip min frame size */ - s->max_framesize = get_bits_long(&s->gb, 24); + skip_bits(&gb, 24); /* skip min frame size */ + s->max_framesize = get_bits_long(&gb, 24); - s->samplerate = get_bits_long(&s->gb, 20); - s->channels = get_bits(&s->gb, 3) + 1; - s->bps = get_bits(&s->gb, 5) + 1; + s->samplerate = get_bits_long(&gb, 20); + s->channels = get_bits(&gb, 3) + 1; + s->bps = get_bits(&gb, 5) + 1; - s->avctx->channels = s->channels; - s->avctx->sample_rate = s->samplerate; + avctx->channels = s->channels; + avctx->sample_rate = s->samplerate; - skip_bits(&s->gb, 36); /* total num of samples */ + skip_bits(&gb, 36); /* total num of samples */ - skip_bits(&s->gb, 64); /* md5 sum */ - skip_bits(&s->gb, 64); /* md5 sum */ + skip_bits(&gb, 64); /* md5 sum */ + skip_bits(&gb, 64); /* md5 sum */ dump_headers(s); } @@ -193,9 +197,8 @@ static int metadata_parse(FLACContext *s) if (metadata_size) { switch (metadata_type) { case METADATA_TYPE_STREAMINFO: - metadata_streaminfo(s); + metadata_streaminfo(s->avctx, s, s->gb.buffer+get_bits_count(&s->gb)/8); streaminfo_updated = 1; - break; default: for (i=0; i<metadata_size; i++) |