shout2: port to 0.11

This commit is contained in:
Mark Nauwelaerts 2012-02-16 15:29:34 +01:00
parent 4945af5eff
commit 834c63f87e
2 changed files with 26 additions and 29 deletions

View file

@ -315,7 +315,7 @@ GST_PLUGINS_NONPORTED="deinterlace interleave flx goom2k1 \
imagefreeze monoscope smpte \ imagefreeze monoscope smpte \
videobox \ videobox \
cairo cairo_gobject dv1394 gdk_pixbuf \ cairo cairo_gobject dv1394 gdk_pixbuf \
oss oss4 shout2 \ oss oss4 \
wavpack \ wavpack \
osx_video osx_audio " osx_video osx_audio "
AC_SUBST(GST_PLUGINS_NONPORTED) AC_SUBST(GST_PLUGINS_NONPORTED)

View file

@ -83,7 +83,6 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
"audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]" WEBM_CAPS)); "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]" WEBM_CAPS));
static void gst_shout2send_class_init (GstShout2sendClass * klass); static void gst_shout2send_class_init (GstShout2sendClass * klass);
static void gst_shout2send_base_init (GstShout2sendClass * klass);
static void gst_shout2send_init (GstShout2send * shout2send); static void gst_shout2send_init (GstShout2send * shout2send);
static void gst_shout2send_finalize (GstShout2send * shout2send); static void gst_shout2send_finalize (GstShout2send * shout2send);
@ -100,7 +99,7 @@ static void gst_shout2send_set_property (GObject * object, guint prop_id,
static void gst_shout2send_get_property (GObject * object, guint prop_id, static void gst_shout2send_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static gboolean gst_shout2send_setcaps (GstPad * pad, GstCaps * caps); static gboolean gst_shout2send_setcaps (GstBaseSink * basesink, GstCaps * caps);
static guint gst_shout2send_signals[LAST_SIGNAL] = { 0 }; static guint gst_shout2send_signals[LAST_SIGNAL] = { 0 };
@ -134,7 +133,7 @@ gst_shout2send_get_type (void)
if (!shout2send_type) { if (!shout2send_type) {
static const GTypeInfo shout2send_info = { static const GTypeInfo shout2send_info = {
sizeof (GstShout2sendClass), sizeof (GstShout2sendClass),
(GBaseInitFunc) gst_shout2send_base_init, NULL,
NULL, NULL,
(GClassInitFunc) gst_shout2send_class_init, (GClassInitFunc) gst_shout2send_class_init,
NULL, NULL,
@ -161,30 +160,15 @@ gst_shout2send_get_type (void)
return shout2send_type; return shout2send_type;
} }
static void
gst_shout2send_base_init (GstShout2sendClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template));
gst_element_class_set_details_simple (element_class, "Icecast network sink",
"Sink/Network", "Sends data to an icecast server",
"Wim Taymans <wim.taymans@chello.be>, "
"Pedro Corte-Real <typo@netcabo.pt>, "
"Zaheer Abbas Merali <zaheerabbas at merali dot org>");
GST_DEBUG_CATEGORY_INIT (shout2_debug, "shout2", 0, "shout2send element");
}
static void static void
gst_shout2send_class_init (GstShout2sendClass * klass) gst_shout2send_class_init (GstShout2sendClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseSinkClass *gstbasesink_class; GstBaseSinkClass *gstbasesink_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass; gstbasesink_class = (GstBaseSinkClass *) klass;
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
@ -255,6 +239,19 @@ gst_shout2send_class_init (GstShout2sendClass * klass)
GST_DEBUG_FUNCPTR (gst_shout2send_unlock_stop); GST_DEBUG_FUNCPTR (gst_shout2send_unlock_stop);
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_shout2send_render); gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_shout2send_render);
gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_shout2send_event); gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_shout2send_event);
gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_shout2send_setcaps);
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sink_template));
gst_element_class_set_details_simple (gstelement_class,
"Icecast network sink",
"Sink/Network", "Sends data to an icecast server",
"Wim Taymans <wim.taymans@chello.be>, "
"Pedro Corte-Real <typo@netcabo.pt>, "
"Zaheer Abbas Merali <zaheerabbas at merali dot org>");
GST_DEBUG_CATEGORY_INIT (shout2_debug, "shout2", 0, "shout2send element");
} }
static void static void
@ -262,9 +259,6 @@ gst_shout2send_init (GstShout2send * shout2send)
{ {
gst_base_sink_set_sync (GST_BASE_SINK (shout2send), FALSE); gst_base_sink_set_sync (GST_BASE_SINK (shout2send), FALSE);
gst_pad_set_setcaps_function (GST_BASE_SINK_PAD (shout2send),
GST_DEBUG_FUNCPTR (gst_shout2send_setcaps));
shout2send->timer = gst_poll_new_timer (); shout2send->timer = gst_poll_new_timer ();
shout2send->ip = g_strdup (DEFAULT_IP); shout2send->ip = g_strdup (DEFAULT_IP);
@ -279,7 +273,7 @@ gst_shout2send_init (GstShout2send * shout2send)
shout2send->protocol = DEFAULT_PROTOCOL; shout2send->protocol = DEFAULT_PROTOCOL;
shout2send->ispublic = DEFAULT_PUBLIC; shout2send->ispublic = DEFAULT_PUBLIC;
shout2send->tags = gst_tag_list_new (); shout2send->tags = gst_tag_list_new_empty ();
shout2send->conn = NULL; shout2send->conn = NULL;
shout2send->audio_format = SHOUT_FORMAT_VORBIS; shout2send->audio_format = SHOUT_FORMAT_VORBIS;
shout2send->connected = FALSE; shout2send->connected = FALSE;
@ -650,6 +644,7 @@ gst_shout2send_render (GstBaseSink * basesink, GstBuffer * buf)
glong ret; glong ret;
gint delay; gint delay;
GstFlowReturn fret; GstFlowReturn fret;
GstMapInfo map;
sink = GST_SHOUT2SEND (basesink); sink = GST_SHOUT2SEND (basesink);
@ -675,8 +670,10 @@ gst_shout2send_render (GstBaseSink * basesink, GstBuffer * buf)
GST_LOG_OBJECT (sink, "we're %d msec late", -delay); GST_LOG_OBJECT (sink, "we're %d msec late", -delay);
} }
GST_LOG_OBJECT (sink, "sending %u bytes of data", GST_BUFFER_SIZE (buf)); gst_buffer_map (buf, &map, GST_MAP_READ);
ret = shout_send (sink->conn, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); GST_LOG_OBJECT (sink, "sending %u bytes of data", (guint) map.size);
ret = shout_send (sink->conn, map.data, map.size);
gst_buffer_unmap (buf, &map);
if (ret != SHOUTERR_SUCCESS) if (ret != SHOUTERR_SUCCESS)
goto send_error; goto send_error;
@ -806,13 +803,13 @@ gst_shout2send_get_property (GObject * object, guint prop_id,
} }
static gboolean static gboolean
gst_shout2send_setcaps (GstPad * pad, GstCaps * caps) gst_shout2send_setcaps (GstBaseSink * basesink, GstCaps * caps)
{ {
const gchar *mimetype; const gchar *mimetype;
GstShout2send *shout2send; GstShout2send *shout2send;
gboolean ret = TRUE; gboolean ret = TRUE;
shout2send = GST_SHOUT2SEND (GST_OBJECT_PARENT (pad)); shout2send = GST_SHOUT2SEND (basesink);
mimetype = gst_structure_get_name (gst_caps_get_structure (caps, 0)); mimetype = gst_structure_get_name (gst_caps_get_structure (caps, 0));