# HG changeset patch
# User renatofilho
# Date 1175529477 -3600
# Node ID 88bf59e8da5f0611e31c399ade43742f3eb9e661
# Parent  f9330272e09deceef092920f2912ec8433f8e6dc
[svn r482] dont make seek for push mode

diff -r f9330272e09d -r 88bf59e8da5f gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
--- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Apr 02 16:02:03 2007 +0100
+++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Apr 02 16:57:57 2007 +0100
@@ -280,7 +280,6 @@
 static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv);
 static void gst_nuv_demux_send_eos (GstNuvDemux * nuv);
 static void gst_nuv_demux_create_seek_index (GstNuvDemux * nuv);
-static void gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h);
 
 
 #if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6) 
@@ -799,8 +798,10 @@
 
   h = nuv->priv->fh;
 
-  if (h.i_type == 'R')
+  if (h.i_type == 'R') {
+    nuv->priv->offset += h.i_length;
     goto done;
+  }
 
   if (h.i_length > 0) {
     ret = gst_nuv_demux_read_bytes (nuv, h.i_length, TRUE, &buf);
@@ -1051,25 +1052,6 @@
   gst_element_post_message (GST_ELEMENT (nuv), msg);
 }
 
-
-static void 
-gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h)
-{
-   if ((h->i_type == 'V') && (h->i_keyframe == 0)) {
-      GSList *lst = g_slist_last (nuv->priv->index);
-      if (lst != NULL) {
-          frame_index_data *d = (frame_index_data *) lst->data;
-          if (d->timecode < h->i_timecode) {
-              frame_index_data *f = g_new0 (frame_index_data, 1);
-              f->offset = nuv->priv->offset - 12;
-              f->timecode = h->i_timecode * GST_MSECOND;
-              nuv->priv->index = g_slist_append (nuv->priv->index, f);
-          }
-      }
-   }
-}
-
-
 static GstFlowReturn
 gst_nuv_demux_play (GstPad * pad)
 {
@@ -1133,7 +1115,6 @@
       if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
         goto pause;
       }
-      gst_nuv_demux_store_keyframe (nuv, &nuv->priv->fh);
       break;
 
     case GST_NUV_DEMUX_MOVI: 
@@ -1302,13 +1283,15 @@
       return NULL;
     }
 
-	  if (pos >= seek_pos) {
-  	  ret = f;
-    	break;
+    if (pos >= seek_pos) {
+      ret = f;
+      break;
     }
-    if ((segment_stop != -1) && (pos > segment_stop))
+
+    if ((segment_stop != -1) &&  (segment_stop != GST_CLOCK_TIME_NONE) && (pos > segment_stop)) {
       break;
-  }  
+    }
+  } 
 
   return ret;
 }
@@ -1333,6 +1316,10 @@
     return FALSE;
   }
 
+  if (nuv->priv->mode == NUV_PUSH_MODE) {
+    return FALSE;
+  }
+
 
   gst_event_parse_seek (event, &rate, &format, &flags,
       &cur_type, &cur, &stop_type, &stop);
@@ -1360,6 +1347,7 @@
     }
     GST_OBJECT_UNLOCK (nuv);
   }
+
   flush = !!(flags & GST_SEEK_FLAG_FLUSH);
   
   if (flush) {
@@ -1373,7 +1361,7 @@
     }
   }
   else {
-	  gst_pad_pause_task (nuv->priv->sinkpad);
+    gst_pad_pause_task (nuv->priv->sinkpad);
   }
 
   GST_PAD_STREAM_LOCK (nuv->priv->sinkpad);
@@ -1425,7 +1413,6 @@
     gst_element_post_message (GST_ELEMENT (nuv), msg);
   }
 
-
   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,