diff options
author | Benjamin Otte <otte@gnome.org> | 2004-01-14 00:53:52 +0000 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2004-01-14 00:53:52 +0000 |
commit | 596506d44396ef26250b58f5ce2dbeb6a5fec369 (patch) | |
tree | f5ea8c5b7c51470db4279cf72c03f11334d80078 /gst-libs/gst/audio/audioclock.c | |
parent | a9eb10c6efde1cb4b040c0b0fe81313a4e9403e5 (diff) | |
download | gst-plugins-bad-596506d44396ef26250b58f5ce2dbeb6a5fec369.tar.gz gst-plugins-bad-596506d44396ef26250b58f5ce2dbeb6a5fec369.tar.bz2 gst-plugins-bad-596506d44396ef26250b58f5ce2dbeb6a5fec369.zip |
use element time.
Original commit message from CVS:
2004-01-14 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/aalib/gstaasink.c: (gst_aasink_chain):
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event):
* ext/esd/esdsink.c: (gst_esdsink_chain):
* ext/libcaca/gstcacasink.c: (gst_cacasink_chain):
* ext/mas/massink.c: (gst_massink_chain):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_chain):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_parse_index),
(gst_matroska_demux_parse_metadata):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_loop),
(gst_mpeg_parse_release_locks):
* gst/tcp/gsttcpsink.c: (gst_tcpsink_chain):
* gst/udp/gstudpsink.c: (gst_udpsink_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
* sys/oss/gstosssink.c: (gst_osssink_init), (gst_osssink_chain),
(gst_osssink_change_state):
* sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_chain):
* sys/ximage/ximagesink.c: (gst_ximagesink_chain):
* sys/xvideo/xvideosink.c: (gst_xvideosink_chain),
(gst_xvideosink_release_locks):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain):
use element time.
* ext/alsa/gstalsaclock.c: (gst_alsa_clock_start),
(gst_alsa_clock_stop):
* gst-libs/gst/audio/audioclock.c: (gst_audio_clock_set_active),
(gst_audio_clock_get_internal_time):
simplify for use with new clocking code.
* testsuite/alsa/Makefile.am:
* testsuite/alsa/sinesrc.c: (sinesrc_init), (sinesrc_force_caps):
fix testsuite for new caps system
Diffstat (limited to 'gst-libs/gst/audio/audioclock.c')
-rw-r--r-- | gst-libs/gst/audio/audioclock.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/gst-libs/gst/audio/audioclock.c b/gst-libs/gst/audio/audioclock.c index feb06d50..77c7e576 100644 --- a/gst-libs/gst/audio/audioclock.c +++ b/gst-libs/gst/audio/audioclock.c @@ -105,19 +105,21 @@ gst_audio_clock_new (gchar *name, GstAudioClockGetTimeFunc func, gpointer user_d void gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active) { - GTimeVal timeval; GstClockTime time; - GstClockTime audiotime; + GstClock *clock; - g_get_current_time (&timeval); - time = GST_TIMEVAL_TO_TIME (timeval); - audiotime = aclock->func ((GstClock*)aclock, aclock->user_data); + g_return_if_fail (GST_IS_AUDIO_CLOCK (aclock)); + clock = GST_CLOCK (aclock); + + time = gst_clock_get_event_time (clock); if (active) { - aclock->adjust = time - audiotime; - } - else { - aclock->adjust = audiotime - time; + aclock->adjust = time - aclock->func (clock, aclock->user_data); + } else { + GTimeVal timeval; + g_get_current_time (&timeval); + + aclock->adjust = GST_TIMEVAL_TO_TIME (timeval) - time; } aclock->active = active; @@ -129,20 +131,12 @@ gst_audio_clock_get_internal_time (GstClock *clock) GstAudioClock *aclock = GST_AUDIO_CLOCK (clock); if (aclock->active) { - GstClockTime audiotime; - - audiotime = aclock->func (clock, aclock->user_data) + aclock->adjust; - - return audiotime; - } - else { - GstClockTime time; + return aclock->func (clock, aclock->user_data) + aclock->adjust; + } else { GTimeVal timeval; g_get_current_time (&timeval); - time = GST_TIMEVAL_TO_TIME (timeval); - - return time; + return GST_TIMEVAL_TO_TIME (timeval); } } |