comparison utils.c @ 2091:02a4fd7c606c libavcodec

flush audio encoder buffers at the end fix vorbis in nut again
author michael
date Tue, 22 Jun 2004 21:14:01 +0000
parents 0817ee1f07e5
children 586a6e8f3290
comparison
equal deleted inserted replaced
2090:869805505b30 2091:02a4fd7c606c
451 } 451 }
452 452
453 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, 453 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
454 const short *samples) 454 const short *samples)
455 { 455 {
456 int ret; 456 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || samples){
457 457 int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples);
458 ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples); 458 avctx->frame_number++;
459 avctx->frame_number++; 459 return ret;
460 return ret; 460 }else
461 return 0;
461 } 462 }
462 463
463 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 464 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
464 const AVFrame *pict) 465 const AVFrame *pict)
465 { 466 {
466 int ret; 467 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
467 468 int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);
468 ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict); 469 avctx->frame_number++;
469 470 emms_c(); //needed to avoid a emms_c() call before every return;
470 emms_c(); //needed to avoid a emms_c() call before every return; 471
471 472 return ret;
472 avctx->frame_number++; 473 }else
473 return ret; 474 return 0;
474 } 475 }
475 476
476 /** 477 /**
477 * decode a frame. 478 * decode a frame.
478 * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes 479 * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes