2005-12-01 Thomas Vander Stichele <thomas at apestaart dot org>
+ * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_base_init),
+ (gst_multi_fd_sink_class_init), (gst_multi_fd_sink_init),
+ (gst_multi_fd_sink_finalize), (gst_multi_fd_sink_add),
+ (gst_multi_fd_sink_remove), (gst_multi_fd_sink_clear),
+ (gst_multi_fd_sink_get_stats),
+ (gst_multi_fd_sink_remove_client_link),
+ (gst_multi_fd_sink_handle_client_read),
+ (gst_multi_fd_sink_client_queue_data),
+ (gst_multi_fd_sink_client_queue_caps),
+ (gst_multi_fd_sink_client_queue_buffer),
+ (gst_multi_fd_sink_new_client),
+ (gst_multi_fd_sink_handle_client_write),
+ (gst_multi_fd_sink_recover_client),
+ (gst_multi_fd_sink_queue_buffer),
+ (gst_multi_fd_sink_handle_clients), (gst_multi_fd_sink_thread),
+ (gst_multi_fd_sink_render), (gst_multi_fd_sink_set_property),
+ (gst_multi_fd_sink_get_property), (gst_multi_fd_sink_start),
+ (gst_multi_fd_sink_stop), (gst_multi_fd_sink_change_state):
+ * gst/tcp/gstmultifdsink.h:
+ * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_get_type),
+ (gst_tcp_client_sink_base_init), (gst_tcp_client_sink_class_init),
+ (gst_tcp_client_sink_init), (gst_tcp_client_sink_finalize),
+ (gst_tcp_client_sink_setcaps), (gst_tcp_client_sink_render),
+ (gst_tcp_client_sink_set_property),
+ (gst_tcp_client_sink_get_property), (gst_tcp_client_sink_start),
+ (gst_tcp_client_sink_stop), (gst_tcp_client_sink_change_state):
+ * gst/tcp/gsttcpclientsink.h:
+ * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_base_init),
+ (gst_tcp_client_src_class_init), (gst_tcp_client_src_init),
+ (gst_tcp_client_src_finalize), (gst_tcp_client_src_getcaps),
+ (gst_tcp_client_src_create), (gst_tcp_client_src_set_property),
+ (gst_tcp_client_src_get_property), (gst_tcp_client_src_start),
+ (gst_tcp_client_src_stop), (gst_tcp_client_src_unlock):
+ * gst/tcp/gsttcpclientsrc.h:
+ * gst/tcp/gsttcpplugin.c: (plugin_init):
+ * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_base_init),
+ (gst_tcp_server_sink_class_init), (gst_tcp_server_sink_init),
+ (gst_tcp_server_sink_finalize),
+ (gst_tcp_server_sink_handle_server_read),
+ (gst_tcp_server_sink_removed), (gst_tcp_server_sink_handle_wait),
+ (gst_tcp_server_sink_set_property),
+ (gst_tcp_server_sink_get_property),
+ (gst_tcp_server_sink_init_send), (gst_tcp_server_sink_close):
+ * gst/tcp/gsttcpserversink.h:
+ * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_base_init),
+ (gst_tcp_server_src_class_init), (gst_tcp_server_src_init),
+ (gst_tcp_server_src_finalize), (gst_tcp_server_src_create),
+ (gst_tcp_server_src_set_property),
+ (gst_tcp_server_src_get_property), (gst_tcp_server_src_start),
+ (gst_tcp_server_src_stop), (gst_tcp_server_src_unlock):
+ * gst/tcp/gsttcpserversrc.h:
+ more borgifying
+
+2005-12-01 Thomas Vander Stichele <thomas at apestaart dot org>
+
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins.args:
* docs/plugins/inspect/plugin-libvisual.xml:
} G_STMT_END
/* elementfactory information */
-static GstElementDetails gst_multifdsink_details =
+static GstElementDetails gst_multi_fd_sink_details =
GST_ELEMENT_DETAILS ("MultiFd sink",
"Sink/Network",
"Send data to multiple filedescriptors",
return client_status_type;
}
-static void gst_multifdsink_finalize (GObject * object);
+static void gst_multi_fd_sink_finalize (GObject * object);
-static void gst_multifdsink_remove_client_link (GstMultiFdSink * sink,
+static void gst_multi_fd_sink_remove_client_link (GstMultiFdSink * sink,
GList * link);
-static GstFlowReturn gst_multifdsink_render (GstBaseSink * bsink,
+static GstFlowReturn gst_multi_fd_sink_render (GstBaseSink * bsink,
GstBuffer * buf);
-static GstStateChangeReturn gst_multifdsink_change_state (GstElement *
+static GstStateChangeReturn gst_multi_fd_sink_change_state (GstElement *
element, GstStateChange transition);
-static void gst_multifdsink_set_property (GObject * object, guint prop_id,
+static void gst_multi_fd_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_multifdsink_get_property (GObject * object, guint prop_id,
+static void gst_multi_fd_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-GST_BOILERPLATE (GstMultiFdSink, gst_multifdsink, GstBaseSink,
+GST_BOILERPLATE (GstMultiFdSink, gst_multi_fd_sink, GstBaseSink,
GST_TYPE_BASE_SINK);
-static guint gst_multifdsink_signals[LAST_SIGNAL] = { 0 };
+static guint gst_multi_fd_sink_signals[LAST_SIGNAL] = { 0 };
static void
-gst_multifdsink_base_init (gpointer g_class)
+gst_multi_fd_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 (&sinktemplate));
- gst_element_class_set_details (element_class, &gst_multifdsink_details);
+ gst_element_class_set_details (element_class, &gst_multi_fd_sink_details);
}
static void
-gst_multifdsink_class_init (GstMultiFdSinkClass * klass)
+gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass;
- gobject_class->set_property = gst_multifdsink_set_property;
- gobject_class->get_property = gst_multifdsink_get_property;
- gobject_class->finalize = gst_multifdsink_finalize;
+ gobject_class->set_property = gst_multi_fd_sink_set_property;
+ gobject_class->get_property = gst_multi_fd_sink_get_property;
+ gobject_class->finalize = gst_multi_fd_sink_finalize;
g_object_class_install_property (gobject_class, ARG_PROTOCOL,
g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
*
* Hand the given open file descriptor to multifdsink to write to.
*/
- gst_multifdsink_signals[SIGNAL_ADD] =
+ gst_multi_fd_sink_signals[SIGNAL_ADD] =
g_signal_new ("add", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMultiFdSinkClass, add),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
*
* Remove the given open file descriptor from multifdsink.
*/
- gst_multifdsink_signals[SIGNAL_REMOVE] =
+ gst_multi_fd_sink_signals[SIGNAL_REMOVE] =
g_signal_new ("remove", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMultiFdSinkClass, remove),
NULL, NULL, gst_tcp_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
*
* Clear all file descriptors from multifdsink.
*/
- gst_multifdsink_signals[SIGNAL_CLEAR] =
+ gst_multi_fd_sink_signals[SIGNAL_CLEAR] =
g_signal_new ("clear", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMultiFdSinkClass, clear),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- gst_multifdsink_signals[SIGNAL_GET_STATS] =
+ gst_multi_fd_sink_signals[SIGNAL_GET_STATS] =
g_signal_new ("get-stats", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMultiFdSinkClass, get_stats),
NULL, NULL, gst_tcp_marshal_BOXED__INT, G_TYPE_VALUE_ARRAY, 1,
*
* The given file descriptor was added to multifdsink.
*/
- gst_multifdsink_signals[SIGNAL_CLIENT_ADDED] =
+ gst_multi_fd_sink_signals[SIGNAL_CLIENT_ADDED] =
g_signal_new ("client-added", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMultiFdSinkClass, client_added),
NULL, NULL, gst_tcp_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
*
* The given file descriptor was removed from multifdsink.
*/
- gst_multifdsink_signals[SIGNAL_CLIENT_REMOVED] =
+ gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED] =
g_signal_new ("client-removed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMultiFdSinkClass,
client_removed), NULL, NULL, gst_tcp_marshal_VOID__INT_BOXED,
G_TYPE_NONE, 2, G_TYPE_INT, GST_TYPE_CLIENT_STATUS);
gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_multifdsink_change_state);
+ GST_DEBUG_FUNCPTR (gst_multi_fd_sink_change_state);
- gstbasesink_class->render = gst_multifdsink_render;
+ gstbasesink_class->render = gst_multi_fd_sink_render;
- klass->add = gst_multifdsink_add;
- klass->remove = gst_multifdsink_remove;
- klass->clear = gst_multifdsink_clear;
- klass->get_stats = gst_multifdsink_get_stats;
+ klass->add = gst_multi_fd_sink_add;
+ klass->remove = gst_multi_fd_sink_remove;
+ klass->clear = gst_multi_fd_sink_clear;
+ klass->get_stats = gst_multi_fd_sink_get_stats;
GST_DEBUG_CATEGORY_INIT (multifdsink_debug, "multifdsink", 0, "FD sink");
}
static void
-gst_multifdsink_init (GstMultiFdSink * this, GstMultiFdSinkClass * klass)
+gst_multi_fd_sink_init (GstMultiFdSink * this, GstMultiFdSinkClass * klass)
{
- GST_OBJECT_FLAG_UNSET (this, GST_MULTIFDSINK_OPEN);
+ GST_OBJECT_FLAG_UNSET (this, GST_MULTI_FD_SINK_OPEN);
this->protocol = DEFAULT_PROTOCOL;
this->mode = DEFAULT_MODE;
}
static void
-gst_multifdsink_finalize (GObject * object)
+gst_multi_fd_sink_finalize (GObject * object)
{
GstMultiFdSink *this;
- this = GST_MULTIFDSINK (object);
+ this = GST_MULTI_FD_SINK (object);
CLIENTS_LOCK_FREE (this);
g_hash_table_destroy (this->fd_hash);
}
void
-gst_multifdsink_add (GstMultiFdSink * sink, int fd)
+gst_multi_fd_sink_add (GstMultiFdSink * sink, int fd)
{
GstTCPClient *client;
GList *clink;
CLIENTS_UNLOCK (sink);
GST_WARNING_OBJECT (sink, "[fd %5d] duplicate client found, refusing", fd);
g_signal_emit (G_OBJECT (sink),
- gst_multifdsink_signals[SIGNAL_CLIENT_REMOVED], 0, fd, client->status);
+ gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED], 0, fd,
+ client->status);
g_free (client);
return;
}
CLIENTS_UNLOCK (sink);
g_signal_emit (G_OBJECT (sink),
- gst_multifdsink_signals[SIGNAL_CLIENT_ADDED], 0, fd);
+ gst_multi_fd_sink_signals[SIGNAL_CLIENT_ADDED], 0, fd);
}
void
-gst_multifdsink_remove (GstMultiFdSink * sink, int fd)
+gst_multi_fd_sink_remove (GstMultiFdSink * sink, int fd)
{
GList *clink;
GstTCPClient *client = (GstTCPClient *) clink->data;
client->status = GST_CLIENT_STATUS_REMOVED;
- gst_multifdsink_remove_client_link (sink, clink);
+ gst_multi_fd_sink_remove_client_link (sink, clink);
SEND_COMMAND (sink, CONTROL_RESTART);
} else {
GST_WARNING_OBJECT (sink, "[fd %5d] no client with this fd found!", fd);
}
void
-gst_multifdsink_clear (GstMultiFdSink * sink)
+gst_multi_fd_sink_clear (GstMultiFdSink * sink)
{
GList *clients, *next;
next = g_list_next (clients);
client->status = GST_CLIENT_STATUS_REMOVED;
- gst_multifdsink_remove_client_link (sink, clients);
+ gst_multi_fd_sink_remove_client_link (sink, clients);
}
SEND_COMMAND (sink, CONTROL_RESTART);
CLIENTS_UNLOCK (sink);
}
GValueArray *
-gst_multifdsink_get_stats (GstMultiFdSink * sink, int fd)
+gst_multi_fd_sink_get_stats (GstMultiFdSink * sink, int fd)
{
GstTCPClient *client;
GValueArray *result = NULL;
* close the fd itself.
*/
static void
-gst_multifdsink_remove_client_link (GstMultiFdSink * sink, GList * link)
+gst_multi_fd_sink_remove_client_link (GstMultiFdSink * sink, GList * link)
{
int fd;
GTimeVal now;
GstTCPClient *client = (GstTCPClient *) link->data;
GstMultiFdSinkClass *fclass;
- fclass = GST_MULTIFDSINK_GET_CLASS (sink);
+ fclass = GST_MULTI_FD_SINK_GET_CLASS (sink);
fd = client->fd.fd;
CLIENTS_UNLOCK (sink);
g_signal_emit (G_OBJECT (sink),
- gst_multifdsink_signals[SIGNAL_CLIENT_REMOVED], 0, fd, client->status);
+ gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED], 0, fd, client->status);
/* lock again before we remove the client completely */
CLIENTS_LOCK (sink);
* which either indicates a close or should be ignored
* returns FALSE if some error occured or the client closed. */
static gboolean
-gst_multifdsink_handle_client_read (GstMultiFdSink * sink,
+gst_multi_fd_sink_handle_client_read (GstMultiFdSink * sink,
GstTCPClient * client)
{
int avail, fd;
* setting it as GST_BUFFER_MALLOCDATA() on the created buffer
*/
static gboolean
-gst_multifdsink_client_queue_data (GstMultiFdSink * sink, GstTCPClient * client,
- gchar * data, gint len)
+gst_multi_fd_sink_client_queue_data (GstMultiFdSink * sink,
+ GstTCPClient * client, gchar * data, gint len)
{
GstBuffer *buf;
}
static gboolean
-gst_multifdsink_client_queue_caps (GstMultiFdSink * sink, GstTCPClient * client,
- const GstCaps * caps)
+gst_multi_fd_sink_client_queue_caps (GstMultiFdSink * sink,
+ GstTCPClient * client, const GstCaps * caps)
{
guint8 *header;
guint8 *payload;
GST_DEBUG_OBJECT (sink, "Could not create GDP packet from caps");
return FALSE;
}
- gst_multifdsink_client_queue_data (sink, client, (gchar *) header, length);
+ gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header, length);
length = gst_dp_header_payload_length (header);
- gst_multifdsink_client_queue_data (sink, client, (gchar *) payload, length);
+ gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) payload, length);
return TRUE;
}
}
static gboolean
-gst_multifdsink_client_queue_buffer (GstMultiFdSink * sink,
+gst_multi_fd_sink_client_queue_buffer (GstMultiFdSink * sink,
GstTCPClient * client, GstBuffer * buffer)
{
if (sink->protocol == GST_TCP_PROTOCOL_GDP) {
"[fd %5d] could not create header, removing client", client->fd.fd);
return FALSE;
}
- gst_multifdsink_client_queue_data (sink, client, (gchar *) header, len);
+ gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header, len);
}
GST_LOG_OBJECT (sink, "[fd %5d] queueing buffer of length %d",
}
static gint
-gst_multifdsink_new_client (GstMultiFdSink * sink, GstTCPClient * client)
+gst_multi_fd_sink_new_client (GstMultiFdSink * sink, GstTCPClient * client)
{
gint result;
* This functions returns FALSE if some error occured.
*/
static gboolean
-gst_multifdsink_handle_client_write (GstMultiFdSink * sink,
+gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
GstTCPClient * client)
{
int fd = client->fd.fd;
gst_object_unref (peer);
/* queue caps for sending */
- res = gst_multifdsink_client_queue_caps (sink, client, caps);
+ res = gst_multi_fd_sink_client_queue_caps (sink, client, caps);
gst_caps_unref (caps);
for (l = sink->streamheader; l; l = l->next) {
/* queue stream headers for sending */
res =
- gst_multifdsink_client_queue_buffer (sink, client,
+ gst_multi_fd_sink_client_queue_buffer (sink, client,
GST_BUFFER (l->data));
if (!res) {
GST_DEBUG_OBJECT (sink,
/* for new connections, we need to find a good spot in the
* bufqueue to start streaming from */
if (client->new_connection) {
- gint position = gst_multifdsink_new_client (sink, client);
+ gint position = gst_multi_fd_sink_new_client (sink, client);
if (position >= 0) {
/* we got a valid spot in the queue */
fd, client, client->bufpos);
/* queueing a buffer will ref it */
- gst_multifdsink_client_queue_buffer (sink, client, buf);
+ gst_multi_fd_sink_client_queue_buffer (sink, client, buf);
/* need to start from the first byte for this new buffer */
client->bufoffset = 0;
* position.
*/
static gint
-gst_multifdsink_recover_client (GstMultiFdSink * sink, GstTCPClient * client)
+gst_multi_fd_sink_recover_client (GstMultiFdSink * sink, GstTCPClient * client)
{
gint newbufpos;
*
*/
static void
-gst_multifdsink_queue_buffer (GstMultiFdSink * sink, GstBuffer * buf)
+gst_multi_fd_sink_queue_buffer (GstMultiFdSink * sink, GstBuffer * buf)
{
GList *clients, *next;
gint queuelen;
if (sink->units_soft_max > 0 && client->bufpos >= sink->units_soft_max) {
gint newpos;
- newpos = gst_multifdsink_recover_client (sink, client);
+ newpos = gst_multi_fd_sink_recover_client (sink, client);
if (newpos != client->bufpos) {
client->bufpos = newpos;
client->discont = TRUE;
/* remove the client, the fd set will be cleared and the select thread will
* be signaled */
client->status = GST_CLIENT_STATUS_SLOW;
- gst_multifdsink_remove_client_link (sink, clients);
+ gst_multi_fd_sink_remove_client_link (sink, clients);
/* set client to invalid position while being removed */
client->bufpos = -1;
need_signal = TRUE;
* garbage list and removed.
*/
static void
-gst_multifdsink_handle_clients (GstMultiFdSink * sink)
+gst_multi_fd_sink_handle_clients (GstMultiFdSink * sink)
{
int result;
GList *clients, *next;
gboolean try_again;
GstMultiFdSinkClass *fclass;
- fclass = GST_MULTIFDSINK_GET_CLASS (sink);
+ fclass = GST_MULTI_FD_SINK_GET_CLASS (sink);
do {
gboolean stop = FALSE;
fd, g_strerror (errno), errno);
if (errno == EBADF) {
client->status = GST_CLIENT_STATUS_ERROR;
- gst_multifdsink_remove_client_link (sink, clients);
+ gst_multi_fd_sink_remove_client_link (sink, clients);
}
}
}
next = g_list_next (clients);
if (client->status != GST_CLIENT_STATUS_OK) {
- gst_multifdsink_remove_client_link (sink, clients);
+ gst_multi_fd_sink_remove_client_link (sink, clients);
continue;
}
if (gst_fdset_fd_has_closed (sink->fdset, &client->fd)) {
client->status = GST_CLIENT_STATUS_CLOSED;
- gst_multifdsink_remove_client_link (sink, clients);
+ gst_multi_fd_sink_remove_client_link (sink, clients);
continue;
}
if (gst_fdset_fd_has_error (sink->fdset, &client->fd)) {
GST_WARNING_OBJECT (sink, "gst_fdset_fd_has_error for %d", client->fd);
client->status = GST_CLIENT_STATUS_ERROR;
- gst_multifdsink_remove_client_link (sink, clients);
+ gst_multi_fd_sink_remove_client_link (sink, clients);
continue;
}
if (gst_fdset_fd_can_read (sink->fdset, &client->fd)) {
/* handle client read */
- if (!gst_multifdsink_handle_client_read (sink, client)) {
- gst_multifdsink_remove_client_link (sink, clients);
+ if (!gst_multi_fd_sink_handle_client_read (sink, client)) {
+ gst_multi_fd_sink_remove_client_link (sink, clients);
continue;
}
}
if (gst_fdset_fd_can_write (sink->fdset, &client->fd)) {
/* handle client write */
- if (!gst_multifdsink_handle_client_write (sink, client)) {
- gst_multifdsink_remove_client_link (sink, clients);
+ if (!gst_multi_fd_sink_handle_client_write (sink, client)) {
+ gst_multi_fd_sink_remove_client_link (sink, clients);
continue;
}
}
/* we handle the client communication in another thread so that we do not block
* the gstreamer thread while we select() on the client fds */
static gpointer
-gst_multifdsink_thread (GstMultiFdSink * sink)
+gst_multi_fd_sink_thread (GstMultiFdSink * sink)
{
while (sink->running) {
- gst_multifdsink_handle_clients (sink);
+ gst_multi_fd_sink_handle_clients (sink);
}
return NULL;
}
static GstFlowReturn
-gst_multifdsink_render (GstBaseSink * bsink, GstBuffer * buf)
+gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
{
GstMultiFdSink *sink;
- sink = GST_MULTIFDSINK (bsink);
+ sink = GST_MULTI_FD_SINK (bsink);
/* since we keep this buffer out of the scope of this method */
gst_buffer_ref (buf);
- g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_MULTIFDSINK_OPEN),
+ g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_MULTI_FD_SINK_OPEN),
GST_FLOW_ERROR);
GST_LOG_OBJECT (sink, "received buffer %p", buf);
sink->previous_buffer_in_caps = FALSE;
/* queue the buffer */
- gst_multifdsink_queue_buffer (sink, buf);
+ gst_multi_fd_sink_queue_buffer (sink, buf);
sink->bytes_to_serve += GST_BUFFER_SIZE (buf);
}
static void
-gst_multifdsink_set_property (GObject * object, guint prop_id,
+gst_multi_fd_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMultiFdSink *multifdsink;
- g_return_if_fail (GST_IS_MULTIFDSINK (object));
- multifdsink = GST_MULTIFDSINK (object);
+ g_return_if_fail (GST_IS_MULTI_FD_SINK (object));
+ multifdsink = GST_MULTI_FD_SINK (object);
switch (prop_id) {
case ARG_PROTOCOL:
}
static void
-gst_multifdsink_get_property (GObject * object, guint prop_id, GValue * value,
+gst_multi_fd_sink_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMultiFdSink *multifdsink;
- g_return_if_fail (GST_IS_MULTIFDSINK (object));
- multifdsink = GST_MULTIFDSINK (object);
+ g_return_if_fail (GST_IS_MULTI_FD_SINK (object));
+ multifdsink = GST_MULTI_FD_SINK (object);
switch (prop_id) {
case ARG_PROTOCOL:
/* create a socket for sending to remote machine */
static gboolean
-gst_multifdsink_start (GstBaseSink * bsink)
+gst_multi_fd_sink_start (GstBaseSink * bsink)
{
GstMultiFdSinkClass *fclass;
int control_socket[2];
GstMultiFdSink *this;
- if (GST_OBJECT_FLAG_IS_SET (bsink, GST_MULTIFDSINK_OPEN))
+ if (GST_OBJECT_FLAG_IS_SET (bsink, GST_MULTI_FD_SINK_OPEN))
return TRUE;
- this = GST_MULTIFDSINK (bsink);
- fclass = GST_MULTIFDSINK_GET_CLASS (this);
+ this = GST_MULTI_FD_SINK (bsink);
+ fclass = GST_MULTI_FD_SINK_GET_CLASS (this);
GST_INFO_OBJECT (this, "starting in mode %d", this->mode);
this->fdset = gst_fdset_new (this->mode);
}
this->running = TRUE;
- this->thread = g_thread_create ((GThreadFunc) gst_multifdsink_thread,
+ this->thread = g_thread_create ((GThreadFunc) gst_multi_fd_sink_thread,
this, TRUE, NULL);
- GST_OBJECT_FLAG_SET (this, GST_MULTIFDSINK_OPEN);
+ GST_OBJECT_FLAG_SET (this, GST_MULTI_FD_SINK_OPEN);
return TRUE;
}
static gboolean
-gst_multifdsink_stop (GstBaseSink * bsink)
+gst_multi_fd_sink_stop (GstBaseSink * bsink)
{
GstMultiFdSinkClass *fclass;
GstMultiFdSink *this;
- this = GST_MULTIFDSINK (bsink);
- fclass = GST_MULTIFDSINK_GET_CLASS (this);
+ this = GST_MULTI_FD_SINK (bsink);
+ fclass = GST_MULTI_FD_SINK_GET_CLASS (this);
- if (!GST_OBJECT_FLAG_IS_SET (bsink, GST_MULTIFDSINK_OPEN))
+ if (!GST_OBJECT_FLAG_IS_SET (bsink, GST_MULTI_FD_SINK_OPEN))
return TRUE;
this->running = FALSE;
}
/* free the clients */
- gst_multifdsink_clear (this);
+ gst_multi_fd_sink_clear (this);
close (READ_SOCKET (this).fd);
close (WRITE_SOCKET (this).fd);
this->fdset = NULL;
}
g_hash_table_foreach_remove (this->fd_hash, multifdsink_hash_remove, this);
- GST_OBJECT_FLAG_UNSET (this, GST_MULTIFDSINK_OPEN);
+ GST_OBJECT_FLAG_UNSET (this, GST_MULTI_FD_SINK_OPEN);
return TRUE;
}
static GstStateChangeReturn
-gst_multifdsink_change_state (GstElement * element, GstStateChange transition)
+gst_multi_fd_sink_change_state (GstElement * element, GstStateChange transition)
{
GstMultiFdSink *sink;
GstStateChangeReturn ret;
- sink = GST_MULTIFDSINK (element);
+ sink = GST_MULTI_FD_SINK (element);
/* we disallow changing the state from the streaming thread */
if (g_thread_self () == sink->thread)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
- if (!gst_multifdsink_start (GST_BASE_SINK (sink)))
+ if (!gst_multi_fd_sink_start (GST_BASE_SINK (sink)))
goto start_failed;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_multifdsink_stop (GST_BASE_SINK (sink));
+ gst_multi_fd_sink_stop (GST_BASE_SINK (sink));
break;
default:
break;
*/
-#ifndef __GST_MULTIFDSINK_H__
-#define __GST_MULTIFDSINK_H__
+#ifndef __GST_MULTI_FD_SINK_H__
+#define __GST_MULTI_FD_SINK_H__
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include "gsttcp.h"
#include "gstfdset.h"
-#define GST_TYPE_MULTIFDSINK \
- (gst_multifdsink_get_type())
-#define GST_MULTIFDSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MULTIFDSINK,GstMultiFdSink))
-#define GST_MULTIFDSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MULTIFDSINK,GstMultiFdSink))
-#define GST_IS_MULTIFDSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MULTIFDSINK))
-#define GST_IS_MULTIFDSINK_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTIFDSINK))
-#define GST_MULTIFDSINK_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MULTIFDSINK, GstMultiFdSinkClass))
+#define GST_TYPE_MULTI_FD_SINK \
+ (gst_multi_fd_sink_get_type())
+#define GST_MULTI_FD_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MULTI_FD_SINK,GstMultiFdSink))
+#define GST_MULTI_FD_SINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MULTI_FD_SINK,GstMultiFdSink))
+#define GST_IS_MULTI_FD_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MULTI_FD_SINK))
+#define GST_IS_MULTI_FD_SINK_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTI_FD_SINK))
+#define GST_MULTI_FD_SINK_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MULTI_FD_SINK, GstMultiFdSinkClass))
typedef struct _GstMultiFdSink GstMultiFdSink;
typedef struct _GstMultiFdSinkClass GstMultiFdSinkClass;
typedef enum {
- GST_MULTIFDSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
+ GST_MULTI_FD_SINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- GST_MULTIFDSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
+ GST_MULTI_FD_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
} GstMultiFdSinkFlags;
typedef enum
void (*client_removed) (GstElement *element, gchar *host, gint fd);
};
-GType gst_multifdsink_get_type (void);
+GType gst_multi_fd_sink_get_type (void);
-void gst_multifdsink_add (GstMultiFdSink *sink, int fd);
-void gst_multifdsink_remove (GstMultiFdSink *sink, int fd);
-void gst_multifdsink_clear (GstMultiFdSink *sink);
-GValueArray* gst_multifdsink_get_stats (GstMultiFdSink *sink, int fd);
+void gst_multi_fd_sink_add (GstMultiFdSink *sink, int fd);
+void gst_multi_fd_sink_remove (GstMultiFdSink *sink, int fd);
+void gst_multi_fd_sink_clear (GstMultiFdSink *sink);
+GValueArray* gst_multi_fd_sink_get_stats (GstMultiFdSink *sink, int fd);
G_END_DECLS
-#endif /* __GST_MULTIFDSINK_H__ */
+#endif /* __GST_MULTI_FD_SINK_H__ */
#include "gsttcpclientsink.h"
/* elementfactory information */
-static GstElementDetails gst_tcpclientsink_details =
+static GstElementDetails gst_tcp_client_sink_details =
GST_ELEMENT_DETAILS ("TCP Client sink",
"Sink/Network",
"Send data as a client over the network via TCP",
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
-static void gst_tcpclientsink_base_init (gpointer g_class);
-static void gst_tcpclientsink_class_init (GstTCPClientSink * klass);
-static void gst_tcpclientsink_init (GstTCPClientSink * tcpclientsink);
-static void gst_tcpclientsink_finalize (GObject * gobject);
+static void gst_tcp_client_sink_base_init (gpointer g_class);
+static void gst_tcp_client_sink_class_init (GstTCPClientSink * klass);
+static void gst_tcp_client_sink_init (GstTCPClientSink * tcpclientsink);
+static void gst_tcp_client_sink_finalize (GObject * gobject);
-static gboolean gst_tcpclientsink_setcaps (GstBaseSink * bsink, GstCaps * caps);
-static GstFlowReturn gst_tcpclientsink_render (GstBaseSink * bsink,
+static gboolean gst_tcp_client_sink_setcaps (GstBaseSink * bsink,
+ GstCaps * caps);
+static GstFlowReturn gst_tcp_client_sink_render (GstBaseSink * bsink,
GstBuffer * buf);
-static GstStateChangeReturn gst_tcpclientsink_change_state (GstElement *
+static GstStateChangeReturn gst_tcp_client_sink_change_state (GstElement *
element, GstStateChange transition);
-static void gst_tcpclientsink_set_property (GObject * object, guint prop_id,
+static void gst_tcp_client_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_tcpclientsink_get_property (GObject * object, guint prop_id,
+static void gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
-/*static guint gst_tcpclientsink_signals[LAST_SIGNAL] = { 0 }; */
+/*static guint gst_tcp_client_sink_signals[LAST_SIGNAL] = { 0 }; */
GType
-gst_tcpclientsink_get_type (void)
+gst_tcp_client_sink_get_type (void)
{
static GType tcpclientsink_type = 0;
if (!tcpclientsink_type) {
static const GTypeInfo tcpclientsink_info = {
sizeof (GstTCPClientSinkClass),
- gst_tcpclientsink_base_init,
+ gst_tcp_client_sink_base_init,
NULL,
- (GClassInitFunc) gst_tcpclientsink_class_init,
+ (GClassInitFunc) gst_tcp_client_sink_class_init,
NULL,
NULL,
sizeof (GstTCPClientSink),
0,
- (GInstanceInitFunc) gst_tcpclientsink_init,
+ (GInstanceInitFunc) gst_tcp_client_sink_init,
NULL
};
}
static void
-gst_tcpclientsink_base_init (gpointer g_class)
+gst_tcp_client_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 (&sinktemplate));
- gst_element_class_set_details (element_class, &gst_tcpclientsink_details);
+ gst_element_class_set_details (element_class, &gst_tcp_client_sink_details);
}
static void
-gst_tcpclientsink_class_init (GstTCPClientSink * klass)
+gst_tcp_client_sink_class_init (GstTCPClientSink * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
parent_class = g_type_class_ref (GST_TYPE_BASE_SINK);
- gobject_class->set_property = gst_tcpclientsink_set_property;
- gobject_class->get_property = gst_tcpclientsink_get_property;
- gobject_class->finalize = gst_tcpclientsink_finalize;
+ gobject_class->set_property = gst_tcp_client_sink_set_property;
+ gobject_class->get_property = gst_tcp_client_sink_get_property;
+ gobject_class->finalize = gst_tcp_client_sink_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST,
g_param_spec_string ("host", "Host", "The host/IP to send the packets to",
g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE, G_PARAM_READWRITE));
- gstelement_class->change_state = gst_tcpclientsink_change_state;
+ gstelement_class->change_state = gst_tcp_client_sink_change_state;
- gstbasesink_class->set_caps = gst_tcpclientsink_setcaps;
- gstbasesink_class->render = gst_tcpclientsink_render;
+ gstbasesink_class->set_caps = gst_tcp_client_sink_setcaps;
+ gstbasesink_class->render = gst_tcp_client_sink_render;
GST_DEBUG_CATEGORY_INIT (tcpclientsink_debug, "tcpclientsink", 0, "TCP sink");
}
static void
-gst_tcpclientsink_init (GstTCPClientSink * this)
+gst_tcp_client_sink_init (GstTCPClientSink * this)
{
this->host = g_strdup (TCP_DEFAULT_HOST);
this->port = TCP_DEFAULT_PORT;
this->sock_fd = -1;
this->protocol = GST_TCP_PROTOCOL_NONE;
- GST_OBJECT_FLAG_UNSET (this, GST_TCPCLIENTSINK_OPEN);
+ GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SINK_OPEN);
}
static void
-gst_tcpclientsink_finalize (GObject * gobject)
+gst_tcp_client_sink_finalize (GObject * gobject)
{
- GstTCPClientSink *this = GST_TCPCLIENTSINK (gobject);
+ GstTCPClientSink *this = GST_TCP_CLIENT_SINK (gobject);
g_free (this->host);
}
static gboolean
-gst_tcpclientsink_setcaps (GstBaseSink * bsink, GstCaps * caps)
+gst_tcp_client_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
{
GstTCPClientSink *sink;
- sink = GST_TCPCLIENTSINK (bsink);
+ sink = GST_TCP_CLIENT_SINK (bsink);
/* write the buffer header if we have one */
switch (sink->protocol) {
}
static GstFlowReturn
-gst_tcpclientsink_render (GstBaseSink * bsink, GstBuffer * buf)
+gst_tcp_client_sink_render (GstBaseSink * bsink, GstBuffer * buf)
{
size_t wrote = 0;
GstTCPClientSink *sink;
gint size;
- sink = GST_TCPCLIENTSINK (bsink);
+ sink = GST_TCP_CLIENT_SINK (bsink);
- g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_TCPCLIENTSINK_OPEN),
+ g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_TCP_CLIENT_SINK_OPEN),
GST_FLOW_WRONG_STATE);
size = GST_BUFFER_SIZE (buf);
}
static void
-gst_tcpclientsink_set_property (GObject * object, guint prop_id,
+gst_tcp_client_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstTCPClientSink *tcpclientsink;
- g_return_if_fail (GST_IS_TCPCLIENTSINK (object));
- tcpclientsink = GST_TCPCLIENTSINK (object);
+ g_return_if_fail (GST_IS_TCP_CLIENT_SINK (object));
+ tcpclientsink = GST_TCP_CLIENT_SINK (object);
switch (prop_id) {
case ARG_HOST:
}
static void
-gst_tcpclientsink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
+gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstTCPClientSink *tcpclientsink;
- g_return_if_fail (GST_IS_TCPCLIENTSINK (object));
- tcpclientsink = GST_TCPCLIENTSINK (object);
+ g_return_if_fail (GST_IS_TCP_CLIENT_SINK (object));
+ tcpclientsink = GST_TCP_CLIENT_SINK (object);
switch (prop_id) {
case ARG_HOST:
/* create a socket for sending to remote machine */
static gboolean
-gst_tcpclientsink_start (GstTCPClientSink * this)
+gst_tcp_client_sink_start (GstTCPClientSink * this)
{
int ret;
gchar *ip;
- if (GST_OBJECT_FLAG_IS_SET (this, GST_TCPCLIENTSINK_OPEN))
+ if (GST_OBJECT_FLAG_IS_SET (this, GST_TCP_CLIENT_SINK_OPEN))
return TRUE;
/* reset caps_sent flag */
}
}
- GST_OBJECT_FLAG_SET (this, GST_TCPCLIENTSINK_OPEN);
+ GST_OBJECT_FLAG_SET (this, GST_TCP_CLIENT_SINK_OPEN);
this->data_written = 0;
}
static gboolean
-gst_tcpclientsink_stop (GstTCPClientSink * this)
+gst_tcp_client_sink_stop (GstTCPClientSink * this)
{
- if (!GST_OBJECT_FLAG_IS_SET (this, GST_TCPCLIENTSINK_OPEN))
+ if (!GST_OBJECT_FLAG_IS_SET (this, GST_TCP_CLIENT_SINK_OPEN))
return TRUE;
if (this->sock_fd != -1) {
this->sock_fd = -1;
}
- GST_OBJECT_FLAG_UNSET (this, GST_TCPCLIENTSINK_OPEN);
+ GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SINK_OPEN);
return TRUE;
}
static GstStateChangeReturn
-gst_tcpclientsink_change_state (GstElement * element, GstStateChange transition)
+gst_tcp_client_sink_change_state (GstElement * element,
+ GstStateChange transition)
{
GstTCPClientSink *sink;
GstStateChangeReturn res;
- sink = GST_TCPCLIENTSINK (element);
+ sink = GST_TCP_CLIENT_SINK (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (!gst_tcpclientsink_start (GST_TCPCLIENTSINK (element)))
+ if (!gst_tcp_client_sink_start (GST_TCP_CLIENT_SINK (element)))
goto start_failure;
break;
default:
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_tcpclientsink_stop (GST_TCPCLIENTSINK (element));
+ gst_tcp_client_sink_stop (GST_TCP_CLIENT_SINK (element));
default:
break;
}
*/
-#ifndef __GST_TCPCLIENTSINK_H__
-#define __GST_TCPCLIENTSINK_H__
+#ifndef __GST_TCP_CLIENT_SINK_H__
+#define __GST_TCP_CLIENT_SINK_H__
#include <gst/gst.h>
#include <arpa/inet.h>
#include "gsttcp.h"
-#define GST_TYPE_TCPCLIENTSINK \
- (gst_tcpclientsink_get_type())
-#define GST_TCPCLIENTSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCPCLIENTSINK,GstTCPClientSink))
-#define GST_TCPCLIENTSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCPCLIENTSINK,GstTCPClientSink))
-#define GST_IS_TCPCLIENTSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCPCLIENTSINK))
-#define GST_IS_TCPCLIENTSINK_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCPCLIENTSINK))
+#define GST_TYPE_TCP_CLIENT_SINK \
+ (gst_tcp_client_sink_get_type())
+#define GST_TCP_CLIENT_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_CLIENT_SINK,GstTCPClientSink))
+#define GST_TCP_CLIENT_SINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_CLIENT_SINK,GstTCPClientSink))
+#define GST_IS_TCP_CLIENT_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_CLIENT_SINK))
+#define GST_IS_TCP_CLIENT_SINK_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_CLIENT_SINK))
typedef struct _GstTCPClientSink GstTCPClientSink;
typedef struct _GstTCPClientSinkClass GstTCPClientSinkClass;
typedef enum {
- GST_TCPCLIENTSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
+ GST_TCP_CLIENT_SINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- GST_TCPCLIENTSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
+ GST_TCP_CLIENT_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
} GstTCPClientSinkFlags;
struct _GstTCPClientSink {
GstBaseSinkClass parent_class;
};
-GType gst_tcpclientsink_get_type(void);
+GType gst_tcp_client_sink_get_type(void);
G_END_DECLS
-#endif /* __GST_TCPCLIENTSINK_H__ */
+#endif /* __GST_TCP_CLIENT_SINK_H__ */
#define MAX_READ_SIZE 4 * 1024
-static GstElementDetails gst_tcpclientsrc_details =
+static GstElementDetails gst_tcp_client_src_details =
GST_ELEMENT_DETAILS ("TCP Client source",
"Source/Network",
"Receive data as a client over the network via TCP",
};
-GST_BOILERPLATE (GstTCPClientSrc, gst_tcpclientsrc, GstPushSrc,
+GST_BOILERPLATE (GstTCPClientSrc, gst_tcp_client_src, GstPushSrc,
GST_TYPE_PUSH_SRC);
-static void gst_tcpclientsrc_finalize (GObject * gobject);
+static void gst_tcp_client_src_finalize (GObject * gobject);
-static GstCaps *gst_tcpclientsrc_getcaps (GstBaseSrc * psrc);
+static GstCaps *gst_tcp_client_src_getcaps (GstBaseSrc * psrc);
-static GstFlowReturn gst_tcpclientsrc_create (GstPushSrc * psrc,
+static GstFlowReturn gst_tcp_client_src_create (GstPushSrc * psrc,
GstBuffer ** outbuf);
-static gboolean gst_tcpclientsrc_stop (GstBaseSrc * bsrc);
-static gboolean gst_tcpclientsrc_start (GstBaseSrc * bsrc);
-static gboolean gst_tcpclientsrc_unlock (GstBaseSrc * bsrc);
+static gboolean gst_tcp_client_src_stop (GstBaseSrc * bsrc);
+static gboolean gst_tcp_client_src_start (GstBaseSrc * bsrc);
+static gboolean gst_tcp_client_src_unlock (GstBaseSrc * bsrc);
-static void gst_tcpclientsrc_set_property (GObject * object, guint prop_id,
+static void gst_tcp_client_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_tcpclientsrc_get_property (GObject * object, guint prop_id,
+static void gst_tcp_client_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
-gst_tcpclientsrc_base_init (gpointer g_class)
+gst_tcp_client_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 (&srctemplate));
- gst_element_class_set_details (element_class, &gst_tcpclientsrc_details);
+ gst_element_class_set_details (element_class, &gst_tcp_client_src_details);
}
static void
-gst_tcpclientsrc_class_init (GstTCPClientSrcClass * klass)
+gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
{
GObjectClass *gobject_class;
GstBaseSrcClass *gstbasesrc_class;
gstbasesrc_class = (GstBaseSrcClass *) klass;
gstpush_src_class = (GstPushSrcClass *) klass;
- gobject_class->set_property = gst_tcpclientsrc_set_property;
- gobject_class->get_property = gst_tcpclientsrc_get_property;
- gobject_class->finalize = gst_tcpclientsrc_finalize;
+ gobject_class->set_property = gst_tcp_client_src_set_property;
+ gobject_class->get_property = gst_tcp_client_src_get_property;
+ gobject_class->finalize = gst_tcp_client_src_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HOST,
g_param_spec_string ("host", "Host",
g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE, G_PARAM_READWRITE));
- gstbasesrc_class->get_caps = gst_tcpclientsrc_getcaps;
- gstbasesrc_class->start = gst_tcpclientsrc_start;
- gstbasesrc_class->stop = gst_tcpclientsrc_stop;
- gstbasesrc_class->unlock = gst_tcpclientsrc_unlock;
+ gstbasesrc_class->get_caps = gst_tcp_client_src_getcaps;
+ gstbasesrc_class->start = gst_tcp_client_src_start;
+ gstbasesrc_class->stop = gst_tcp_client_src_stop;
+ gstbasesrc_class->unlock = gst_tcp_client_src_unlock;
- gstpush_src_class->create = gst_tcpclientsrc_create;
+ gstpush_src_class->create = gst_tcp_client_src_create;
GST_DEBUG_CATEGORY_INIT (tcpclientsrc_debug, "tcpclientsrc", 0,
"TCP Client Source");
}
static void
-gst_tcpclientsrc_init (GstTCPClientSrc * this, GstTCPClientSrcClass * g_class)
+gst_tcp_client_src_init (GstTCPClientSrc * this, GstTCPClientSrcClass * g_class)
{
this->port = TCP_DEFAULT_PORT;
this->host = g_strdup (TCP_DEFAULT_HOST);
gst_base_src_set_live (GST_BASE_SRC (this), TRUE);
- GST_OBJECT_FLAG_UNSET (this, GST_TCPCLIENTSRC_OPEN);
+ GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SRC_OPEN);
}
static void
-gst_tcpclientsrc_finalize (GObject * gobject)
+gst_tcp_client_src_finalize (GObject * gobject)
{
- GstTCPClientSrc *this = GST_TCPCLIENTSRC (gobject);
+ GstTCPClientSrc *this = GST_TCP_CLIENT_SRC (gobject);
g_free (this->host);
}
static GstCaps *
-gst_tcpclientsrc_getcaps (GstBaseSrc * bsrc)
+gst_tcp_client_src_getcaps (GstBaseSrc * bsrc)
{
GstTCPClientSrc *src;
GstCaps *caps = NULL;
- src = GST_TCPCLIENTSRC (bsrc);
+ src = GST_TCP_CLIENT_SRC (bsrc);
- if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCPCLIENTSRC_OPEN))
+ if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_CLIENT_SRC_OPEN))
caps = gst_caps_new_any ();
else if (src->caps)
caps = gst_caps_copy (src->caps);
}
static GstFlowReturn
-gst_tcpclientsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf)
+gst_tcp_client_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
{
GstTCPClientSrc *src;
GstFlowReturn ret = GST_FLOW_OK;
- src = GST_TCPCLIENTSRC (psrc);
+ src = GST_TCP_CLIENT_SRC (psrc);
- if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCPCLIENTSRC_OPEN))
+ if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_CLIENT_SRC_OPEN))
goto wrong_state;
GST_LOG_OBJECT (src, "asked for a buffer");
}
static void
-gst_tcpclientsrc_set_property (GObject * object, guint prop_id,
+gst_tcp_client_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstTCPClientSrc *tcpclientsrc = GST_TCPCLIENTSRC (object);
+ GstTCPClientSrc *tcpclientsrc = GST_TCP_CLIENT_SRC (object);
switch (prop_id) {
case PROP_HOST:
}
static void
-gst_tcpclientsrc_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
+gst_tcp_client_src_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
- GstTCPClientSrc *tcpclientsrc = GST_TCPCLIENTSRC (object);
+ GstTCPClientSrc *tcpclientsrc = GST_TCP_CLIENT_SRC (object);
switch (prop_id) {
case PROP_HOST:
/* create a socket for connecting to remote server */
static gboolean
-gst_tcpclientsrc_start (GstBaseSrc * bsrc)
+gst_tcp_client_src_start (GstBaseSrc * bsrc)
{
int ret;
gchar *ip;
- GstTCPClientSrc *src = GST_TCPCLIENTSRC (bsrc);
+ GstTCPClientSrc *src = GST_TCP_CLIENT_SRC (bsrc);
/* create the control sockets before anything */
if (socketpair (PF_UNIX, SOCK_STREAM, 0, CONTROL_SOCKETS (src)) < 0)
GST_DEBUG_OBJECT (src, "opened receiving client socket with fd %d",
src->sock_fd);
- GST_OBJECT_FLAG_SET (src, GST_TCPCLIENTSRC_OPEN);
+ GST_OBJECT_FLAG_SET (src, GST_TCP_CLIENT_SRC_OPEN);
/* look up name if we need to */
if (!(ip = gst_tcp_host_to_ip (GST_ELEMENT (src), src->host)))
sizeof (src->server_sin));
if (ret) {
- gst_tcpclientsrc_stop (GST_BASE_SRC (src));
+ gst_tcp_client_src_stop (GST_BASE_SRC (src));
switch (errno) {
case ECONNREFUSED:
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
}
name_resolv:
{
- gst_tcpclientsrc_stop (GST_BASE_SRC (src));
+ gst_tcp_client_src_stop (GST_BASE_SRC (src));
return FALSE;
}
}
* unset OPEN flag
* used both to recover from errors and go to NULL state */
static gboolean
-gst_tcpclientsrc_stop (GstBaseSrc * bsrc)
+gst_tcp_client_src_stop (GstBaseSrc * bsrc)
{
GstTCPClientSrc *src;
- src = GST_TCPCLIENTSRC (bsrc);
+ src = GST_TCP_CLIENT_SRC (bsrc);
GST_DEBUG_OBJECT (src, "closing socket");
if (src->sock_fd != -1) {
gst_caps_unref (src->caps);
src->caps = NULL;
}
- GST_OBJECT_FLAG_UNSET (src, GST_TCPCLIENTSRC_OPEN);
+ GST_OBJECT_FLAG_UNSET (src, GST_TCP_CLIENT_SRC_OPEN);
close (READ_SOCKET (src));
close (WRITE_SOCKET (src));
/* will be called only between calls to start() and stop() */
static gboolean
-gst_tcpclientsrc_unlock (GstBaseSrc * bsrc)
+gst_tcp_client_src_unlock (GstBaseSrc * bsrc)
{
- GstTCPClientSrc *src = GST_TCPCLIENTSRC (bsrc);
+ GstTCPClientSrc *src = GST_TCP_CLIENT_SRC (bsrc);
SEND_COMMAND (src, CONTROL_STOP);
*/
-#ifndef __GST_TCPCLIENTSRC_H__
-#define __GST_TCPCLIENTSRC_H__
+#ifndef __GST_TCP_CLIENT_SRC_H__
+#define __GST_TCP_CLIENT_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
#include "gsttcp.h"
-#define GST_TYPE_TCPCLIENTSRC \
- (gst_tcpclientsrc_get_type())
-#define GST_TCPCLIENTSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCPCLIENTSRC,GstTCPClientSrc))
-#define GST_TCPCLIENTSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCPCLIENTSRC,GstTCPClientSrc))
-#define GST_IS_TCPCLIENTSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCPCLIENTSRC))
-#define GST_IS_TCPCLIENTSRC_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCPCLIENTSRC))
+#define GST_TYPE_TCP_CLIENT_SRC \
+ (gst_tcp_client_src_get_type())
+#define GST_TCP_CLIENT_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_CLIENT_SRC,GstTCPClientSrc))
+#define GST_TCP_CLIENT_SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_CLIENT_SRC,GstTCPClientSrc))
+#define GST_IS_TCP_CLIENT_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_CLIENT_SRC))
+#define GST_IS_TCP_CLIENT_SRC_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_CLIENT_SRC))
typedef struct _GstTCPClientSrc GstTCPClientSrc;
typedef struct _GstTCPClientSrcClass GstTCPClientSrcClass;
typedef enum {
- GST_TCPCLIENTSRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
+ GST_TCP_CLIENT_SRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- GST_TCPCLIENTSRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
+ GST_TCP_CLIENT_SRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
} GstTCPClientSrcFlags;
struct _GstTCPClientSrc {
GstPushSrcClass parent_class;
};
-GType gst_tcpclientsrc_get_type (void);
+GType gst_tcp_client_src_get_type (void);
G_END_DECLS
-#endif /* __GST_TCPCLIENTSRC_H__ */
+#endif /* __GST_TCP_CLIENT_SRC_H__ */
gst_dp_init ();
if (!gst_element_register (plugin, "tcpclientsink", GST_RANK_NONE,
- GST_TYPE_TCPCLIENTSINK))
+ GST_TYPE_TCP_CLIENT_SINK))
return FALSE;
if (!gst_element_register (plugin, "tcpclientsrc", GST_RANK_NONE,
- GST_TYPE_TCPCLIENTSRC))
+ GST_TYPE_TCP_CLIENT_SRC))
return FALSE;
if (!gst_element_register (plugin, "tcpserversink", GST_RANK_NONE,
- GST_TYPE_TCPSERVERSINK))
+ GST_TYPE_TCP_SERVER_SINK))
return FALSE;
if (!gst_element_register (plugin, "tcpserversrc", GST_RANK_NONE,
- GST_TYPE_TCPSERVERSRC))
+ GST_TYPE_TCP_SERVER_SRC))
return FALSE;
if (!gst_element_register (plugin, "multifdsink", GST_RANK_NONE,
- GST_TYPE_MULTIFDSINK))
+ GST_TYPE_MULTI_FD_SINK))
return FALSE;
GST_DEBUG_CATEGORY_INIT (tcp_debug, "tcp", 0, "TCP calls");
#define TCP_BACKLOG 5
/* elementfactory information */
-static GstElementDetails gst_tcpserversink_details =
+static GstElementDetails gst_tcp_server_sink_details =
GST_ELEMENT_DETAILS ("TCP Server sink",
"Sink/Network",
"Send data as a server over the network via TCP",
ARG_PORT,
};
-static void gst_tcpserversink_finalize (GObject * gobject);
+static void gst_tcp_server_sink_finalize (GObject * gobject);
-static gboolean gst_tcpserversink_handle_wait (GstMultiFdSink * sink,
+static gboolean gst_tcp_server_sink_handle_wait (GstMultiFdSink * sink,
GstFDSet * set);
-static gboolean gst_tcpserversink_init_send (GstMultiFdSink * this);
-static gboolean gst_tcpserversink_close (GstMultiFdSink * this);
-static void gst_tcpserversink_removed (GstMultiFdSink * sink, int fd);
+static gboolean gst_tcp_server_sink_init_send (GstMultiFdSink * this);
+static gboolean gst_tcp_server_sink_close (GstMultiFdSink * this);
+static void gst_tcp_server_sink_removed (GstMultiFdSink * sink, int fd);
-static void gst_tcpserversink_set_property (GObject * object, guint prop_id,
+static void gst_tcp_server_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_tcpserversink_get_property (GObject * object, guint prop_id,
+static void gst_tcp_server_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-GST_BOILERPLATE (GstTCPServerSink, gst_tcpserversink, GstMultiFdSink,
- GST_TYPE_MULTIFDSINK);
+GST_BOILERPLATE (GstTCPServerSink, gst_tcp_server_sink, GstMultiFdSink,
+ GST_TYPE_MULTI_FD_SINK);
static void
-gst_tcpserversink_base_init (gpointer g_class)
+gst_tcp_server_sink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_set_details (element_class, &gst_tcpserversink_details);
+ gst_element_class_set_details (element_class, &gst_tcp_server_sink_details);
}
static void
-gst_tcpserversink_class_init (GstTCPServerSinkClass * klass)
+gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
{
GObjectClass *gobject_class;
GstMultiFdSinkClass *gstmultifdsink_class;
gobject_class = (GObjectClass *) klass;
gstmultifdsink_class = (GstMultiFdSinkClass *) klass;
- gobject_class->set_property = gst_tcpserversink_set_property;
- gobject_class->get_property = gst_tcpserversink_get_property;
- gobject_class->finalize = gst_tcpserversink_finalize;
+ gobject_class->set_property = gst_tcp_server_sink_set_property;
+ gobject_class->get_property = gst_tcp_server_sink_get_property;
+ gobject_class->finalize = gst_tcp_server_sink_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST,
g_param_spec_string ("host", "host", "The host/IP to send the packets to",
g_param_spec_int ("port", "port", "The port to send the packets to",
0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT, G_PARAM_READWRITE));
- gstmultifdsink_class->init = gst_tcpserversink_init_send;
- gstmultifdsink_class->wait = gst_tcpserversink_handle_wait;
- gstmultifdsink_class->close = gst_tcpserversink_close;
- gstmultifdsink_class->removed = gst_tcpserversink_removed;
+ gstmultifdsink_class->init = gst_tcp_server_sink_init_send;
+ gstmultifdsink_class->wait = gst_tcp_server_sink_handle_wait;
+ gstmultifdsink_class->close = gst_tcp_server_sink_close;
+ gstmultifdsink_class->removed = gst_tcp_server_sink_removed;
GST_DEBUG_CATEGORY_INIT (tcpserversink_debug, "tcpserversink", 0, "TCP sink");
}
static void
-gst_tcpserversink_init (GstTCPServerSink * this, GstTCPServerSinkClass * klass)
+gst_tcp_server_sink_init (GstTCPServerSink * this,
+ GstTCPServerSinkClass * klass)
{
this->server_port = TCP_DEFAULT_PORT;
/* should support as minimum 576 for IPV4 and 1500 for IPV6 */
}
static void
-gst_tcpserversink_finalize (GObject * gobject)
+gst_tcp_server_sink_finalize (GObject * gobject)
{
- GstTCPServerSink *this = GST_TCPSERVERSINK (gobject);
+ GstTCPServerSink *this = GST_TCP_SERVER_SINK (gobject);
g_free (this->host);
}
/* handle a read request on the server,
* which indicates a new client connection */
static gboolean
-gst_tcpserversink_handle_server_read (GstTCPServerSink * sink)
+gst_tcp_server_sink_handle_server_read (GstTCPServerSink * sink)
{
/* new client */
int client_sock_fd;
return FALSE;
}
- gst_multifdsink_add (GST_MULTIFDSINK (sink), client_sock_fd);
+ gst_multi_fd_sink_add (GST_MULTI_FD_SINK (sink), client_sock_fd);
GST_DEBUG_OBJECT (sink, "added new client ip %s with fd %d",
inet_ntoa (client_address.sin_addr), client_sock_fd);
}
static void
-gst_tcpserversink_removed (GstMultiFdSink * sink, int fd)
+gst_tcp_server_sink_removed (GstMultiFdSink * sink, int fd)
{
- GstTCPServerSink *this = GST_TCPSERVERSINK (sink);
+ GstTCPServerSink *this = GST_TCP_SERVER_SINK (sink);
GST_LOG_OBJECT (this, "closing fd %d", fd);
if (close (fd) < 0) {
}
static gboolean
-gst_tcpserversink_handle_wait (GstMultiFdSink * sink, GstFDSet * set)
+gst_tcp_server_sink_handle_wait (GstMultiFdSink * sink, GstFDSet * set)
{
- GstTCPServerSink *this = GST_TCPSERVERSINK (sink);
+ GstTCPServerSink *this = GST_TCP_SERVER_SINK (sink);
if (gst_fdset_fd_can_read (set, &this->server_sock)) {
/* handle new client connection on server socket */
- if (!gst_tcpserversink_handle_server_read (this)) {
+ if (!gst_tcp_server_sink_handle_server_read (this)) {
GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
("client connection failed: %s", g_strerror (errno)));
return FALSE;
}
static void
-gst_tcpserversink_set_property (GObject * object, guint prop_id,
+gst_tcp_server_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstTCPServerSink *sink;
- g_return_if_fail (GST_IS_TCPSERVERSINK (object));
- sink = GST_TCPSERVERSINK (object);
+ g_return_if_fail (GST_IS_TCP_SERVER_SINK (object));
+ sink = GST_TCP_SERVER_SINK (object);
switch (prop_id) {
case ARG_HOST:
}
static void
-gst_tcpserversink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
+gst_tcp_server_sink_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstTCPServerSink *sink;
- g_return_if_fail (GST_IS_TCPSERVERSINK (object));
- sink = GST_TCPSERVERSINK (object);
+ g_return_if_fail (GST_IS_TCP_SERVER_SINK (object));
+ sink = GST_TCP_SERVER_SINK (object);
switch (prop_id) {
case ARG_HOST:
/* create a socket for sending to remote machine */
static gboolean
-gst_tcpserversink_init_send (GstMultiFdSink * parent)
+gst_tcp_server_sink_init_send (GstMultiFdSink * parent)
{
int ret;
- GstTCPServerSink *this = GST_TCPSERVERSINK (parent);
+ GstTCPServerSink *this = GST_TCP_SERVER_SINK (parent);
/* create sending server socket */
if ((this->server_sock.fd = socket (AF_INET, SOCK_STREAM, 0)) == -1) {
}
static gboolean
-gst_tcpserversink_close (GstMultiFdSink * parent)
+gst_tcp_server_sink_close (GstMultiFdSink * parent)
{
- GstTCPServerSink *this = GST_TCPSERVERSINK (parent);
+ GstTCPServerSink *this = GST_TCP_SERVER_SINK (parent);
if (this->server_sock.fd != -1) {
gst_fdset_remove_fd (parent->fdset, &this->server_sock);
*/
-#ifndef __GST_TCPSERVERSINK_H__
-#define __GST_TCPSERVERSINK_H__
+#ifndef __GST_TCP_SERVER_SINK_H__
+#define __GST_TCP_SERVER_SINK_H__
#include <gst/gst.h>
#include <arpa/inet.h>
#include "gstmultifdsink.h"
-#define GST_TYPE_TCPSERVERSINK \
- (gst_tcpserversink_get_type())
-#define GST_TCPSERVERSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCPSERVERSINK,GstTCPServerSink))
-#define GST_TCPSERVERSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCPSERVERSINK,GstTCPServerSink))
-#define GST_IS_TCPSERVERSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCPSERVERSINK))
-#define GST_IS_TCPSERVERSINK_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCPSERVERSINK))
+#define GST_TYPE_TCP_SERVER_SINK \
+ (gst_tcp_server_sink_get_type())
+#define GST_TCP_SERVER_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_SERVER_SINK,GstTCPServerSink))
+#define GST_TCP_SERVER_SINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_SERVER_SINK,GstTCPServerSink))
+#define GST_IS_TCP_SERVER_SINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_SERVER_SINK))
+#define GST_IS_TCP_SERVER_SINK_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_SERVER_SINK))
typedef struct _GstTCPServerSink GstTCPServerSink;
typedef struct _GstTCPServerSinkClass GstTCPServerSinkClass;
typedef enum {
- GST_TCPSERVERSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
+ GST_TCP_SERVER_SINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- GST_TCPSERVERSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
+ GST_TCP_SERVER_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
} GstTCPServerSinkFlags;
struct _GstTCPServerSink {
GstMultiFdSinkClass parent_class;
};
-GType gst_tcpserversink_get_type (void);
+GType gst_tcp_server_sink_get_type (void);
G_END_DECLS
-#endif /* __GST_TCPSERVERSINK_H__ */
+#endif /* __GST_TCP_SERVER_SINK_H__ */
#define TCP_BACKLOG 1 /* client connection queue */
-static GstElementDetails gst_tcpserversrc_details =
+static GstElementDetails gst_tcp_server_src_details =
GST_ELEMENT_DETAILS ("TCP Server source",
"Source/Network",
"Receive data as a server over the network via TCP",
};
-GST_BOILERPLATE (GstTCPServerSrc, gst_tcpserversrc, GstPushSrc,
+GST_BOILERPLATE (GstTCPServerSrc, gst_tcp_server_src, GstPushSrc,
GST_TYPE_PUSH_SRC);
-static void gst_tcpserversrc_finalize (GObject * gobject);
+static void gst_tcp_server_src_finalize (GObject * gobject);
-static gboolean gst_tcpserversrc_start (GstBaseSrc * bsrc);
-static gboolean gst_tcpserversrc_stop (GstBaseSrc * bsrc);
-static gboolean gst_tcpserversrc_unlock (GstBaseSrc * bsrc);
-static GstFlowReturn gst_tcpserversrc_create (GstPushSrc * psrc,
+static gboolean gst_tcp_server_src_start (GstBaseSrc * bsrc);
+static gboolean gst_tcp_server_src_stop (GstBaseSrc * bsrc);
+static gboolean gst_tcp_server_src_unlock (GstBaseSrc * bsrc);
+static GstFlowReturn gst_tcp_server_src_create (GstPushSrc * psrc,
GstBuffer ** buf);
-static void gst_tcpserversrc_set_property (GObject * object, guint prop_id,
+static void gst_tcp_server_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_tcpserversrc_get_property (GObject * object, guint prop_id,
+static void gst_tcp_server_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
-gst_tcpserversrc_base_init (gpointer g_class)
+gst_tcp_server_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 (&srctemplate));
- gst_element_class_set_details (element_class, &gst_tcpserversrc_details);
+ gst_element_class_set_details (element_class, &gst_tcp_server_src_details);
}
static void
-gst_tcpserversrc_class_init (GstTCPServerSrcClass * klass)
+gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
{
GObjectClass *gobject_class;
GstBaseSrcClass *gstbasesrc_class;
gstbasesrc_class = (GstBaseSrcClass *) klass;
gstpush_src_class = (GstPushSrcClass *) klass;
- gobject_class->set_property = gst_tcpserversrc_set_property;
- gobject_class->get_property = gst_tcpserversrc_get_property;
- gobject_class->finalize = gst_tcpserversrc_finalize;
+ gobject_class->set_property = gst_tcp_server_src_set_property;
+ gobject_class->get_property = gst_tcp_server_src_get_property;
+ gobject_class->finalize = gst_tcp_server_src_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HOST,
g_param_spec_string ("host", "Host", "The hostname to listen as",
g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE, G_PARAM_READWRITE));
- gstbasesrc_class->start = gst_tcpserversrc_start;
- gstbasesrc_class->stop = gst_tcpserversrc_stop;
- gstbasesrc_class->unlock = gst_tcpserversrc_unlock;
+ gstbasesrc_class->start = gst_tcp_server_src_start;
+ gstbasesrc_class->stop = gst_tcp_server_src_stop;
+ gstbasesrc_class->unlock = gst_tcp_server_src_unlock;
- gstpush_src_class->create = gst_tcpserversrc_create;
+ gstpush_src_class->create = gst_tcp_server_src_create;
GST_DEBUG_CATEGORY_INIT (tcpserversrc_debug, "tcpserversrc", 0,
"TCP Server Source");
}
static void
-gst_tcpserversrc_init (GstTCPServerSrc * src, GstTCPServerSrcClass * g_class)
+gst_tcp_server_src_init (GstTCPServerSrc * src, GstTCPServerSrcClass * g_class)
{
src->server_port = TCP_DEFAULT_PORT;
src->host = g_strdup (TCP_DEFAULT_HOST);
READ_SOCKET (src) = -1;
WRITE_SOCKET (src) = -1;
- GST_OBJECT_FLAG_UNSET (src, GST_TCPSERVERSRC_OPEN);
+ GST_OBJECT_FLAG_UNSET (src, GST_TCP_SERVER_SRC_OPEN);
}
static void
-gst_tcpserversrc_finalize (GObject * gobject)
+gst_tcp_server_src_finalize (GObject * gobject)
{
- GstTCPServerSrc *src = GST_TCPSERVERSRC (gobject);
+ GstTCPServerSrc *src = GST_TCP_SERVER_SRC (gobject);
g_free (src->host);
}
static GstFlowReturn
-gst_tcpserversrc_create (GstPushSrc * psrc, GstBuffer ** outbuf)
+gst_tcp_server_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
{
GstTCPServerSrc *src;
GstFlowReturn ret = GST_FLOW_OK;
fd_set testfds;
int maxfdp1;
- src = GST_TCPSERVERSRC (psrc);
+ src = GST_TCP_SERVER_SRC (psrc);
- if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCPSERVERSRC_OPEN))
+ if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_SERVER_SRC_OPEN))
goto wrong_state;
restart:
}
static void
-gst_tcpserversrc_set_property (GObject * object, guint prop_id,
+gst_tcp_server_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstTCPServerSrc *tcpserversrc = GST_TCPSERVERSRC (object);
+ GstTCPServerSrc *tcpserversrc = GST_TCP_SERVER_SRC (object);
switch (prop_id) {
case PROP_HOST:
}
static void
-gst_tcpserversrc_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
+gst_tcp_server_src_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
- GstTCPServerSrc *tcpserversrc = GST_TCPSERVERSRC (object);
+ GstTCPServerSrc *tcpserversrc = GST_TCP_SERVER_SRC (object);
switch (prop_id) {
case PROP_HOST:
/* set up server */
static gboolean
-gst_tcpserversrc_start (GstBaseSrc * bsrc)
+gst_tcp_server_src_start (GstBaseSrc * bsrc)
{
int ret;
- GstTCPServerSrc *src = GST_TCPSERVERSRC (bsrc);
+ GstTCPServerSrc *src = GST_TCP_SERVER_SRC (bsrc);
/* create the control sockets before anything */
if (socketpair (PF_UNIX, SOCK_STREAM, 0, CONTROL_SOCKETS (src)) < 0)
GST_DEBUG_OBJECT (src, "received client");
- GST_OBJECT_FLAG_SET (src, GST_TCPSERVERSRC_OPEN);
+ GST_OBJECT_FLAG_SET (src, GST_TCP_SERVER_SRC_OPEN);
return TRUE;
}
static gboolean
-gst_tcpserversrc_stop (GstBaseSrc * bsrc)
+gst_tcp_server_src_stop (GstBaseSrc * bsrc)
{
- GstTCPServerSrc *src = GST_TCPSERVERSRC (bsrc);
+ GstTCPServerSrc *src = GST_TCP_SERVER_SRC (bsrc);
if (src->server_sock_fd != -1) {
close (src->server_sock_fd);
close (src->client_sock_fd);
src->client_sock_fd = -1;
}
- GST_OBJECT_FLAG_UNSET (src, GST_TCPSERVERSRC_OPEN);
+ GST_OBJECT_FLAG_UNSET (src, GST_TCP_SERVER_SRC_OPEN);
close (READ_SOCKET (src));
close (WRITE_SOCKET (src));
/* will be called only between calls to start() and stop() */
static gboolean
-gst_tcpserversrc_unlock (GstBaseSrc * bsrc)
+gst_tcp_server_src_unlock (GstBaseSrc * bsrc)
{
- GstTCPServerSrc *src = GST_TCPSERVERSRC (bsrc);
+ GstTCPServerSrc *src = GST_TCP_SERVER_SRC (bsrc);
SEND_COMMAND (src, CONTROL_STOP);
*/
-#ifndef __GST_TCPSERVERSRC_H__
-#define __GST_TCPSERVERSRC_H__
+#ifndef __GST_TCP_SERVER_SRC_H__
+#define __GST_TCP_SERVER_SRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
#include <fcntl.h>
-#define GST_TYPE_TCPSERVERSRC \
- (gst_tcpserversrc_get_type())
-#define GST_TCPSERVERSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCPSERVERSRC,GstTCPServerSrc))
-#define GST_TCPSERVERSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCPSERVERSRC,GstTCPServerSrc))
-#define GST_IS_TCPSERVERSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCPSERVERSRC))
-#define GST_IS_TCPSERVERSRC_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCPSERVERSRC))
+#define GST_TYPE_TCP_SERVER_SRC \
+ (gst_tcp_server_src_get_type())
+#define GST_TCP_SERVER_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_SERVER_SRC,GstTCPServerSrc))
+#define GST_TCP_SERVER_SRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_SERVER_SRC,GstTCPServerSrc))
+#define GST_IS_TCP_SERVER_SRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_SERVER_SRC))
+#define GST_IS_TCP_SERVER_SRC_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_SERVER_SRC))
typedef struct _GstTCPServerSrc GstTCPServerSrc;
typedef struct _GstTCPServerSrcClass GstTCPServerSrcClass;
typedef enum {
- GST_TCPSERVERSRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
+ GST_TCP_SERVER_SRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- GST_TCPSERVERSRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
+ GST_TCP_SERVER_SRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
} GstTCPServerSrcFlags;
struct _GstTCPServerSrc {
GstPushSrcClass parent_class;
};
-GType gst_tcpserversrc_get_type (void);
+GType gst_tcp_server_src_get_type (void);
G_BEGIN_DECLS
-#endif /* __GST_TCPSERVERSRC_H__ */
+#endif /* __GST_TCP_SERVER_SRC_H__ */