mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter: use the new AVFrame key_frame flag in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
dc7bd7c5a5
commit
af8db9106c
|
@ -59,7 +59,7 @@ static void tlog_ref(void *ctx, AVFrame *ref, int end)
|
||||||
ref->width, ref->height,
|
ref->width, ref->height,
|
||||||
!(ref->flags & AV_FRAME_FLAG_INTERLACED) ? 'P' : /* Progressive */
|
!(ref->flags & AV_FRAME_FLAG_INTERLACED) ? 'P' : /* Progressive */
|
||||||
(ref->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 'T' : 'B', /* Top / Bottom */
|
(ref->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 'T' : 'B', /* Top / Bottom */
|
||||||
ref->key_frame,
|
!!(ref->flags & AV_FRAME_FLAG_KEY),
|
||||||
av_get_picture_type_char(ref->pict_type));
|
av_get_picture_type_char(ref->pict_type));
|
||||||
}
|
}
|
||||||
if (ref->nb_samples) {
|
if (ref->nb_samples) {
|
||||||
|
|
|
@ -256,6 +256,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (copy->key_frame)
|
||||||
|
copy->flags |= AV_FRAME_FLAG_KEY;
|
||||||
|
|
||||||
ret = ff_filter_frame(ctx->outputs[0], copy);
|
ret = ff_filter_frame(ctx->outputs[0], copy);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -346,7 +346,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
select->var_values[VAR_POS] = frame->pkt_pos == -1 ? NAN : frame->pkt_pos;
|
select->var_values[VAR_POS] = frame->pkt_pos == -1 ? NAN : frame->pkt_pos;
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
select->var_values[VAR_KEY] = frame->key_frame;
|
select->var_values[VAR_KEY] = !!(frame->flags & AV_FRAME_FLAG_KEY);
|
||||||
select->var_values[VAR_CONCATDEC_SELECT] = get_concatdec_select(frame, av_rescale_q(frame->pts, inlink->time_base, AV_TIME_BASE_Q));
|
select->var_values[VAR_CONCATDEC_SELECT] = get_concatdec_select(frame, av_rescale_q(frame->pts, inlink->time_base, AV_TIME_BASE_Q));
|
||||||
|
|
||||||
switch (inlink->type) {
|
switch (inlink->type) {
|
||||||
|
@ -375,7 +375,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
select->var_values[VAR_N],
|
select->var_values[VAR_N],
|
||||||
select->var_values[VAR_PTS],
|
select->var_values[VAR_PTS],
|
||||||
select->var_values[VAR_T],
|
select->var_values[VAR_T],
|
||||||
frame->key_frame);
|
!!(frame->flags & AV_FRAME_FLAG_KEY));
|
||||||
|
|
||||||
switch (inlink->type) {
|
switch (inlink->type) {
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
|
|
|
@ -72,7 +72,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||||
p += frame->linesize[0];
|
p += frame->linesize[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame->key_frame)
|
if (frame->flags & AV_FRAME_FLAG_KEY)
|
||||||
s->last_keyframe = s->frame;
|
s->last_keyframe = s->frame;
|
||||||
|
|
||||||
pblack = s->nblack * 100 / (inlink->w * inlink->h);
|
pblack = s->nblack * 100 / (inlink->w * inlink->h);
|
||||||
|
|
|
@ -302,6 +302,7 @@ static int request_frame(AVFilterLink *link)
|
||||||
frame->pts = ctx->pts;
|
frame->pts = ctx->pts;
|
||||||
frame->duration = 1;
|
frame->duration = 1;
|
||||||
frame->key_frame = 1;
|
frame->key_frame = 1;
|
||||||
|
frame->flags |= AV_FRAME_FLAG_KEY
|
||||||
#if FF_API_INTERLACED_FRAME
|
#if FF_API_INTERLACED_FRAME
|
||||||
frame->interlaced_frame = 0;
|
frame->interlaced_frame = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -724,7 +724,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||||
frame->width, frame->height,
|
frame->width, frame->height,
|
||||||
!(frame->flags & AV_FRAME_FLAG_INTERLACED) ? 'P' : /* Progressive */
|
!(frame->flags & AV_FRAME_FLAG_INTERLACED) ? 'P' : /* Progressive */
|
||||||
(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 'T' : 'B', /* Top / Bottom */
|
(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 'T' : 'B', /* Top / Bottom */
|
||||||
frame->key_frame,
|
!!(frame->flags & AV_FRAME_FLAG_KEY),
|
||||||
av_get_picture_type_char(frame->pict_type));
|
av_get_picture_type_char(frame->pict_type));
|
||||||
|
|
||||||
if (s->calculate_checksums) {
|
if (s->calculate_checksums) {
|
||||||
|
|
|
@ -398,6 +398,7 @@ static int activate(AVFilterContext *ctx)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
frame->key_frame = 1;
|
frame->key_frame = 1;
|
||||||
|
frame->flags |= AV_FRAME_FLAG_KEY;
|
||||||
#if FF_API_INTERLACED_FRAME
|
#if FF_API_INTERLACED_FRAME
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
frame->interlaced_frame = 0;
|
frame->interlaced_frame = 0;
|
||||||
|
|
|
@ -185,6 +185,7 @@ static int activate(AVFilterContext *ctx)
|
||||||
frame->pts = test->pts;
|
frame->pts = test->pts;
|
||||||
frame->duration = 1;
|
frame->duration = 1;
|
||||||
frame->key_frame = 1;
|
frame->key_frame = 1;
|
||||||
|
frame->flags |= AV_FRAME_FLAG_KEY;
|
||||||
#if FF_API_INTERLACED_FRAME
|
#if FF_API_INTERLACED_FRAME
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
frame->interlaced_frame = 0;
|
frame->interlaced_frame = 0;
|
||||||
|
|
Loading…
Reference in New Issue