diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2004-07-07 16:11:39 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2004-07-07 16:11:39 +0000 |
commit | f68667a5e5d2ce3c30724e84846cd94ec0c6127f (patch) | |
tree | 03f54c51f5aeba84c5e54b3ef02bd6310c9c90f7 /sys/oss/gstosssrc.c | |
parent | 87aff668ef0b5c4fbdcb23f2ca130d7caee83ee7 (diff) |
sys/oss/: Fix offset on osssrc.
Original commit message from CVS:
* sys/oss/gstosselement.c: (gst_osselement_reset),
(gst_osselement_parse_caps):
* sys/oss/gstosselement.h:
* sys/oss/gstosssrc.c: (gst_osssrc_get):
Fix offset on osssrc.
Diffstat (limited to 'sys/oss/gstosssrc.c')
-rw-r--r-- | sys/oss/gstosssrc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c index bd23b817..1bd2521d 100644 --- a/sys/oss/gstosssrc.c +++ b/sys/oss/gstosssrc.c @@ -335,6 +335,7 @@ gst_osssrc_get (GstPad * pad) GstOssSrc *src; GstBuffer *buf; glong readbytes; + glong readsamples; src = GST_OSSSRC (gst_pad_get_parent (pad)); @@ -376,19 +377,21 @@ gst_osssrc_get (GstPad * pad) return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); } + readsamples = readbytes * GST_OSSELEMENT (src)->rate / + GST_OSSELEMENT (src)->bps; + GST_BUFFER_SIZE (buf) = readbytes; GST_BUFFER_OFFSET (buf) = src->curoffset; - + GST_BUFFER_OFFSET_END (buf) = src->curoffset + readsamples; GST_BUFFER_DURATION (buf) = - (GST_SECOND * GST_BUFFER_SIZE (buf)) / (GST_OSSELEMENT (src)->bps * - GST_OSSELEMENT (src)->rate); + readsamples * GST_SECOND / GST_OSSELEMENT (src)->rate; /* if we have a clock */ if (src->clock) { if (src->clock == src->provided_clock) { /* if it's our own clock, we can be very accurate */ GST_BUFFER_TIMESTAMP (buf) = - src->curoffset * GST_SECOND / GST_OSSELEMENT (src)->bps; + src->curoffset * GST_SECOND / GST_OSSELEMENT (src)->rate; } else { /* somebody elses clock, timestamp with that clock, no discontinuity in * the stream since the OFFSET is updated correctly. Elements can stretch @@ -401,7 +404,7 @@ gst_osssrc_get (GstPad * pad) GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; } - src->curoffset += readbytes; + src->curoffset += readsamples; GST_DEBUG ("pushed buffer from soundcard of %ld bytes, timestamp %" G_GINT64_FORMAT, readbytes, GST_BUFFER_TIMESTAMP (buf)); |