gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
branchtrunk
changeset 501 4b6e332ac7b3
parent 476 f9330272e09d
child 508 224adf6cd007
     1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Apr 02 16:02:03 2007 +0100
     1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Wed Apr 04 21:41:18 2007 +0100
     1.3 @@ -280,7 +280,6 @@
     1.4  static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv);
     1.5  static void gst_nuv_demux_send_eos (GstNuvDemux * nuv);
     1.6  static void gst_nuv_demux_create_seek_index (GstNuvDemux * nuv);
     1.7 -static void gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h);
     1.8  
     1.9  
    1.10  #if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6) 
    1.11 @@ -799,8 +798,10 @@
    1.12  
    1.13    h = nuv->priv->fh;
    1.14  
    1.15 -  if (h.i_type == 'R')
    1.16 +  if (h.i_type == 'R') {
    1.17 +    nuv->priv->offset += h.i_length;
    1.18      goto done;
    1.19 +  }
    1.20  
    1.21    if (h.i_length > 0) {
    1.22      ret = gst_nuv_demux_read_bytes (nuv, h.i_length, TRUE, &buf);
    1.23 @@ -1051,25 +1052,6 @@
    1.24    gst_element_post_message (GST_ELEMENT (nuv), msg);
    1.25  }
    1.26  
    1.27 -
    1.28 -static void 
    1.29 -gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h)
    1.30 -{
    1.31 -   if ((h->i_type == 'V') && (h->i_keyframe == 0)) {
    1.32 -      GSList *lst = g_slist_last (nuv->priv->index);
    1.33 -      if (lst != NULL) {
    1.34 -          frame_index_data *d = (frame_index_data *) lst->data;
    1.35 -          if (d->timecode < h->i_timecode) {
    1.36 -              frame_index_data *f = g_new0 (frame_index_data, 1);
    1.37 -              f->offset = nuv->priv->offset - 12;
    1.38 -              f->timecode = h->i_timecode * GST_MSECOND;
    1.39 -              nuv->priv->index = g_slist_append (nuv->priv->index, f);
    1.40 -          }
    1.41 -      }
    1.42 -   }
    1.43 -}
    1.44 -
    1.45 -
    1.46  static GstFlowReturn
    1.47  gst_nuv_demux_play (GstPad * pad)
    1.48  {
    1.49 @@ -1133,7 +1115,6 @@
    1.50        if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
    1.51          goto pause;
    1.52        }
    1.53 -      gst_nuv_demux_store_keyframe (nuv, &nuv->priv->fh);
    1.54        break;
    1.55  
    1.56      case GST_NUV_DEMUX_MOVI: 
    1.57 @@ -1302,13 +1283,15 @@
    1.58        return NULL;
    1.59      }
    1.60  
    1.61 -	  if (pos >= seek_pos) {
    1.62 -  	  ret = f;
    1.63 -    	break;
    1.64 +    if (pos >= seek_pos) {
    1.65 +      ret = f;
    1.66 +      break;
    1.67      }
    1.68 -    if ((segment_stop != -1) && (pos > segment_stop))
    1.69 +
    1.70 +    if ((segment_stop != -1) &&  (segment_stop != GST_CLOCK_TIME_NONE) && (pos > segment_stop)) {
    1.71        break;
    1.72 -  }  
    1.73 +    }
    1.74 +  } 
    1.75  
    1.76    return ret;
    1.77  }
    1.78 @@ -1333,6 +1316,10 @@
    1.79      return FALSE;
    1.80    }
    1.81  
    1.82 +  if (nuv->priv->mode == NUV_PUSH_MODE) {
    1.83 +    return FALSE;
    1.84 +  }
    1.85 +
    1.86  
    1.87    gst_event_parse_seek (event, &rate, &format, &flags,
    1.88        &cur_type, &cur, &stop_type, &stop);
    1.89 @@ -1360,6 +1347,7 @@
    1.90      }
    1.91      GST_OBJECT_UNLOCK (nuv);
    1.92    }
    1.93 +
    1.94    flush = !!(flags & GST_SEEK_FLAG_FLUSH);
    1.95    
    1.96    if (flush) {
    1.97 @@ -1373,7 +1361,7 @@
    1.98      }
    1.99    }
   1.100    else {
   1.101 -	  gst_pad_pause_task (nuv->priv->sinkpad);
   1.102 +    gst_pad_pause_task (nuv->priv->sinkpad);
   1.103    }
   1.104  
   1.105    GST_PAD_STREAM_LOCK (nuv->priv->sinkpad);
   1.106 @@ -1425,7 +1413,6 @@
   1.107      gst_element_post_message (GST_ELEMENT (nuv), msg);
   1.108    }
   1.109  
   1.110 -
   1.111    GST_DEBUG_OBJECT (nuv, "NEW SEGMENT START %" G_GUINT64_FORMAT ", STOP %" G_GUINT64_FORMAT, 
   1.112      segment_start, segment_stop);
   1.113    newsegment_event = gst_event_new_new_segment (FALSE, rate,