Commit 94afcb3f authored by Dafydd Harries's avatar Dafydd Harries

add GStreamer sink

darcs-hash:20070208171033-c9803-a4c5644aa41618d48c57c65261a72d0b1951a068.gz
parent 83498616
......@@ -18,6 +18,9 @@ lib_LTLIBRARIES = libgstnice.la
libgstnice_la_SOURCES = \
gstnicesrc.h \
gstnicesrc.c \
gstnicesink.h \
gstnicesink.c \
gstnice.h \
gstnice.c
libgstnice_la_LIBADD = $(COMMON_LDADD)
......
#include "config.h"
#include "gstnicesrc.h"
#include "gstnicesink.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "nicesrc", GST_RANK_NONE,
GST_TYPE_NICE_SRC);
if (!gst_element_register (plugin, "nicesrc",
GST_RANK_NONE, GST_TYPE_NICE_SRC))
return FALSE;
if (!gst_element_register (plugin, "nicesink",
GST_RANK_NONE, GST_TYPE_NICE_SINK))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE (
......
#include "gstnicesrc.h"
#include "gstnicesink.h"
#include "config.h"
#include "gstnicesink.h"
static GstFlowReturn
gst_nice_sink_render (
GstBaseSink *basesink, GstBuffer *buffer);
static void
gst_nice_sink_set_property (
GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void
gst_nice_sink_get_property (
GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
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 =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
GST_BOILERPLATE (GstNiceSink, gst_nice_sink, GstBaseSink, GST_TYPE_BASE_SINK);
enum
{
PROP_AGENT = 1,
PROP_STREAM,
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
gst_nice_sink_class_init (GstNiceSinkClass *klass)
{
GstBaseSinkClass *gstbasesink_class;
GObjectClass *gobject_class;
gstbasesink_class = (GstBaseSinkClass *) klass;
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_nice_sink_render);
gobject_class = (GObjectClass *) klass;
gobject_class->set_property = gst_nice_sink_set_property;
gobject_class->get_property = gst_nice_sink_get_property;
g_object_class_install_property (gobject_class, PROP_AGENT,
g_param_spec_pointer (
"agent",
"Agent",
"The NiceAgent this source is bound to",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_STREAM,
g_param_spec_uint (
"stream",
"Stream ID",
"The ID of the stream to read from",
0,
G_MAXUINT,
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_COMPONENT,
g_param_spec_uint (
"component",
"Component ID",
"The ID of the component to read from",
0,
G_MAXUINT,
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
static void
gst_nice_sink_init (GstNiceSink *sink, GstNiceSinkClass *g_class)
{
}
static GstFlowReturn
gst_nice_sink_render (
GstBaseSink *basesink, GstBuffer *buffer)
{
GstNiceSink *nicesink;
nicesink = GST_NICE_SINK (basesink);
nice_agent_send (nicesink->agent, nicesink->stream_id,
nicesink->component_id, GST_BUFFER_SIZE (buffer),
(gchar *) GST_BUFFER_DATA (buffer));
return GST_FLOW_OK;
}
static void
gst_nice_sink_set_property (
GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GstNiceSink *sink = GST_NICE_SINK (object);
switch (prop_id)
{
case PROP_AGENT:
sink->agent = g_value_get_pointer (value);
break;
case PROP_STREAM:
sink->stream_id = g_value_get_uint (value);
break;
case PROP_COMPONENT:
sink->component_id = g_value_get_uint (value);
break;
}
}
static void
gst_nice_sink_get_property (
GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GstNiceSink *sink = GST_NICE_SINK (object);
switch (prop_id)
{
case PROP_AGENT:
g_value_set_pointer (value, sink->agent);
break;
case PROP_STREAM:
g_value_set_uint (value, sink->stream_id);
break;
case PROP_COMPONENT:
g_value_set_uint (value, sink->component_id);
break;
}
}
#ifndef _GST_NICE_SINK_H
#define _GST_NICE_SINK_H
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include <nice/nice.h>
G_BEGIN_DECLS
#define GST_TYPE_NICE_SINK \
(gst_nice_sink_get_type())
#define GST_NICE_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NICE_SINK,GstNiceSink))
#define GST_NICE_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NICE_SINK,GstNiceSinkClass))
#define GST_IS_NICE_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NICE_SINK))
#define GST_IS_NICE_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NICE_SINK))
typedef struct _GstNiceSink GstNiceSink;
struct _GstNiceSink
{
GstBaseSink parent;
GstPad *sinkpad;
NiceAgent *agent;
guint stream_id;
guint component_id;
};
typedef struct _GstNiceSinkClass GstNiceSinkClass;
struct _GstNiceSinkClass
{
GstBaseSinkClass parent_class;
};
GType gst_nice_sink_get_type (void);
G_END_DECLS
#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