Commit 9367f189 authored by Thomas Guillem's avatar 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.
parent 5d42a862
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment