mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavc: use AVFrame.duration instead of AVFrame.pkt_duration
This commit is contained in:
parent
4397f9a5a0
commit
ac2cda4296
@ -546,7 +546,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
|
||||
frame->pts = pkt_pts;
|
||||
|
||||
frame->pkt_pos = -1;
|
||||
frame->pkt_duration = 0;
|
||||
frame->duration = 0;
|
||||
frame->pkt_size = -1;
|
||||
|
||||
if (!priv->need_second_field) {
|
||||
|
@ -624,7 +624,7 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
* So set pkt_pts and clear all the other pkt_ fields.
|
||||
*/
|
||||
frame->pkt_pos = -1;
|
||||
frame->pkt_duration = 0;
|
||||
frame->duration = 0;
|
||||
frame->pkt_size = -1;
|
||||
|
||||
frame->interlaced_frame = !parsed_frame.is_deinterlacing && !parsed_frame.dispinfo.progressive_frame;
|
||||
|
@ -394,8 +394,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
frame->pts += diff_ts;
|
||||
if(frame->pkt_dts!=AV_NOPTS_VALUE)
|
||||
frame->pkt_dts += diff_ts;
|
||||
if (frame->pkt_duration >= diff_ts)
|
||||
frame->pkt_duration -= diff_ts;
|
||||
if (frame->duration >= diff_ts)
|
||||
frame->duration -= diff_ts;
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n");
|
||||
}
|
||||
@ -417,7 +417,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
int64_t diff_ts = av_rescale_q(frame->nb_samples - discard_padding,
|
||||
(AVRational){1, avctx->sample_rate},
|
||||
avctx->pkt_timebase);
|
||||
frame->pkt_duration = diff_ts;
|
||||
frame->duration = diff_ts;
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for discarded samples.\n");
|
||||
}
|
||||
@ -549,6 +549,12 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
|
||||
frame->pts,
|
||||
frame->pkt_dts);
|
||||
|
||||
#if FF_API_PKT_DURATION
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
frame->pkt_duration = frame->duration;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
/* the only case where decode data is not set should be decoders
|
||||
* that do not call ff_get_buffer() */
|
||||
av_assert0((frame->private_ref && frame->private_ref->size == sizeof(FrameDecodeData)) ||
|
||||
@ -1267,7 +1273,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
|
||||
if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) {
|
||||
frame->pts = pkt->pts;
|
||||
frame->pkt_pos = pkt->pos;
|
||||
frame->pkt_duration = pkt->duration;
|
||||
frame->duration = pkt->duration;
|
||||
frame->pkt_size = pkt->size;
|
||||
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
|
||||
|
@ -339,7 +339,7 @@ static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src)
|
||||
return ret;
|
||||
|
||||
avctx->internal->last_audio_frame = 1;
|
||||
return 0;
|
||||
goto finish;
|
||||
} else if (src->nb_samples > avctx->frame_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d)\n", src->nb_samples, avctx->frame_size);
|
||||
return AVERROR(EINVAL);
|
||||
@ -351,6 +351,15 @@ static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
finish:
|
||||
|
||||
#if FF_API_PKT_DURATION
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (dst->pkt_duration && dst->pkt_duration != dst->duration)
|
||||
dst->duration = dst->pkt_duration;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -475,7 +475,7 @@ static int gif_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
|
||||
s->frame->pts = avpkt->pts;
|
||||
s->frame->pkt_dts = avpkt->dts;
|
||||
s->frame->pkt_duration = avpkt->duration;
|
||||
s->frame->duration = avpkt->duration;
|
||||
|
||||
if (avpkt->size >= 6) {
|
||||
s->keyframe = memcmp(avpkt->data, gif87a_sig, 6) == 0 ||
|
||||
|
@ -415,7 +415,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
|
||||
frame->pkt_dts = p->m.timestamp;
|
||||
frame->pkt_pos = p->m.offset;
|
||||
frame->pkt_size = p->m.size;
|
||||
frame->pkt_duration = p->m.duration;
|
||||
frame->duration = p->m.duration;
|
||||
frame->key_frame = p->frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY;
|
||||
|
||||
switch (p->frame_hdr->frame_type) {
|
||||
|
@ -344,7 +344,7 @@ static IMFSample *mf_v_avframe_to_sample(AVCodecContext *avctx, const AVFrame *f
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IMFSample_SetSampleDuration(sample, mf_to_mf_time(avctx, frame->pkt_duration));
|
||||
IMFSample_SetSampleDuration(sample, mf_to_mf_time(avctx, frame->duration));
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
|
||||
return res;
|
||||
|
||||
frame->pkt_pos = avctx->internal->last_pkt_props->pos;
|
||||
frame->pkt_duration = avctx->internal->last_pkt_props->duration;
|
||||
frame->duration = avctx->internal->last_pkt_props->duration;
|
||||
|
||||
if (context->tff >= 0) {
|
||||
frame->interlaced_frame = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user