]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit 'e05e5920a4e1f1f15cc8a7c843159d519f6ec18e'
authorJames Almer <jamrial@gmail.com>
Tue, 11 Sep 2018 16:41:07 +0000 (13:41 -0300)
committerJames Almer <jamrial@gmail.com>
Tue, 11 Sep 2018 16:41:07 +0000 (13:41 -0300)
* commit 'e05e5920a4e1f1f15cc8a7c843159d519f6ec18e':
  qsv: Error out if getting session handle failed in avfilter

Merged-by: James Almer <jamrial@gmail.com>
1  2 
libavfilter/qsvvpp.c
libavfilter/vf_deinterlace_qsv.c
libavfilter/vf_scale_qsv.c

diff --combined libavfilter/qsvvpp.c
index 2c012956280e277bfd63da3994a04d41333d8b6a,75966b352d5e62c20961c0fe93750c1d857f1c13..7ee1e565b6481d1ad8777950261eb9214eb55438
@@@ -1,18 -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
   */
  
@@@ -296,7 -296,7 +296,7 @@@ static QSVFrame *submit_frame(QSVVPPCon
              av_log(ctx, AV_LOG_ERROR, "QSVVPP gets a wrong frame.\n");
              return NULL;
          }
 -        qsv_frame->frame   = picref;
 +        qsv_frame->frame   = av_frame_clone(picref);
          qsv_frame->surface = (mfxFrameSurface1 *)qsv_frame->frame->data[3];
      } else {
          /* make a copy if the input is not padded as libmfx requires */
              av_frame_copy_props(qsv_frame->frame, picref);
              av_frame_free(&picref);
          } else
 -            qsv_frame->frame = picref;
 +            qsv_frame->frame = av_frame_clone(picref);
  
          if (map_frame_to_surface(qsv_frame->frame,
                                  &qsv_frame->surface_internal) < 0) {
@@@ -503,6 -503,11 +503,11 @@@ static int init_vpp_session(AVFilterCon
          }
      }
  
+     if (ret != MFX_ERR_NONE) {
+         av_log(avctx, AV_LOG_ERROR, "Error getting the session handle\n");
+         return AVERROR_UNKNOWN;
+     }
      /* create a "slave" session with those same properties, to be used for vpp */
      ret = MFXInit(impl, &ver, &s->session);
      if (ret != MFX_ERR_NONE) {
index c9e76c6056a1a8157fc87ba8e48a2749563ebf46,b659d424bef5694ae316f6afd0f954e50bdec430..d6b02e98c5b2889edf162d64794f4cffca38e892
@@@ -1,18 -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,6 -77,7 +77,6 @@@ typedef struct QSVDeintContext 
  
      int64_t last_pts;
  
 -    int got_output_frame;
      int eof;
  
      /* option for Deinterlacing algorithm to be used */
@@@ -115,10 -116,8 +115,10 @@@ static int qsvdeint_query_formats(AVFil
          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;
  }
@@@ -202,6 -201,11 +202,11 @@@ static int init_out_session(AVFilterCon
          }
      }
  
+     if (err != MFX_ERR_NONE) {
+         av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
+         return AVERROR_UNKNOWN;
+     }
      /* create a "slave" session with those same properties, to be used for
       * actual deinterlacing */
      err = MFXInit(impl, &ver, &s->session);
@@@ -540,12 -544,18 +545,12 @@@ static int qsvdeint_filter_frame(AVFilt
  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"},
index d1189942d126c9de1b13f04974693ed82244433d,e9bfff867d891285951e8a0a871af9d3e5bdccb8..7d593b2b211ea50a9cf65c220c9f10bee9c03ed8
@@@ -1,18 -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
   */
  
@@@ -152,10 -152,8 +152,10 @@@ static int qsvscale_query_formats(AVFil
          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;
  }
@@@ -302,6 -300,11 +302,11 @@@ static int init_out_session(AVFilterCon
          }
      }
  
+     if (err != MFX_ERR_NONE) {
+         av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
+         return AVERROR_UNKNOWN;
+     }
      /* create a "slave" session with those same properties, to be used for
       * actual scaling */
      err = MFXInit(impl, &ver, &s->session);
@@@ -584,7 -587,7 +589,7 @@@ fail
  }
  
  #define OFFSET(x) offsetof(QSVScaleContext, x)
 -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
 +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
  static const AVOption options[] = {
      { "w",      "Output video width",  OFFSET(w_expr),     AV_OPT_TYPE_STRING, { .str = "iw"   }, .flags = FLAGS },
      { "h",      "Output video height", OFFSET(h_expr),     AV_OPT_TYPE_STRING, { .str = "ih"   }, .flags = FLAGS },