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 | |
| 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.
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | sys/oss/gstosselement.c | 2 | ||||
| -rw-r--r-- | sys/oss/gstosselement.h | 3 | ||||
| -rw-r--r-- | sys/oss/gstosssrc.c | 13 | 
4 files changed, 21 insertions, 5 deletions
@@ -1,5 +1,13 @@  2004-07-07  Wim Taymans  <wim@fluendo.com> +	* 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. + +2004-07-07  Wim Taymans  <wim@fluendo.com> +  	* ext/theora/theora.c: (plugin_init):  	* ext/theora/theoradec.c: (theora_dec_from_granulepos),  	(theora_dec_src_query), (theora_dec_chain): diff --git a/sys/oss/gstosselement.c b/sys/oss/gstosselement.c index 5d17dfe2..5e72ef1c 100644 --- a/sys/oss/gstosselement.c +++ b/sys/oss/gstosselement.c @@ -456,6 +456,7 @@ gst_osselement_reset (GstOssElement * oss)    oss->rate = 44100;    oss->fragment = 0;    oss->bps = 0; +  oss->sample_width = 0;  /* AFMT_*_BE not available on all OSS includes (e.g. FBSD) */  #ifdef WORDS_BIGENDIAN @@ -545,6 +546,7 @@ gst_osselement_parse_caps (GstOssElement * oss, const GstCaps * caps)    gst_structure_get_int (structure, "channels", &oss->channels);    gst_structure_get_int (structure, "rate", &oss->rate); +  oss->sample_width = bps * oss->channels;    oss->bps = bps * oss->channels * oss->rate;    oss->format = format; diff --git a/sys/oss/gstosselement.h b/sys/oss/gstosselement.h index d541ecc5..fb161ad6 100644 --- a/sys/oss/gstosselement.h +++ b/sys/oss/gstosselement.h @@ -79,6 +79,9 @@ struct _GstOssElement    /* stats bytes per *second* */    guint		 bps; +  /* sample width in bytes */ +  guint		 sample_width; +    /* parameters */    gint 		 law;    gint 		 endianness; 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));  | 
