]> git.sesse.net Git - ffmpeg/blobdiff - fftools/ffmpeg_qsv.c
Merge commit 'c95169f0ec68bdeeabc5fde8aa4076f406242524'
[ffmpeg] / fftools / ffmpeg_qsv.c
similarity index 79%
rename from avtools/avconv_qsv.c
rename to fftools/ffmpeg_qsv.c
index 723c6e0224510fbbaf57704a17819588f98e4c7d..74427500291a5e10e83c109e118683dcf0115ee1 100644 (file)
@@ -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
  */
 
@@ -26,7 +26,9 @@
 #include "libavutil/opt.h"
 #include "libavcodec/qsv.h"
 
-#include "avconv.h"
+#include "ffmpeg.h"
+
+char *qsv_device = NULL;
 
 static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
 {
@@ -44,15 +46,26 @@ static void qsv_uninit(AVCodecContext *s)
 static int qsv_device_init(InputStream *ist)
 {
     int err;
+    AVDictionary *dict = NULL;
+
+    if (qsv_device) {
+        err = av_dict_set(&dict, "child_device", qsv_device, 0);
+        if (err < 0)
+            return err;
+    }
 
     err = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_QSV,
-                                 ist->hwaccel_device, NULL, 0);
+                                 ist->hwaccel_device, dict, 0);
     if (err < 0) {
         av_log(NULL, AV_LOG_ERROR, "Error creating a QSV device\n");
-        return err;
+        goto err_out;
     }
 
-    return 0;
+err_out:
+    if (dict)
+        av_dict_free(&dict);
+
+    return err;
 }
 
 int qsv_init(AVCodecContext *s)
@@ -80,7 +93,7 @@ int qsv_init(AVCodecContext *s)
     frames_ctx->height            = FFALIGN(s->coded_height, 32);
     frames_ctx->format            = AV_PIX_FMT_QSV;
     frames_ctx->sw_format         = s->sw_pix_fmt;
-    frames_ctx->initial_pool_size = 32;
+    frames_ctx->initial_pool_size = 64;
     frames_hwctx->frame_type      = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
 
     ret = av_hwframe_ctx_init(ist->hw_frames_ctx);