From afea379ffdd1873b49ced2ddc43f3f63a0e4d9d3 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 17 Oct 2005 13:46:22 +0000 Subject: [PATCH] gst/tcp/gstmultifdsink.c: Convert to use the boilerplate macro. Original commit message from CVS: 2005-10-17 Andy Wingo * gst/tcp/gstmultifdsink.c: Convert to use the boilerplate macro. * gst/tcp/gsttcp.c (gst_tcp_socket_read): Comment update. --- ChangeLog | 4 ++++ gst/tcp/gstmultifdsink.c | 37 ++++------------------------------- gst/tcp/gsttcp.c | 7 ++----- gst/tcp/gsttcpserversink.c | 40 ++++---------------------------------- 4 files changed, 14 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index c21a0e4838..d8e0fc4bf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-10-17 Andy Wingo + * gst/tcp/gstmultifdsink.c: Convert to use the boilerplate macro. + + * gst/tcp/gsttcp.c (gst_tcp_socket_read): Comment update. + * ext/theora/theoraenc.c (theora_buffer_from_packet): Pass the alloc_buffer flow return to callers. (theora_enc_chain, theora_enc_chain): Adapt to buffer_from_packet diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c index bd81b53b52..a3ebccd5bc 100644 --- a/gst/tcp/gstmultifdsink.c +++ b/gst/tcp/gstmultifdsink.c @@ -218,9 +218,6 @@ gst_client_status_get_type (void) return client_status_type; } -static void gst_multifdsink_base_init (gpointer g_class); -static void gst_multifdsink_class_init (GstMultiFdSinkClass * klass); -static void gst_multifdsink_init (GstMultiFdSink * multifdsink); static void gst_multifdsink_finalize (GObject * object); static void gst_multifdsink_remove_client_link (GstMultiFdSink * sink, @@ -237,36 +234,12 @@ static void gst_multifdsink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstElementClass *parent_class = NULL; +GST_BOILERPLATE (GstMultiFdSink, gst_multifdsink, GstBaseSink, + GST_TYPE_BASE_SINK); + static guint gst_multifdsink_signals[LAST_SIGNAL] = { 0 }; -GType -gst_multifdsink_get_type (void) -{ - static GType multifdsink_type = 0; - - - if (!multifdsink_type) { - static const GTypeInfo multifdsink_info = { - sizeof (GstMultiFdSinkClass), - gst_multifdsink_base_init, - NULL, - (GClassInitFunc) gst_multifdsink_class_init, - NULL, - NULL, - sizeof (GstMultiFdSink), - 0, - (GInstanceInitFunc) gst_multifdsink_init, - NULL - }; - - multifdsink_type = - g_type_register_static (GST_TYPE_BASE_SINK, "GstMultiFdSink", - &multifdsink_info, 0); - } - return multifdsink_type; -} static void gst_multifdsink_base_init (gpointer g_class) @@ -290,8 +263,6 @@ gst_multifdsink_class_init (GstMultiFdSinkClass * klass) gstelement_class = (GstElementClass *) klass; gstbasesink_class = (GstBaseSinkClass *) klass; - parent_class = g_type_class_ref (GST_TYPE_BASE_SINK); - gobject_class->set_property = gst_multifdsink_set_property; gobject_class->get_property = gst_multifdsink_get_property; gobject_class->finalize = gst_multifdsink_finalize; @@ -444,7 +415,7 @@ gst_multifdsink_class_init (GstMultiFdSinkClass * klass) } static void -gst_multifdsink_init (GstMultiFdSink * this) +gst_multifdsink_init (GstMultiFdSink * this, GstMultiFdSinkClass * klass) { GST_OBJECT_FLAG_UNSET (this, GST_MULTIFDSINK_OPEN); diff --git a/gst/tcp/gsttcp.c b/gst/tcp/gsttcp.c index 65dd0748da..26ce38271f 100644 --- a/gst/tcp/gsttcp.c +++ b/gst/tcp/gsttcp.c @@ -124,11 +124,8 @@ gst_tcp_socket_write (int socket, const void *buf, size_t count) return bytes_written; } -/* read number of bytes from a socket into a given buffer incrementally. - * Returns number of bytes read with same semantics as read(2): - * < 0: error, see errno - * = 0: EOF - * > 0: bytes read +/* atomically read count bytes into buf, cancellable. return val of GST_FLOW_OK + * indicates success, anything else is failure. */ static GstFlowReturn gst_tcp_socket_read (GstElement * this, int socket, void *buf, size_t count, diff --git a/gst/tcp/gsttcpserversink.c b/gst/tcp/gsttcpserversink.c index 5be2e1da31..6c3ed8cb7d 100644 --- a/gst/tcp/gsttcpserversink.c +++ b/gst/tcp/gsttcpserversink.c @@ -59,9 +59,6 @@ enum ARG_PORT, }; -static void gst_tcpserversink_base_init (gpointer g_class); -static void gst_tcpserversink_class_init (GstTCPServerSink * klass); -static void gst_tcpserversink_init (GstTCPServerSink * tcpserversink); static void gst_tcpserversink_finalize (GObject * gobject); static gboolean gst_tcpserversink_handle_wait (GstMultiFdSink * sink, @@ -76,34 +73,9 @@ static void gst_tcpserversink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstMultiFdSinkClass *parent_class = NULL; +GST_BOILERPLATE (GstTCPServerSink, gst_tcpserversink, GstMultiFdSink, + GST_TYPE_MULTIFDSINK); -GType -gst_tcpserversink_get_type (void) -{ - static GType tcpserversink_type = 0; - - - if (!tcpserversink_type) { - static const GTypeInfo tcpserversink_info = { - sizeof (GstTCPServerSinkClass), - gst_tcpserversink_base_init, - NULL, - (GClassInitFunc) gst_tcpserversink_class_init, - NULL, - NULL, - sizeof (GstTCPServerSink), - 0, - (GInstanceInitFunc) gst_tcpserversink_init, - NULL - }; - - tcpserversink_type = - g_type_register_static (GST_TYPE_MULTIFDSINK, "GstTCPServerSink", - &tcpserversink_info, 0); - } - return tcpserversink_type; -} static void gst_tcpserversink_base_init (gpointer g_class) @@ -114,18 +86,14 @@ gst_tcpserversink_base_init (gpointer g_class) } static void -gst_tcpserversink_class_init (GstTCPServerSink * klass) +gst_tcpserversink_class_init (GstTCPServerSinkClass * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; GstMultiFdSinkClass *gstmultifdsink_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; gstmultifdsink_class = (GstMultiFdSinkClass *) klass; - parent_class = g_type_class_ref (GST_TYPE_MULTIFDSINK); - gobject_class->set_property = gst_tcpserversink_set_property; gobject_class->get_property = gst_tcpserversink_get_property; gobject_class->finalize = gst_tcpserversink_finalize; @@ -146,7 +114,7 @@ gst_tcpserversink_class_init (GstTCPServerSink * klass) } static void -gst_tcpserversink_init (GstTCPServerSink * this) +gst_tcpserversink_init (GstTCPServerSink * this, GstTCPServerSinkClass * klass) { this->server_port = TCP_DEFAULT_PORT; /* should support as minimum 576 for IPV4 and 1500 for IPV6 */