Revision 9eda2f94

View differences:

libavcodec/flac.c
21 21
 * @file flac.c
22 22
 * FLAC (Free Lossless Audio Codec) decoder
23 23
 * @author Alex Beregszaszi
24
 *
25
 * For more information on the FLAC format, visit:
26
 *  http://flac.sourceforge.net/
27
 *
28
 * This decoder can be used in 1 of 2 ways: Either raw FLAC data can be fed
29
 * through, starting from the initial 'fLaC' signature; or by passing the
30
 * 34-byte streaminfo structure through avctx->extradata[_size] followed
31
 * by data starting with the 0xFFF8 marker.
24 32
 */
25 33
 
26 34
#include <limits.h>
......
33 41

  
34 42
#define MAX_CHANNELS 8
35 43
#define MAX_BLOCKSIZE 65535
44
#define FLAC_STREAMINFO_SIZE 34
36 45

  
37 46
enum decorrelation_type {
38 47
    INDEPENDENT,
......
144 153
    return crc;
145 154
}
146 155

  
156
static void metadata_streaminfo(FLACContext *s);
157
static void dump_headers(FLACContext *s);
158

  
147 159
static int flac_decode_init(AVCodecContext * avctx)
148 160
{
161
    FLACContext *s = avctx->priv_data;
162
    s->avctx = avctx;
163

  
164
    /* initialize based on the demuxer-supplied streamdata header */
165
    if (avctx->extradata_size == FLAC_STREAMINFO_SIZE) {
166
        init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8);
167
        metadata_streaminfo(s);
168
        dump_headers(s);
169
    }
170

  
149 171
    return 0;
150 172
}
151 173

  
......
546 568
    int tmp = 0, i, j = 0, input_buf_size;
547 569
    int16_t *samples = data, *left, *right;
548 570

  
549
    s->avctx = avctx;
550
    
551 571
    if(s->max_framesize == 0){
552 572
        s->max_framesize= 8192; // should hopefully be enough for the first header
553 573
        s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);

Also available in: Unified diff