diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-12 18:10:35 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-12 18:10:35 +0100 |
commit | 5743095ca9566db981b8fe113fc4f330dda5798a (patch) | |
tree | 6b41bfefa2e2ceb11acb489108ce3ad7e72f5922 /doc/examples/muxing.c | |
parent | 6b6b0e9daed339ed8da7606a8b043aed6ee2a4c4 (diff) | |
parent | 9d3009c6c4b9b6734f07df7c88f6a42ded6cdf38 (diff) | |
download | ffmpeg-5743095ca9566db981b8fe113fc4f330dda5798a.tar.gz |
Merge commit '9d3009c6c4b9b6734f07df7c88f6a42ded6cdf38'
* commit '9d3009c6c4b9b6734f07df7c88f6a42ded6cdf38':
avconv: print an error on applying options of the wrong type.
atomic: Check for __sync_val_compare_and_swap instead of __sync_synchronize
output-example: Update to use encode_video2 instead of the now dropped encode_video
Conflicts:
doc/examples/muxing.c
ffmpeg_opt.c
libavutil/atomic.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc/examples/muxing.c')
-rw-r--r-- | doc/examples/muxing.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c index 0a00884859..7305cc6284 100644 --- a/doc/examples/muxing.c +++ b/doc/examples/muxing.c @@ -342,25 +342,19 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st) ret = av_interleaved_write_frame(oc, &pkt); } else { - /* encode the image */ - AVPacket pkt; - int got_output; - + AVPacket pkt = { 0 }; + int got_packet; av_init_packet(&pkt); - pkt.data = NULL; // packet data will be allocated by the encoder - pkt.size = 0; - ret = avcodec_encode_video2(c, &pkt, frame, &got_output); + /* encode the image */ + ret = avcodec_encode_video2(c, &pkt, frame, &got_packet); if (ret < 0) { fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret)); exit(1); } - /* If size is zero, it means the image was buffered. */ - if (got_output) { - if (c->coded_frame->key_frame) - pkt.flags |= AV_PKT_FLAG_KEY; + if (!ret && got_packet && pkt.size) { pkt.stream_index = st->index; /* Write the compressed frame to the media file. */ |