]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/qsvvpp.c
avformat/mpegts: make sure mpegts_read_header always stops at the first pmt
[ffmpeg] / libavfilter / qsvvpp.c
index 2c012956280e277bfd63da3994a04d41333d8b6a..8d5ff2eb653c398361efe567394caf0f363041e6 100644 (file)
@@ -142,7 +142,7 @@ static int pix_fmt_to_mfx_fourcc(int format)
         return MFX_FOURCC_NV12;
     case AV_PIX_FMT_YUYV422:
         return MFX_FOURCC_YUY2;
-    case AV_PIX_FMT_RGB32:
+    case AV_PIX_FMT_BGRA:
         return MFX_FOURCC_RGB4;
     }
 
@@ -153,6 +153,7 @@ static int map_frame_to_surface(AVFrame *frame, mfxFrameSurface1 *surface)
 {
     switch (frame->format) {
     case AV_PIX_FMT_NV12:
+    case AV_PIX_FMT_P010:
         surface->Data.Y  = frame->data[0];
         surface->Data.UV = frame->data[1];
         break;
@@ -316,7 +317,6 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p
             }
 
             av_frame_copy_props(qsv_frame->frame, picref);
-            av_frame_free(&picref);
         } else
             qsv_frame->frame = av_frame_clone(picref);
 
@@ -461,6 +461,8 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
         out_frames_ctx->height            = FFALIGN(outlink->h, 32);
         out_frames_ctx->sw_format         = s->out_sw_format;
         out_frames_ctx->initial_pool_size = 64;
+        if (avctx->extra_hw_frames > 0)
+            out_frames_ctx->initial_pool_size += avctx->extra_hw_frames;
         out_frames_hwctx->frame_type      = s->out_mem_mode;
 
         ret = av_hwframe_ctx_init(out_frames_ref);
@@ -503,6 +505,11 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
         }
     }
 
+    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) {