diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-04-14 18:06:29 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-04-19 21:12:03 +0200 |
commit | b088d59347ed24c9346d8bc1c81ee09637fbd7ec (patch) | |
tree | 4a7e56e58049d7da9cd3e15d038dbdd2169e3a5e | |
parent | 7ec4881f3e660ab1c6e8f157a55524bc367ae5f4 (diff) | |
download | ffmpeg-b088d59347ed24c9346d8bc1c81ee09637fbd7ec.tar.gz |
lavc/mjpegdec: properly set pts and duration for smvjpeg
A single smvjpeg packet decodes into one large mjpeg frame, slices of
which are then returned as output frames. Packet duration covers all of
these slices.
-rw-r--r-- | libavcodec/mjpegdec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 9e78d644a1..c41d4bce5e 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -3013,6 +3013,8 @@ static void smv_process_frame(AVCodecContext *avctx, AVFrame *frame) frame->crop_top = FFMIN(s->smv_next_frame * avctx->height, frame->height); frame->crop_bottom = frame->height - (s->smv_next_frame + 1) * avctx->height; + if (s->smv_frame->pts != AV_NOPTS_VALUE) + s->smv_frame->pts += s->smv_frame->duration; s->smv_next_frame = (s->smv_next_frame + 1) % s->smv_frames_per_jpeg; if (s->smv_next_frame == 0) @@ -3044,6 +3046,9 @@ static int smvjpeg_receive_frame(AVCodecContext *avctx, AVFrame *frame) if (!got_frame) return AVERROR(EAGAIN); + // packet duration covers all the frames in the packet + s->smv_frame->duration /= s->smv_frames_per_jpeg; + return_frame: av_assert0(s->smv_frame->buf[0]); ret = av_frame_ref(frame, s->smv_frame); |