[FFmpeg-cvslog] ffmpeg: Remove the hw_device_ctx global
Mark Thompson
git at videolan.org
Sun Apr 26 20:59:50 EEST 2020
ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Mon Apr 13 16:33:21 2020 +0100| [79c173cc1900c735b1e256f5755b3e434a080a4f] | committer: 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.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79c173cc1900c735b1e256f5755b3e434a080a4f
---
fftools/ffmpeg.c | 1 -
fftools/ffmpeg.h | 1 -
fftools/ffmpeg_opt.c | 11 ++---------
fftools/ffmpeg_qsv.c | 1 +
4 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2287af59f0..cf64837b8a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -4759,7 +4759,6 @@ static int transcode(void)
}
}
- av_buffer_unref(&hw_device_ctx);
hw_device_free_all();
/* finished ! */
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 43b5040f73..98700f24e5 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -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
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 680f0f1dfb..16e321b5a3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -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
diff --git a/fftools/ffmpeg_qsv.c b/fftools/ffmpeg_qsv.c
index 9c4285b6c7..960c88b69d 100644
--- a/fftools/ffmpeg_qsv.c
+++ b/fftools/ffmpeg_qsv.c
@@ -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)
More information about the ffmpeg-cvslog
mailing list