]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/videotoolbox: allow not setting the kCVPixelBufferPixelFormatTypeKey
authorwm4 <nfxjfg@googlemail.com>
Fri, 24 Feb 2017 09:17:34 +0000 (10:17 +0100)
committerwm4 <nfxjfg@googlemail.com>
Thu, 2 Mar 2017 09:32:21 +0000 (10:32 +0100)
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.

doc/APIchanges
libavcodec/version.h
libavcodec/videotoolbox.c
libavcodec/videotoolbox.h

index cd5f926b15bc7dfc11828f80f052aa552581a98d..6922ea5268f658b8b43bab33b273e059d3c8f923 100644 (file)
@@ -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
index 3b4c2531466a2cf3b0dee3199279b37e45f7fe10..5d8b22cb29a964ec23f9af0b2946f36d0d23cd68 100644 (file)
@@ -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, \
index 1288aa5087386bf2213f497142b0deb486e6c83f..2ebe60fb5c0d0d4c09a0dee78c8070ec74fdeec1 100644 (file)
@@ -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);
index a48638e2b224fce5c220b87e774bf5aa02629cab..af2db0d580932f1e2c04606e2f1a856468bafbf8 100644 (file)
@@ -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;