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.
This commit is contained in:
Ole André Vadla Ravnås 2010-11-19 15:53:55 +01:00
parent 6cf92cd25c
commit f7e5878c9e
5 changed files with 10 additions and 8 deletions

View file

@ -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;

View file

@ -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),

View file

@ -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,

View file

@ -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);
}
}

View file

@ -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;