X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_deinterlace_qsv.c;h=80217c84199155530452ae01492bdea34586a934;hb=c5cdec9731b864d4e4bda59a7ad9246967ef99da;hp=b659d424bef5694ae316f6afd0f954e50bdec430;hpb=e05e5920a4e1f1f15cc8a7c843159d519f6ec18e;p=ffmpeg diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index b659d424bef..80217c84199 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -1,18 +1,18 @@ /* - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -77,14 +77,13 @@ typedef struct QSVDeintContext { int64_t last_pts; - int got_output_frame; int eof; /* option for Deinterlacing algorithm to be used */ int mode; } QSVDeintContext; -static void qsvdeint_uninit(AVFilterContext *ctx) +static av_cold void qsvdeint_uninit(AVFilterContext *ctx) { QSVDeintContext *s = ctx->priv; QSVFrame *cur; @@ -116,8 +115,10 @@ static int qsvdeint_query_formats(AVFilterContext *ctx) AV_PIX_FMT_QSV, AV_PIX_FMT_NONE, }; AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); + int ret; - ff_set_common_formats(ctx, pix_fmts); + if ((ret = ff_set_common_formats(ctx, pix_fmts)) < 0) + return ret; return 0; } @@ -418,9 +419,11 @@ static int submit_frame(AVFilterContext *ctx, AVFrame *frame, qf->surface.Info.PicStruct = !qf->frame->interlaced_frame ? MFX_PICSTRUCT_PROGRESSIVE : (qf->frame->top_field_first ? MFX_PICSTRUCT_FIELD_TFF : MFX_PICSTRUCT_FIELD_BFF); - if (qf->frame->repeat_pict == 1) + if (qf->frame->repeat_pict == 1) { qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED; - else if (qf->frame->repeat_pict == 2) + qf->surface.Info.PicStruct |= qf->frame->top_field_first ? MFX_PICSTRUCT_FIELD_TFF : + MFX_PICSTRUCT_FIELD_BFF; + } else if (qf->frame->repeat_pict == 2) qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING; else if (qf->frame->repeat_pict == 4) qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING; @@ -544,18 +547,12 @@ static int qsvdeint_filter_frame(AVFilterLink *link, AVFrame *in) static int qsvdeint_request_frame(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; - QSVDeintContext *s = ctx->priv; - int ret = 0; - s->got_output_frame = 0; - while (ret >= 0 && !s->got_output_frame) - ret = ff_request_frame(ctx->inputs[0]); - - return ret; + return ff_request_frame(ctx->inputs[0]); } #define OFFSET(x) offsetof(QSVDeintContext, x) -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM static const AVOption options[] = { { "mode", "set deinterlace mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"}, { "bob", "bob algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_BOB}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},