gst-libs/gst/play/gstplay.c: Fixing the way to get current position.

Original commit message from CVS:
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.
This commit is contained in:
Julien Moutte 2004-01-27 21:24:14 +00:00
parent 5a6674f100
commit a7db4b6141
3 changed files with 51 additions and 22 deletions

View file

@ -1,3 +1,8 @@
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):

View file

@ -311,8 +311,9 @@ gst_play_have_video_size (GstElement *element, gint width,
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);
@ -323,11 +324,18 @@ gst_play_tick_callback (GstPlay *play)
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;
@ -643,11 +651,15 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
}
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);
}
}

View file

@ -311,8 +311,9 @@ gst_play_have_video_size (GstElement *element, gint width,
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);
@ -323,11 +324,18 @@ gst_play_tick_callback (GstPlay *play)
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;
@ -643,11 +651,15 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
}
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);
}
}