summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-10-12 16:06:07 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-10-13 13:43:29 +0200
commit34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e (patch)
tree945785254daf45072207b06386cdb7c008382ce9 /doc
parent16b0c929621f84983b83b9735ce973acb12723bc (diff)
downloadffmpeg-streaming-34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e.zip
ffmpeg-streaming-34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e.tar.gz
avformat: Do not use AVFMT_RAWPICTURE
There are no formats supporting it anymore and it is deprecated. Update the documentation accordingly.
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/output.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/doc/examples/output.c b/doc/examples/output.c
index af5445b..c883429 100644
--- a/doc/examples/output.c
+++ b/doc/examples/output.c
@@ -491,48 +491,30 @@ static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
int ret;
AVCodecContext *c;
AVFrame *frame;
+ AVPacket pkt = { 0 };
int got_packet = 0;
c = ost->st->codec;
frame = get_video_frame(ost);
- if (oc->oformat->flags & AVFMT_RAWPICTURE) {
- /* a hack to avoid data copy with some raw video muxers */
- AVPacket pkt;
- av_init_packet(&pkt);
-
- if (!frame)
- return 1;
+ av_init_packet(&pkt);
- pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index = ost->st->index;
- pkt.data = (uint8_t *)frame;
- pkt.size = sizeof(AVPicture);
+ /* encode the image */
+ ret = avcodec_encode_video2(c, &pkt, frame, &got_packet);
+ if (ret < 0) {
+ fprintf(stderr, "Error encoding a video frame\n");
+ exit(1);
+ }
- pkt.pts = pkt.dts = frame->pts;
+ if (got_packet) {
av_packet_rescale_ts(&pkt, c->time_base, ost->st->time_base);
+ pkt.stream_index = ost->st->index;
+ /* Write the compressed frame to the media file. */
ret = av_interleaved_write_frame(oc, &pkt);
- } else {
- AVPacket pkt = { 0 };
- av_init_packet(&pkt);
-
- /* encode the image */
- ret = avcodec_encode_video2(c, &pkt, frame, &got_packet);
- if (ret < 0) {
- fprintf(stderr, "Error encoding a video frame\n");
- exit(1);
- }
-
- if (got_packet) {
- av_packet_rescale_ts(&pkt, c->time_base, ost->st->time_base);
- pkt.stream_index = ost->st->index;
-
- /* Write the compressed frame to the media file. */
- ret = av_interleaved_write_frame(oc, &pkt);
- }
}
+
if (ret != 0) {
fprintf(stderr, "Error while writing video frame\n");
exit(1);
OpenPOWER on IntegriCloud