comparison ra288.c @ 2956:5f51b1e0bed6 libavcodec

Cook compatibe decoder, patch by Benjamin Larsson Add cook demucing, change rm demuxer so that it reorders audio packets before sending them to the decoder, and send minimum decodeable sized packets; pass only real codec extradata fo the decoder Fix 28_8 decoder for the new demuxer strategy
author rtognimp
date Fri, 09 Dec 2005 16:08:18 +0000
parents 3d4a1f8e6a27
children ef2149182f1c
comparison
equal deleted inserted replaced
2955:64f38f1be88f 2956:5f51b1e0bed6
226 /* Decode a block (celp) */ 226 /* Decode a block (celp) */
227 static int ra288_decode_frame(AVCodecContext * avctx, 227 static int ra288_decode_frame(AVCodecContext * avctx,
228 void *data, int *data_size, 228 void *data, int *data_size,
229 uint8_t * buf, int buf_size) 229 uint8_t * buf, int buf_size)
230 { 230 {
231 if(avctx->extradata_size>=6)
232 {
233 //((short*)(avctx->extradata))[0]; /* subpacket size */
234 //((short*)(avctx->extradata))[1]; /* subpacket height */
235 //((short*)(avctx->extradata))[2]; /* subpacket flavour */
236 //((short*)(avctx->extradata))[3]; /* coded frame size */
237 //((short*)(avctx->extradata))[4]; /* codec's data length */
238 //((short*)(avctx->extradata))[5...] /* codec's data */
239 int bret;
240 void *datao; 231 void *datao;
241 int w=avctx->block_align; /* 228 */ 232
242 int h=((short*)(avctx->extradata))[1]; /* 12 */ 233 if (buf_size < avctx->block_align)
243 int cfs=((short*)(avctx->extradata))[3]; /* coded frame size 38 */
244 int i,j;
245 if(buf_size<w*h)
246 { 234 {
247 av_log(avctx, AV_LOG_ERROR, "ffra288: Error! Input buffer is too small [%d<%d]\n",buf_size,w*h); 235 av_log(avctx, AV_LOG_ERROR, "ffra288: Error! Input buffer is too small [%d<%d]\n",buf_size,avctx->block_align);
248 return 0; 236 return 0;
249 } 237 }
238
250 datao = data; 239 datao = data;
251 bret = 0; 240 data = decode_block(avctx, buf, (signed short *)data, avctx->block_align);
252 for (j = 0; j < h/2; j++) 241
253 for (i = 0; i < h; i++)
254 {
255 data=decode_block(avctx,&buf[j*cfs+cfs*i*h/2],(signed short *)data,cfs);
256 bret += cfs;
257 }
258 *data_size = (char *)data - (char *)datao; 242 *data_size = (char *)data - (char *)datao;
259 return bret; 243 return avctx->block_align;
260 }
261 else
262 {
263 av_log(avctx, AV_LOG_ERROR, "ffra288: Error: need extra data!!!\n");
264 return 0;
265 }
266 } 244 }
267 245
268 AVCodec ra_288_decoder = 246 AVCodec ra_288_decoder =
269 { 247 {
270 "real_288", 248 "real_288",