[FFmpeg-devel] [PATCH] lavc: force *got_packet_ptr to 0 at the start of avcodec_encode_audio4()
Stefano Sabatini
stefasab at gmail.com
Mon Feb 6 13:20:45 CET 2012
Do not require the application level code to explicitely set *got_packet_ptr
to 0 before to call avcodec_encode_audio4(), thus removing possible cause
of errors.
This is also consistent with the avcodec_decode_video*() API.
---
ffmpeg.c | 1 -
libavcodec/utils.c | 2 +-
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index ba63ca9..7dd3918 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1074,7 +1074,6 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
}
}
- got_packet = 0;
if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) {
av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n");
exit_program(1);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7420672..3ae13b0 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -942,6 +942,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
int user_packet = !!avpkt->data;
int nb_samples;
+ *got_packet_ptr = 0;
if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {
av_init_packet(avpkt);
avpkt->size = 0;
@@ -963,7 +964,6 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
}
if (avctx->codec->encode2) {
- *got_packet_ptr = 0;
ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
if (!ret && *got_packet_ptr &&
!(avctx->codec->capabilities & CODEC_CAP_DELAY)) {
--
1.7.5.4
More information about the ffmpeg-devel
mailing list