Mercurial > libavcodec.hg
annotate adxdec.c @ 7767:f692318902dc libavcodec
Check ff_init_me()s return value.
author | michael |
---|---|
date | Mon, 01 Sep 2008 00:28:51 +0000 |
parents | 3e0103ac9d76 |
children | 2acf0ae7b041 |
rev | line source |
---|---|
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
1 /* |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
2 * ADX ADPCM codecs |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
3 * Copyright (c) 2001,2003 BERO |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
4 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3445
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3445
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3445
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3445
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3445
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
16 * |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3445
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2967
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
20 */ |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
21 #include "avcodec.h" |
5866 | 22 #include "adx.h" |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
23 |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
24 /** |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
25 * @file adx.c |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
26 * SEGA CRI adx codecs. |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
27 * |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
28 * Reference documents: |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
29 * http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
30 * adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/ |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
31 */ |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
32 |
7600
3e0103ac9d76
Mark adx_decode_init() as type int instead of void, the function returns
diego
parents:
7451
diff
changeset
|
33 static av_cold int adx_decode_init(AVCodecContext *avctx) |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
34 { |
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
35 avctx->sample_fmt = SAMPLE_FMT_S16; |
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
36 return 0; |
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
37 } |
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
38 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
39 /* 18 bytes <-> 32 samples */ |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
40 |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
41 static void adx_decode(short *out,const unsigned char *in,PREV *prev) |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
42 { |
5067 | 43 int scale = AV_RB16(in); |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
44 int i; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
45 int s0,s1,s2,d; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
46 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
47 // printf("%x ",scale); |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
48 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
49 in+=2; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
50 s1 = prev->s1; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
51 s2 = prev->s2; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
52 for(i=0;i<16;i++) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
53 d = in[i]; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
54 // d>>=4; if (d&8) d-=16; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
55 d = ((signed char)d >> 4); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
56 s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
57 s2 = s1; |
5525
bc4791868c52
various simplifications around recent av_clip_int16() usage
aurel
parents:
5523
diff
changeset
|
58 s1 = av_clip_int16(s0); |
bc4791868c52
various simplifications around recent av_clip_int16() usage
aurel
parents:
5523
diff
changeset
|
59 *out++=s1; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
60 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
61 d = in[i]; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
62 //d&=15; if (d&8) d-=16; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
63 d = ((signed char)(d<<4) >> 4); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
64 s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
65 s2 = s1; |
5525
bc4791868c52
various simplifications around recent av_clip_int16() usage
aurel
parents:
5523
diff
changeset
|
66 s1 = av_clip_int16(s0); |
bc4791868c52
various simplifications around recent av_clip_int16() usage
aurel
parents:
5523
diff
changeset
|
67 *out++=s1; |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
68 } |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
69 prev->s1 = s1; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
70 prev->s2 = s2; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
71 |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
72 } |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
73 |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
74 static void adx_decode_stereo(short *out,const unsigned char *in,PREV *prev) |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
75 { |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
76 short tmp[32*2]; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
77 int i; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
78 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
79 adx_decode(tmp ,in ,prev); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
80 adx_decode(tmp+32,in+18,prev+1); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
81 for(i=0;i<32;i++) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
82 out[i*2] = tmp[i]; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
83 out[i*2+1] = tmp[i+32]; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
84 } |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
85 } |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
86 |
5864 | 87 /* return data offset or 0 */ |
88 static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize) | |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
89 { |
5864 | 90 int offset; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
91 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
92 if (buf[0]!=0x80) return 0; |
5067 | 93 offset = (AV_RB32(buf)^0x80000000)+4; |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
94 if (bufsize<offset || memcmp(buf+offset-6,"(c)CRI",6)) return 0; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
95 |
5864 | 96 avctx->channels = buf[7]; |
97 avctx->sample_rate = AV_RB32(buf+8); | |
98 avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32; | |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
99 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
100 return offset; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
101 } |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
102 |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
103 static int adx_decode_frame(AVCodecContext *avctx, |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
104 void *data, int *data_size, |
6261 | 105 const uint8_t *buf0, int buf_size) |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
106 { |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
107 ADXContext *c = avctx->priv_data; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
108 short *samples = data; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
109 const uint8_t *buf = buf0; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
110 int rest = buf_size; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
111 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
112 if (!c->header_parsed) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
113 int hdrsize = adx_decode_header(avctx,buf,rest); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
114 if (hdrsize==0) return -1; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
115 c->header_parsed = 1; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
116 buf += hdrsize; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
117 rest -= hdrsize; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
118 } |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
119 |
5704
cf77b8588f15
Do not try to decode more data than output buffer may hold
kostya
parents:
5525
diff
changeset
|
120 /* 18 bytes of data are expanded into 32*2 bytes of audio, |
cf77b8588f15
Do not try to decode more data than output buffer may hold
kostya
parents:
5525
diff
changeset
|
121 so guard against buffer overflows */ |
cf77b8588f15
Do not try to decode more data than output buffer may hold
kostya
parents:
5525
diff
changeset
|
122 if(rest/18 > *data_size/64) |
cf77b8588f15
Do not try to decode more data than output buffer may hold
kostya
parents:
5525
diff
changeset
|
123 rest = (*data_size/64) * 18; |
cf77b8588f15
Do not try to decode more data than output buffer may hold
kostya
parents:
5525
diff
changeset
|
124 |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
125 if (c->in_temp) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
126 int copysize = 18*avctx->channels - c->in_temp; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
127 memcpy(c->dec_temp+c->in_temp,buf,copysize); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
128 rest -= copysize; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
129 buf += copysize; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
130 if (avctx->channels==1) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
131 adx_decode(samples,c->dec_temp,c->prev); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
132 samples += 32; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
133 } else { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
134 adx_decode_stereo(samples,c->dec_temp,c->prev); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
135 samples += 32*2; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
136 } |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
137 } |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
138 // |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
139 if (avctx->channels==1) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
140 while(rest>=18) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
141 adx_decode(samples,buf,c->prev); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
142 rest-=18; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
143 buf+=18; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
144 samples+=32; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
145 } |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
146 } else { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
147 while(rest>=18*2) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
148 adx_decode_stereo(samples,buf,c->prev); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
149 rest-=18*2; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
150 buf+=18*2; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
151 samples+=32*2; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
152 } |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
153 } |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
154 // |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
155 c->in_temp = rest; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
156 if (rest) { |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
157 memcpy(c->dec_temp,buf,rest); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
158 buf+=rest; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
159 } |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
160 *data_size = (uint8_t*)samples - (uint8_t*)data; |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
161 // printf("%d:%d ",buf-buf0,*data_size); fflush(stdout); |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
162 return buf-buf0; |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
163 } |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
164 |
3445 | 165 AVCodec adpcm_adx_decoder = { |
166 "adpcm_adx", | |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
167 CODEC_TYPE_AUDIO, |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
168 CODEC_ID_ADPCM_ADX, |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
169 sizeof(ADXContext), |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
170 adx_decode_init, |
1534
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
171 NULL, |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
172 NULL, |
5bdf2017d854
replace file to remove nasty DOS CRs and hard tabs
melanson
parents:
1531
diff
changeset
|
173 adx_decode_frame, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6710
diff
changeset
|
174 .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX"), |
1531
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
175 }; |
a78de892cefd
added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff
changeset
|
176 |