[gst-devel] events for mad

vishnu at pobox.com vishnu at pobox.com
Fri Oct 26 13:58:07 CEST 2001


This patch helps, but mad refuses to pause for some reason.  Any ideas?

-- 
Victory to the Divine Mother!!   ... after all,
  http://sahajayoga.org                http://why-compete.org
-------------- next part --------------
Index: gstmad.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/mp3decode/mad/gstmad.c,v
retrieving revision 1.17
diff -u -p -r1.17 gstmad.c
--- gstmad.c	2001/10/17 22:04:11	1.17
+++ gstmad.c	2001/10/26 20:56:48
@@ -174,13 +174,30 @@ gst_mad_input (void *user_data,
 
     // deal with events
     if (GST_IS_EVENT (inbuf)) {
-      g_print ("have event!\n");
-      gst_element_set_state (GST_ELEMENT (mad), GST_STATE_PAUSED);
+      GstEvent *event = GST_EVENT (inbuf);
 
-      // FIXME call the default handler here?
-      if (GST_PAD_CONNECTED (mad->srcpad))
-        gst_pad_push (mad->srcpad, inbuf);
+      switch (GST_EVENT_TYPE (event)) {
+      case GST_EVENT_DISCONTINUOUS:
+	mad->need_sync = TRUE;
+	break;
+	
+      case GST_EVENT_EOS:
+	gst_element_set_state (GST_ELEMENT (mad), GST_STATE_PAUSED);
+	break;
+	
+      default:
+	g_warning ("Don't know how to cope with event type %d",
+		   GST_EVENT_TYPE (event));
+	  break;
+	}
 
+      gst_event_free (event);
+
+      /* osssink doesn't understand or need events yet
+	
+	if (GST_PAD_CONNECTED (mad->srcpad))
+	 gst_pad_push (mad->srcpad, inbuf); */
+
       // FIXME eek!!
       //cothread_switch(cothread_current_main());
 
@@ -195,11 +212,6 @@ gst_mad_input (void *user_data,
       buffer = inbuf;
   }
   while (GST_BUFFER_SIZE (buffer) < 4096);
-
-  if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLUSH)) {
-    GST_DEBUG (0, "flush\n");
-    mad->need_sync = TRUE;
-  }
 
   mad->last_time = GST_BUFFER_TIMESTAMP (buffer);
   /* thomas added this bit to implement timestamps */


More information about the gstreamer-devel mailing list