applemedia: Do weak linking with the VideoToolbox framework
authorSebastian Dröge <sebastian@centricular.com>
Wed, 17 Sep 2014 07:38:20 +0000 (10:38 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 17 Sep 2014 07:38:20 +0000 (10:38 +0300)
It does not exist on older OSX and iOS but we still want to
be able to use it when it's available.

sys/applemedia/Makefile.am
sys/applemedia/plugin.m

index 36f3b9e..7467442 100644 (file)
@@ -96,5 +96,5 @@ libgstapplemedia_la_SOURCES +=                        \
        vtenc.c                                 \
        vtdec.c
 
-libgstapplemedia_la_LDFLAGS += -Wl,-framework -Wl,VideoToolbox
+libgstapplemedia_la_LDFLAGS += -Wl,-weak_framework -Wl,VideoToolbox
 endif
index e85f67a..b9d82b3 100644 (file)
@@ -90,8 +90,11 @@ plugin_init (GstPlugin * plugin)
   res &= gst_element_register (plugin, "atdec", GST_RANK_MARGINAL, GST_TYPE_ATDEC);
 
 #ifdef HAVE_VIDEOTOOLBOX
-  res &= gst_element_register (plugin, "vtdec", GST_RANK_PRIMARY, GST_TYPE_VTDEC);
-  gst_vtenc_register_elements (plugin);
+  /* Check if the framework actually exists at runtime */
+  if (VTCompressionSessionCreate != NULL) {
+    res &= gst_element_register (plugin, "vtdec", GST_RANK_PRIMARY, GST_TYPE_VTDEC);
+    gst_vtenc_register_elements (plugin);
+  }
 #endif
 
   return res;