[libav-devel] [RFC/PATCH 02/11] qsvdec: list supported pixel formats

Anton Khirnov anton at khirnov.net
Wed Aug 12 15:07:13 CEST 2015


This is useful for detecting QSV-enabled decoders.
---
This is rather hacky. Can anyone think of a better solution?
---
 libavcodec/qsvdec_h2645.c | 6 ++++++
 libavcodec/qsvdec_mpeg2.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c
index ec34a18..52e22ee 100644
--- a/libavcodec/qsvdec_h2645.c
+++ b/libavcodec/qsvdec_h2645.c
@@ -243,6 +243,9 @@ AVCodec ff_hevc_qsv_decoder = {
     .close          = qsv_decode_close,
     .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_DR1,
     .priv_class     = &hevc_class,
+    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_QSV,
+                                                    AV_PIX_FMT_NONE },
 };
 #endif
 
@@ -278,5 +281,8 @@ AVCodec ff_h264_qsv_decoder = {
     .close          = qsv_decode_close,
     .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
     .priv_class     = &class,
+    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_QSV,
+                                                    AV_PIX_FMT_NONE },
 };
 #endif
diff --git a/libavcodec/qsvdec_mpeg2.c b/libavcodec/qsvdec_mpeg2.c
index 98318bd..3378d02 100644
--- a/libavcodec/qsvdec_mpeg2.c
+++ b/libavcodec/qsvdec_mpeg2.c
@@ -175,4 +175,7 @@ AVCodec ff_mpeg2_qsv_decoder = {
     .close          = qsv_decode_close,
     .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_DR1,
     .priv_class     = &class,
+    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_QSV,
+                                                    AV_PIX_FMT_NONE },
 };
-- 
2.0.0



More information about the libav-devel mailing list