Mercurial > libavcodec.hg
comparison a52dec.c @ 1064:b32afefe7d33 libavcodec
* UINTX -> uintx_t INTX -> intx_t
| author | kabi |
|---|---|
| date | Tue, 11 Feb 2003 16:35:48 +0000 |
| parents | 696ccd81403e |
| children | 1e39f273ecd6 |
comparison
equal
deleted
inserted
replaced
| 1063:fdeac9642346 | 1064:b32afefe7d33 |
|---|---|
| 27 /** | 27 /** |
| 28 * liba52 - Copyright (C) Aaron Holtzman | 28 * liba52 - Copyright (C) Aaron Holtzman |
| 29 * released under the GPL license. | 29 * released under the GPL license. |
| 30 */ | 30 */ |
| 31 typedef struct AC3DecodeState { | 31 typedef struct AC3DecodeState { |
| 32 UINT8 inbuf[4096]; /* input buffer */ | 32 uint8_t inbuf[4096]; /* input buffer */ |
| 33 UINT8 *inbuf_ptr; | 33 uint8_t *inbuf_ptr; |
| 34 int frame_size; | 34 int frame_size; |
| 35 int flags; | 35 int flags; |
| 36 int channels; | 36 int channels; |
| 37 a52_state_t* state; | 37 a52_state_t* state; |
| 38 sample_t* samples; | 38 sample_t* samples; |
| 121 else if (i < 0x43bf8000) | 121 else if (i < 0x43bf8000) |
| 122 return -32768; | 122 return -32768; |
| 123 return i - 0x43c00000; | 123 return i - 0x43c00000; |
| 124 } | 124 } |
| 125 | 125 |
| 126 static inline void float_to_int (float * _f, INT16 * s16, int nchannels) | 126 static inline void float_to_int (float * _f, int16_t * s16, int nchannels) |
| 127 { | 127 { |
| 128 int i, j, c; | 128 int i, j, c; |
| 129 int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format | 129 int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format |
| 130 | 130 |
| 131 j = 0; | 131 j = 0; |
| 140 | 140 |
| 141 #define HEADER_SIZE 7 | 141 #define HEADER_SIZE 7 |
| 142 | 142 |
| 143 static int a52_decode_frame(AVCodecContext *avctx, | 143 static int a52_decode_frame(AVCodecContext *avctx, |
| 144 void *data, int *data_size, | 144 void *data, int *data_size, |
| 145 UINT8 *buf, int buf_size) | 145 uint8_t *buf, int buf_size) |
| 146 { | 146 { |
| 147 AC3DecodeState *s = avctx->priv_data; | 147 AC3DecodeState *s = avctx->priv_data; |
| 148 UINT8 *buf_ptr; | 148 uint8_t *buf_ptr; |
| 149 int flags, i, len; | 149 int flags, i, len; |
| 150 int sample_rate, bit_rate; | 150 int sample_rate, bit_rate; |
| 151 short *out_samples = data; | 151 short *out_samples = data; |
| 152 float level; | 152 float level; |
| 153 static const int ac3_channels[8] = { | 153 static const int ac3_channels[8] = { |
| 219 goto fail; | 219 goto fail; |
| 220 float_to_int(s->samples, out_samples + i * 256 * avctx->channels, avctx->channels); | 220 float_to_int(s->samples, out_samples + i * 256 * avctx->channels, avctx->channels); |
| 221 } | 221 } |
| 222 s->inbuf_ptr = s->inbuf; | 222 s->inbuf_ptr = s->inbuf; |
| 223 s->frame_size = 0; | 223 s->frame_size = 0; |
| 224 *data_size = 6 * avctx->channels * 256 * sizeof(INT16); | 224 *data_size = 6 * avctx->channels * 256 * sizeof(int16_t); |
| 225 break; | 225 break; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 return buf_ptr - buf; | 228 return buf_ptr - buf; |
| 229 } | 229 } |
