[gst-devel] address already in use(98)

Marc Leeman marc.leeman at gmail.com
Wed Feb 2 20:22:06 CET 2011


> Is there a way to solve the problem? To have two pipe that works togheter?

A piece of example code where the socket is req'd and set again:

gboolean
gst_vbcp_connect_udp (GstVbcpSrcBin * decoder, gchar * addr, guint port)
{
  gchar *uri;

  GST_DEBUG_OBJECT(decoder, "connecting to the vbcp server");

  g_return_val_if_fail (decoder != NULL, FALSE);
  g_return_val_if_fail (decoder->fd == -1, FALSE);
  g_return_val_if_fail (addr != NULL, FALSE);

  g_return_val_if_fail (decoder->appsink != NULL, FALSE);
  g_return_val_if_fail (decoder->appsrc != NULL, FALSE);
  g_return_val_if_fail (decoder->udpsrc == NULL, FALSE);
  g_return_val_if_fail (decoder->udpsink == NULL, FALSE);

  uri = g_strdup_printf ("udp://%s:%d", addr, port);
  GST_DEBUG_OBJECT(decoder, "creating %s.", uri);
  decoder->udpsink = gst_element_make_from_uri (GST_URI_SINK, uri,
NULL);
  g_free (uri);

  g_object_set (G_OBJECT (decoder->udpsink), "closefd", FALSE, NULL);

  gst_bin_add(
      GST_BIN_CAST(decoder),
      decoder->udpsink);

  gst_element_sync_state_with_parent(decoder->udpsink);

  decoder->udpsrc = gst_element_factory_make("udpsrc", NULL);
  gst_bin_add(
      GST_BIN_CAST(decoder),
      decoder->udpsrc);

  g_object_get (G_OBJECT (decoder->udpsink), "sock", &decoder->fd,
NULL);
  GST_DEBUG_OBJECT (decoder, "UDP sink has sock %d", decoder->fd);
  g_object_set (G_OBJECT (decoder->udpsrc), "sockfd", decoder->fd,
NULL);

  /* link the elements together */
  gst_element_link_many(decoder->appsrc, decoder->udpsink, NULL);
  gst_element_link_many(decoder->udpsrc, decoder->appsink, NULL);

  gint socketfd;
  g_object_get (G_OBJECT (decoder->udpsrc), "sockfd", &socketfd, NULL);
  GST_DEBUG_OBJECT (decoder, "UDP src has sock %d", socketfd);

  gst_element_sync_state_with_parent(decoder->appsrc);
  gst_element_sync_state_with_parent(decoder->udpsrc);
  gst_element_sync_state_with_parent(decoder->appsink);

  return TRUE;
}       

-- 
  greetz, marc
When speculation has done its worst, two plus two still equals four.
		-- S. Johnson
crichton 2.6.26 #1 PREEMPT Tue Jul 29 21:17:59 CDT 2008 GNU/Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110202/7824b8c4/attachment.pgp>


More information about the gstreamer-devel mailing list