---
 Changelog       |  1 +
 Makefile        |  1 +
 avconv.h        |  2 ++
 avconv_opt.c    |  3 +++
 avconv_qsv.c    | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 doc/avconv.texi |  4 ++++
 6 files changed, 63 insertions(+)
 create mode 100644 avconv_qsv.c

diff --git a/Changelog b/Changelog
index 27770e5..74518a7 100644
--- a/Changelog
+++ b/Changelog
@@ -5,6 +5,7 @@ version <next>:
 - aliases and defaults for Ogg subtypes (opus, spx)
 - HEVC/H.265 RTP payload format (draft v6) packetizer and depacketizer
 - avplay now exits by default at the end of playback
+- libmfx-based QSV hwaccel1.3 and related avconv support
 
 
 version 11:
diff --git a/Makefile b/Makefile
index cc016b3..2707b15 100644
--- a/Makefile
+++ b/Makefile
@@ -76,6 +76,7 @@ OBJS-avconv                   += avconv_opt.o avconv_filter.o
 OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o
 OBJS-avconv-$(HAVE_DXVA2_LIB) += avconv_dxva2.o
 OBJS-avconv-$(CONFIG_VDA)     += avconv_vda.o
+OBJS-avconv-$(CONFIG_QSV)     += avconv_qsv.o
 
 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr base64
 HOSTPROGS  := $(TESTTOOLS:%=tests/%) doc/print_options
diff --git a/avconv.h b/avconv.h
index b932d7e..862f37c 100644
--- a/avconv.h
+++ b/avconv.h
@@ -54,6 +54,7 @@ enum HWAccelID {
     HWACCEL_VDPAU,
     HWACCEL_DXVA2,
     HWACCEL_VDA,
+    HWACCEL_QSV,
 };
 
 typedef struct HWAccel {
@@ -427,5 +428,6 @@ int avconv_parse_options(int argc, char **argv);
 int vdpau_init(AVCodecContext *s);
 int dxva2_init(AVCodecContext *s);
 int vda_init(AVCodecContext *s);
+int qsv_init(AVCodecContext *s);
 
 #endif /* AVCONV_H */
diff --git a/avconv_opt.c b/avconv_opt.c
index 2d06912..e145104 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -63,6 +63,9 @@ const HWAccel hwaccels[] = {
 #if CONFIG_VDA
     { "vda",   vda_init,   HWACCEL_VDA,   AV_PIX_FMT_VDA },
 #endif
+#if CONFIG_QSV
+    { "qsv",   qsv_init,   HWACCEL_QSV,   AV_PIX_FMT_NONE },
+#endif
     { 0 },
 };
 
diff --git a/avconv_qsv.c b/avconv_qsv.c
new file mode 100644
index 0000000..c6bd318
--- /dev/null
+++ b/avconv_qsv.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav 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,
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/qsv.h"
+
+#include "libavutil/imgutils.h"
+
+#include "avconv.h"
+
+static void qsv_uninit(AVCodecContext *s)
+{
+    InputStream *ist = s->opaque;
+
+    ist->hwaccel_uninit        = NULL;
+    ist->hwaccel_retrieve_data = NULL;
+
+    av_qsv_default_free(s);
+    av_freep(&ist->hwaccel_ctx);
+}
+
+int qsv_init(AVCodecContext *s)
+{
+    InputStream *ist = s->opaque;
+    int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : 
AV_LOG_ERROR;
+    int ret;
+
+    ist->hwaccel_uninit = qsv_uninit;
+
+    ret = av_qsv_default_init(s);
+    if (ret < 0) {
+        av_log(NULL, loglevel, "Error creating QSV decoder.\n");
+        qsv_uninit(s);
+    }
+
+    return ret;
+}
diff --git a/doc/avconv.texi b/doc/avconv.texi
index 37733bc..add6371 100644
--- a/doc/avconv.texi
+++ b/doc/avconv.texi
@@ -590,6 +590,10 @@ Use VDPAU (Video Decode and Presentation API for Unix) 
hardware acceleration.
 Use DXVA2 (DirectX Video Acceleration) hardware acceleration.
 @end table
 
+@item qsv
+Use QSV (QuickSync Video) hardware acceleration.
+@end table
+
 This option has no effect if the selected hwaccel is not available or not
 supported by the chosen decoder.
 
-- 
2.1.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to