Commit 0e9dcfae authored by Olivier Crête's avatar Olivier Crête
Browse files

Compile the plugin for both GStreamer 0.10 and 1.0

Revert this patch to drop GStreamer 0.10 support
parent 322e89ad
......@@ -8,21 +8,16 @@
include common.mk
ALWAYS_SUBDIRS = \
SUBDIRS = \
stun \
socket \
random \
agent \
nice \
gst \
docs \
tests
SUBDIRS = $(ALWAYS_SUBDIRS)
if WITH_GSTREAMER
SUBDIRS += gst
endif
DIST_SUBDIRS = $(ALWAYS_SUBDIRS) gst
DISTCHECK_CONFIGURE_FLAGS = --disable-assert -enable-gtk-doc
EXTRA_DIST = \
......
......@@ -111,15 +111,20 @@ PKG_CHECK_MODULES(GLIB, [dnl
])
AC_ARG_WITH(gstreamer,
AC_HELP_STRING([--with-gstreamer], [use GStreamer]),
AC_HELP_STRING([--with-gstreamer], [build GStreamer plugin]),
[with_gstreamer=${withval}],
[with_gstreamer=auto])
AC_ARG_WITH(gstreamer-0.10,
AC_HELP_STRING([--with-gstreamer-0.10], [build GStreamer 0.10 plugin]),
[with_gstreamer010=${withval}],
[with_gstreamer010=auto])
AS_IF([test "$with_gstreamer" != no], [
PKG_CHECK_MODULES(GST, [
gstreamer-1.0 >= 0.11.1
gstreamer-base-1.0 >= 0.11.1
gstreamer-1.0 >= 0.11.91
gstreamer-base-1.0 >= 0.11.91
],
[
with_gstreamer=yes
......@@ -128,16 +133,38 @@ AS_IF([test "$with_gstreamer" != no], [
],
[
AS_IF([test "$with_gstreamer" = yes], [
AC_MSG_ERROR([GStreamer support was requested but GStreamer libraries are not available])
AC_MSG_ERROR([GStreamer 1.0 support was requested but GStreamer 1.0 libraries are not available])
])
with_gstreamer=no
])
])
AS_IF([test "$with_gstreamer010" != no], [
PKG_CHECK_MODULES(GST010, [
gstreamer-0.10 >= 0.10.10
gstreamer-base-0.10 >= 0.10.10
],
[
with_gstreamer010=yes
GST_MAJORMINOR=0.10
gstplugin010dir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
],
[
AS_IF([test "$with_gstreamer010" = yes], [
AC_MSG_ERROR([GStreamer 0.10 support was requested but GStreamer 0.10 libraries are not available])
])
with_gstreamer010=no
])
])
AC_SUBST(gstplugindir)
AC_SUBST(gstplugin010dir)
AM_CONDITIONAL(WITH_GSTREAMER, test "$with_gstreamer" = yes)
AM_CONDITIONAL(WITH_GSTREAMER010, test "$with_gstreamer010" = yes)
GUPNP_IGD_REQUIRED=0.1.2
......
......@@ -7,22 +7,22 @@
# Licensed under MPL 1.1/LGPL 2.1. See file COPYING.
AM_CFLAGS = $(LIBNICE_CFLAGS) \
$(GST_CFLAGS) \
-I $(top_srcdir) \
-I $(top_srcdir)/socket \
-I $(top_srcdir)/agent \
-I $(top_srcdir)/random \
-I $(top_srcdir)/stun \
-DGST_USE_UNSTABLE_API
-I $(top_srcdir)/stun
COMMON_LDADD = \
$(GST_LIBS) \
COMMON_LIBADD = \
$(top_builddir)/nice/libnice.la
# libgstnice
if WITH_GSTREAMER
gstplugin_LTLIBRARIES = libgstnice.la
libgstnice_la_CFLAGS = $(AM_CFLAGS) $(GST_CFLAGS) -DGST_USE_UNSTABLE_API
libgstnice_la_SOURCES = \
gstnicesrc.h \
gstnicesrc.c \
......@@ -31,6 +31,26 @@ libgstnice_la_SOURCES = \
gstnice.h \
gstnice.c
libgstnice_la_LIBADD = $(COMMON_LDADD)
libgstnice_la_LIBADD = $(COMMON_LIBADD) $(GST_LIBS)
libgstnice_la_LDFLAGS = -module -avoid-version
endif
if WITH_GSTREAMER010
gstplugin010_LTLIBRARIES = libgstnice010.la
libgstnice010_la_CFLAGS = $(AM_CFLAGS) $(GST010_CFLAGS)
libgstnice010_la_SOURCES = \
gstnicesrc.h \
gstnicesrc.c \
gstnicesink.h \
gstnicesink.c \
gstnice.h \
gstnice.c
libgstnice010_la_LIBADD = $(COMMON_LIBADD) $(GST010_LIBS)
libgstnice010_la_LDFLAGS = -module -avoid-version
endif
......@@ -55,10 +55,16 @@ plugin_init (GstPlugin *plugin)
return TRUE;
}
#if GST_CHECK_VERSION (1,0,0)
#define PLUGIN_NAME nice
#else
#define PLUGIN_NAME "nice"
#endif
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
nice,
PLUGIN_NAME,
"Interactive UDP connectivity establishment",
plugin_init, VERSION, "LGPL", PACKAGE_NAME,
"http://telepathy.freedesktop.org/wiki/");
......
......@@ -110,7 +110,12 @@ gst_nice_sink_class_init (GstNiceSinkClass *klass)
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_nice_sink_sink_template));
gst_element_class_set_metadata (gstelement_class, "ICE sink",
#if GST_CHECK_VERSION (1,0,0)
gst_element_class_set_metadata (gstelement_class,
#else
gst_element_class_set_details_simple (gstelement_class,
#endif
"ICE sink",
"Sink",
"Interactive UDP connectivity establishment",
"Dafydd Harries <dafydd.harries@collabora.co.uk>");
......@@ -154,6 +159,8 @@ static GstFlowReturn
gst_nice_sink_render (GstBaseSink *basesink, GstBuffer *buffer)
{
GstNiceSink *nicesink = GST_NICE_SINK (basesink);
#if GST_CHECK_VERSION (1,0,0)
GstMapInfo info;
gst_buffer_map (buffer, &info, GST_MAP_READ);
......@@ -162,6 +169,11 @@ gst_nice_sink_render (GstBaseSink *basesink, GstBuffer *buffer)
nicesink->component_id, info.size, (gchar *) info.data);
gst_buffer_unmap (buffer, &info);
#else
nice_agent_send (nicesink->agent, nicesink->stream_id,
nicesink->component_id, GST_BUFFER_SIZE (buffer),
(gchar *) GST_BUFFER_DATA (buffer));
#endif
return GST_FLOW_OK;
}
......
......@@ -129,7 +129,11 @@ gst_nice_src_class_init (GstNiceSrcClass *klass)
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_nice_src_src_template));
#if GST_CHECK_VERSION (1,0,0)
gst_element_class_set_metadata (gstelement_class,
#else
gst_element_class_set_details_simple (gstelement_class,
#endif
"ICE source",
"Source",
"Interactive UDP connectivity establishment",
......@@ -194,8 +198,13 @@ gst_nice_src_read_callback (NiceAgent *agent,
GST_LOG_OBJECT (agent, "Got buffer, getting out of the main loop");
#if GST_CHECK_VERSION (1,0,0)
buffer = gst_buffer_new_allocate (NULL, len, NULL);
gst_buffer_fill (buffer, 0, buf, len);
#else
buffer = gst_buffer_new_and_alloc (len);
memcpy (GST_BUFFER_DATA (buffer), buf, len);
#endif
g_queue_push_tail (nicesrc->outbufs, buffer);
g_main_loop_quit (nicesrc->mainloop);
......@@ -270,7 +279,11 @@ gst_nice_src_create (
GST_OBJECT_LOCK (basesrc);
if (nicesrc->unlocked) {
GST_OBJECT_UNLOCK (basesrc);
#if GST_CHECK_VERSION (1,0,0)
return GST_FLOW_FLUSHING;
#else
return GST_FLOW_WRONG_STATE;
#endif
}
GST_OBJECT_UNLOCK (basesrc);
......@@ -283,7 +296,11 @@ gst_nice_src_create (
return GST_FLOW_OK;
} else {
GST_LOG_OBJECT (nicesrc, "Got interrupting, returning wrong-state");
#if GST_CHECK_VERSION (1,0,0)
return GST_FLOW_FLUSHING;
#else
return GST_FLOW_WRONG_STATE;
#endif
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment