[FFmpeg-cvslog] avcodec/videotoolbox: allow not setting the kCVPixelBufferPixelFormatTypeKey

wm4 git at videolan.org
Thu Mar 2 11:32:38 EET 2017


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Fri Feb 24 10:17:34 2017 +0100| [ade7c1a2326e2bb9be5e60a48b9968eb1d16bfaf] | committer: wm4

avcodec/videotoolbox: allow not setting the kCVPixelBufferPixelFormatTypeKey

If AVVideotoolboxContext.cv_pix_fmt_type is set to 0, don't set the
kCVPixelBufferPixelFormatTypeKey value on the VT decoder.

This makes VT output its native format, which can be much faster on
some hardware iterations (if the native format does not match with
the requested format, it will be converted, which is slow).

The default is still forcing nv12.

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

 doc/APIchanges            | 4 ++++
 libavcodec/version.h      | 2 +-
 libavcodec/videotoolbox.c | 3 ++-
 libavcodec/videotoolbox.h | 3 ++-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cd5f926..6922ea5 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2017-03-02 - xxxxxxx - lavc 57.81.104 - videotoolbox.h
+  AVVideotoolboxContext.cv_pix_fmt_type can now be set to 0 to output the
+  native decoder format. (The default value is not changed.)
+
 2017-03-02 - xxxxxxx - lavu 55.47.101, lavc 57.81.102, lavf 57.66.103
   Remove requirement to use AVOption or accessors to access certain fields
   in AVFrame, AVCodecContext, and AVFormatContext that were previously
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 3b4c253..5d8b22c 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  81
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 1288aa5..2ebe60f 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -472,7 +472,8 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
                                                       &kCFTypeDictionaryKeyCallBacks,
                                                       &kCFTypeDictionaryValueCallBacks);
 
-    CFDictionarySetValue(buffer_attributes, kCVPixelBufferPixelFormatTypeKey, cv_pix_fmt);
+    if (pix_fmt)
+        CFDictionarySetValue(buffer_attributes, kCVPixelBufferPixelFormatTypeKey, cv_pix_fmt);
     CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfacePropertiesKey, io_surface_properties);
     CFDictionarySetValue(buffer_attributes, kCVPixelBufferWidthKey, w);
     CFDictionarySetValue(buffer_attributes, kCVPixelBufferHeightKey, h);
diff --git a/libavcodec/videotoolbox.h b/libavcodec/videotoolbox.h
index a48638e..af2db0d 100644
--- a/libavcodec/videotoolbox.h
+++ b/libavcodec/videotoolbox.h
@@ -58,7 +58,8 @@ typedef struct AVVideotoolboxContext {
 
     /**
      * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
-     * set by the caller.
+     * set by the caller. If this is set to 0, then no specific format is
+     * requested from the decoder, and its native format is output.
      */
     OSType cv_pix_fmt_type;
 



More information about the ffmpeg-cvslog mailing list