diff mbox

[FFmpeg-devel] lavc/videotoolbox: set kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey

Message ID 20170224094939.12523-1-nfxjfg@googlemail.com
State Accepted
Commit f07492e7fb6601948649ea09a25a493b3da0b75b
Headers show

Commit Message

wm4 Feb. 24, 2017, 9:49 a.m. UTC
Makes sure the output can be mapped as OpenGL texture.
This is what at least video players normally want.
---
 libavcodec/videotoolbox.c | 1 +
 1 file changed, 1 insertion(+)

Comments

wm4 March 2, 2017, 9:34 a.m. UTC | #1
On Fri, 24 Feb 2017 10:49:39 +0100
wm4 <nfxjfg@googlemail.com> wrote:

> Makes sure the output can be mapped as OpenGL texture.
> This is what at least video players normally want.
> ---
>  libavcodec/videotoolbox.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index 2ebe60fb5c..824f2d8e68 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -477,6 +477,7 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
>      CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfacePropertiesKey, io_surface_properties);
>      CFDictionarySetValue(buffer_attributes, kCVPixelBufferWidthKey, w);
>      CFDictionarySetValue(buffer_attributes, kCVPixelBufferHeightKey, h);
> +    CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue);
>  
>      CFRelease(io_surface_properties);
>      CFRelease(cv_pix_fmt);

Applied.
Wang Bin March 3, 2017, 2:37 a.m. UTC | #2
It's macOS only. For iOS, we can use kCVPixelBufferOpenGLESCompatibilityKey
wm4 March 3, 2017, 5:32 a.m. UTC | #3
On Fri, 3 Mar 2017 10:37:08 +0800
Wang Bin <wbsecg1@gmail.com> wrote:

> It's macOS only. For iOS, we can use kCVPixelBufferOpenGLESCompatibilityKey

So what happens on iOS with the current code? If it doesn't work, could
you add support for using the iOS-specific constant on iOS? (From what
I know, GLES is exclusive to iOS, while real GL is exclusive to OSX, so
maybe not a huge problem.)
Wang Bin March 3, 2017, 8:53 a.m. UTC | #4
>
> So what happens on iOS with the current code?


Compile error. VLC uses kCVPixelBufferOpenGLESCompatibilityKey for iOS and
kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey for OSX. Should I send
a patch?
wm4 March 3, 2017, 8:57 a.m. UTC | #5
On Fri, 3 Mar 2017 16:53:37 +0800
Wang Bin <wbsecg1@gmail.com> wrote:

> >
> > So what happens on iOS with the current code?  
> 
> 
> Compile error. VLC uses kCVPixelBufferOpenGLESCompatibilityKey for iOS and
> kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey for OSX. Should I send
> a patch?

That would be great.
diff mbox

Patch

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 2ebe60fb5c..824f2d8e68 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -477,6 +477,7 @@  static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
     CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfacePropertiesKey, io_surface_properties);
     CFDictionarySetValue(buffer_attributes, kCVPixelBufferWidthKey, w);
     CFDictionarySetValue(buffer_attributes, kCVPixelBufferHeightKey, h);
+    CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue);
 
     CFRelease(io_surface_properties);
     CFRelease(cv_pix_fmt);