From 596506d44396ef26250b58f5ce2dbeb6a5fec369 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 14 Jan 2004 00:53:52 +0000 Subject: use element time. Original commit message from CVS: 2004-01-14 Benjamin Otte * 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 --- ChangeLog | 32 ++++++++++++++++++++++++++++++++ ext/mas/massink.c | 7 ++----- ext/sdl/sdlvideosink.c | 9 ++------- gst-libs/gst/audio/audioclock.c | 34 ++++++++++++++-------------------- 4 files changed, 50 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index a76eaddb..4c8bbb45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2004-01-14 Benjamin Otte + + * 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 + 2004-01-14 Benjamin Otte * ext/flac/gstflacdec.c: (gst_flacdec_update_metadata): diff --git a/ext/mas/massink.c b/ext/mas/massink.c index 01eed9e6..376cc862 100644 --- a/ext/mas/massink.c +++ b/ext/mas/massink.c @@ -225,12 +225,9 @@ gst_massink_chain (GstPad *pad, GstData *_data) GstMassink *massink = GST_MASSINK (gst_pad_get_parent (pad)); - if (massink->clock) { - GstClockID id = gst_clock_new_single_shot_id (massink->clock, GST_BUFFER_TIMESTAMP (buf)); - + if (massink->clock && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { GST_DEBUG ("massink: clock wait: %llu\n", GST_BUFFER_TIMESTAMP (buf)); - gst_element_clock_wait (GST_ELEMENT (massink), id, NULL); - gst_clock_id_free (id); + gst_element_wait (GST_ELEMENT (massink), GST_BUFFER_TIMESTAMP (buf)); } if (GST_BUFFER_DATA (buf) != NULL) { diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c index 1e3e2f6e..a5fa4704 100644 --- a/ext/sdl/sdlvideosink.c +++ b/ext/sdl/sdlvideosink.c @@ -562,13 +562,8 @@ gst_sdlvideosink_chain (GstPad *pad, GstData *_data) return; } - if (GST_VIDEOSINK_CLOCK (sdlvideosink)) { - GstClockID id = gst_clock_new_single_shot_id ( - GST_VIDEOSINK_CLOCK (sdlvideosink), - GST_BUFFER_TIMESTAMP (buf)); - - gst_element_clock_wait (GST_ELEMENT (sdlvideosink), id, NULL); - gst_clock_id_free (id); + if (GST_VIDEOSINK_CLOCK (sdlvideosink) && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { + gst_element_wait (GST_ELEMENT (sdlvideosink), GST_BUFFER_TIMESTAMP (buf)); } if (GST_BUFFER_DATA (buf) != sdlvideosink->overlay->pixels[0]) { 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); } } -- cgit v1.2.1