diff -r a0e5b7d75f25 -r 585b3db817a1 gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Thu Nov 30 19:44:22 2006 +0000 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Thu Nov 30 21:25:06 2006 +0000 @@ -1078,12 +1078,14 @@ return GST_FLOW_ERROR_NO_DATA; if (move) { - guint8 *data = (guint8 *) gst_adapter_take (nuv->priv->adapter, size); - *buffer = gst_buffer_new_and_alloc ( size ); + guint8 *data = NULL; + data = (guint8 *) gst_adapter_take (nuv->priv->adapter, size); + *buffer = gst_buffer_new (); gst_buffer_set_data (*buffer, data, size); } else { - guint8 *data = (guint8 *) gst_adapter_peek (nuv->priv->adapter, size); - *buffer = gst_buffer_new_and_alloc ( size ); + guint8 *data = NULL; + data = (guint8 *) gst_adapter_peek (nuv->priv->adapter, size); + *buffer = gst_buffer_new (); gst_buffer_set_data (*buffer, data, size); } } @@ -1323,6 +1325,7 @@ interval = current_timestamp - nuv->priv->last_update; if (interval > (10 * GST_SECOND)) { + GstMessage* msg = NULL; gint64 average = 0; gint64 duration_bytes = gst_nuv_demux_get_bytes_duration (nuv); @@ -1338,9 +1341,8 @@ nuv->priv->duration_average = gst_util_uint64_scale (GST_SECOND, duration_bytes, average); } nuv->priv->last_update = current_timestamp; - gst_element_post_message (GST_ELEMENT (nuv), - gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, - nuv->priv->duration_average) ); + 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); } } @@ -1350,11 +1352,16 @@ gst_nuv_demux_get_bytes_duration (GstNuvDemux *nuv) { if (nuv->priv->duration_bytes == GST_CLOCK_TIME_NONE) { - GstFormat format = GST_FORMAT_BYTES; - gint64 duration = 0; - if (gst_pad_query_peer_duration (nuv->priv->sinkpad, &format, &duration)) { + GstPad *peer = gst_pad_get_peer (nuv->priv->sinkpad); + GstQuery *query = gst_query_new_duration (GST_FORMAT_BYTES); + if (gst_pad_query (peer, query)) { + gint64 duration; + + gst_query_parse_duration (query, NULL, &duration); nuv->priv->duration_bytes = duration; } + gst_object_unref (peer); + gst_query_unref (query); } return nuv->priv->duration_bytes; } @@ -1363,11 +1370,15 @@ gst_nuv_demux_get_time_duration (GstNuvDemux *nuv) { if (nuv->priv->duration_time == GST_CLOCK_TIME_NONE) { - GstFormat format = GST_FORMAT_TIME; - gint64 duration = 0; - if (gst_pad_query_peer_duration (nuv->priv->sinkpad, &format, &duration)) { + GstPad *peer = gst_pad_get_peer (nuv->priv->sinkpad); + GstQuery *query = gst_query_new_duration (GST_FORMAT_TIME); + if (gst_pad_query (peer, query)) { + gint64 duration; + gst_query_parse_duration (query, NULL, &duration); nuv->priv->duration_time = duration; } + gst_object_unref (peer); + gst_query_unref (query); } return nuv->priv->duration_time; }