summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2012-09-13 21:26:29 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2012-09-14 12:47:13 -0400
commit0e9dcfae9440b7e5795f7526eebc3f39e5407d48 (patch)
treef3d70445ec9af107fe48bdde68927b8700b5f551 /gst
parent322e89addacb8b635f815e79047711c11d3ccc9e (diff)
downloadlibnice-0e9dcfae9440b7e5795f7526eebc3f39e5407d48.tar.gz
Compile the plugin for both GStreamer 0.10 and 1.0
Revert this patch to drop GStreamer 0.10 support
Diffstat (limited to 'gst')
-rw-r--r--gst/Makefile.am32
-rw-r--r--gst/gstnice.c8
-rw-r--r--gst/gstnicesink.c14
-rw-r--r--gst/gstnicesrc.c17
4 files changed, 63 insertions, 8 deletions
diff --git a/gst/Makefile.am b/gst/Makefile.am
index 34e00c7..0cf811d 100644
--- a/gst/Makefile.am
+++ b/gst/Makefile.am
@@ -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
diff --git a/gst/gstnice.c b/gst/gstnice.c
index 8e92685..078b6b8 100644
--- a/gst/gstnice.c
+++ b/gst/gstnice.c
@@ -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/");
diff --git a/gst/gstnicesink.c b/gst/gstnicesink.c
index 4783019..9898e94 100644
--- a/gst/gstnicesink.c
+++ b/gst/gstnicesink.c
@@ -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;
}
diff --git a/gst/gstnicesrc.c b/gst/gstnicesrc.c
index f264d28..ac47e91 100644
--- a/gst/gstnicesrc.c
+++ b/gst/gstnicesrc.c
@@ -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
}
}