[vlc-commits] ci_filters: change color_space handling

Thomas Guillem git at videolan.org
Wed Sep 27 11:38:12 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Sep 27 10:48:54 2017 +0200| [9367f189bcb804c7996cfb22881d787a16cb19b4] | committer: Thomas Guillem

ci_filters: change color_space handling

Use the [CIContext render:toCVPixelBuffer:] method (since macos 10.11, iphone
5.0) that handle automatically the color space.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9367f189bcb804c7996cfb22881d787a16cb19b4
---

 modules/video_filter/Makefile.am  |  1 +
 modules/video_filter/ci_filters.m | 30 +++---------------------------
 2 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/modules/video_filter/Makefile.am b/modules/video_filter/Makefile.am
index a47c235363..e80a92acf6 100644
--- a/modules/video_filter/Makefile.am
+++ b/modules/video_filter/Makefile.am
@@ -110,6 +110,7 @@ video_filter_LTLIBRARIES = \
 # macOS / iOS hardware video filters
 libci_filters_plugin_la_SOURCES = video_filter/ci_filters.m codec/vt_utils.c codec/vt_utils.h
 if HAVE_OSX
+libci_filters_plugin_la_OBJCFLAGS = $(AM_CFLAGS) -mmacosx-version-min=10.11
 libci_filters_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(video_filterdir)' \
 	-Wl,-framework,Foundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreImage -Wl,-framework,CoreVideo
 video_filter_LTLIBRARIES += libci_filters_plugin.la
diff --git a/modules/video_filter/ci_filters.m b/modules/video_filter/ci_filters.m
index 4ab6b200f6..2e8dbac083 100644
--- a/modules/video_filter/ci_filters.m
+++ b/modules/video_filter/ci_filters.m
@@ -338,14 +338,7 @@ Filter(filter_t *filter, picture_t *src)
             ci_img = [fchain->ci_filter valueForKey: kCIOutputImageKey];
         }
 
-        [ctx->ci_ctx render: ci_img
-#if !TARGET_OS_IPHONE
-                toIOSurface: CVPixelBufferGetIOSurface(cvpx)
-#else
-            toCVPixelBuffer: cvpx
-#endif
-                     bounds: [ci_img extent]
-                 colorSpace: ctx->color_space];
+        [ctx->ci_ctx render: ci_img toCVPixelBuffer: cvpx];
     } /* autoreleasepool */
 
     CopyInfoAndRelease(dst, src);
@@ -523,12 +516,6 @@ error:
     return VLC_EGENERIC;
 }
 
-#if MAC_OS_X_VERSION_MIN_ALLOWED <= MAC_OS_X_VERSION_10_11
-const CFStringRef kCGColorSpaceITUR_709 = CFSTR("kCGColorSpaceITUR_709");
-#endif
-
-#define OSX_EL_CAPITAN_AND_HIGHER (NSFoundationVersionNumber >= 1252)
-
 static int
 Open(vlc_object_t *obj, char const *psz_filter)
 {
@@ -560,21 +547,10 @@ Open(vlc_object_t *obj, char const *psz_filter)
             goto error;
 
         if (filter->fmt_in.video.i_chroma != VLC_CODEC_CVPX_NV12
-         && filter->fmt_in.video.i_chroma != VLC_CODEC_CVPX_BGRA)
-        {
-            if (!OSX_EL_CAPITAN_AND_HIGHER)
+         && filter->fmt_in.video.i_chroma != VLC_CODEC_CVPX_BGRA
+         && Open_AddConverters(filter, ctx))
                 goto error;
 
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
-            ctx->color_space =
-                CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
-#pragma clang diagnostic pop
-
-            if (Open_AddConverters(filter, ctx))
-                goto error;
-        }
-
 #if !TARGET_OS_IPHONE
         CGLContextObj glctx = var_InheritAddress(filter, "macosx-glcontext");
         if (!glctx)



More information about the vlc-commits mailing list