summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r--fftools/ffmpeg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0682a6fcc5..4da1f94c03 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -925,6 +925,7 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
av_ts2str(frame->pts), av_ts2timestr(frame->pts, &enc->time_base),
enc->time_base.num, enc->time_base.den);
}
+ frame->reordered_opaque = (int64_t)frame->opaque;
}
update_benchmark(NULL);
@@ -956,6 +957,11 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
return ret;
}
+ if (enc->codec->capabilities & AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE)
+ pkt->opaque = (void*)enc->reordered_opaque;
+ else if (frame)
+ pkt->opaque = frame->opaque;
+
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "encoder -> type:%s "
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s "
@@ -2076,6 +2082,7 @@ static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacke
*got_frame = 0;
if (pkt) {
+ avctx->reordered_opaque = (int64_t)pkt->opaque;
ret = avcodec_send_packet(avctx, pkt);
// In particular, we don't expect AVERROR(EAGAIN), because we read all
// decoded frames with avcodec_receive_frame() until done.
@@ -2086,8 +2093,10 @@ static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacke
ret = avcodec_receive_frame(avctx, frame);
if (ret < 0 && ret != AVERROR(EAGAIN))
return ret;
- if (ret >= 0)
+ if (ret >= 0) {
*got_frame = 1;
+ frame->opaque = (void*)frame->reordered_opaque;
+ }
return 0;
}