gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
branchtrunk
changeset 446 d260ed30f4de
parent 440 1a9af071ab1f
child 476 f9330272e09d
     1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Mar 23 13:56:18 2007 +0000
     1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Mar 23 22:54:24 2007 +0000
     1.3 @@ -377,8 +377,6 @@
     1.4    nuv->priv->mode = NUV_PUSH_MODE;
     1.5    nuv->priv->adapter = gst_adapter_new ();
     1.6  
     1.7 -  g_debug ("Adapter %p", nuv->priv->adapter);
     1.8 -
     1.9    nuv->priv->new_audio_segment = TRUE;
    1.10    nuv->priv->new_video_segment = TRUE;
    1.11  
    1.12 @@ -403,7 +401,6 @@
    1.13  {
    1.14    GstNuvDemux *nuv = GST_NUV_DEMUX (object);
    1.15  
    1.16 -  g_debug ("NUV DISPOSE");
    1.17  
    1.18    if (nuv->priv->mpeg_buffer != NULL) {
    1.19      gst_buffer_unref (nuv->priv->mpeg_buffer);
    1.20 @@ -1027,13 +1024,10 @@
    1.21  {
    1.22    GstMessage *msg;
    1.23    nuv_frame_header h;
    1.24 -  g_debug ("CREATING INDEX");
    1.25  
    1.26    while (gst_nuv_demux_frame_header_load (nuv, &h) == GST_FLOW_OK) {
    1.27 -    if (h.i_keyframe == 0) {
    1.28 -    //if (h.i_type == 'V') {
    1.29 +    if ((h.i_type == 'V') && (h.i_keyframe == 0)) {
    1.30        frame_index_data *f = g_new0 (frame_index_data, 1);
    1.31 -      g_debug ("KEY FRAME AT %lld", nuv->priv->offset);
    1.32  
    1.33        f->offset = nuv->priv->offset - 12;
    1.34        f->timecode = h.i_timecode * GST_MSECOND;
    1.35 @@ -1046,7 +1040,9 @@
    1.36    		  nuv->priv->duration_time = h.i_timecode * GST_MSECOND;
    1.37      }
    1.38    }
    1.39 -  g_debug ("CREATING INDEX: DONE : DURATION Bytes/Sec: %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT, nuv->priv->offset, nuv->priv->duration_time);
    1.40 +  GST_DEBUG_OBJECT  (nuv, "CREATING INDEX: DONE : DURATION Bytes/Sec: %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT, 
    1.41 +    nuv->priv->offset, nuv->priv->duration_time);
    1.42 +
    1.43    nuv->priv->duration_bytes = nuv->priv->offset;
    1.44    nuv->priv->offset = nuv->priv->header_lengh;
    1.45  
    1.46 @@ -1141,7 +1137,6 @@
    1.47    gst_pad_pause_task (nuv->priv->sinkpad);
    1.48  
    1.49    if (res == GST_FLOW_ERROR_EOS) {
    1.50 -    g_debug ("EOS EOS EOS EOS EOS EOS");
    1.51      gst_nuv_demux_send_eos (nuv);
    1.52      nuv->priv->eos = TRUE;
    1.53      res = GST_FLOW_OK;
    1.54 @@ -1187,7 +1182,6 @@
    1.55        }
    1.56        /* got eos */
    1.57      } else if (ret == GST_FLOW_UNEXPECTED) {
    1.58 -      g_debug ("GOT EOS");
    1.59        return GST_FLOW_ERROR_EOS;
    1.60      }
    1.61    } else {
    1.62 @@ -1213,14 +1207,10 @@
    1.63    gboolean res = TRUE;
    1.64    GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
    1.65   
    1.66 -  g_debug ("SINK ACTIVATE");
    1.67 -
    1.68    if (gst_pad_check_pull_range (sinkpad)) {
    1.69 -    g_debug ("PULL");
    1.70      gst_adapter_clear (nuv->priv->adapter);
    1.71      res = gst_pad_activate_pull (sinkpad, TRUE);
    1.72    } else {
    1.73 -    g_debug ("PUSH");
    1.74      gst_adapter_clear (nuv->priv->adapter);
    1.75      res = gst_pad_activate_push (sinkpad, TRUE);
    1.76    }
    1.77 @@ -1242,7 +1232,6 @@
    1.78      gst_pad_start_task (sinkpad, (GstTaskFunction) gst_nuv_demux_loop, sinkpad);
    1.79    } else {
    1.80      GST_DEBUG_OBJECT (nuv, "deactivating pull function");
    1.81 -    g_debug ("STOP TASK");
    1.82      gst_pad_stop_task (sinkpad);
    1.83    }
    1.84    gst_object_unref (nuv);
    1.85 @@ -1320,11 +1309,16 @@
    1.86    gint64 segment_stop;
    1.87    GstEvent *newsegment_event;
    1.88  
    1.89 +  if (nuv->priv->eos) {
    1.90 +    return FALSE;
    1.91 +  }
    1.92  
    1.93 -  g_debug ("DEMUX SEEK");
    1.94 +
    1.95    gst_event_parse_seek (event, &rate, &format, &flags,
    1.96        &cur_type, &cur, &stop_type, &stop);
    1.97  
    1.98 +
    1.99 +
   1.100  /*
   1.101    if (format == GST_FORMAT_TIME) {
   1.102      GST_DEBUG_OBJECT (nuv, "Can only seek on BYTES");
   1.103 @@ -1396,8 +1390,6 @@
   1.104      goto seek_error;
   1.105    }
   1.106  
   1.107 -  g_debug ("found frame at %lld", entry->offset);
   1.108 -
   1.109    segment_start = entry->timecode;
   1.110  
   1.111    nuv->priv->segment_start = segment_start;
   1.112 @@ -1414,7 +1406,8 @@
   1.113    }
   1.114  
   1.115  
   1.116 -  g_debug ("NEW SEGMENT START %" G_GUINT64_FORMAT ", STOP %" G_GUINT64_FORMAT, segment_start, segment_stop);
   1.117 +  GST_DEBUG_OBJECT (nuv, "NEW SEGMENT START %" G_GUINT64_FORMAT ", STOP %" G_GUINT64_FORMAT, 
   1.118 +    segment_start, segment_stop);
   1.119    newsegment_event = gst_event_new_new_segment (FALSE, rate,
   1.120      GST_FORMAT_TIME, segment_start, segment_stop, segment_start);
   1.121  
   1.122 @@ -1441,7 +1434,6 @@
   1.123  
   1.124    gst_event_unref (newsegment_event);
   1.125  
   1.126 -  g_debug ("STARTING TASK AGAIN");
   1.127    nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
   1.128    nuv->priv->offset = entry->offset;
   1.129  
   1.130 @@ -1469,7 +1461,6 @@
   1.131    
   1.132    switch (GST_EVENT_TYPE (event)) {
   1.133      case GST_EVENT_SEEK:
   1.134 -      g_debug ("SEEK");
   1.135        res = gst_nuv_demux_do_seek (nuv, event);
   1.136        break;
   1.137      default:
   1.138 @@ -1490,8 +1481,6 @@
   1.139    if (nuv->priv->mode != NUV_PUSH_MODE)
   1.140      return ret;
   1.141  
   1.142 -  g_debug ("CHAIN ADP %p", nuv->priv->adapter);
   1.143 -
   1.144    gst_adapter_push (nuv->priv->adapter, buf);  
   1.145    
   1.146    while ((ret == GST_FLOW_OK) && (nuv->priv->more_data == FALSE)) {
   1.147 @@ -1501,8 +1490,6 @@
   1.148    nuv->priv->more_data = FALSE;
   1.149    gst_object_unref (nuv);
   1.150  
   1.151 -  g_debug ("CHAIN END");
   1.152 -  
   1.153    return ret;
   1.154  }
   1.155  
   1.156 @@ -1521,7 +1508,7 @@
   1.157  static void
   1.158  gst_nuv_demux_reset (GstNuvDemux * nuv)
   1.159  {
   1.160 -  g_debug ("RESET");
   1.161 +  nuv->priv->eos = FALSE;
   1.162    nuv->priv->more_data = FALSE;
   1.163    nuv->priv->state = GST_NUV_DEMUX_START;
   1.164    nuv->priv->mode = NUV_PUSH_MODE;
   1.165 @@ -1570,7 +1557,6 @@
   1.166  
   1.167    switch (transition) {
   1.168      case GST_STATE_CHANGE_NULL_TO_READY:
   1.169 -	g_debug ("NULL_TO_READY");
   1.170        gst_nuv_demux_reset (GST_NUV_DEMUX (element));
   1.171        gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
   1.172        break;
   1.173 @@ -1584,9 +1570,7 @@
   1.174    }
   1.175  
   1.176    switch (transition) {
   1.177 -    case GST_STATE_CHANGE_PAUSED_TO_READY:
   1.178      case GST_STATE_CHANGE_READY_TO_NULL:
   1.179 -      g_debug ("PAUSED_TO_READY");
   1.180        gst_nuv_demux_reset (GST_NUV_DEMUX (element));
   1.181        gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
   1.182        break;