diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2005-08-15 13:05:35 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2005-08-15 13:05:35 +0000 |
commit | 06570ab90da3faed296801230f105527d2dc7c82 (patch) | |
tree | 81aa82abcc167fd3e2eece1af207afdd992e1503 | |
parent | 054f0aae4801ee48d37990841e3f24334375c4f0 (diff) |
ext/esd/esdsink.c: Basic hacks to make video playback using esdsink not totally make yuou rip your heart out. We writ...
Original commit message from CVS:
* ext/esd/esdsink.c: (gst_esdsink_get_time), (gst_esdsink_chain):
Basic hacks to make video playback using esdsink not totally make
yuou rip your heart out. We write a few samples per cycle, so that
the clock will increment in a slightly lineair fashion instead of
in large hiccuped steps (which makes video playback in an ok'ish
way, compared to how it was), and we take timestamps into account for
calculating the clock position, so that _get_time() at least returns
a value that will make video playback in sync. Should make Ubuntu
users happy (they default to esdsink).
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | ext/esd/esdsink.c | 24 |
2 files changed, 30 insertions, 6 deletions
@@ -1,3 +1,15 @@ +2005-08-15 Ronald S. Bultje <rbultje@ronald.bitfreak.net> + + * ext/esd/esdsink.c: (gst_esdsink_get_time), (gst_esdsink_chain): + Basic hacks to make video playback using esdsink not totally make + yuou rip your heart out. We write a few samples per cycle, so that + the clock will increment in a slightly lineair fashion instead of + in large hiccuped steps (which makes video playback in an ok'ish + way, compared to how it was), and we take timestamps into account for + calculating the clock position, so that _get_time() at least returns + a value that will make video playback in sync. Should make Ubuntu + users happy (they default to esdsink). + 2005-08-14 Ronald S. Bultje <rbultje@ronald.bitfreak.net> * gst/qtdemux/qtdemux.c: (qtdemux_video_caps): diff --git a/ext/esd/esdsink.c b/ext/esd/esdsink.c index daad3817a..627318d10 100644 --- a/ext/esd/esdsink.c +++ b/ext/esd/esdsink.c @@ -243,9 +243,14 @@ gst_esdsink_get_time (GstClock * clock, gpointer data) { GstEsdsink *esdsink = GST_ESDSINK (data); GstClockTime res; + int latency = 0; - res = (esdsink->handled * GST_SECOND) / esdsink->frequency; - //- GST_SECOND * 2; + //if (esdsink->handled > 0 && esdsink->fd > 0) + //latency = esd_get_latency (esdsink->fd); + if (latency > esdsink->handled) + latency = esdsink->handled; + + res = ((esdsink->handled - latency) * GST_SECOND) / esdsink->frequency; return res; } @@ -302,12 +307,19 @@ gst_esdsink_chain (GstPad * pad, GstData * _data) } if (GST_BUFFER_DATA (buf) != NULL) { - if (!esdsink->mute && esdsink->fd >= 0) { - guchar *data = GST_BUFFER_DATA (buf); - gint size = GST_BUFFER_SIZE (buf); + guchar *data = GST_BUFFER_DATA (buf); + gint size = GST_BUFFER_SIZE (buf); + + if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { + esdsink->handled = esdsink->frequency * GST_BUFFER_TIMESTAMP (buf) / + GST_SECOND; + } + + while (size > 0 && !esdsink->mute && esdsink->fd >= 0) { gint to_write = 0; - to_write = size; + to_write = size > 128 ? 128 : size; + size -= to_write; GST_LOG ("fd=%d data=%p size=%d", esdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); |