#include "ffmpeg.h"
+char *qsv_device = NULL;
+
static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
{
InputStream *ist = s->opaque;
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)