Commit e2383f9b authored by Olivier Crête's avatar Olivier Crête

Port GStreamer src/sink to 0.11

parent 48618e25
...@@ -118,12 +118,12 @@ AC_ARG_WITH(gstreamer, ...@@ -118,12 +118,12 @@ AC_ARG_WITH(gstreamer,
AS_IF([test "$with_gstreamer" != no], [ AS_IF([test "$with_gstreamer" != no], [
PKG_CHECK_MODULES(GST, [ PKG_CHECK_MODULES(GST, [
gstreamer-0.10 >= 0.10.0 gstreamer-0.11 >= 0.11.1
gstreamer-base-0.10 >= 0.10.0 gstreamer-base-0.11 >= 0.11.1
], ],
[ [
with_gstreamer=yes with_gstreamer=yes
GST_MAJORMINOR=0.10 GST_MAJORMINOR=0.11
gstplugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" gstplugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
], ],
[ [
......
...@@ -12,7 +12,8 @@ AM_CFLAGS = $(LIBNICE_CFLAGS) \ ...@@ -12,7 +12,8 @@ AM_CFLAGS = $(LIBNICE_CFLAGS) \
-I $(top_srcdir)/socket \ -I $(top_srcdir)/socket \
-I $(top_srcdir)/agent \ -I $(top_srcdir)/agent \
-I $(top_srcdir)/random \ -I $(top_srcdir)/random \
-I $(top_srcdir)/stun -I $(top_srcdir)/stun \
-DGST_USE_UNSTABLE_API
COMMON_LDADD = \ COMMON_LDADD = \
$(GST_LIBS) \ $(GST_LIBS) \
......
...@@ -71,13 +71,6 @@ gst_nice_sink_change_state ( ...@@ -71,13 +71,6 @@ gst_nice_sink_change_state (
GstElement * element, GstElement * element,
GstStateChange transition); GstStateChange transition);
static const GstElementDetails gst_nice_sink_details =
GST_ELEMENT_DETAILS (
"ICE sink",
"Sink",
"Interactive UDP connectivity establishment",
"Dafydd Harries <dafydd.harries@collabora.co.uk>");
static GstStaticPadTemplate gst_nice_sink_sink_template = static GstStaticPadTemplate gst_nice_sink_sink_template =
GST_STATIC_PAD_TEMPLATE ( GST_STATIC_PAD_TEMPLATE (
"sink", "sink",
...@@ -85,7 +78,7 @@ GST_STATIC_PAD_TEMPLATE ( ...@@ -85,7 +78,7 @@ GST_STATIC_PAD_TEMPLATE (
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY); GST_STATIC_CAPS_ANY);
GST_BOILERPLATE (GstNiceSink, gst_nice_sink, GstBaseSink, GST_TYPE_BASE_SINK); G_DEFINE_TYPE (GstNiceSink, gst_nice_sink, GST_TYPE_BASE_SINK);
enum enum
{ {
...@@ -94,16 +87,6 @@ enum ...@@ -94,16 +87,6 @@ enum
PROP_COMPONENT PROP_COMPONENT
}; };
static void
gst_nice_sink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_nice_sink_sink_template));
gst_element_class_set_details (element_class, &gst_nice_sink_details);
}
static void static void
gst_nice_sink_class_init (GstNiceSinkClass *klass) gst_nice_sink_class_init (GstNiceSinkClass *klass)
{ {
...@@ -125,6 +108,14 @@ gst_nice_sink_class_init (GstNiceSinkClass *klass) ...@@ -125,6 +108,14 @@ gst_nice_sink_class_init (GstNiceSinkClass *klass)
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gstelement_class->change_state = gst_nice_sink_change_state; gstelement_class->change_state = gst_nice_sink_change_state;
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",
"Sink",
"Interactive UDP connectivity establishment",
"Dafydd Harries <dafydd.harries@collabora.co.uk>");
g_object_class_install_property (gobject_class, PROP_AGENT, g_object_class_install_property (gobject_class, PROP_AGENT,
g_param_spec_object ( g_param_spec_object (
"agent", "agent",
...@@ -155,22 +146,22 @@ gst_nice_sink_class_init (GstNiceSinkClass *klass) ...@@ -155,22 +146,22 @@ gst_nice_sink_class_init (GstNiceSinkClass *klass)
} }
static void static void
gst_nice_sink_init ( gst_nice_sink_init (GstNiceSink *sink)
GstNiceSink *sink,
GstNiceSinkClass *g_class)
{ {
} }
static GstFlowReturn static GstFlowReturn
gst_nice_sink_render ( gst_nice_sink_render (GstBaseSink *basesink, GstBuffer *buffer)
GstBaseSink *basesink, GstBuffer *buffer)
{ {
GstNiceSink *nicesink; GstNiceSink *nicesink = GST_NICE_SINK (basesink);
GstMapInfo info;
gst_buffer_map (buffer, &info, GST_MAP_READ);
nicesink = GST_NICE_SINK (basesink);
nice_agent_send (nicesink->agent, nicesink->stream_id, nice_agent_send (nicesink->agent, nicesink->stream_id,
nicesink->component_id, GST_BUFFER_SIZE (buffer), nicesink->component_id, info.size, (gchar *) info.data);
(gchar *) GST_BUFFER_DATA (buffer));
gst_buffer_unmap (buffer, &info);
return GST_FLOW_OK; return GST_FLOW_OK;
} }
...@@ -185,7 +176,7 @@ gst_nice_sink_dispose (GObject *object) ...@@ -185,7 +176,7 @@ gst_nice_sink_dispose (GObject *object)
g_object_unref (sink->agent); g_object_unref (sink->agent);
sink->agent = NULL; sink->agent = NULL;
GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); G_OBJECT_CLASS (gst_nice_sink_parent_class)->dispose (object);
} }
static void static void
...@@ -271,7 +262,8 @@ gst_nice_sink_change_state (GstElement * element, GstStateChange transition) ...@@ -271,7 +262,8 @@ gst_nice_sink_change_state (GstElement * element, GstStateChange transition)
break; break;
} }
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ret = GST_ELEMENT_CLASS (gst_nice_sink_parent_class)->change_state (element,
transition);
return ret; return ret;
} }
...@@ -86,13 +86,6 @@ gst_nice_src_change_state ( ...@@ -86,13 +86,6 @@ gst_nice_src_change_state (
GstElement * element, GstElement * element,
GstStateChange transition); GstStateChange transition);
static const GstElementDetails gst_nice_src_details =
GST_ELEMENT_DETAILS (
"ICE source",
"Source",
"Interactive UDP connectivity establishment",
"Dafydd Harries <dafydd.harries@collabora.co.uk>");
static GstStaticPadTemplate gst_nice_src_src_template = static GstStaticPadTemplate gst_nice_src_src_template =
GST_STATIC_PAD_TEMPLATE ( GST_STATIC_PAD_TEMPLATE (
"src", "src",
...@@ -100,7 +93,7 @@ GST_STATIC_PAD_TEMPLATE ( ...@@ -100,7 +93,7 @@ GST_STATIC_PAD_TEMPLATE (
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY); GST_STATIC_CAPS_ANY);
GST_BOILERPLATE (GstNiceSrc, gst_nice_src, GstBaseSrc, GST_TYPE_BASE_SRC); G_DEFINE_TYPE (GstNiceSrc, gst_nice_src, GST_TYPE_BASE_SRC);
enum enum
{ {
...@@ -109,15 +102,6 @@ enum ...@@ -109,15 +102,6 @@ enum
PROP_COMPONENT PROP_COMPONENT
}; };
static void
gst_nice_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_nice_src_src_template));
gst_element_class_set_details (element_class, &gst_nice_src_details);
}
static void static void
gst_nice_src_class_init (GstNiceSrcClass *klass) gst_nice_src_class_init (GstNiceSrcClass *klass)
...@@ -142,6 +126,14 @@ gst_nice_src_class_init (GstNiceSrcClass *klass) ...@@ -142,6 +126,14 @@ gst_nice_src_class_init (GstNiceSrcClass *klass)
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gstelement_class->change_state = gst_nice_src_change_state; gstelement_class->change_state = gst_nice_src_change_state;
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_nice_src_src_template));
gst_element_class_set_metadata (gstelement_class,
"ICE source",
"Source",
"Interactive UDP connectivity establishment",
"Dafydd Harries <dafydd.harries@collabora.co.uk>");
g_object_class_install_property (gobject_class, PROP_AGENT, g_object_class_install_property (gobject_class, PROP_AGENT,
g_param_spec_object ( g_param_spec_object (
"agent", "agent",
...@@ -172,7 +164,7 @@ gst_nice_src_class_init (GstNiceSrcClass *klass) ...@@ -172,7 +164,7 @@ gst_nice_src_class_init (GstNiceSrcClass *klass)
} }
static void static void
gst_nice_src_init (GstNiceSrc *src, GstNiceSrcClass *g_class) gst_nice_src_init (GstNiceSrc *src)
{ {
gst_base_src_set_live (GST_BASE_SRC (src), TRUE); gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME); gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
...@@ -198,16 +190,15 @@ gst_nice_src_read_callback (NiceAgent *agent, ...@@ -198,16 +190,15 @@ gst_nice_src_read_callback (NiceAgent *agent,
GstBaseSrc *basesrc = GST_BASE_SRC (data); GstBaseSrc *basesrc = GST_BASE_SRC (data);
GstNiceSrc *nicesrc = GST_NICE_SRC (basesrc); GstNiceSrc *nicesrc = GST_NICE_SRC (basesrc);
GstBuffer *buffer = NULL; GstBuffer *buffer = NULL;
GstMapInfo info;
GST_LOG_OBJECT (agent, "Got buffer, getting out of the main loop"); GST_LOG_OBJECT (agent, "Got buffer, getting out of the main loop");
nicesrc->flow_ret = gst_pad_alloc_buffer (basesrc->srcpad, nicesrc->offset, buffer = gst_buffer_new_allocate (NULL, len, 1);
len, GST_PAD_CAPS (basesrc->srcpad), &buffer); gst_buffer_map (buffer, &info, GST_MAP_WRITE);
if (nicesrc->flow_ret == GST_FLOW_OK) { memcpy (info.data, buf, len);
memcpy (buffer->data, buf, len); gst_buffer_unmap (buffer, &info);
buffer->size = len; g_queue_push_tail (nicesrc->outbufs, buffer);
g_queue_push_tail (nicesrc->outbufs, buffer);
}
g_main_loop_quit (nicesrc->mainloop); g_main_loop_quit (nicesrc->mainloop);
} }
...@@ -295,7 +286,7 @@ gst_nice_src_create ( ...@@ -295,7 +286,7 @@ gst_nice_src_create (
*buffer = g_queue_pop_head (nicesrc->outbufs); *buffer = g_queue_pop_head (nicesrc->outbufs);
if (*buffer != NULL) { if (*buffer != NULL) {
GST_LOG_OBJECT (nicesrc, "Got buffer, pushing"); GST_LOG_OBJECT (nicesrc, "Got buffer, pushing");
return nicesrc->flow_ret; return GST_FLOW_OK;
} else { } else {
GST_LOG_OBJECT (nicesrc, "Got interrupting, returning wrong-state"); GST_LOG_OBJECT (nicesrc, "Got interrupting, returning wrong-state");
return GST_FLOW_WRONG_STATE; return GST_FLOW_WRONG_STATE;
...@@ -324,7 +315,7 @@ gst_nice_src_dispose (GObject *object) ...@@ -324,7 +315,7 @@ gst_nice_src_dispose (GObject *object)
g_queue_free (src->outbufs); g_queue_free (src->outbufs);
src->outbufs = NULL; src->outbufs = NULL;
GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); G_OBJECT_CLASS (gst_nice_src_parent_class)->dispose (object);
} }
static void static void
...@@ -419,7 +410,8 @@ gst_nice_src_change_state (GstElement * element, GstStateChange transition) ...@@ -419,7 +410,8 @@ gst_nice_src_change_state (GstElement * element, GstStateChange transition)
break; break;
} }
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ret = GST_ELEMENT_CLASS (gst_nice_src_parent_class)->change_state (element,
transition);
return ret; return ret;
} }
......
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