diff -r fbe02bb1f3f9 -r 318e94209a11 gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Fri Dec 01 16:08:34 2006 +0000 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Fri Dec 01 17:13:06 2006 +0000 @@ -601,6 +601,7 @@ { gint64 duration = 0; duration = gst_nuv_demux_get_time_duration (nuv); + g_debug ("Query"); if (duration == GST_CLOCK_TIME_NONE) { duration = nuv->priv->duration_average; } @@ -733,8 +734,6 @@ h->i_timecode += nuv->priv->time_diff; timestamp = h->i_timecode * GST_MSECOND; - - //GST_BUFFER_SIZE (buf) = h->i_length; GST_BUFFER_TIMESTAMP (buf) = timestamp; } else { @@ -798,18 +797,9 @@ default: break; } - if (buf != NULL) { - gst_buffer_unref (buf); - buf = NULL; - } - goto done; } default: - if (buf != NULL) { - gst_buffer_unref (buf); - buf = NULL; - } break; } @@ -822,6 +812,7 @@ /* pushing the buffer */ gst_buffer_set_caps (buf, GST_PAD_CAPS (pad)); ret = gst_pad_push (pad, buf); + buf = NULL; if (ret != GST_FLOW_OK) { GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad)); @@ -840,12 +831,13 @@ //GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad)); } - } else if (buf != NULL) { + } + +done: + if (buf != NULL) { gst_buffer_unref (buf); buf = NULL; } - -done: nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER; g_free (nuv->priv->fh); nuv->priv->fh = NULL; @@ -1089,7 +1081,7 @@ guint8 *data = NULL; data = (guint8 *) gst_adapter_take (nuv->priv->adapter, size); *buffer = gst_buffer_new (); - gst_buffer_set_data (*buffer, data, size); + GST_BUFFER_SIZE (*buffer) = size; GST_BUFFER_MALLOCDATA (*buffer) = data; GST_BUFFER_DATA (*buffer) = data; } else { @@ -1217,7 +1209,6 @@ } case GST_EVENT_EOS: - g_debug ("EEEEEEEEEEEEEEEEEOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSS"); default: res = gst_pad_event_default (pad, event); break; @@ -1236,6 +1227,7 @@ gst_adapter_push (nuv->priv->adapter, buf); gst_object_unref (nuv); + //gst_buffer_unref (buf); return gst_nuv_demux_play (pad); } @@ -1328,6 +1320,7 @@ gst_nuv_demux_update_duration (GstNuvDemux *nuv, guint64 current_timestamp) { guint64 interval = 0; + return; if (gst_nuv_demux_get_time_duration (nuv) != GST_CLOCK_TIME_NONE) return; @@ -1342,19 +1335,18 @@ if (duration_bytes == GST_CLOCK_TIME_NONE) return; - if (current_timestamp > 0) { - interval = gst_util_uint64_scale (1, current_timestamp - nuv->priv->time_start, GST_SECOND); - if (interval > 0) { - average = gst_util_uint64_scale (1 , nuv->priv->streamer_offset, interval); - } - if (average > 0) { - nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average); - } - nuv->priv->last_update = current_timestamp; - msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_average); - gst_element_post_message (GST_ELEMENT (nuv), msg); - GST_DEBUG_OBJECT (nuv, "New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average); + interval = gst_util_uint64_scale (1, current_timestamp - nuv->priv->time_start, GST_SECOND); + if (interval > 0) { + average = gst_util_uint64_scale (1 , nuv->priv->streamer_offset, interval); } + if (average > 0) { + nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average); + } + + nuv->priv->last_update = current_timestamp; + msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_average); + gst_element_post_message (GST_ELEMENT (nuv), msg); + GST_DEBUG_OBJECT (nuv, "New Duration Average %"G_GUINT64_FORMAT, nuv->priv->duration_average); } }