]> git.sesse.net Git - ffmpeg/commitdiff
ffmpeg: Remove the hw_device_ctx global
authorMark Thompson <sw@jkqxz.net>
Mon, 13 Apr 2020 15:33:21 +0000 (16:33 +0100)
committerMark Thompson <sw@jkqxz.net>
Sun, 26 Apr 2020 17:38:25 +0000 (18:38 +0100)
The ad-hoc libmfx setup code is the only place its still used, so move it
into that file.

fftools/ffmpeg.c
fftools/ffmpeg.h
fftools/ffmpeg_opt.c
fftools/ffmpeg_qsv.c

index 2287af59f0d9d9ffc4a8dcb71ea46abef13a801a..cf64837b8a07cd329d8606c76353e95255f074ec 100644 (file)
@@ -4759,7 +4759,6 @@ static int transcode(void)
         }
     }
 
-    av_buffer_unref(&hw_device_ctx);
     hw_device_free_all();
 
     /* finished ! */
index 43b5040f73853f595a3b31b181355a8c635d426c..98700f24e5d377a11ef1f31be5eefd0b439eeb9f 100644 (file)
@@ -615,7 +615,6 @@ extern const AVIOInterruptCB int_cb;
 
 extern const OptionDef options[];
 extern const HWAccel hwaccels[];
-extern AVBufferRef *hw_device_ctx;
 #if CONFIG_QSV
 extern char *qsv_device;
 #endif
index 680f0f1dfb73e55779bafed6a55a3f18a6be1edf..16e321b5a3c5a70ed6c45178c000197695d54c3b 100644 (file)
@@ -139,7 +139,6 @@ const HWAccel hwaccels[] = {
 #endif
     { 0 },
 };
-AVBufferRef *hw_device_ctx;
 HWDevice *filter_hw_device;
 
 char *vstats_filename;
@@ -536,21 +535,15 @@ static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
 #if CONFIG_VAAPI
 static int opt_vaapi_device(void *optctx, const char *opt, const char *arg)
 {
-    HWDevice *dev;
     const char *prefix = "vaapi:";
     char *tmp;
     int err;
     tmp = av_asprintf("%s%s", prefix, arg);
     if (!tmp)
         return AVERROR(ENOMEM);
-    err = hw_device_init_from_string(tmp, &dev);
+    err = hw_device_init_from_string(tmp, NULL);
     av_free(tmp);
-    if (err < 0)
-        return err;
-    hw_device_ctx = av_buffer_ref(dev->device_ref);
-    if (!hw_device_ctx)
-        return AVERROR(ENOMEM);
-    return 0;
+    return err;
 }
 #endif
 
index 9c4285b6c72553cd22afb319f9141fa715731dc4..960c88b69d5e09211e568259fd1df65337e1e115 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "ffmpeg.h"
 
+static AVBufferRef *hw_device_ctx;
 char *qsv_device = NULL;
 
 static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)