+2004-01-27 Julien MOUTTE <julien@moutte.net>
+
+ * gst-libs/gst/play/gstplay.c: (gst_play_tick_callback),
+ (gst_play_seek_to_time): Fixing the way to get current position.
+
2004-01-27 Benjamin Otte <in7y118@public.uni-hamburg.de>
* sys/oss/gstosssink.c: (gst_osssink_sink_query):
static gboolean
gst_play_tick_callback (GstPlay *play)
{
- GstElement* audio_sink_element;
- GstClockTime time;
+ GstFormat format = GST_FORMAT_TIME;
+ gboolean q = FALSE;
+ GstElement *audio_sink_element = NULL;
g_return_val_if_fail (play != NULL, FALSE);
audio_sink_element = g_hash_table_lookup (play->priv->elements,
"audio_sink_element");
- time = gst_element_get_time (audio_sink_element);
- play->priv->time_nanos = GST_CLOCK_TIME_IS_VALID (time) ? time : 0;
- g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
- 0,play->priv->time_nanos);
+ if (!GST_IS_ELEMENT (audio_sink_element)) {
+ play->priv->tick_id = 0;
+ return FALSE;
+ }
+
+ q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format,
+ &(play->priv->time_nanos));
+
+ if (q)
+ g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
+ 0,play->priv->time_nanos);
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
return TRUE;
}
if (s) {
- GstClockTime time;
- time = gst_element_get_time (audio_sink_element);
- play->priv->time_nanos = GST_CLOCK_TIME_IS_VALID (time) ? time : 0;
- g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
- 0,play->priv->time_nanos);
+ GstFormat format = GST_FORMAT_TIME;
+ gboolean q = FALSE;
+
+ q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format,
+ &(play->priv->time_nanos));
+
+ if (q)
+ g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
+ 0,play->priv->time_nanos);
}
}
static gboolean
gst_play_tick_callback (GstPlay *play)
{
- GstElement* audio_sink_element;
- GstClockTime time;
+ GstFormat format = GST_FORMAT_TIME;
+ gboolean q = FALSE;
+ GstElement *audio_sink_element = NULL;
g_return_val_if_fail (play != NULL, FALSE);
audio_sink_element = g_hash_table_lookup (play->priv->elements,
"audio_sink_element");
- time = gst_element_get_time (audio_sink_element);
- play->priv->time_nanos = GST_CLOCK_TIME_IS_VALID (time) ? time : 0;
- g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
- 0,play->priv->time_nanos);
+ if (!GST_IS_ELEMENT (audio_sink_element)) {
+ play->priv->tick_id = 0;
+ return FALSE;
+ }
+
+ q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format,
+ &(play->priv->time_nanos));
+
+ if (q)
+ g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
+ 0,play->priv->time_nanos);
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
return TRUE;
}
if (s) {
- GstClockTime time;
- time = gst_element_get_time (audio_sink_element);
- play->priv->time_nanos = GST_CLOCK_TIME_IS_VALID (time) ? time : 0;
- g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
- 0,play->priv->time_nanos);
+ GstFormat format = GST_FORMAT_TIME;
+ gboolean q = FALSE;
+
+ q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format,
+ &(play->priv->time_nanos));
+
+ if (q)
+ g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
+ 0,play->priv->time_nanos);
}
}