1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avutil/frame: deprecate interlaced_frame and top_field_first

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2023-04-12 14:18:50 -03:00
parent 3675dd0e0c
commit 599abc0f3a
25 changed files with 155 additions and 0 deletions

View File

@ -570,8 +570,12 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
}
if (!ret) {
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = !!(frame->flags & AV_FRAME_FLAG_INTERLACED);
frame->top_field_first = !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->best_effort_timestamp = guess_correct_pts(avctx,
frame->pts,
frame->pkt_dts);

View File

@ -192,10 +192,14 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
av_frame_move_ref(frame, avci->buffer_frame);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
if (frame->interlaced_frame)
frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (frame->top_field_first)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
return 0;
}

View File

@ -247,10 +247,14 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
if (copy->interlaced_frame)
copy->flags |= AV_FRAME_FLAG_INTERLACED;
if (copy->top_field_first)
copy->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ret = ff_filter_frame(ctx->outputs[0], copy);
if (ret < 0)

View File

@ -302,7 +302,9 @@ static int request_frame(AVFilterLink *link)
frame->pts = ctx->pts;
frame->duration = 1;
frame->key_frame = 1;
#if FF_API_INTERLACED_FRAME
frame->interlaced_frame = 0;
#endif
frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->sample_aspect_ratio = ctx->sar;

View File

@ -303,7 +303,11 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
output_frame->pts = input_frame->pts +
ctx->frame_queue[current_frame_index + 1]->pts;
}
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
output_frame->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
output_frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
av_log(avctx, AV_LOG_DEBUG, "Filter output: %s, %ux%u (%"PRId64").\n",

View File

@ -443,7 +443,11 @@ static int filter(AVFilterContext *ctx, AVFrame *in, int64_t pts, int64_t durati
if (!out)
return AVERROR(ENOMEM);
av_frame_copy_props(out, in);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags &= ~AV_FRAME_FLAG_INTERLACED;
out->pts = pts;
out->duration = duration;

View File

@ -73,7 +73,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
int i;
inpicref->height = outlink->h;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
inpicref->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
inpicref->flags &= ~AV_FRAME_FLAG_INTERLACED;
for (i = 0; i < field->nb_planes; i++) {

View File

@ -217,11 +217,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
switch (hint) {
case '+':
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags |= AV_FRAME_FLAG_INTERLACED;
break;
case '-':
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags &= ~AV_FRAME_FLAG_INTERLACED;
break;
case '=':

View File

@ -820,12 +820,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
/* mark the frame we are unable to match properly as interlaced so a proper
* de-interlacer can take the relay */
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
dst->interlaced_frame = interlaced_frame;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (interlaced_frame) {
dst->flags |= AV_FRAME_FLAG_INTERLACED;
av_log(ctx, AV_LOG_WARNING, "Frame #%"PRId64" at %s is still interlaced\n",
outlink->frame_count_in, av_ts2timestr(in->pts, &inlink->time_base));
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
dst->top_field_first = field;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (field)
dst->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
else

View File

@ -140,7 +140,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
}
}
}
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->top_field_first = s->dst_tff;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (s->dst_tff)
out->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
else

View File

@ -183,16 +183,28 @@ static void filter(AVFilterContext *ctx)
}
if (idet->last_type == TFF){
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
idet->cur->top_field_first = 1;
idet->cur->interlaced_frame = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
idet->cur->flags |= (AV_FRAME_FLAG_INTERLACED | AV_FRAME_FLAG_TOP_FIELD_FIRST);
}else if(idet->last_type == BFF){
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
idet->cur->top_field_first = 0;
idet->cur->interlaced_frame = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
idet->cur->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
idet->cur->flags |= AV_FRAME_FLAG_INTERLACED;
}else if(idet->last_type == PROGRESSIVE){
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
idet->cur->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
idet->cur->flags &= ~AV_FRAME_FLAG_INTERLACED;
}
@ -248,7 +260,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
}
if (idet->analyze_interlaced_flag_done) {
if ((picref->flags & AV_FRAME_FLAG_INTERLACED) && idet->interlaced_flag_accuracy < 0) {
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
picref->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
picref->flags &= ~AV_FRAME_FLAG_INTERLACED;
}
return ff_filter_frame(ctx->outputs[0], picref);
@ -289,7 +305,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
if (idet->analyze_interlaced_flag) {
if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
idet->cur->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
idet->cur->flags &= ~AV_FRAME_FLAG_INTERLACED;
filter(ctx);
if (idet->last_type == PROGRESSIVE) {
@ -303,7 +323,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
if ((idet->next->flags & AV_FRAME_FLAG_INTERLACED) && idet->interlaced_flag_accuracy < 0) {
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
idet->next->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
idet->next->flags &= ~AV_FRAME_FLAG_INTERLACED;
}
idet->analyze_interlaced_flag_done = 1;

View File

@ -141,7 +141,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
return AVERROR(ENOMEM);
}
av_frame_copy_props(outpic, inpic);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
outpic->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
outpic->flags &= ~AV_FRAME_FLAG_INTERLACED;
for (plane = 0; plane < 4 && inpic->data[plane] && inpic->linesize[plane]; plane++) {

View File

@ -665,7 +665,11 @@ static int get_frame(AVFilterContext *ctx, int is_second)
if (!dst)
return AVERROR(ENOMEM);
av_frame_copy_props(dst, s->prev);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
dst->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
dst->flags &= ~AV_FRAME_FLAG_INTERLACED;
dst->pts = s->pts;

View File

@ -70,7 +70,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
int ret;
inpicref->height = outlink->h;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
inpicref->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
inpicref->flags &= ~AV_FRAME_FLAG_INTERLACED;
if (!s->second) {

View File

@ -127,11 +127,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
/* set field */
if (s->field_mode == MODE_PROG) {
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
} else if (s->field_mode != MODE_AUTO) {
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = 1;
frame->top_field_first = s->field_mode;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (s->field_mode)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;

View File

@ -204,8 +204,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
s->stride[i],
(s->planeheight[i] - !s->first_field + 1) / 2);
}
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
s->frame[nout]->interlaced_frame = 1;
s->frame[nout]->top_field_first = !s->first_field;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->frame[nout]->flags |= AV_FRAME_FLAG_INTERLACED;
if (s->first_field)
s->frame[nout]->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
@ -228,8 +232,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
inpicref->data[i], inpicref->linesize[i],
s->stride[i],
s->planeheight[i]);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
s->frame[nout]->interlaced_frame = inpicref->interlaced_frame;
s->frame[nout]->top_field_first = inpicref->top_field_first;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->frame[nout]->flags |= (inpicref->flags & (AV_FRAME_FLAG_INTERLACED | AV_FRAME_FLAG_TOP_FIELD_FIRST));
nout++;
len -= 2;
@ -256,8 +264,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
}
av_frame_copy_props(frame, inpicref);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = interlaced;
frame->top_field_first = tff;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (interlaced)
frame->flags |= AV_FRAME_FLAG_INTERLACED;
else

View File

@ -391,8 +391,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
return AVERROR(ENOMEM);
av_frame_copy_props(out, cur);
out->height = outlink->h;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 1;
out->top_field_first = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags |= AV_FRAME_FLAG_INTERLACED | AV_FRAME_FLAG_TOP_FIELD_FIRST;
out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, av_make_q(2, 1));
@ -460,8 +464,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
if (!out)
return AVERROR(ENOMEM);
av_frame_copy_props(out, cur);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 1;
out->top_field_first = tff;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags |= AV_FRAME_FLAG_INTERLACED;
if (tff)
out->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
@ -487,7 +495,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
out = av_frame_clone(cur);
if (!out)
return AVERROR(ENOMEM);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags |= AV_FRAME_FLAG_INTERLACED;
if (cur->pts != AV_NOPTS_VALUE)
out->pts = cur->pts*2;
@ -502,8 +514,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
if (!out)
return AVERROR(ENOMEM);
av_frame_copy_props(out, next);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 1;
out->top_field_first = !tff;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags |= AV_FRAME_FLAG_INTERLACED;
if (tff)
out->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;

View File

@ -486,7 +486,11 @@ static int filter(AVFilterContext *ctx, int is_second)
if (!out)
return AVERROR(ENOMEM);
av_frame_copy_props(out, s->cur);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags &= ~AV_FRAME_FLAG_INTERLACED;
if (!is_second) {

View File

@ -148,8 +148,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)));
out->pts = s->double_weave ? s->prev->pts : in->pts / 2;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
out->interlaced_frame = 1;
out->top_field_first = !s->first_field;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
out->flags |= AV_FRAME_FLAG_INTERLACED;
if (s->first_field)
out->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;

View File

@ -398,7 +398,11 @@ static int activate(AVFilterContext *ctx)
return AVERROR(ENOMEM);
frame->key_frame = 1;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->sample_aspect_ratio = (AVRational) {1, 1};

View File

@ -185,7 +185,11 @@ static int activate(AVFilterContext *ctx)
frame->pts = test->pts;
frame->duration = 1;
frame->key_frame = 1;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->flags &= ~AV_FRAME_FLAG_INTERLACED;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->sample_aspect_ratio = test->sar;

View File

@ -43,7 +43,11 @@ static int return_frame(AVFilterContext *ctx, int is_second)
return AVERROR(ENOMEM);
av_frame_copy_props(yadif->out, yadif->cur);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
yadif->out->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
yadif->out->flags &= ~AV_FRAME_FLAG_INTERLACED;
if (yadif->current_field == YADIF_FIELD_BACK_END)
yadif->current_field = YADIF_FIELD_END;
@ -149,7 +153,11 @@ int ff_yadif_filter_frame(AVFilterLink *link, AVFrame *frame)
return AVERROR(ENOMEM);
av_frame_copy_props(yadif->out, yadif->cur);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
yadif->out->interlaced_frame = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
yadif->out->flags &= ~AV_FRAME_FLAG_INTERLACED;
if (yadif->out->pts != AV_NOPTS_VALUE)

View File

@ -275,8 +275,12 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
dst->pts = src->pts;
dst->duration = src->duration;
dst->repeat_pict = src->repeat_pict;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
dst->interlaced_frame = src->interlaced_frame;
dst->top_field_first = src->top_field_first;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
dst->palette_has_changed = src->palette_has_changed;
dst->sample_rate = src->sample_rate;
dst->opaque = src->opaque;

View File

@ -491,15 +491,23 @@ typedef struct AVFrame {
*/
int repeat_pict;
#if FF_API_INTERLACED_FRAME
/**
* The content of the picture is interlaced.
*
* @deprecated Use AV_FRAME_FLAG_INTERLACED instead
*/
attribute_deprecated
int interlaced_frame;
/**
* If the content is interlaced, is top field displayed first.
*
* @deprecated Use AV_FRAME_FLAG_TOP_FIELD_FIRST instead
*/
attribute_deprecated
int top_field_first;
#endif
/**
* Tell user application that palette has changed from previous frame.

View File

@ -115,6 +115,7 @@
#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}