comparison ac3dec.c @ 1064:b32afefe7d33 libavcodec

* UINTX -> uintx_t INTX -> intx_t
author kabi
date Tue, 11 Feb 2003 16:35:48 +0000
parents 718a22dc121f
children 1e39f273ecd6
comparison
equal deleted inserted replaced
1063:fdeac9642346 1064:b32afefe7d33
20 #include "libac3/ac3.h" 20 #include "libac3/ac3.h"
21 21
22 /* currently, I use libac3 which is Copyright (C) Aaron Holtzman and 22 /* currently, I use libac3 which is Copyright (C) Aaron Holtzman and
23 released under the GPL license. I may reimplement it someday... */ 23 released under the GPL license. I may reimplement it someday... */
24 typedef struct AC3DecodeState { 24 typedef struct AC3DecodeState {
25 UINT8 inbuf[4096]; /* input buffer */ 25 uint8_t inbuf[4096]; /* input buffer */
26 UINT8 *inbuf_ptr; 26 uint8_t *inbuf_ptr;
27 int frame_size; 27 int frame_size;
28 int flags; 28 int flags;
29 int channels; 29 int channels;
30 ac3_state_t state; 30 ac3_state_t state;
31 } AC3DecodeState; 31 } AC3DecodeState;
51 return -32768; 51 return -32768;
52 else 52 else
53 return i - 0x43c00000; 53 return i - 0x43c00000;
54 } 54 }
55 55
56 static inline void float_to_int (float * _f, INT16 * s16, int nchannels) 56 static inline void float_to_int (float * _f, int16_t * s16, int nchannels)
57 { 57 {
58 int i, j, c; 58 int i, j, c;
59 int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format 59 int32_t * f = (int32_t *) _f; // XXX assumes IEEE float format
60 60
61 j = 0; 61 j = 0;
70 70
71 #define HEADER_SIZE 7 71 #define HEADER_SIZE 7
72 72
73 static int ac3_decode_frame(AVCodecContext *avctx, 73 static int ac3_decode_frame(AVCodecContext *avctx,
74 void *data, int *data_size, 74 void *data, int *data_size,
75 UINT8 *buf, int buf_size) 75 uint8_t *buf, int buf_size)
76 { 76 {
77 AC3DecodeState *s = avctx->priv_data; 77 AC3DecodeState *s = avctx->priv_data;
78 UINT8 *buf_ptr; 78 uint8_t *buf_ptr;
79 int flags, i, len; 79 int flags, i, len;
80 int sample_rate, bit_rate; 80 int sample_rate, bit_rate;
81 short *out_samples = data; 81 short *out_samples = data;
82 float level; 82 float level;
83 static const int ac3_channels[8] = { 83 static const int ac3_channels[8] = {
149 goto fail; 149 goto fail;
150 float_to_int (*samples, out_samples + i * 256 * avctx->channels, avctx->channels); 150 float_to_int (*samples, out_samples + i * 256 * avctx->channels, avctx->channels);
151 } 151 }
152 s->inbuf_ptr = s->inbuf; 152 s->inbuf_ptr = s->inbuf;
153 s->frame_size = 0; 153 s->frame_size = 0;
154 *data_size = 6 * avctx->channels * 256 * sizeof(INT16); 154 *data_size = 6 * avctx->channels * 256 * sizeof(int16_t);
155 break; 155 break;
156 } 156 }
157 } 157 }
158 return buf_ptr - buf; 158 return buf_ptr - buf;
159 } 159 }