Esempio n. 1
0
static void
gst_udpsink_set_property (GObject * object, guint prop_id, const GValue * value,
    GParamSpec * pspec)
{
  GstUDPSink *udpsink;

  udpsink = GST_UDPSINK (object);

  /* remove old host */
  gst_multiudpsink_remove (GST_MULTIUDPSINK (udpsink),
      udpsink->host, udpsink->port);

  switch (prop_id) {
    case PROP_HOST:
      g_free (udpsink->host);
      udpsink->host = g_value_dup_string (value);
      break;
    case PROP_PORT:
      udpsink->port = g_value_get_int (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
  /* add new host */
  gst_multiudpsink_add (GST_MULTIUDPSINK (udpsink),
      udpsink->host, udpsink->port);
}
Esempio n. 2
0
static void
gst_udpsink_init (GstUDPSink * udpsink)
{
  udpsink->host = g_strdup (UDP_DEFAULT_HOST);
  udpsink->port = UDP_DEFAULT_PORT;
  gst_multiudpsink_add (GST_MULTIUDPSINK (udpsink), udpsink->host,
      udpsink->port);
}
Esempio n. 3
0
static void
gst_udpsink_init (GstUDPSink * udpsink, GstUDPSinkClass * klass)
{
  udpsink->host = g_strdup (UDP_DEFAULT_HOST);
  udpsink->port = UDP_DEFAULT_PORT;
  udpsink->uri = g_strdup_printf ("udp://%s:%d", udpsink->host, udpsink->port);

  gst_multiudpsink_add (GST_MULTIUDPSINK (udpsink), udpsink->host,
      udpsink->port);
}
Esempio n. 4
0
static gboolean
gst_udpsink_set_uri (GstUDPSink * sink, const gchar * uri)
{
  gchar *protocol;
  gchar *location;
  gchar *colptr;

  protocol = gst_uri_get_protocol (uri);
  if (strcmp (protocol, "udp") != 0)
    goto wrong_protocol;
  g_free (protocol);

  location = gst_uri_get_location (uri);
  if (!location)
    return FALSE;
  colptr = strstr (location, ":");

  gst_multiudpsink_remove (GST_MULTIUDPSINK (sink), sink->host, sink->port);

  if (colptr != NULL) {
    g_free (sink->host);
    sink->host = g_strndup (location, colptr - location);
    sink->port = atoi (colptr + 1);
  } else {
    g_free (sink->host);
    sink->host = g_strdup (location);
    sink->port = UDP_DEFAULT_PORT;
  }
  g_free (location);

  gst_multiudpsink_add (GST_MULTIUDPSINK (sink), sink->host, sink->port);

  gst_udpsink_update_uri (sink);

  return TRUE;

  /* ERRORS */
wrong_protocol:
  {
    g_free (protocol);
    GST_ELEMENT_ERROR (sink, RESOURCE, READ, (NULL),
        ("error parsing uri %s: wrong protocol (%s != udp)", uri, protocol));
    return FALSE;
  }
}
Esempio n. 5
0
static gboolean
gst_udpsink_set_uri (GstUDPSink * sink, const gchar * uri)
{
  gst_multiudpsink_remove (GST_MULTIUDPSINK (sink), sink->host, sink->port);

  if (!gst_udp_parse_uri (uri, &sink->host, &sink->port))
    goto wrong_uri;

  g_free (sink->uri);
  sink->uri = g_strdup (uri);

  gst_multiudpsink_add (GST_MULTIUDPSINK (sink), sink->host, sink->port);

  return TRUE;

  /* ERRORS */
wrong_uri:
  {
    GST_ELEMENT_ERROR (sink, RESOURCE, READ, (NULL),
        ("error parsing uri %s", uri));
    return FALSE;
  }
}