[svn r169] trunk
authorrenatofilho
Fri Dec 01 17:12:22 2006 +0000 (2006-12-01)
branchtrunk
changeset 168b8960c4f7b4d
parent 167 fbe02bb1f3f9
child 169 318e94209a11
[svn r169]
gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
     1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Dec 01 16:08:34 2006 +0000
     1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Dec 01 17:12:22 2006 +0000
     1.3 @@ -601,6 +601,7 @@
     1.4        {
     1.5          gint64 duration = 0;
     1.6          duration = gst_nuv_demux_get_time_duration (nuv);
     1.7 +        g_debug ("Query");
     1.8          if (duration == GST_CLOCK_TIME_NONE) {
     1.9              duration = nuv->priv->duration_average;
    1.10          }
    1.11 @@ -733,8 +734,6 @@
    1.12            h->i_timecode += nuv->priv->time_diff;
    1.13  
    1.14        timestamp = h->i_timecode * GST_MSECOND;
    1.15 -
    1.16 -      //GST_BUFFER_SIZE (buf) = h->i_length;
    1.17        GST_BUFFER_TIMESTAMP (buf) = timestamp;
    1.18    }
    1.19    else {
    1.20 @@ -798,18 +797,9 @@
    1.21          default:
    1.22            break;
    1.23        }
    1.24 -      if (buf != NULL) {
    1.25 -        gst_buffer_unref (buf);
    1.26 -        buf = NULL;
    1.27 -      }
    1.28 -
    1.29        goto done;
    1.30      }
    1.31      default:
    1.32 -      if (buf != NULL) {
    1.33 -        gst_buffer_unref (buf);
    1.34 -        buf = NULL;
    1.35 -      }
    1.36        break;
    1.37    }
    1.38  
    1.39 @@ -822,6 +812,7 @@
    1.40        /* pushing the buffer */
    1.41        gst_buffer_set_caps (buf, GST_PAD_CAPS (pad));
    1.42        ret = gst_pad_push (pad, buf);
    1.43 +      buf = NULL;
    1.44  
    1.45        if (ret != GST_FLOW_OK) {
    1.46          GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad));
    1.47 @@ -840,12 +831,13 @@
    1.48  
    1.49          //GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad));
    1.50        }
    1.51 -  } else if (buf != NULL) {
    1.52 +  } 
    1.53 +
    1.54 +done:
    1.55 +  if (buf != NULL) {
    1.56        gst_buffer_unref (buf);
    1.57        buf = NULL;
    1.58    }
    1.59 -
    1.60 -done:
    1.61    nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
    1.62    g_free (nuv->priv->fh);
    1.63    nuv->priv->fh = NULL;
    1.64 @@ -1089,7 +1081,7 @@
    1.65        guint8 *data = NULL;
    1.66        data = (guint8 *) gst_adapter_take (nuv->priv->adapter, size);
    1.67        *buffer = gst_buffer_new ();
    1.68 -      gst_buffer_set_data (*buffer, data, size);
    1.69 +      GST_BUFFER_SIZE (*buffer) = size;
    1.70        GST_BUFFER_MALLOCDATA (*buffer) = data;
    1.71        GST_BUFFER_DATA (*buffer) = data;
    1.72      } else {
    1.73 @@ -1217,7 +1209,6 @@
    1.74      }
    1.75  
    1.76      case GST_EVENT_EOS:
    1.77 -        g_debug ("EEEEEEEEEEEEEEEEEOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSS");
    1.78      default:
    1.79        res = gst_pad_event_default (pad, event);
    1.80        break;
    1.81 @@ -1236,6 +1227,7 @@
    1.82    gst_adapter_push (nuv->priv->adapter, buf);
    1.83  
    1.84    gst_object_unref (nuv);
    1.85 +  //gst_buffer_unref (buf);
    1.86  
    1.87    return gst_nuv_demux_play (pad);
    1.88  }
    1.89 @@ -1328,6 +1320,7 @@
    1.90  gst_nuv_demux_update_duration (GstNuvDemux *nuv, guint64 current_timestamp)
    1.91  {
    1.92      guint64 interval = 0;
    1.93 +    return;
    1.94  
    1.95      if (gst_nuv_demux_get_time_duration (nuv) != GST_CLOCK_TIME_NONE)
    1.96          return;
    1.97 @@ -1342,19 +1335,18 @@
    1.98          if (duration_bytes == GST_CLOCK_TIME_NONE)
    1.99              return;
   1.100  
   1.101 -        if (current_timestamp > 0) {
   1.102 -            interval = gst_util_uint64_scale (1, current_timestamp - nuv->priv->time_start, GST_SECOND);
   1.103 -            if (interval > 0) {
   1.104 -                average = gst_util_uint64_scale (1 , nuv->priv->streamer_offset, interval);
   1.105 -            }
   1.106 -            if (average > 0) {
   1.107 -                nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average);
   1.108 -            }
   1.109 -            nuv->priv->last_update = current_timestamp;
   1.110 -            msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_average);
   1.111 -            gst_element_post_message (GST_ELEMENT (nuv), msg);
   1.112 -            GST_DEBUG_OBJECT (nuv, "New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average);
   1.113 +        interval = gst_util_uint64_scale (1, current_timestamp - nuv->priv->time_start, GST_SECOND);
   1.114 +        if (interval > 0) {
   1.115 +            average = gst_util_uint64_scale (1 , nuv->priv->streamer_offset, interval);
   1.116          }
   1.117 +        if (average > 0) {
   1.118 +            nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average);
   1.119 +        }
   1.120 +        
   1.121 +        nuv->priv->last_update = current_timestamp;
   1.122 +        msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_average);
   1.123 +        gst_element_post_message (GST_ELEMENT (nuv), msg);
   1.124 +        GST_DEBUG_OBJECT (nuv, "New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average);
   1.125      }
   1.126  }
   1.127