From f7e5878c9e4c905ffab0de443ac92715db500cb6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Fri, 19 Nov 2010 15:53:55 +0100 Subject: [PATCH] applemedia: bring back Leopard compatibility At least as far as miovideosrc is concerned. Turns out that CoreVideo's CVPixelBufferGetIOSurface is not present in Leopard's version of CoreVideo. We solve this by making it possible for symbols to be marked as optional. --- sys/applemedia/coremediactx.h | 3 --- sys/applemedia/cvapi.c | 3 ++- sys/applemedia/dynapi-internal.h | 1 + sys/applemedia/dynapi.c | 7 ++++--- sys/applemedia/dynapi.h | 4 +++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/applemedia/coremediactx.h b/sys/applemedia/coremediactx.h index 4125ecd..0220b3e 100644 --- a/sys/applemedia/coremediactx.h +++ b/sys/applemedia/coremediactx.h @@ -46,9 +46,6 @@ G_BEGIN_DECLS #define GST_IS_CORE_MEDIA_CTX_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CORE_MEDIA_CTX)) -#define GST_DYN_SYM_SPEC(type, name) \ - { G_STRINGIFY (name), G_STRUCT_OFFSET (type, name) } - typedef struct _GstCoreMediaCtx GstCoreMediaCtx; typedef struct _GstCoreMediaCtxClass GstCoreMediaCtxClass; diff --git a/sys/applemedia/cvapi.c b/sys/applemedia/cvapi.c index 73186f8..4307f07 100644 --- a/sys/applemedia/cvapi.c +++ b/sys/applemedia/cvapi.c @@ -37,6 +37,7 @@ gst_cv_api_class_init (GstCVApiClass * klass) } #define SYM_SPEC(name) GST_DYN_SYM_SPEC (GstCVApi, name) +#define SYM_SPEC_OPTIONAL(name) GST_DYN_SYM_SPEC_OPTIONAL (GstCVApi, name) GstCVApi * gst_cv_api_obtain (GError ** error) @@ -53,7 +54,7 @@ gst_cv_api_obtain (GError ** error) SYM_SPEC (CVPixelBufferGetBytesPerRowOfPlane), SYM_SPEC (CVPixelBufferGetHeight), SYM_SPEC (CVPixelBufferGetHeightOfPlane), - SYM_SPEC (CVPixelBufferGetIOSurface), + SYM_SPEC_OPTIONAL (CVPixelBufferGetIOSurface), SYM_SPEC (CVPixelBufferGetPlaneCount), SYM_SPEC (CVPixelBufferGetTypeID), SYM_SPEC (CVPixelBufferIsPlanar), diff --git a/sys/applemedia/dynapi-internal.h b/sys/applemedia/dynapi-internal.h index b584ea7..d6624d1 100644 --- a/sys/applemedia/dynapi-internal.h +++ b/sys/applemedia/dynapi-internal.h @@ -30,6 +30,7 @@ struct _GstDynSymSpec { const gchar * name; guint offset; + gboolean is_required; }; gpointer _gst_dyn_api_new (GType derived_type, const gchar * filename, diff --git a/sys/applemedia/dynapi.c b/sys/applemedia/dynapi.c index 87ff10c..139fabd 100644 --- a/sys/applemedia/dynapi.c +++ b/sys/applemedia/dynapi.c @@ -142,9 +142,10 @@ _gst_dyn_api_new (GType derived_type, const gchar * filename, names_not_found = g_array_new (TRUE, FALSE, sizeof (gchar *)); for (i = 0; symbols[i].name != NULL; i++) { - if (!g_module_symbol (priv->module, symbols[i].name, - (gpointer *) (((guint8 *) api) + symbols[i].offset))) { - g_array_append_val (names_not_found, symbols[i].name); + const GstDynSymSpec *s = &symbols[i]; + if (!g_module_symbol (priv->module, s->name, + (gpointer *) (((guint8 *) api) + s->offset)) && s->is_required) { + g_array_append_val (names_not_found, s->name); } } diff --git a/sys/applemedia/dynapi.h b/sys/applemedia/dynapi.h index 2b125ba..4be83b2 100644 --- a/sys/applemedia/dynapi.h +++ b/sys/applemedia/dynapi.h @@ -38,7 +38,9 @@ G_BEGIN_DECLS (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DYN_API)) #define GST_DYN_SYM_SPEC(type, name) \ - { G_STRINGIFY (name), G_STRUCT_OFFSET (type, name) } + { G_STRINGIFY (name), G_STRUCT_OFFSET (type, name), TRUE } +#define GST_DYN_SYM_SPEC_OPTIONAL(type, name) \ + { G_STRINGIFY (name), G_STRUCT_OFFSET (type, name), FALSE } typedef struct _GstDynApi GstDynApi; typedef struct _GstDynApiClass GstDynApiClass; -- 2.7.4