[FFmpeg-cvslog] Merge commit '536bb17e9659c5ed7576a218d4085cdd6d5742fa'

Hendrik Leppkes git at videolan.org
Mon Nov 14 16:20:22 EET 2016


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Mon Nov 14 15:19:43 2016 +0100| [1bc6cdf2fcbd3caea7b78d0a617c6e338606d756] | committer: Hendrik Leppkes

Merge commit '536bb17e9659c5ed7576a218d4085cdd6d5742fa'

* commit '536bb17e9659c5ed7576a218d4085cdd6d5742fa':
  qsvdec: make ff_qsv_map_pixfmt() return a MFX fourcc as well

Merged-by: Hendrik Leppkes <h.leppkes at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1bc6cdf2fcbd3caea7b78d0a617c6e338606d756
---

 libavcodec/qsv.c          | 12 ++++++++++++
 libavcodec/qsv_internal.h |  2 ++
 libavcodec/qsvdec.c       | 15 ++-------------
 libavcodec/qsvdec.h       |  3 +--
 4 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index efd7cea..041daa5 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -105,6 +105,18 @@ int ff_qsv_error(int mfx_err)
     }
 }
 
+int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc)
+{
+    switch (format) {
+    case AV_PIX_FMT_YUV420P:
+    case AV_PIX_FMT_YUVJ420P:
+        *fourcc = MFX_FOURCC_NV12;
+        return AV_PIX_FMT_NV12;
+    default:
+        return AVERROR(ENOSYS);
+    }
+}
+
 static int qsv_load_plugins(mfxSession session, const char *load_plugins,
                             void *logctx)
 {
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 82e1029..5d2a216 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -65,6 +65,8 @@ int ff_qsv_error(int mfx_err);
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile);
 
+int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
+
 int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session,
                                  const char *load_plugins);
 
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 51da8f8..9d3a6da 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -40,17 +40,6 @@
 #include "qsv_internal.h"
 #include "qsvdec.h"
 
-int ff_qsv_map_pixfmt(enum AVPixelFormat format)
-{
-    switch (format) {
-    case AV_PIX_FMT_YUV420P:
-    case AV_PIX_FMT_YUVJ420P:
-        return AV_PIX_FMT_NV12;
-    default:
-        return AVERROR(ENOSYS);
-    }
-}
-
 static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session,
                             AVBufferRef *hw_frames_ref)
 {
@@ -150,7 +139,7 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
     param.mfx.FrameInfo.BitDepthLuma   = 8;
     param.mfx.FrameInfo.BitDepthChroma = 8;
     param.mfx.FrameInfo.Shift          = 0;
-    param.mfx.FrameInfo.FourCC         = MFX_FOURCC_NV12;
+    param.mfx.FrameInfo.FourCC         = q->fourcc;
     param.mfx.FrameInfo.Width          = avctx->coded_width;
     param.mfx.FrameInfo.Height         = avctx->coded_height;
     param.mfx.FrameInfo.ChromaFormat   = MFX_CHROMAFORMAT_YUV420;
@@ -474,7 +463,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
                                            AV_PIX_FMT_NONE };
         enum AVPixelFormat qsv_format;
 
-        qsv_format = ff_qsv_map_pixfmt(q->parser->format);
+        qsv_format = ff_qsv_map_pixfmt(q->parser->format, &q->fourcc);
         if (qsv_format < 0) {
             av_log(avctx, AV_LOG_ERROR,
                    "Only 8-bit YUV420 streams are supported.\n");
diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h
index 0bf1e55..01f4cf9 100644
--- a/libavcodec/qsvdec.h
+++ b/libavcodec/qsvdec.h
@@ -56,6 +56,7 @@ typedef struct QSVContext {
     AVCodecParserContext *parser;
     AVCodecContext *avctx_internal;
     enum AVPixelFormat orig_pix_fmt;
+    uint32_t fourcc;
 
     // options set by the caller
     int async_depth;
@@ -67,8 +68,6 @@ typedef struct QSVContext {
     int         nb_ext_buffers;
 } QSVContext;
 
-int ff_qsv_map_pixfmt(enum AVPixelFormat format);
-
 int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
                         AVFrame *frame, int *got_frame, AVPacket *pkt);
 


======================================================================

diff --cc libavcodec/qsv_internal.h
index 82e1029,e865741..5d2a216
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@@ -63,8 -60,9 +63,10 @@@ typedef struct QSVFramesContext 
  int ff_qsv_error(int mfx_err);
  
  int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 +int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile);
  
+ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
+ 
  int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session,
                                   const char *load_plugins);
  



More information about the ffmpeg-cvslog mailing list