Пример #1
0
void
client_connection (GstRTSPServer *gstrtspserver,
               GstRTSPClient *arg1,
               gpointer       user_data)
{
  GstRTSPConnection * conn = (GstRTSPConnection*) gst_rtsp_client_get_connection (arg1);
  g_print ("Local ip %s\n",
        gst_rtsp_connection_get_ip (conn));

  gint * port = (gint*) user_data;

  g_print ("Port %d\n", *port);  

  if (global_clock == NULL) {
    g_print ("No clocks already available\n");
  } else {
    g_print ("A clock was present, unref it!.\n");
  }

  global_clock = gst_net_client_clock_new ("net_clock", gst_rtsp_connection_get_ip (conn), 8554, 0);

  if (global_clock == NULL) {
    g_print ("Failed to create net clock client for %s:%d\n",
        "192.168.0.1", 8554);
    return;
  }

  g_print ("Waiting clock...");
  /* Wait for the clock to stabilise */
  gst_clock_wait_for_sync (global_clock, GST_CLOCK_TIME_NONE);

  g_print ("Synked!\n");        
}
Пример #2
0
static void client_connected(GstRTSPServer *gstrtspserver,
                             GstRTSPClient *client,
                             gpointer       user_data) {
  GstRTSPConnection* conn = gst_rtsp_client_get_connection(client);
  g_message("client %p connected from %s",
          client, gst_rtsp_connection_get_ip(conn));
  g_signal_connect(client, "closed", (GCallback)client_closed,
                   NULL);
}