# HG changeset patch
# User renatofilho
# Date 1174662535 0
# Node ID db17a60b9b42b7fd2ad8b38fc78dd3ef3f7bc6cb
# Parent  f310d1d086b5b2163e9d2a033f90e600da97ff08
[svn r447] removed debug messages

diff -r f310d1d086b5 -r db17a60b9b42 gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
--- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Mar 23 14:34:50 2007 +0000
+++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Mar 23 15:08:55 2007 +0000
@@ -377,8 +377,6 @@
   nuv->priv->mode = NUV_PUSH_MODE;
   nuv->priv->adapter = gst_adapter_new ();
 
-  g_debug ("Adapter %p", nuv->priv->adapter);
-
   nuv->priv->new_audio_segment = TRUE;
   nuv->priv->new_video_segment = TRUE;
 
@@ -403,7 +401,6 @@
 {
   GstNuvDemux *nuv = GST_NUV_DEMUX (object);
 
-  g_debug ("NUV DISPOSE");
 
   if (nuv->priv->mpeg_buffer != NULL) {
     gst_buffer_unref (nuv->priv->mpeg_buffer);
@@ -1027,13 +1024,10 @@
 {
   GstMessage *msg;
   nuv_frame_header h;
-  g_debug ("CREATING INDEX");
 
   while (gst_nuv_demux_frame_header_load (nuv, &h) == GST_FLOW_OK) {
-    if (h.i_keyframe == 0) {
-    //if (h.i_type == 'V') {
+    if ((h.i_type == 'V') && (h.i_keyframe == 0)) {
       frame_index_data *f = g_new0 (frame_index_data, 1);
-      g_debug ("KEY FRAME AT %lld", nuv->priv->offset);
 
       f->offset = nuv->priv->offset - 12;
       f->timecode = h.i_timecode * GST_MSECOND;
@@ -1046,7 +1040,9 @@
   		  nuv->priv->duration_time = h.i_timecode * GST_MSECOND;
     }
   }
-  g_debug ("CREATING INDEX: DONE : DURATION Bytes/Sec: %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT, nuv->priv->offset, nuv->priv->duration_time);
+  GST_DEBUG_OBJECT  (nuv, "CREATING INDEX: DONE : DURATION Bytes/Sec: %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT, 
+    nuv->priv->offset, nuv->priv->duration_time);
+
   nuv->priv->duration_bytes = nuv->priv->offset;
   nuv->priv->offset = nuv->priv->header_lengh;
 
@@ -1141,7 +1137,6 @@
   gst_pad_pause_task (nuv->priv->sinkpad);
 
   if (res == GST_FLOW_ERROR_EOS) {
-    g_debug ("EOS EOS EOS EOS EOS EOS");
     gst_nuv_demux_send_eos (nuv);
     nuv->priv->eos = TRUE;
     res = GST_FLOW_OK;
@@ -1187,7 +1182,6 @@
       }
       /* got eos */
     } else if (ret == GST_FLOW_UNEXPECTED) {
-      g_debug ("GOT EOS");
       return GST_FLOW_ERROR_EOS;
     }
   } else {
@@ -1213,14 +1207,10 @@
   gboolean res = TRUE;
   GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
  
-  g_debug ("SINK ACTIVATE");
-
   if (gst_pad_check_pull_range (sinkpad)) {
-    g_debug ("PULL");
     gst_adapter_clear (nuv->priv->adapter);
     res = gst_pad_activate_pull (sinkpad, TRUE);
   } else {
-    g_debug ("PUSH");
     gst_adapter_clear (nuv->priv->adapter);
     res = gst_pad_activate_push (sinkpad, TRUE);
   }
@@ -1242,7 +1232,6 @@
     gst_pad_start_task (sinkpad, (GstTaskFunction) gst_nuv_demux_loop, sinkpad);
   } else {
     GST_DEBUG_OBJECT (nuv, "deactivating pull function");
-    g_debug ("STOP TASK");
     gst_pad_stop_task (sinkpad);
   }
   gst_object_unref (nuv);
@@ -1320,11 +1309,16 @@
   gint64 segment_stop;
   GstEvent *newsegment_event;
 
+  if (nuv->priv->eos) {
+    return FALSE;
+  }
 
-  g_debug ("DEMUX SEEK");
+
   gst_event_parse_seek (event, &rate, &format, &flags,
       &cur_type, &cur, &stop_type, &stop);
 
+
+
 /*
   if (format == GST_FORMAT_TIME) {
     GST_DEBUG_OBJECT (nuv, "Can only seek on BYTES");
@@ -1396,8 +1390,6 @@
     goto seek_error;
   }
 
-  g_debug ("found frame at %lld", entry->offset);
-
   segment_start = entry->timecode;
 
   nuv->priv->segment_start = segment_start;
@@ -1414,7 +1406,8 @@
   }
 
 
-  g_debug ("NEW SEGMENT START %" G_GUINT64_FORMAT ", STOP %" G_GUINT64_FORMAT, segment_start, segment_stop);
+  GST_DEBUG_OBJECT (nuv, "NEW SEGMENT START %" G_GUINT64_FORMAT ", STOP %" G_GUINT64_FORMAT, 
+    segment_start, segment_stop);
   newsegment_event = gst_event_new_new_segment (FALSE, rate,
     GST_FORMAT_TIME, segment_start, segment_stop, segment_start);
 
@@ -1441,7 +1434,6 @@
 
   gst_event_unref (newsegment_event);
 
-  g_debug ("STARTING TASK AGAIN");
   nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
   nuv->priv->offset = entry->offset;
 
@@ -1469,7 +1461,6 @@
   
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_SEEK:
-      g_debug ("SEEK");
       res = gst_nuv_demux_do_seek (nuv, event);
       break;
     default:
@@ -1490,8 +1481,6 @@
   if (nuv->priv->mode != NUV_PUSH_MODE)
     return ret;
 
-  g_debug ("CHAIN ADP %p", nuv->priv->adapter);
-
   gst_adapter_push (nuv->priv->adapter, buf);  
   
   while ((ret == GST_FLOW_OK) && (nuv->priv->more_data == FALSE)) {
@@ -1501,8 +1490,6 @@
   nuv->priv->more_data = FALSE;
   gst_object_unref (nuv);
 
-  g_debug ("CHAIN END");
-  
   return ret;
 }
 
@@ -1521,7 +1508,7 @@
 static void
 gst_nuv_demux_reset (GstNuvDemux * nuv)
 {
-  g_debug ("RESET");
+  nuv->priv->eos = FALSE;
   nuv->priv->more_data = FALSE;
   nuv->priv->state = GST_NUV_DEMUX_START;
   nuv->priv->mode = NUV_PUSH_MODE;
@@ -1570,7 +1557,6 @@
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
-	g_debug ("NULL_TO_READY");
       gst_nuv_demux_reset (GST_NUV_DEMUX (element));
       gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
       break;
@@ -1584,9 +1570,7 @@
   }
 
   switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
     case GST_STATE_CHANGE_READY_TO_NULL:
-      g_debug ("PAUSED_TO_READY");
       gst_nuv_demux_reset (GST_NUV_DEMUX (element));
       gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
       break;