comparison g726.c @ 1797:fac680cf3008 libavcodec

* gotta setup coded_frame for encoding. avcodec.h says that for decoding lavc is supposed to set it up as well and I don't think I see any reason not to.
author romansh
date Tue, 10 Feb 2004 20:48:09 +0000
parents 7da4bdafe42e
children 9a481659d7cb
comparison
equal deleted inserted replaced
1796:7186712b391e 1797:fac680cf3008
332 g726_reset(&c->c, avctx->bit_rate); 332 g726_reset(&c->c, avctx->bit_rate);
333 c->code_size = c->c.tbls->bits; 333 c->code_size = c->c.tbls->bits;
334 c->bit_buffer = 0; 334 c->bit_buffer = 0;
335 c->bits_left = 0; 335 c->bits_left = 0;
336 336
337 avctx->coded_frame = avcodec_alloc_frame();
338 if (!avctx->coded_frame)
339 return -ENOMEM;
340 avctx->coded_frame->key_frame = 1;
341
342 return 0;
343 }
344
345 static int g726_close(AVCodecContext *avctx)
346 {
347 av_freep(&avctx->coded_frame);
337 return 0; 348 return 0;
338 } 349 }
339 350
340 static int g726_encode_frame(AVCodecContext *avctx, 351 static int g726_encode_frame(AVCodecContext *avctx,
341 uint8_t *dst, int buf_size, void *data) 352 uint8_t *dst, int buf_size, void *data)
392 CODEC_TYPE_AUDIO, 403 CODEC_TYPE_AUDIO,
393 CODEC_ID_ADPCM_G726, 404 CODEC_ID_ADPCM_G726,
394 sizeof(AVG726Context), 405 sizeof(AVG726Context),
395 g726_init, 406 g726_init,
396 g726_encode_frame, 407 g726_encode_frame,
397 NULL, 408 g726_close,
398 NULL, 409 NULL,
399 }; 410 };
400 #endif //CONFIG_ENCODERS 411 #endif //CONFIG_ENCODERS
401 412
402 AVCodec adpcm_g726_decoder = { 413 AVCodec adpcm_g726_decoder = {
404 CODEC_TYPE_AUDIO, 415 CODEC_TYPE_AUDIO,
405 CODEC_ID_ADPCM_G726, 416 CODEC_ID_ADPCM_G726,
406 sizeof(AVG726Context), 417 sizeof(AVG726Context),
407 g726_init, 418 g726_init,
408 NULL, 419 NULL,
409 NULL, 420 g726_close,
410 g726_decode_frame, 421 g726_decode_frame,
411 }; 422 };