[vlc-commits] ci_filters: use CoreImage converter for source

Thomas Guillem git at videolan.org
Thu Sep 28 13:51:42 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 28 11:11:18 2017 +0200| [50b2d6ad85046763ba3123a11a4c5d2388117950] | committer: Thomas Guillem

ci_filters: use CoreImage converter for source

CoreImage can accept YUV2 as input (it'll do a conversion internally), but it
can't output this same chroma (so the dst_cnverter is still needed).

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

 modules/video_filter/ci_filters.m | 40 ++-------------------------------------
 1 file changed, 2 insertions(+), 38 deletions(-)

diff --git a/modules/video_filter/ci_filters.m b/modules/video_filter/ci_filters.m
index 1b7f709d1d..1d40cee093 100644
--- a/modules/video_filter/ci_filters.m
+++ b/modules/video_filter/ci_filters.m
@@ -72,7 +72,6 @@ struct  ci_filters_ctx
     CIContext *                 ci_ctx;
     CGColorSpaceRef             color_space;
     struct filter_chain *       fchain;
-    filter_t *                  src_converter;
     filter_t *                  dst_converter;
 };
 
@@ -291,13 +290,6 @@ Filter(filter_t *filter, picture_t *src)
     if (ctx->fchain->filter != filter_types[0])
         return src;
 
-    if (ctx->src_converter)
-    {
-        src = ctx->src_converter->pf_video_filter(ctx->src_converter, src);
-        if (!src)
-            return NULL;
-    }
-
     picture_t *dst = picture_NewFromFormat(&ctx->cvpx_pool_fmt);
     if (!dst)
         goto error;
@@ -448,39 +440,17 @@ Close_RemoveConverters(filter_t *filter, struct ci_filters_ctx *ctx)
         vlc_object_release(ctx->dst_converter);
         CVPixelBufferPoolRelease(ctx->outconv_cvpx_pool);
     }
-    if (ctx->src_converter)
-    {
-        module_unneed(ctx->src_converter, ctx->src_converter->p_module);
-        vlc_object_release(ctx->src_converter);
-    }
 }
 
 static int
-Open_AddConverters(filter_t *filter, struct ci_filters_ctx *ctx)
+Open_AddConverter(filter_t *filter, struct ci_filters_ctx *ctx)
 {
-    ctx->src_converter = vlc_object_create(filter, sizeof(filter_t));
-    if (!ctx->src_converter)
-        goto error;
-
-    ctx->src_converter->fmt_in = filter->fmt_in;
-    ctx->src_converter->fmt_out = filter->fmt_in;
-    ctx->src_converter->fmt_out.i_codec = VLC_CODEC_CVPX_NV12;
-    ctx->src_converter->fmt_out.video.i_chroma = VLC_CODEC_CVPX_NV12;
-
     video_format_Copy(&ctx->cvpx_pool_fmt, &filter->fmt_in.video);
     ctx->cvpx_pool_fmt.i_chroma = VLC_CODEC_CVPX_NV12;
     ctx->cvpx_pool = cvpxpool_create(&ctx->cvpx_pool_fmt, 3);
     if (!ctx->cvpx_pool)
         goto error;
 
-    ctx->src_converter->owner.sys = ctx->cvpx_pool;
-    ctx->src_converter->owner.video.buffer_new = CVPX_buffer_new;
-
-    ctx->src_converter->p_module =
-        module_need(ctx->src_converter, "video converter", NULL, false);
-    if (!ctx->src_converter->p_module)
-        goto error;
-
     ctx->dst_converter = vlc_object_create(filter, sizeof(filter_t));
     if (!ctx->dst_converter)
         goto error;
@@ -514,12 +484,6 @@ error:
         if (ctx->outconv_cvpx_pool)
             CVPixelBufferPoolRelease(ctx->outconv_cvpx_pool);
     }
-    if (ctx->src_converter)
-    {
-        if (ctx->src_converter->p_module)
-            module_unneed(ctx->src_converter, ctx->src_converter->p_module);
-        vlc_object_release(ctx->src_converter);
-    }
     return VLC_EGENERIC;
 }
 
@@ -570,7 +534,7 @@ Open(vlc_object_t *obj, char const *psz_filter)
 
         if (filter->fmt_in.video.i_chroma != VLC_CODEC_CVPX_NV12
          && filter->fmt_in.video.i_chroma != VLC_CODEC_CVPX_BGRA
-         && Open_AddConverters(filter, ctx))
+         && Open_AddConverter(filter, ctx))
             goto error;
 
 #pragma clang diagnostic push



More information about the vlc-commits mailing list