summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-10-14 14:43:20 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2015-10-14 14:43:20 +0200
commit1899b2579993c4faca79cade01e374378db128dd (patch)
treec867a55af62bb55bceb084c7cd5eeff5ac93490a /doc/examples
parent9ccd90626f0ecef205faef1d25f0e3649d18e1b3 (diff)
parent34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e (diff)
Merge commit '34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e'
* commit '34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e': avformat: Do not use AVFMT_RAWPICTURE Removal from ffmpeg.c not merged because some parts of avdevice still use it Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/muxing.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index b5bd54a105..041617aff3 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -498,39 +498,20 @@ static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
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;
-
- pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index = ost->st->index;
- pkt.data = (uint8_t *)frame;
- pkt.size = sizeof(AVPicture);
+ AVPacket pkt = { 0 };
+ av_init_packet(&pkt);
- pkt.pts = pkt.dts = frame->pts;
- av_packet_rescale_ts(&pkt, c->time_base, ost->st->time_base);
+ /* 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);
+ }
- ret = av_interleaved_write_frame(oc, &pkt);
+ if (got_packet) {
+ ret = write_frame(oc, &c->time_base, ost->st, &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 video frame: %s\n", av_err2str(ret));
- exit(1);
- }
-
- if (got_packet) {
- ret = write_frame(oc, &c->time_base, ost->st, &pkt);
- } else {
- ret = 0;
- }
+ ret = 0;
}
if (ret < 0) {