Remove crappy event code from tee
authorWim Taymans <wim.taymans@gmail.com>
Fri, 31 May 2002 21:36:11 +0000 (21:36 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 31 May 2002 21:36:11 +0000 (21:36 +0000)
Original commit message from CVS:
Remove crappy event code from tee
Some more debugging info in filesrc

gst/elements/gstfilesrc.c
gst/elements/gsttee.c
plugins/elements/gstfilesrc.c
plugins/elements/gsttee.c

index 6b885fb..cbd29a0 100644 (file)
@@ -466,6 +466,7 @@ gst_filesrc_get (GstPad *pad)
 
   /* check for EOF */
   if (src->curoffset == src->filelen) {
+    GST_DEBUG (0, "filesrc eos %lld %lld\n", src->curoffset, src->filelen);
     gst_element_set_eos (GST_ELEMENT (src));
     return GST_BUFFER (gst_event_new (GST_EVENT_EOS));
   }
@@ -697,6 +698,8 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
 {
   GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad));
 
+  GST_DEBUG(0, "event %d", GST_EVENT_TYPE (event));
+
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_SEEK:
       if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) {
@@ -705,12 +708,15 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
       switch (GST_EVENT_SEEK_METHOD (event)) {
         case GST_SEEK_METHOD_SET:
           src->curoffset = (guint64) GST_EVENT_SEEK_OFFSET (event);
+          GST_DEBUG(0, "seek set pending to %lld", src->curoffset);
          break;
         case GST_SEEK_METHOD_CUR:
           src->curoffset += GST_EVENT_SEEK_OFFSET (event);
+          GST_DEBUG(0, "seek cur pending to %lld", src->curoffset);
          break;
         case GST_SEEK_METHOD_END:
           src->curoffset = src->filelen - ABS (GST_EVENT_SEEK_OFFSET (event));
+          GST_DEBUG(0, "seek end pending to %lld", src->curoffset);
          break;
        default:
           return FALSE;
index 5bbbb78..e9c37dc 100644 (file)
@@ -58,7 +58,6 @@ static void   gst_tee_class_init      (GstTeeClass *klass);
 static void    gst_tee_init            (GstTee *tee);
 
 static GstPad*         gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *unused);
-static gboolean gst_tee_event_handler  (GstPad *pad, GstEvent *event);
 
 static void    gst_tee_set_property    (GObject *object, guint prop_id, 
                                         const GValue *value, GParamSpec *pspec);
@@ -213,7 +212,6 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
   srcpad = gst_pad_new_from_template (templ, name);
   g_free (name);
   gst_element_add_pad (GST_ELEMENT (tee), srcpad);
-  gst_pad_set_event_function (srcpad, gst_tee_event_handler);
   GST_PAD_ELEMENT_PRIVATE (srcpad) = NULL;
 
   if (GST_PAD_CAPS (tee->sinkpad)) {
@@ -223,24 +221,6 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
   return srcpad;
 }
 
-static gboolean
-gst_tee_event_handler (GstPad *pad, GstEvent *event)
-{
-  GstTee *tee;
-           
-  tee = GST_TEE (gst_pad_get_parent (pad));
-             
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_FLUSH:
-      GST_PAD_ELEMENT_PRIVATE (pad) = gst_event_new (GST_EVENT_TYPE (event));
-      break; 
-    default:
-      break;
-  }
-
-  return TRUE;
-}
-
 static void
 gst_tee_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
@@ -305,7 +285,6 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
   g_return_if_fail (buf != NULL);
 
   tee = GST_TEE (gst_pad_get_parent (pad));
-  /*gst_trace_add_entry (NULL, 0, buf, "tee buffer");*/
 
   gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads - 1);
   
@@ -318,16 +297,6 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
     if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC)
       continue;
 
-    if (GST_PAD_ELEMENT_PRIVATE (outpad)) {
-      GstEvent *event = GST_EVENT (GST_PAD_ELEMENT_PRIVATE (outpad));
-       
-      GST_PAD_ELEMENT_PRIVATE (outpad) = NULL;
-      if (GST_PAD_IS_CONNECTED (outpad))
-        gst_pad_push (outpad, GST_BUFFER (event));
-      else
-       gst_event_free (event);
-    }
-
     if (!tee->silent) {
       g_free (tee->last_message);
       tee->last_message = g_strdup_printf ("chain        ******* (%s:%s)t (%d bytes, %llu) %p",
index 6b885fb..cbd29a0 100644 (file)
@@ -466,6 +466,7 @@ gst_filesrc_get (GstPad *pad)
 
   /* check for EOF */
   if (src->curoffset == src->filelen) {
+    GST_DEBUG (0, "filesrc eos %lld %lld\n", src->curoffset, src->filelen);
     gst_element_set_eos (GST_ELEMENT (src));
     return GST_BUFFER (gst_event_new (GST_EVENT_EOS));
   }
@@ -697,6 +698,8 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
 {
   GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad));
 
+  GST_DEBUG(0, "event %d", GST_EVENT_TYPE (event));
+
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_SEEK:
       if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) {
@@ -705,12 +708,15 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
       switch (GST_EVENT_SEEK_METHOD (event)) {
         case GST_SEEK_METHOD_SET:
           src->curoffset = (guint64) GST_EVENT_SEEK_OFFSET (event);
+          GST_DEBUG(0, "seek set pending to %lld", src->curoffset);
          break;
         case GST_SEEK_METHOD_CUR:
           src->curoffset += GST_EVENT_SEEK_OFFSET (event);
+          GST_DEBUG(0, "seek cur pending to %lld", src->curoffset);
          break;
         case GST_SEEK_METHOD_END:
           src->curoffset = src->filelen - ABS (GST_EVENT_SEEK_OFFSET (event));
+          GST_DEBUG(0, "seek end pending to %lld", src->curoffset);
          break;
        default:
           return FALSE;
index 5bbbb78..e9c37dc 100644 (file)
@@ -58,7 +58,6 @@ static void   gst_tee_class_init      (GstTeeClass *klass);
 static void    gst_tee_init            (GstTee *tee);
 
 static GstPad*         gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *unused);
-static gboolean gst_tee_event_handler  (GstPad *pad, GstEvent *event);
 
 static void    gst_tee_set_property    (GObject *object, guint prop_id, 
                                         const GValue *value, GParamSpec *pspec);
@@ -213,7 +212,6 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
   srcpad = gst_pad_new_from_template (templ, name);
   g_free (name);
   gst_element_add_pad (GST_ELEMENT (tee), srcpad);
-  gst_pad_set_event_function (srcpad, gst_tee_event_handler);
   GST_PAD_ELEMENT_PRIVATE (srcpad) = NULL;
 
   if (GST_PAD_CAPS (tee->sinkpad)) {
@@ -223,24 +221,6 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
   return srcpad;
 }
 
-static gboolean
-gst_tee_event_handler (GstPad *pad, GstEvent *event)
-{
-  GstTee *tee;
-           
-  tee = GST_TEE (gst_pad_get_parent (pad));
-             
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_FLUSH:
-      GST_PAD_ELEMENT_PRIVATE (pad) = gst_event_new (GST_EVENT_TYPE (event));
-      break; 
-    default:
-      break;
-  }
-
-  return TRUE;
-}
-
 static void
 gst_tee_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
@@ -305,7 +285,6 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
   g_return_if_fail (buf != NULL);
 
   tee = GST_TEE (gst_pad_get_parent (pad));
-  /*gst_trace_add_entry (NULL, 0, buf, "tee buffer");*/
 
   gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads - 1);
   
@@ -318,16 +297,6 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
     if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC)
       continue;
 
-    if (GST_PAD_ELEMENT_PRIVATE (outpad)) {
-      GstEvent *event = GST_EVENT (GST_PAD_ELEMENT_PRIVATE (outpad));
-       
-      GST_PAD_ELEMENT_PRIVATE (outpad) = NULL;
-      if (GST_PAD_IS_CONNECTED (outpad))
-        gst_pad_push (outpad, GST_BUFFER (event));
-      else
-       gst_event_free (event);
-    }
-
     if (!tee->silent) {
       g_free (tee->last_message);
       tee->last_message = g_strdup_printf ("chain        ******* (%s:%s)t (%d bytes, %llu) %p",