mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-07 11:13:41 +02:00
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.
This commit is contained in:
parent
7ec4881f3e
commit
b088d59347
@ -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_top = FFMIN(s->smv_next_frame * avctx->height, frame->height);
|
||||||
frame->crop_bottom = frame->height - (s->smv_next_frame + 1) * avctx->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;
|
s->smv_next_frame = (s->smv_next_frame + 1) % s->smv_frames_per_jpeg;
|
||||||
|
|
||||||
if (s->smv_next_frame == 0)
|
if (s->smv_next_frame == 0)
|
||||||
@ -3044,6 +3046,9 @@ static int smvjpeg_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
|||||||
if (!got_frame)
|
if (!got_frame)
|
||||||
return AVERROR(EAGAIN);
|
return AVERROR(EAGAIN);
|
||||||
|
|
||||||
|
// packet duration covers all the frames in the packet
|
||||||
|
s->smv_frame->duration /= s->smv_frames_per_jpeg;
|
||||||
|
|
||||||
return_frame:
|
return_frame:
|
||||||
av_assert0(s->smv_frame->buf[0]);
|
av_assert0(s->smv_frame->buf[0]);
|
||||||
ret = av_frame_ref(frame, s->smv_frame);
|
ret = av_frame_ref(frame, s->smv_frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user