mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavfi: use AVFrame.duration instead of AVFrame.pkt_duration
This commit is contained in:
parent
ac2cda4296
commit
357ba45a5c
@ -11842,7 +11842,7 @@ The current packet's position in the input file or stream
|
||||
(in bytes, from the start of the input). A value of -1 indicates
|
||||
this info is not available.
|
||||
|
||||
@item pkt_duration
|
||||
@item duration
|
||||
The current packet's duration, in seconds.
|
||||
|
||||
@item pkt_size
|
||||
|
@ -243,6 +243,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
}
|
||||
|
||||
#if FF_API_PKT_DURATION
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (copy->pkt_duration && copy->pkt_duration != copy->duration)
|
||||
copy->duration = copy->pkt_duration;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
ret = ff_filter_frame(ctx->outputs[0], copy);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -331,9 +331,16 @@ static int push_frame(AVFilterContext *ctx)
|
||||
if (!out)
|
||||
return AVERROR(ENOMEM);
|
||||
out->pts += s->duration - s->start_pts;
|
||||
#if FF_API_PKT_DURATION
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (out->pkt_duration)
|
||||
duration = out->pkt_duration;
|
||||
else
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if (out->duration)
|
||||
duration = out->duration;
|
||||
else
|
||||
duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
|
||||
pts = out->pts + duration;
|
||||
ret = ff_filter_frame(outlink, out);
|
||||
@ -368,9 +375,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
s->nb_frames++;
|
||||
#if FF_API_PKT_DURATION
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (frame->pkt_duration)
|
||||
duration = frame->pkt_duration;
|
||||
else
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if (frame->duration)
|
||||
duration = frame->duration;
|
||||
else
|
||||
duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
|
||||
s->duration = frame->pts + duration;
|
||||
ret = ff_filter_frame(outlink, frame);
|
||||
|
@ -1413,8 +1413,15 @@ static int filter_frame(AVFilterLink *link, AVFrame *input_frame)
|
||||
&debug_matches, 1);
|
||||
}
|
||||
|
||||
#if FF_API_PKT_DURATION
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (input_frame->pkt_duration) {
|
||||
duration = input_frame->pkt_duration;
|
||||
} else
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if (input_frame->duration) {
|
||||
duration = input_frame->duration;
|
||||
} else {
|
||||
duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
|
||||
}
|
||||
|
@ -91,8 +91,11 @@ static const char *const var_names[] = {
|
||||
"y",
|
||||
"pict_type",
|
||||
"pkt_pos",
|
||||
#if FF_API_PKT_DURATION
|
||||
"pkt_duration",
|
||||
#endif
|
||||
"pkt_size",
|
||||
"duration",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -131,8 +134,11 @@ enum var_name {
|
||||
VAR_Y,
|
||||
VAR_PICT_TYPE,
|
||||
VAR_PKT_POS,
|
||||
#if FF_API_PKT_DURATION
|
||||
VAR_PKT_DURATION,
|
||||
#endif
|
||||
VAR_PKT_SIZE,
|
||||
VAR_DURATION,
|
||||
VAR_VARS_NB
|
||||
};
|
||||
|
||||
@ -1649,8 +1655,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
|
||||
s->var_values[VAR_PICT_TYPE] = frame->pict_type;
|
||||
s->var_values[VAR_PKT_POS] = frame->pkt_pos;
|
||||
#if FF_API_PKT_DURATION
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
s->var_values[VAR_PKT_DURATION] = frame->pkt_duration * av_q2d(inlink->time_base);
|
||||
|
||||
if (frame->pkt_duration)
|
||||
s->var_values[VAR_DURATION] = frame->pkt_duration * av_q2d(inlink->time_base);
|
||||
else
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
s->var_values[VAR_DURATION] = frame->duration * av_q2d(inlink->time_base);
|
||||
s->var_values[VAR_PKT_SIZE] = frame->pkt_size;
|
||||
|
||||
s->metadata = frame->metadata;
|
||||
|
||||
for (int i = 0; i < loop; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user