libavcodec/flac.c File Reference

FLAC (Free Lossless Audio Codec) decoder. More...

#include <limits.h>
#include "avcodec.h"
#include "bitstream.h"
#include "golomb.h"
#include "crc.h"
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  FLACContext

Defines

#define ALT_BITSTREAM_READER
#define MAX_CHANNELS   8
#define MAX_BLOCKSIZE   65535
#define FLAC_STREAMINFO_SIZE   34
#define METADATA_TYPE_STREAMINFO   0
#define DECORRELATE(left, right)

Enumerations

enum  decorrelation_type { INDEPENDENT, LEFT_SIDE, RIGHT_SIDE, MID_SIDE }

Functions

static int64_t get_utf8 (GetBitContext *gb)
static void metadata_streaminfo (FLACContext *s)
static void allocate_buffers (FLACContext *s)
static int metadata_parse (FLACContext *s)
 Parse a list of metadata blocks.
static int flac_decode_init (AVCodecContext *avctx)
static void dump_headers (FLACContext *s)
static int decode_residuals (FLACContext *s, int channel, int pred_order)
static int decode_subframe_fixed (FLACContext *s, int channel, int pred_order)
static int decode_subframe_lpc (FLACContext *s, int channel, int pred_order)
static int decode_subframe (FLACContext *s, int channel)
static int decode_frame (FLACContext *s, int alloc_data_size)
static int flac_decode_frame (AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
static int flac_decode_close (AVCodecContext *avctx)
static void flac_flush (AVCodecContext *avctx)

Variables

static int sample_rate_table []
static int sample_size_table []
static int blocksize_table []
AVCodec flac_decoder


Detailed Description

FLAC (Free Lossless Audio Codec) decoder.

Author:
Alex Beregszaszi
For more information on the FLAC format, visit: http://flac.sourceforge.net/

This decoder can be used in 1 of 2 ways: Either raw FLAC data can be fed through, starting from the initial 'fLaC' signature; or by passing the 34-byte streaminfo structure through avctx->extradata[_size] followed by data starting with the 0xFFF8 marker.

Definition in file flac.c.


Define Documentation

#define ALT_BITSTREAM_READER

Definition at line 38 of file flac.c.

#define DECORRELATE ( left,
right   ) 

Value:

assert(s->channels == 2);\
            for (i = 0; i < s->blocksize; i++)\
            {\
                int a= s->decoded[0][i];\
                int b= s->decoded[1][i];\
                *samples++ = ((left)  << (24 - s->bps)) >> 8;\
                *samples++ = ((right) << (24 - s->bps)) >> 8;\
            }\
            break;

Referenced by flac_decode_frame().

#define FLAC_STREAMINFO_SIZE   34

#define MAX_BLOCKSIZE   65535

Definition at line 48 of file flac.c.

#define MAX_CHANNELS   8

Definition at line 47 of file flac.c.

#define METADATA_TYPE_STREAMINFO   0

Definition at line 76 of file flac.c.

Referenced by metadata_parse().


Enumeration Type Documentation

Enumerator:
INDEPENDENT 
LEFT_SIDE 
RIGHT_SIDE 
MID_SIDE 

Definition at line 51 of file flac.c.


Function Documentation

static void allocate_buffers ( FLACContext s  )  [static]

Definition at line 129 of file flac.c.

static int decode_frame ( FLACContext s,
int  alloc_data_size 
) [static]

Definition at line 480 of file flac.c.

static int decode_residuals ( FLACContext s,
int  channel,
int  pred_order 
) [static]

Definition at line 214 of file flac.c.

Referenced by decode_subframe_fixed(), and decode_subframe_lpc().

static int decode_subframe ( FLACContext s,
int  channel 
) [inline, static]

Definition at line 394 of file flac.c.

Referenced by decode_frame().

static int decode_subframe_fixed ( FLACContext s,
int  channel,
int  pred_order 
) [static]

Definition at line 260 of file flac.c.

Referenced by decode_subframe().

static int decode_subframe_lpc ( FLACContext s,
int  channel,
int  pred_order 
) [static]

Definition at line 313 of file flac.c.

Referenced by decode_subframe(), and shorten_decode_frame().

static void dump_headers ( FLACContext s  )  [static]

Definition at line 120 of file flac.c.

Referenced by metadata_streaminfo().

static int flac_decode_close ( AVCodecContext avctx  )  [static]

Definition at line 740 of file flac.c.

static int flac_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
const uint8_t buf,
int  buf_size 
) [static]

Definition at line 591 of file flac.c.

static int flac_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 101 of file flac.c.

static void flac_flush ( AVCodecContext avctx  )  [static]

Definition at line 754 of file flac.c.

static int64_t get_utf8 ( GetBitContext gb  )  [static]

Definition at line 91 of file flac.c.

Referenced by decode_frame().

static int metadata_parse ( FLACContext s  )  [static]

Parse a list of metadata blocks.

This list of blocks must begin with the fLaC marker.

Parameters:
s the flac decoding context containing the gb bit reader used to parse metadata
Returns:
1 if some metadata was read, 0 if no fLaC marker was found

Definition at line 177 of file flac.c.

Referenced by flac_decode_frame(), and flac_decode_init().

static void metadata_streaminfo ( FLACContext s  )  [static]

Definition at line 146 of file flac.c.

Referenced by flac_decode_init(), and metadata_parse().


Variable Documentation

int blocksize_table[] [static]

Initial value:

 {
     0,    192, 576<<0, 576<<1, 576<<2, 576<<3,      0,      0,
256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7
}

Definition at line 86 of file flac.c.

Referenced by decode_frame().

Initial value:

Definition at line 761 of file flac.c.

int sample_rate_table[] [static]

Initial value:

{ 0, 0, 0, 0,
  8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
  0, 0, 0, 0 }

Definition at line 78 of file flac.c.

Referenced by decode_frame().

int sample_size_table[] [static]

Initial value:

{ 0, 8, 12, 0, 16, 20, 24, 0 }

Definition at line 83 of file flac.c.

Referenced by decode_frame().


Generated on Thu Apr 2 07:15:41 2009 for ffmpeg by  doxygen 1.5.6