summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2001-08-31 01:07:55 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2001-08-31 01:07:55 +0000
commit2d3f4a1d87de306103990f1c8690d4e997e45db3 (patch)
treef8b903f41934bc08bf6e2aad99e7ee519027da07
parentb069a0b052c69b3fa9d6ab8c9a871aa7edaba573 (diff)
downloadxine-lib-2d3f4a1d87de306103990f1c8690d4e997e45db3.tar.gz
xine-lib-2d3f4a1d87de306103990f1c8690d4e997e45db3.tar.bz2
Improved rate sensing.
CVS patchset: 530 CVS date: 2001/08/31 01:07:55
-rw-r--r--src/liblpcm/xine_decoder.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/liblpcm/xine_decoder.c b/src/liblpcm/xine_decoder.c
index dafd6594d..f2063ed6a 100644
--- a/src/liblpcm/xine_decoder.c
+++ b/src/liblpcm/xine_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_decoder.c,v 1.3 2001/08/30 23:43:49 jcdutton Exp $
+ * $Id: xine_decoder.c,v 1.4 2001/08/31 01:07:55 jcdutton Exp $
*
* 31-8-2001 Added LPCM rate sensing.
* (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk
@@ -43,6 +43,7 @@ typedef struct lpcm_decoder_s {
uint32_t pts;
uint32_t last_pts;
+ uint32_t last_size;
uint32_t rate;
ao_instance_t *audio_out;
@@ -63,6 +64,7 @@ void lpcm_init (audio_decoder_t *this_gen, ao_instance_t *audio_out) {
this->output_open = 0;
this->pts = 0;
this->last_pts = 0;
+ this->last_size = 0;
this->rate = 0;
}
@@ -71,16 +73,14 @@ void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
lpcm_decoder_t *this = (lpcm_decoder_t *) this_gen;
int16_t *sample_buffer=(int16_t *)buf->content;
-
- if (buf->decoder_info[0] == 0)
- return;
- if (buf->PTS > 0) {
this->last_pts=this->pts;
this->pts = buf->PTS;
- }
+ if (buf->decoder_info[0] == 0)
+ return;
if ((this->last_pts > 0) && (this->pts > 0) && (this->rate == 0)) {
- this->rate=(45000 * buf->size)/(this->pts-this->last_pts);
+ this->rate=(22500 * this->last_size)/(this->pts-this->last_pts);
}
+ this->last_size=buf->size;
if (this->rate == 0)
return;
if (!this->output_open) {
@@ -104,7 +104,7 @@ void lpcm_close (audio_decoder_t *this_gen) {
if (this->output_open)
this->audio_out->close (this->audio_out);
-
+ printf("LPCM:Close\n");
this->output_open = 0;
}