diff --git a/configure.ac b/configure.ac index e2d78dede0..d69031a815 100644 --- a/configure.ac +++ b/configure.ac @@ -725,6 +725,11 @@ AG_GST_CHECK_FEATURE(GDK_PIXBUF, [GDK pixbuf], gdkpixbuf, [ AG_GST_PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= 2.8.0) ]) +translit(dnm, m, l) AM_CONDITIONAL(USE_GDK_PIXBUF3, true) +AG_GST_CHECK_FEATURE(GDK_PIXBUF3, [GDK pixbuf], gdkpixbuf3, [ + AG_GST_PKG_CHECK_MODULES(GDK_PIXBUF3, gdk-pixbuf-3.0) +]) + dnl *** HAL *** translit(dnm, m, l) AM_CONDITIONAL(USE_HAL, true) AG_GST_CHECK_FEATURE(HAL, [HAL libraries], halelements, [ diff --git a/ext/Makefile.am b/ext/Makefile.am index 1dc2e2abca..c78d14c58e 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -37,8 +37,12 @@ endif if USE_GDK_PIXBUF GDK_PIXBUF_DIR = gdk_pixbuf else +if USE_GDK_PIXBUF3 +GDK_PIXBUF_DIR = gdk_pixbuf +else GDK_PIXBUF_DIR = endif +endif if USE_HAL HAL_DIR = hal diff --git a/ext/gdk_pixbuf/Makefile.am b/ext/gdk_pixbuf/Makefile.am index cf5265c2e8..acd2c5efcc 100644 --- a/ext/gdk_pixbuf/Makefile.am +++ b/ext/gdk_pixbuf/Makefile.am @@ -1,4 +1,13 @@ -plugin_LTLIBRARIES = libgstgdkpixbuf.la +plugin_LTLIBRARIES = + +if USE_GDK_PIXBUF +plugin_LTLIBRARIES += libgstgdkpixbuf.la + +endif + +if USE_GDK_PIXBUF3 +plugin_LTLIBRARIES += libgstgdkpixbuf3.la +endif libgstgdkpixbuf_la_SOURCES = gstgdkpixbuf.c gstgdkpixbufsink.c pixbufscale.c libgstgdkpixbuf_la_CFLAGS = \ @@ -12,8 +21,21 @@ libgstgdkpixbuf_la_LIBADD = \ libgstgdkpixbuf_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstgdkpixbuf_la_LIBTOOLFLAGS = --tag=disable-static +libgstgdkpixbuf3_la_SOURCES = gstgdkpixbuf.c gstgdkpixbufsink.c pixbufscale.c +libgstgdkpixbuf3_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) $(GDK_PIXBUF3_CFLAGS) \ + -DGDK_PIXBUF3=1 +libgstgdkpixbuf3_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) $(GDK_PIXBUF3_LIBS) +libgstgdkpixbuf3_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstgdkpixbuf3_la_LIBTOOLFLAGS = --tag=disable-static + noinst_HEADERS = \ gstgdkpixbuf.h \ gstgdkpixbufsink.h \ - pixbufscale.h \ - gstgdkanimation.h + pixbufscale.h + diff --git a/ext/gdk_pixbuf/gstgdkpixbuf.c b/ext/gdk_pixbuf/gstgdkpixbuf.c index 1896eb4415..81f3d5918c 100644 --- a/ext/gdk_pixbuf/gstgdkpixbuf.c +++ b/ext/gdk_pixbuf/gstgdkpixbuf.c @@ -84,7 +84,14 @@ static gboolean gst_gdk_pixbuf_sink_event (GstPad * pad, GstEvent * event); static void gst_gdk_pixbuf_type_find (GstTypeFind * tf, gpointer ignore); #endif +#ifdef GDK_PIXBUF3 +typedef GstGdkPixbuf GstGdkPixbuf3; +typedef GstGdkPixbufClass GstGdkPixbuf3Class; + +GST_BOILERPLATE (GstGdkPixbuf3, gst_gdk_pixbuf, GstElement, GST_TYPE_ELEMENT); +#else GST_BOILERPLATE (GstGdkPixbuf, gst_gdk_pixbuf, GstElement, GST_TYPE_ELEMENT); +#endif static gboolean gst_gdk_pixbuf_sink_setcaps (GstPad * pad, GstCaps * caps) @@ -516,6 +523,16 @@ gst_gdk_pixbuf_type_find (GstTypeFind * tf, gpointer ignore) } #endif +#ifdef GDK_PIXBUF3 +#define PLUGIN_NAME "gdkpixbuf3" +#define GDKPIXBUFDEC "gdkpixbufdec3" +#define GDKPIXBUFSINK "gdkpixbufsink3" +#else +#define PLUGIN_NAME "gdkpixbuf" +#define GDKPIXBUFDEC "gdkpixbufdec" +#define GDKPIXBUFSINK "gdkpixbufsink" +#endif + /* entry point to initialize the plug-in * initialize the plug-in itself * register the element factories and pad templates @@ -524,10 +541,10 @@ gst_gdk_pixbuf_type_find (GstTypeFind * tf, gpointer ignore) static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_gdk_pixbuf_debug, "gdkpixbuf", 0, + GST_DEBUG_CATEGORY_INIT (gst_gdk_pixbuf_debug, PLUGIN_NAME, 0, "gdk pixbuf loader"); - if (!gst_element_register (plugin, "gdkpixbufdec", GST_RANK_MARGINAL, + if (!gst_element_register (plugin, GDKPIXBUFDEC, GST_RANK_MARGINAL, GST_TYPE_GDK_PIXBUF)) return FALSE; @@ -536,7 +553,7 @@ plugin_init (GstPlugin * plugin) gst_gdk_pixbuf_type_find, NULL, GST_CAPS_ANY, NULL); #endif - if (!gst_element_register (plugin, "gdkpixbufsink", GST_RANK_NONE, + if (!gst_element_register (plugin, GDKPIXBUFSINK, GST_RANK_NONE, GST_TYPE_GDK_PIXBUF_SINK)) return FALSE; @@ -552,6 +569,6 @@ plugin_init (GstPlugin * plugin) * so keep the name plugin_desc, or you cannot get your plug-in registered */ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, - "gdkpixbuf", + PLUGIN_NAME, "GdkPixbuf-based image decoder, scaler and sink", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/ext/gdk_pixbuf/gstgdkpixbufsink.c b/ext/gdk_pixbuf/gstgdkpixbufsink.c index 3258358a74..f17b72f095 100644 --- a/ext/gdk_pixbuf/gstgdkpixbufsink.c +++ b/ext/gdk_pixbuf/gstgdkpixbufsink.c @@ -109,9 +109,16 @@ enum PROP_LAST }; +#ifdef GDK_PIXBUF3 +typedef GstGdkPixbufSink GstGdkPixbufSink3; +typedef GstGdkPixbufSinkClass GstGdkPixbufSink3Class; +GST_BOILERPLATE (GstGdkPixbufSink3, gst_gdk_pixbuf_sink, GstVideoSink, + GST_TYPE_VIDEO_SINK); +#else GST_BOILERPLATE (GstGdkPixbufSink, gst_gdk_pixbuf_sink, GstVideoSink, GST_TYPE_VIDEO_SINK); +#endif static void gst_gdk_pixbuf_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/ext/gdk_pixbuf/pixbufscale.c b/ext/gdk_pixbuf/pixbufscale.c index d8d9808236..03063936b5 100644 --- a/ext/gdk_pixbuf/pixbufscale.c +++ b/ext/gdk_pixbuf/pixbufscale.c @@ -81,8 +81,13 @@ gst_pixbufscale_method_get_type (void) }; if (!pixbufscale_method_type) { +#ifdef GDK_PIXBUF3 + pixbufscale_method_type = + g_enum_register_static ("GstPixbuf3ScaleMethod", pixbufscale_methods); +#else pixbufscale_method_type = g_enum_register_static ("GstPixbufScaleMethod", pixbufscale_methods); +#endif } return pixbufscale_method_type; } @@ -108,8 +113,16 @@ static gboolean gst_pixbufscale_handle_src_event (GstPad * pad, static gboolean parse_caps (GstCaps * caps, gint * width, gint * height); +#ifdef GDK_PIXBUF3 +typedef GstPixbufScale GstPixbufScale3; +typedef GstPixbufScaleClass GstPixbufScale3Class; + +GST_BOILERPLATE (GstPixbufScale3, gst_pixbufscale, GstBaseTransform, + GST_TYPE_BASE_TRANSFORM); +#else GST_BOILERPLATE (GstPixbufScale, gst_pixbufscale, GstBaseTransform, GST_TYPE_BASE_TRANSFORM); +#endif static void gst_pixbufscale_base_init (gpointer g_class) @@ -469,14 +482,20 @@ gst_pixbufscale_handle_src_event (GstPad * pad, GstEvent * event) return ret; } +#ifdef GDK_PIXBUF3 +#define GDKPIXBUFSCALE "gdkpixbufscale3" +#else +#define GDKPIXBUFSCALE "gdkpixbufscale" +#endif + gboolean pixbufscale_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "gdkpixbufscale", GST_RANK_NONE, + if (!gst_element_register (plugin, GDKPIXBUFSCALE, GST_RANK_NONE, GST_TYPE_PIXBUFSCALE)) return FALSE; - GST_DEBUG_CATEGORY_INIT (pixbufscale_debug, "gdkpixbufscale", 0, + GST_DEBUG_CATEGORY_INIT (pixbufscale_debug, GDKPIXBUFSCALE, 0, "pixbufscale element"); return TRUE;