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
This commit is contained in:
Benjamin Otte 2004-01-14 00:53:52 +00:00
parent f4c6604e6c
commit 9a9f767369
7 changed files with 43 additions and 102 deletions

View file

@ -1,3 +1,35 @@
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
2004-01-14 Benjamin Otte <in7y118@public.uni-hamburg.de> 2004-01-14 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/flac/gstflacdec.c: (gst_flacdec_update_metadata): * ext/flac/gstflacdec.c: (gst_flacdec_update_metadata):

View file

@ -356,10 +356,8 @@ gst_aasink_chain (GstPad *pad, GstData *_data)
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP(buf)); GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP(buf));
if (aasink->clock) { if (aasink->clock && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
GstClockID id = gst_clock_new_single_shot_id (aasink->clock, GST_BUFFER_TIMESTAMP(buf)); gst_element_wait (GST_ELEMENT (aasink), GST_BUFFER_TIMESTAMP (buf));
gst_element_clock_wait (GST_ELEMENT (aasink), id, NULL);
gst_clock_id_free (id);
} }
aa_render (aasink->context, &aasink->ascii_parms, aa_render (aasink->context, &aasink->ascii_parms,

View file

@ -280,10 +280,7 @@ gst_esdsink_chain (GstPad *pad, GstData *_data)
gint64 value; gint64 value;
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) { if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
if (!gst_clock_handle_discont (esdsink->clock, value)){ gst_element_set_time (GST_ELEMENT (esdsink), value);
gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
FALSE);
}
esdsink->handled = 0; esdsink->handled = 0;
} }
esdsink->resync = TRUE; esdsink->resync = TRUE;
@ -306,25 +303,13 @@ gst_esdsink_chain (GstPad *pad, GstData *_data)
if (esdsink->clock){ if (esdsink->clock){
gint delay = 0; gint delay = 0;
gint64 queued; gint64 queued;
GstClockTimeDiff jitter;
delay = gst_esdsink_get_latency (esdsink); delay = gst_esdsink_get_latency (esdsink);
queued = delay * GST_SECOND / esdsink->frequency; queued = delay * GST_SECOND / esdsink->frequency;
if (esdsink->resync && esdsink->sync) { if (esdsink->resync && esdsink->sync) {
GstClockID id = gst_clock_new_single_shot_id (esdsink->clock, gst_element_wait (GST_ELEMENT (esdsink), GST_BUFFER_TIMESTAMP (buf) - queued);
GST_BUFFER_TIMESTAMP (buf) - queued);
gst_element_clock_wait (GST_ELEMENT (esdsink), id, &jitter);
gst_clock_id_free (id);
if (jitter >= 0){
gst_clock_handle_discont (esdsink->clock,
GST_BUFFER_TIMESTAMP (buf) - queued + jitter);
to_write = size;
gst_audio_clock_set_active ((GstAudioClock *)esdsink->provided_clock, TRUE);
esdsink->resync = FALSE;
}
}else{ }else{
to_write = size; to_write = size;
} }

View file

@ -335,19 +335,11 @@ gst_cacasink_chain (GstPad *pad, GstData *_data)
cacasink = GST_CACASINK (gst_pad_get_parent (pad)); cacasink = GST_CACASINK (gst_pad_get_parent (pad));
if (GST_VIDEOSINK_CLOCK (cacasink) && time != -1) { if (cacasink->clock && GST_CLOCK_TIME_IS_VALID (time)) {
GstClockReturn ret;
cacasink->id = gst_clock_new_single_shot_id (
GST_VIDEOSINK_CLOCK (cacasink), time);
GST_DEBUG ("videosink: clock %s wait: %" G_GUINT64_FORMAT " %u", GST_DEBUG ("videosink: clock %s wait: %" G_GUINT64_FORMAT " %u",
GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)), GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)),
time, GST_BUFFER_SIZE (buf)); time, GST_BUFFER_SIZE (buf));
gst_element_wait (GST_ELEMENT (cacasink), GST_BUFFER_TIMESTAMP (buf));
ret = gst_clock_id_wait (cacasink->id, &jitter);
gst_clock_id_free (cacasink->id);
cacasink->id = NULL;
} }
caca_clear (); caca_clear ();

View file

@ -1225,7 +1225,6 @@ gst_matroska_demux_parse_index (GstMatroskaDemux *demux,
if (prevent_eos) { if (prevent_eos) {
length = gst_bytestream_length (ebml->bs); length = gst_bytestream_length (ebml->bs);
gst_clock_set_active (demux->clock, FALSE);
} }
while (res) { while (res) {
@ -1391,10 +1390,6 @@ gst_matroska_demux_parse_index (GstMatroskaDemux *demux,
} }
} }
if (prevent_eos) {
gst_clock_set_active (demux->clock, TRUE);
}
return res; return res;
} }
@ -1496,7 +1491,6 @@ gst_matroska_demux_parse_metadata (GstMatroskaDemux *demux,
if (prevent_eos) { if (prevent_eos) {
length = gst_bytestream_length (ebml->bs); length = gst_bytestream_length (ebml->bs);
gst_clock_set_active (demux->clock, FALSE);
} }
while (res) { while (res) {
@ -1531,10 +1525,6 @@ gst_matroska_demux_parse_metadata (GstMatroskaDemux *demux,
} }
} }
if (prevent_eos) {
gst_clock_set_active (demux->clock, TRUE);
}
return res; return res;
} }

View file

@ -274,12 +274,8 @@ gst_udpsink_chain (GstPad *pad, GstData *_data)
udpsink = GST_UDPSINK (GST_OBJECT_PARENT (pad)); udpsink = GST_UDPSINK (GST_OBJECT_PARENT (pad));
if (udpsink->clock) { if (udpsink->clock && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
GstClockID id = gst_clock_new_single_shot_id (udpsink->clock, GST_BUFFER_TIMESTAMP (buf)); gst_element_wait (GST_ELEMENT (udpsink), GST_BUFFER_TIMESTAMP (buf));
GST_DEBUG ("udpsink: clock wait: %" G_GUINT64_FORMAT "\n", GST_BUFFER_TIMESTAMP (buf));
gst_element_clock_wait (GST_ELEMENT (udpsink), id, NULL);
gst_clock_id_free (id);
} }
tolen = sizeof(udpsink->theiraddr); tolen = sizeof(udpsink->theiraddr);

View file

@ -204,7 +204,6 @@ gst_osssink_init (GstOssSink *osssink)
osssink->bufsize = 4096; osssink->bufsize = 4096;
osssink->chunk_size = 4096; osssink->chunk_size = 4096;
osssink->resync = FALSE;
osssink->mute = FALSE; osssink->mute = FALSE;
osssink->sync = TRUE; osssink->sync = TRUE;
osssink->provided_clock = gst_audio_clock_new ("ossclock", gst_osssink_get_time, osssink); osssink->provided_clock = gst_audio_clock_new ("ossclock", gst_osssink_get_time, osssink);
@ -339,20 +338,6 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), FALSE); gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), FALSE);
gst_pad_event_default (pad, event); gst_pad_event_default (pad, event);
return; return;
case GST_EVENT_DISCONTINUOUS:
{
gint64 value;
ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET);
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
if (!gst_clock_handle_discont (osssink->clock, value))
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), FALSE);
osssink->handled = 0;
}
osssink->resync = TRUE;
break;
}
default: default:
gst_pad_event_default (pad, event); gst_pad_event_default (pad, event);
return; return;
@ -372,44 +357,7 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
if (GST_OSSELEMENT (osssink)->fd >= 0) { if (GST_OSSELEMENT (osssink)->fd >= 0) {
if (!osssink->mute) { if (!osssink->mute) {
guchar *data = GST_BUFFER_DATA (buf); guchar *data = GST_BUFFER_DATA (buf);
gint size = GST_BUFFER_SIZE (buf); gint to_write = GST_BUFFER_SIZE (buf);
gint to_write = 0;
if (osssink->clock) {
gint delay = 0;
gint64 queued;
GstClockTimeDiff jitter;
delay = gst_osssink_get_delay (osssink);
queued = delay * GST_SECOND / GST_OSSELEMENT (osssink)->bps;
if (osssink->resync && osssink->sync) {
GstClockID id = gst_clock_new_single_shot_id (osssink->clock, buftime - queued);
gst_element_clock_wait (GST_ELEMENT (osssink), id, &jitter);
gst_clock_id_free (id);
if (jitter >= 0) {
gst_clock_handle_discont (osssink->clock, buftime - queued + jitter);
to_write = size;
gst_audio_clock_set_active ((GstAudioClock*)osssink->provided_clock, TRUE);
osssink->resync = FALSE;
}
}
else {
to_write = size;
}
}
/* no clock, try to be as fast as possible */
else {
audio_buf_info ospace;
ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_GETOSPACE, &ospace);
if (ospace.bytes >= size) {
to_write = size;
}
}
while (to_write > 0) { while (to_write > 0) {
gint done = write (GST_OSSELEMENT (osssink)->fd, data, gint done = write (GST_OSSELEMENT (osssink)->fd, data,
@ -425,6 +373,8 @@ gst_osssink_chain (GstPad *pad, GstData *_data)
osssink->handled += done; osssink->handled += done;
} }
} }
} else {
g_warning ("muting osssinks unimplemented wrt clocks!");
} }
} }
@ -583,13 +533,11 @@ gst_osssink_change_state (GstElement *element)
case GST_STATE_READY_TO_PAUSED: case GST_STATE_READY_TO_PAUSED:
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_PAUSED_TO_PLAYING:
osssink->resync = TRUE;
break; break;
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_PLAYING_TO_PAUSED:
if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN)) if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN))
ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0); ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0);
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), FALSE); gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), FALSE);
osssink->resync = TRUE;
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_PAUSED_TO_READY:
if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN)) if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN))