Commit 79c173cc authored by Mark Thompson's avatar Mark Thompson

ffmpeg: Remove the hw_device_ctx global

The ad-hoc libmfx setup code is the only place its still used, so move it
into that file.
parent 8abd3b20
...@@ -4759,7 +4759,6 @@ static int transcode(void) ...@@ -4759,7 +4759,6 @@ static int transcode(void)
} }
} }
av_buffer_unref(&hw_device_ctx);
hw_device_free_all(); hw_device_free_all();
/* finished ! */ /* finished ! */
......
...@@ -615,7 +615,6 @@ extern const AVIOInterruptCB int_cb; ...@@ -615,7 +615,6 @@ extern const AVIOInterruptCB int_cb;
extern const OptionDef options[]; extern const OptionDef options[];
extern const HWAccel hwaccels[]; extern const HWAccel hwaccels[];
extern AVBufferRef *hw_device_ctx;
#if CONFIG_QSV #if CONFIG_QSV
extern char *qsv_device; extern char *qsv_device;
#endif #endif
......
...@@ -139,7 +139,6 @@ const HWAccel hwaccels[] = { ...@@ -139,7 +139,6 @@ const HWAccel hwaccels[] = {
#endif #endif
{ 0 }, { 0 },
}; };
AVBufferRef *hw_device_ctx;
HWDevice *filter_hw_device; HWDevice *filter_hw_device;
char *vstats_filename; char *vstats_filename;
...@@ -536,21 +535,15 @@ static int opt_sdp_file(void *optctx, const char *opt, const char *arg) ...@@ -536,21 +535,15 @@ static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
#if CONFIG_VAAPI #if CONFIG_VAAPI
static int opt_vaapi_device(void *optctx, const char *opt, const char *arg) static int opt_vaapi_device(void *optctx, const char *opt, const char *arg)
{ {
HWDevice *dev;
const char *prefix = "vaapi:"; const char *prefix = "vaapi:";
char *tmp; char *tmp;
int err; int err;
tmp = av_asprintf("%s%s", prefix, arg); tmp = av_asprintf("%s%s", prefix, arg);
if (!tmp) if (!tmp)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
err = hw_device_init_from_string(tmp, &dev); err = hw_device_init_from_string(tmp, NULL);
av_free(tmp); av_free(tmp);
if (err < 0) return err;
return err;
hw_device_ctx = av_buffer_ref(dev->device_ref);
if (!hw_device_ctx)
return AVERROR(ENOMEM);
return 0;
} }
#endif #endif
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "ffmpeg.h" #include "ffmpeg.h"
static AVBufferRef *hw_device_ctx;
char *qsv_device = NULL; char *qsv_device = NULL;
static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment