applemedia: vtdec: remove the internal GstGLColorConvert
authorAlessandro Decina <alessandro.d@gmail.com>
Mon, 14 Dec 2015 05:10:01 +0000 (16:10 +1100)
committerAlessandro Decina <alessandro.d@gmail.com>
Wed, 16 Dec 2015 06:03:03 +0000 (17:03 +1100)
It was added back in the day to make texture sharing work by default with
glimagesink inside playbin. These days glimagesink accepts (and converts) YUV
internally so it's no longer needed.

sys/applemedia/videotexturecache.h
sys/applemedia/videotexturecache.m
sys/applemedia/vtdec.c

index b9103a6..0b43566 100644 (file)
@@ -40,7 +40,6 @@ typedef struct _GstVideoTextureCache
   gboolean configured;
   GstCaps *in_caps;
   GstCaps *out_caps;
-  GstGLColorConvert *convert;
 } GstVideoTextureCache;
 
 GstVideoTextureCache *gst_video_texture_cache_new (GstGLContext * ctx);
index 68cb697..3a5cf31 100644 (file)
@@ -48,8 +48,6 @@ gst_video_texture_cache_new (GstGLContext * ctx)
 
   cache->ctx = gst_object_ref (ctx);
   gst_video_info_init (&cache->input_info);
-  cache->convert = gst_gl_color_convert_new (cache->ctx);
-  cache->configured = FALSE;
 
 #if HAVE_IOS
   CFMutableDictionaryRef cache_attrs =
@@ -82,7 +80,6 @@ gst_video_texture_cache_free (GstVideoTextureCache * cache)
   gst_object_unref (cache->pool);
 #endif
 #endif
-  gst_object_unref (cache->convert);
   gst_object_unref (cache->ctx);
   if (cache->in_caps)
     gst_caps_unref (cache->in_caps);
@@ -112,7 +109,6 @@ gst_video_texture_cache_set_format (GstVideoTextureCache * cache,
   gst_caps_features_add (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
   gst_video_info_from_caps (&cache->input_info, in_caps);
 
-  cache->configured = FALSE;
   if (cache->in_caps)
     gst_caps_unref (cache->in_caps);
   if (cache->out_caps)
@@ -271,34 +267,11 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
     return;
   }
 
-  if (!cache->configured) {
-    cache->in_caps = gst_caps_make_writable (cache->in_caps);
-#if HAVE_IOS
-    gst_caps_set_simple (cache->in_caps, "texture-target", G_TYPE_STRING, GST_GL_TEXTURE_TARGET_2D_STR, NULL);
-#else
-    gst_caps_set_simple (cache->in_caps, "texture-target", G_TYPE_STRING, GST_GL_TEXTURE_TARGET_RECTANGLE_STR, NULL);
-#endif
-    gst_caps_set_simple (cache->out_caps, "texture-target", G_TYPE_STRING, "2D", NULL);
-
-    if (!gst_gl_color_convert_set_caps (cache->convert, cache->in_caps, cache->out_caps)) {
-      if (mem1)
-        gst_memory_unref (mem1);
-      if (mem2)
-        gst_memory_unref (mem2);
-      gst_buffer_unref (buffer);
-
-      return;
-    }
-
-    cache->configured = TRUE;
-  }
-
   gst_buffer_append_memory (buffer, mem1);
   if (mem2)
     gst_buffer_append_memory (buffer, mem2);
 
-  data->output_buffer = gst_gl_color_convert_perform (cache->convert, buffer);
-  gst_buffer_unref (buffer);
+  data->output_buffer = buffer;
 }
 
 GstBuffer *
index bba3b28..0e08367 100644 (file)
@@ -108,17 +108,11 @@ const CFStringRef
 CFSTR ("RequireHardwareAcceleratedVideoDecoder");
 #endif
 
-#define GST_VTDEC_VIDEO_FORMAT_STR "NV12"
-
 #define VIDEO_SRC_CAPS \
-    "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "              \
-    "format = (string) RGBA, "                                          \
-    "width = " GST_VIDEO_SIZE_RANGE ", "                                \
-    "height = " GST_VIDEO_SIZE_RANGE ", "                               \
-    "framerate = " GST_VIDEO_FPS_RANGE ", "                             \
-    "texture-target = (string) 2D "                                     \
-    " ; "                                                               \
-    GST_VIDEO_CAPS_MAKE(GST_VTDEC_VIDEO_FORMAT_STR) ";"
+    GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_MEMORY_GL_MEMORY,\
+        "NV12") ", "                                                    \
+    "texture-target = (string) rectangle;"                              \
+    GST_VIDEO_CAPS_MAKE("NV12") ";"
 
 G_DEFINE_TYPE (GstVtdec, gst_vtdec, GST_TYPE_VIDEO_DECODER);
 
@@ -290,6 +284,10 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder)
     output_textures =
         gst_caps_features_contains (features,
         GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+    if (output_textures)
+      gst_caps_set_simple (output_state->caps,
+          "texture-target", G_TYPE_STRING, GST_GL_TEXTURE_TARGET_RECTANGLE_STR,
+          NULL);
   }
   gst_caps_unref (caps);