From 0258ec0273a253c9fb94a16856228b9cb1f67761 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Wed, 2 Jul 2014 12:54:45 +0200 Subject: [PATCH] applemedia: enable vtdec and vtenc only on >= 10.8 where VideoToolbox is public Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=723670 --- configure.ac | 6 ++++++ sys/applemedia/Makefile.am | 16 +++++++++------- sys/applemedia/plugin.m | 11 ++++++++--- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 614cecde82..a2651bb8ae 100644 --- a/configure.ac +++ b/configure.ac @@ -501,6 +501,7 @@ fi AC_CHECK_HEADER(AVFoundation/AVFoundation.h, HAVE_AVFOUNDATION="yes", HAVE_AVFOUNDATION="no", [-]) AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-]) +AC_CHECK_HEADER(VideoToolbox/VideoToolbox.h, HAVE_VIDEOTOOLBOX="yes", HAVE_VIDEOTOOLBOX="no", [-]) AM_CONDITIONAL(HAVE_AVFOUNDATION, test "x$HAVE_AVFOUNDATION" = "xyes") if test "x$HAVE_AVFOUNDATION" = "xyes"; then @@ -512,6 +513,11 @@ if test "x$HAVE_IOS" = "xyes"; then AC_DEFINE(HAVE_IOS, 1, [Define if building for Apple iOS]) fi +AM_CONDITIONAL(HAVE_VIDEOTOOLBOX, test "x$HAVE_VIDEOTOOLBOX" = "xyes") +if test "x$HAVE_VIDEOTOOLBOX" = "xyes"; then + AC_DEFINE(HAVE_VIDEOTOOLBOX, 1, [Define if building with VideoToolbox]) +fi + dnl disable gst plugins we might not be able to build on this dnl platform: (ugly but minimally invasive) dnl FIXME: maybe move to sys, or make work with winsock2 diff --git a/sys/applemedia/Makefile.am b/sys/applemedia/Makefile.am index fc8199c2dc..ecbaf08954 100644 --- a/sys/applemedia/Makefile.am +++ b/sys/applemedia/Makefile.am @@ -54,10 +54,6 @@ libgstapplemedia_la_LDFLAGS = \ -Wl,-framework -Wl,CoreVideo \ -Wl,-framework -Wl,AudioToolbox -if !HAVE_IOS -libgstapplemedia_la_LDFLAGS += -Wl,-framework -Wl,VideoToolbox -endif - noinst_HEADERS = \ qtkitvideosrc.h \ avfvideosrc.h \ @@ -88,9 +84,7 @@ libgstapplemedia_la_LDFLAGS += \ else libgstapplemedia_la_SOURCES += \ - qtkitvideosrc.m \ - vtenc.c \ - vtdec.c + qtkitvideosrc.m libgstapplemedia_la_LDFLAGS += \ -Wl,-framework -Wl,Cocoa \ @@ -108,3 +102,11 @@ libgstapplemedia_la_LDFLAGS += \ -Wl,-framework -Wl,AVFoundation endif + +if HAVE_VIDEOTOOLBOX +libgstapplemedia_la_SOURCES += \ + vtenc.c \ + vtdec.c + +libgstapplemedia_la_LDFLAGS += -Wl,-framework -Wl,VideoToolbox +endif diff --git a/sys/applemedia/plugin.m b/sys/applemedia/plugin.m index 5486ae04a4..1205f9ff8f 100644 --- a/sys/applemedia/plugin.m +++ b/sys/applemedia/plugin.m @@ -31,18 +31,23 @@ #include "avfvideosrc.h" #include "avfassetsrc.h" #endif +#ifdef HAVE_VIDEOTOOLBOX +#include "vtdec.h" +#endif #ifndef HAVE_IOS #define AV_RANK GST_RANK_SECONDARY #include "vth264decbin.h" #include "vth264encbin.h" -#include "vtdec.h" #else #define AV_RANK GST_RANK_PRIMARY #endif #include "atdec.h" -#ifndef HAVE_IOS +#ifdef HAVE_VIDEOTOOLBOX void gst_vtenc_register_elements (GstPlugin * plugin); +#endif + +#ifndef HAVE_IOS static void enable_mt_mode (void) @@ -84,7 +89,7 @@ plugin_init (GstPlugin * plugin) #endif res &= gst_element_register (plugin, "atdec", GST_RANK_PRIMARY, GST_TYPE_ATDEC); -#ifndef HAVE_IOS +#ifdef HAVE_VIDEOTOOLBOX res &= gst_element_register (plugin, "vtdec", GST_RANK_PRIMARY, GST_TYPE_VTDEC); gst_vtenc_register_elements (plugin); #endif