Trying to make udp plugins work
authorZeeshan Ali <zeenix@gmail.com>
Fri, 8 Nov 2002 01:29:11 +0000 (01:29 +0000)
committerZeeshan Ali <zeenix@gmail.com>
Fri, 8 Nov 2002 01:29:11 +0000 (01:29 +0000)
Original commit message from CVS:
Trying to make udp plugins work

gst/udp/gstudpsink.c
gst/udp/gstudpsink.h
gst/udp/gstudpsrc.c

index 4273dda..a905903 100644 (file)
@@ -165,6 +165,16 @@ gst_udpsink_sinkconnect (GstPad *pad, GstCaps *caps)
 }
 
 static void
+gst_udpsink_set_clock (GstElement *element, GstClock *clock)
+{
+  GstUDPSink *udpsink;
+             
+  udpsink = GST_UDPSINK (element);
+
+  udpsink->clock = clock;
+}
+
+static void
 gst_udpsink_init (GstUDPSink *udpsink)
 {
   /* create the sink and src pads */
@@ -175,6 +185,10 @@ gst_udpsink_init (GstUDPSink *udpsink)
 
   udpsink->host = g_strdup (UDP_DEFAULT_HOST);
   udpsink->port = UDP_DEFAULT_PORT;
+  
+  udpsink->clock = NULL;
+
+  GST_ELEMENT (udpsink)->setclockfunc = gst_udpsink_set_clock;
 }
 
 static void
@@ -182,12 +196,18 @@ gst_udpsink_chain (GstPad *pad, GstBuffer *buf)
 {
   GstUDPSink *udpsink;
   int tolen;
+  GstClockTimeDiff *jitter = NULL;
 
   g_return_if_fail (pad != NULL);
   g_return_if_fail (GST_IS_PAD (pad));
   g_return_if_fail (buf != NULL);
 
   udpsink = GST_UDPSINK (GST_OBJECT_PARENT (pad));
+  
+  if (udpsink->clock) {
+    GST_DEBUG (0, "udpsink: clock wait: %llu\n", GST_BUFFER_TIMESTAMP (buf));
+    gst_element_clock_wait (GST_ELEMENT (udpsink), udpsink->clock, GST_BUFFER_TIMESTAMP (buf), jitter);
+  }
 
   tolen = sizeof(udpsink->theiraddr);
 
index 0f986fd..0fd39f4 100644 (file)
@@ -73,6 +73,8 @@ struct _GstUDPSink {
 
   gint port;
   gchar *host;
+    
+  GstClock *clock;
 };
 
 struct _GstUDPSinkClass {
index 39541f7..2de4b26 100644 (file)
@@ -266,7 +266,7 @@ gst_udpsrc_init_receive (GstUDPSrc *src)
   fcntl (src->control_sock, F_SETFL, O_NONBLOCK);
 
   GST_FLAG_SET (src, GST_UDPSRC_OPEN);
-
+  
   return TRUE;
 }