summaryrefslogtreecommitdiff
path: root/src/libxineadec
diff options
context:
space:
mode:
Diffstat (limited to 'src/libxineadec')
-rw-r--r--src/libxineadec/Makefile.am3
-rw-r--r--src/libxineadec/fooaudio.c8
-rw-r--r--src/libxineadec/gsm610.c6
-rw-r--r--src/libxineadec/gsm610/long_term.c4
-rw-r--r--src/libxineadec/gsm610/lpc.c4
-rw-r--r--src/libxineadec/gsm610/rpe.c4
-rw-r--r--src/libxineadec/gsm610/short_term.c4
-rw-r--r--src/libxineadec/nsf.c10
-rw-r--r--src/libxineadec/xine_lpcm_decoder.c35
-rw-r--r--src/libxineadec/xine_speex_decoder.c21
-rw-r--r--src/libxineadec/xine_vorbis_decoder.c254
11 files changed, 218 insertions, 135 deletions
diff --git a/src/libxineadec/Makefile.am b/src/libxineadec/Makefile.am
index d502b7955..ae261e60c 100644
--- a/src/libxineadec/Makefile.am
+++ b/src/libxineadec/Makefile.am
@@ -1,3 +1,4 @@
+include $(top_builddir)/misc/Makefile.plugins
include $(top_srcdir)/misc/Makefile.common
EXTRA_DIST = fooaudio.c
@@ -39,7 +40,7 @@ xineplug_decode_lpcm_la_CFLAGS = $(VISIBILITY_FLAG)
xineplug_decode_lpcm_la_LIBADD = $(XINE_LIB)
xineplug_decode_vorbis_la_SOURCES = xine_vorbis_decoder.c
-xineplug_decode_vorbis_la_LIBADD = $(XINE_LIB) $(VORBIS_LIBS) $(OGG_LIBS)
+xineplug_decode_vorbis_la_LIBADD = $(XINE_LIB) $(VORBIS_LIBS) $(OGG_LIBS) $(LTLIBINTL)
xineplug_decode_vorbis_la_CFLAGS = $(VISIBILITY_FLAG) $(VORBIS_CFLAGS)
xineplug_decode_speex_la_SOURCES = xine_speex_decoder.c
diff --git a/src/libxineadec/fooaudio.c b/src/libxineadec/fooaudio.c
index 5ab4fa1f6..53fcef801 100644
--- a/src/libxineadec/fooaudio.c
+++ b/src/libxineadec/fooaudio.c
@@ -22,6 +22,10 @@
* place of the data it should actually send.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -91,7 +95,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
this->channels = buf->decoder_info[3];
/* initialize the data accumulation buffer */
- this->buf = xine_xmalloc(AUDIOBUFSIZE);
+ this->buf = calloc(1, AUDIOBUFSIZE);
this->bufsize = AUDIOBUFSIZE;
this->size = 0;
@@ -255,7 +259,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
fooaudio_decoder_t *this ;
- this = (fooaudio_decoder_t *) xine_xmalloc (sizeof (fooaudio_decoder_t));
+ this = (fooaudio_decoder_t *) calloc(1, sizeof(fooaudio_decoder_t));
/* connect the member functions */
this->audio_decoder.decode_data = fooaudio_decode_data;
diff --git a/src/libxineadec/gsm610.c b/src/libxineadec/gsm610.c
index 23c0d2104..c67382bc5 100644
--- a/src/libxineadec/gsm610.c
+++ b/src/libxineadec/gsm610.c
@@ -101,7 +101,7 @@ static void gsm610_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
if (buf->decoder_flags & BUF_FLAG_STDHEADER) {
this->sample_rate = buf->decoder_info[1];
- this->buf = xine_xmalloc(AUDIOBUFSIZE);
+ this->buf = calloc(1, AUDIOBUFSIZE);
this->bufsize = AUDIOBUFSIZE;
this->size = 0;
@@ -233,7 +233,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
gsm610_decoder_t *this ;
- this = (gsm610_decoder_t *) xine_xmalloc (sizeof (gsm610_decoder_t));
+ this = (gsm610_decoder_t *) calloc(1, sizeof(gsm610_decoder_t));
this->audio_decoder.decode_data = gsm610_decode_data;
this->audio_decoder.reset = gsm610_reset;
@@ -265,7 +265,7 @@ static void *init_plugin (xine_t *xine, void *data) {
gsm610_class_t *this ;
- this = (gsm610_class_t *) xine_xmalloc (sizeof (gsm610_class_t));
+ this = (gsm610_class_t *) calloc(1, sizeof(gsm610_class_t));
this->decoder_class.open_plugin = open_plugin;
this->decoder_class.get_identifier = get_identifier;
diff --git a/src/libxineadec/gsm610/long_term.c b/src/libxineadec/gsm610/long_term.c
index 625662e1f..d3ef1b63d 100644
--- a/src/libxineadec/gsm610/long_term.c
+++ b/src/libxineadec/gsm610/long_term.c
@@ -6,6 +6,10 @@
/* $Header: /nfshome/cvs/xine-lib/src/libxineadec/gsm610/long_term.c,v 1.3 2003/12/07 15:34:30 f1rmb Exp $ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include "xineutils.h"
diff --git a/src/libxineadec/gsm610/lpc.c b/src/libxineadec/gsm610/lpc.c
index 0f51fa55f..7a8a8e2bc 100644
--- a/src/libxineadec/gsm610/lpc.c
+++ b/src/libxineadec/gsm610/lpc.c
@@ -6,6 +6,10 @@
/* $Header: /nfshome/cvs/xine-lib/src/libxineadec/gsm610/lpc.c,v 1.3 2003/12/07 15:34:30 f1rmb Exp $ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include "xineutils.h"
diff --git a/src/libxineadec/gsm610/rpe.c b/src/libxineadec/gsm610/rpe.c
index 67d94d30e..be1b1529b 100644
--- a/src/libxineadec/gsm610/rpe.c
+++ b/src/libxineadec/gsm610/rpe.c
@@ -6,6 +6,10 @@
/* $Header: /nfshome/cvs/xine-lib/src/libxineadec/gsm610/rpe.c,v 1.3 2003/12/07 15:34:30 f1rmb Exp $ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include "xineutils.h"
#include "private.h"
diff --git a/src/libxineadec/gsm610/short_term.c b/src/libxineadec/gsm610/short_term.c
index 8222b2caa..c2d64853b 100644
--- a/src/libxineadec/gsm610/short_term.c
+++ b/src/libxineadec/gsm610/short_term.c
@@ -6,6 +6,10 @@
/* $Header: /nfshome/cvs/xine-lib/src/libxineadec/gsm610/short_term.c,v 1.3 2003/12/07 15:34:30 f1rmb Exp $ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include "xineutils.h"
#include "private.h"
diff --git a/src/libxineadec/nsf.c b/src/libxineadec/nsf.c
index bdf523f1d..d4841ec6e 100644
--- a/src/libxineadec/nsf.c
+++ b/src/libxineadec/nsf.c
@@ -21,6 +21,10 @@
* http://www.baisoku.org/
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -90,7 +94,7 @@ static void nsf_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
this->song_number = buf->content[4];
/* allocate a buffer for the file */
this->nsf_size = _X_BE_32(&buf->content[0]);
- this->nsf_file = xine_xmalloc(this->nsf_size);
+ this->nsf_file = calloc(1, this->nsf_size);
this->nsf_index = 0;
/* peform any other required initialization */
@@ -205,7 +209,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
nsf_decoder_t *this ;
- this = (nsf_decoder_t *) xine_xmalloc (sizeof (nsf_decoder_t));
+ this = (nsf_decoder_t *) calloc(1, sizeof(nsf_decoder_t));
/* connect the member functions */
this->audio_decoder.decode_data = nsf_decode_data;
@@ -255,7 +259,7 @@ static void *init_plugin (xine_t *xine, void *data) {
nsf_class_t *this ;
- this = (nsf_class_t *) xine_xmalloc (sizeof (nsf_class_t));
+ this = (nsf_class_t *) calloc(1, sizeof(nsf_class_t));
this->decoder_class.open_plugin = open_plugin;
this->decoder_class.get_identifier = get_identifier;
diff --git a/src/libxineadec/xine_lpcm_decoder.c b/src/libxineadec/xine_lpcm_decoder.c
index 8d8f23a05..435545d56 100644
--- a/src/libxineadec/xine_lpcm_decoder.c
+++ b/src/libxineadec/xine_lpcm_decoder.c
@@ -20,6 +20,11 @@
* 31-8-2001 Added LPCM rate sensing.
* (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk
*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifndef __sun
#define _XOPEN_SOURCE 500
#endif
@@ -187,18 +192,34 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
uint8_t *d = (uint8_t *)audio_buffer->mem;
int n = buf->size;
- while (n >= 0) {
+ while (n >= 3) {
if ( stream_be ) {
- *d++ = s[0];
- *d++ = s[1];
+ if ( stream_be == this->cpu_be ) {
+ *d++ = s[0];
+ *d++ = s[1];
+ } else {
+ *d++ = s[1];
+ *d++ = s[0];
+ }
} else {
- *d++ = s[1];
- *d++ = s[2];
+ if ( stream_be == this->cpu_be ) {
+ *d++ = s[1];
+ *d++ = s[2];
+ }
+ else
+ {
+ *d++ = s[2];
+ *d++ = s[1];
+ }
}
s += 3;
n -= 3;
}
+
+ if ( (d - (uint8_t*)audio_buffer->mem)/2*3 < buf->size )
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "lpcm_decoder: lost %i bytes\n", (int)(buf->size - (d - (uint8_t*)audio_buffer->mem))/2*3);
+
} else {
memcpy (audio_buffer->mem, sample_buffer, buf->size);
}
@@ -224,7 +245,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
lpcm_decoder_t *this ;
- this = (lpcm_decoder_t *) xine_xmalloc (sizeof (lpcm_decoder_t));
+ this = (lpcm_decoder_t *) calloc(1, sizeof(lpcm_decoder_t));
this->audio_decoder.decode_data = lpcm_decode_data;
this->audio_decoder.reset = lpcm_reset;
@@ -259,7 +280,7 @@ static void *init_plugin (xine_t *xine, void *data) {
lpcm_class_t *this ;
- this = (lpcm_class_t *) xine_xmalloc (sizeof (lpcm_class_t));
+ this = (lpcm_class_t *) calloc(1, sizeof(lpcm_class_t));
this->decoder_class.open_plugin = open_plugin;
this->decoder_class.get_identifier = get_identifier;
diff --git a/src/libxineadec/xine_speex_decoder.c b/src/libxineadec/xine_speex_decoder.c
index aa8234385..46ea3a9f9 100644
--- a/src/libxineadec/xine_speex_decoder.c
+++ b/src/libxineadec/xine_speex_decoder.c
@@ -170,16 +170,16 @@ void read_metadata (speex_decoder_t *this, char * comments, int length)
#endif
for (i = 0; speex_comment_keys[i].key != NULL; i++) {
+ size_t keylen = strlen(speex_comment_keys[i].key);
if ( !strncasecmp (speex_comment_keys[i].key, c,
- strlen(speex_comment_keys[i].key)) ) {
- int keylen = strlen(speex_comment_keys[i].key);
+ keylen) ) {
char meta_info[(len - keylen) + 1];
lprintf ("known metadata %d %d\n",
i, speex_comment_keys[i].xine_metainfo_index);
- snprintf(meta_info, (len - keylen), "%s", c + keylen);
+ strncpy(meta_info, &c[keylen], len-keylen);
_x_meta_info_set_utf8(this->stream, speex_comment_keys[i].xine_metainfo_index, meta_info);
}
}
@@ -204,7 +204,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
if (!this->st) {
SpeexMode * spx_mode;
SpeexHeader * spx_header;
- int modeID;
+ unsigned int modeID;
int bitrate;
speex_bits_init (&this->bits);
@@ -216,7 +216,12 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
return;
}
- modeID = spx_header->mode;
+ modeID = (unsigned int)spx_header->mode;
+ if (modeID >= SPEEX_NB_MODES) {
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid mode ID %u\n", modeID);
+ return;
+ }
+
spx_mode = (SpeexMode *) speex_mode_list[modeID];
if (spx_mode->bitstream_version != spx_header->mode_bitstream_version) {
@@ -280,7 +285,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
}
} else if (this->output_open) {
- int i, j;
+ int j;
audio_buffer_t *audio_buffer;
@@ -350,7 +355,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
speex_decoder_t *this ;
static SpeexStereoState init_stereo = SPEEX_STEREO_STATE_INIT;
- this = (speex_decoder_t *) xine_xmalloc (sizeof (speex_decoder_t));
+ this = (speex_decoder_t *) calloc(1, sizeof(speex_decoder_t));
this->audio_decoder.decode_data = speex_decode_data;
this->audio_decoder.reset = speex_reset;
@@ -391,7 +396,7 @@ static void *init_plugin (xine_t *xine, void *data) {
speex_class_t *this;
- this = (speex_class_t *) xine_xmalloc (sizeof (speex_class_t));
+ this = (speex_class_t *) calloc(1, sizeof(speex_class_t));
this->decoder_class.open_plugin = open_plugin;
this->decoder_class.get_identifier = get_identifier;
diff --git a/src/libxineadec/xine_vorbis_decoder.c b/src/libxineadec/xine_vorbis_decoder.c
index 4b7a6c15d..218c26033 100644
--- a/src/libxineadec/xine_vorbis_decoder.c
+++ b/src/libxineadec/xine_vorbis_decoder.c
@@ -41,6 +41,7 @@
#include <vorbis/codec.h>
#define MAX_NUM_SAMPLES 4096
+#define INIT_BUFSIZE 8192
typedef struct {
audio_decoder_class_t decoder_class;
@@ -70,6 +71,11 @@ typedef struct vorbis_decoder_s {
xine_stream_t *stream;
+ /* data accumulation stuff */
+ unsigned char *buf;
+ int bufsize;
+ int size;
+
} vorbis_decoder_t;
@@ -78,6 +84,7 @@ static void vorbis_reset (audio_decoder_t *this_gen) {
vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
if( this->header_count ) return;
+ this->size = 0;
/* clear block first, as it might contain allocated data */
vorbis_block_clear(&this->vb);
@@ -136,126 +143,147 @@ static void get_metadata (vorbis_decoder_t *this) {
_x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "vorbis");
}
+static void vorbis_check_bufsize (vorbis_decoder_t *this, int size) {
+ if (size > this->bufsize) {
+ this->bufsize = size + size / 2;
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ _("vorbis: increasing buffer to %d to avoid overflow.\n"),
+ this->bufsize);
+ this->buf = realloc(this->buf, this->bufsize);
+ }
+}
+
static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
memset( &this->op, 0, sizeof(this->op) );
- this->op.packet = buf->content;
- this->op.bytes = buf->size;
-
- if ( (buf->decoder_flags & BUF_FLAG_HEADER) &&
- !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) {
- lprintf ("%d headers to go\n", this->header_count);
- if (this->header_count) {
- int res = 0;
+ /* data accumulation */
+ vorbis_check_bufsize(this, this->size + buf->size);
+ xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size);
+ this->size += buf->size;
- if (this->header_count == 3)
- this->op.b_o_s = 1;
+ if (buf->decoder_flags & BUF_FLAG_FRAME_END) {
+ this->op.packet = this->buf;
+ this->op.bytes = this->size;
-
- if( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ){
- /* error case; not a vorbis header */
- xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res);
- xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64);
- return;
- }
-
- this->header_count--;
-
- if (!this->header_count) {
-
- int mode = AO_CAP_MODE_MONO;
-
- get_metadata (this);
-
- mode = _x_ao_channels2mode(this->vi.channels);
-
- this->convsize=MAX_NUM_SAMPLES/this->vi.channels;
-
- if (!this->output_open) {
- this->output_open = (this->stream->audio_out->open) (this->stream->audio_out,
- this->stream,
- 16,
- this->vi.rate,
- mode) ;
-
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE,
- this->vi.bitrate_nominal);
-
- }
-
- /* OK, got and parsed all three headers. Initialize the Vorbis
- * packet->PCM decoder. */
- lprintf("all three headers parsed. initializing decoder.\n");
- /* initialize central decode state */
- vorbis_synthesis_init(&this->vd,&this->vi);
- /* initialize local state for most of the decode so multiple
- * block decodes can proceed in parallel. We could init
- * multiple vorbis_block structures for vd here */
- vorbis_block_init(&this->vd,&this->vb);
+ /* reset accumultaion buffer */
+ this->size = 0;
+
+ if ( (buf->decoder_flags & BUF_FLAG_HEADER) &&
+ !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) {
+
+ lprintf ("%d headers to go\n", this->header_count);
+
+ if (this->header_count) {
+ int res = 0;
+
+ if (this->header_count == 3)
+ this->op.b_o_s = 1;
+
+ if ( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ) {
+ /* error case; not a vorbis header */
+ xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res);
+ xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64);
+ return;
+ }
+
+ this->header_count--;
+
+ if (!this->header_count) {
+
+ int mode = AO_CAP_MODE_MONO;
+
+ get_metadata (this);
+
+ mode = _x_ao_channels2mode(this->vi.channels);
+
+ this->convsize=MAX_NUM_SAMPLES/this->vi.channels;
+
+ if (!this->output_open) {
+ this->output_open = (this->stream->audio_out->open) (this->stream->audio_out,
+ this->stream,
+ 16,
+ this->vi.rate,
+ mode) ;
+
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE,
+ this->vi.bitrate_nominal);
+
+ }
+
+ /* OK, got and parsed all three headers. Initialize the Vorbis
+ * packet->PCM decoder. */
+ lprintf("all three headers parsed. initializing decoder.\n");
+ /* initialize central decode state */
+ vorbis_synthesis_init(&this->vd,&this->vi);
+ /* initialize local state for most of the decode so multiple
+ * block decodes can proceed in parallel. We could init
+ * multiple vorbis_block structures for vd here */
+ vorbis_block_init(&this->vd,&this->vb);
+ }
}
- }
-
- } else if (this->output_open) {
-
- float **pcm;
- int samples;
-
- if(vorbis_synthesis(&this->vb,&this->op)==0)
- vorbis_synthesis_blockin(&this->vd,&this->vb);
-
- if (buf->pts!=0)
- this->pts=buf->pts;
-
- while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){
-
- /* **pcm is a multichannel float vector. In stereo, for
- * example, pcm[0][...] is left, and pcm[1][...] is right.
- * samples is the size of each channel. Convert the float
- * values (-1.<=range<=1.) to whatever PCM format and write
- * it out
- */
-
- int i,j;
- int bout=(samples<this->convsize?samples:this->convsize);
- audio_buffer_t *audio_buffer;
-
- audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out);
-
- /* convert floats to 16 bit signed ints (host order) and
- interleave */
- for(i=0;i<this->vi.channels;i++){
- ogg_int16_t *ptr=audio_buffer->mem+i;
- float *mono=pcm[i];
- for(j=0;j<bout;j++){
- int val=(mono[j] + 1.0f) * 32768.f;
- val -= 32768;
- /* might as well guard against clipping */
- if(val>32767){
- val=32767;
- } else if(val<-32768){
- val=-32768;
- }
- *ptr=val;
- ptr+=this->vi.channels;
- }
+
+ } else if (this->output_open) {
+
+ float **pcm;
+ int samples;
+
+ if(vorbis_synthesis(&this->vb,&this->op)==0)
+ vorbis_synthesis_blockin(&this->vd,&this->vb);
+
+ if (buf->pts!=0)
+ this->pts=buf->pts;
+
+ while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){
+
+ /* **pcm is a multichannel float vector. In stereo, for
+ * example, pcm[0][...] is left, and pcm[1][...] is right.
+ * samples is the size of each channel. Convert the float
+ * values (-1.<=range<=1.) to whatever PCM format and write
+ * it out
+ */
+
+ int i,j;
+ int bout=(samples<this->convsize?samples:this->convsize);
+ audio_buffer_t *audio_buffer;
+
+ audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out);
+
+ /* convert floats to 16 bit signed ints (host order) and
+ interleave */
+ for(i=0;i<this->vi.channels;i++){
+ ogg_int16_t *ptr=audio_buffer->mem+i;
+ float *mono=pcm[i];
+ for(j=0;j<bout;j++){
+ int val=(mono[j] + 1.0f) * 32768.f;
+ val -= 32768;
+ /* might as well guard against clipping */
+ if(val>32767){
+ val=32767;
+ } else if(val<-32768){
+ val=-32768;
+ }
+ *ptr=val;
+ ptr+=this->vi.channels;
+ }
+ }
+
+ audio_buffer->vpts = this->pts;
+ this->pts=0;
+ audio_buffer->num_frames = bout;
+
+ this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream);
+
+ buf->pts=0;
+
+ /* tell libvorbis how many samples we actually consumed */
+ vorbis_synthesis_read(&this->vd,bout);
}
-
- audio_buffer->vpts = this->pts;
- this->pts=0;
- audio_buffer->num_frames = bout;
-
- this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream);
-
- buf->pts=0;
-
- /* tell libvorbis how many samples we actually consumed */
- vorbis_synthesis_read(&this->vd,bout);
+ } else {
+ lprintf("output not open\n");
}
- } else {
- lprintf("output not open\n");
}
}
@@ -287,7 +315,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
vorbis_decoder_t *this ;
- this = (vorbis_decoder_t *) xine_xmalloc (sizeof (vorbis_decoder_t));
+ this = (vorbis_decoder_t *) calloc(1, sizeof(vorbis_decoder_t));
this->audio_decoder.decode_data = vorbis_decode_data;
this->audio_decoder.reset = vorbis_reset;
@@ -299,6 +327,10 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
this->header_count = 3;
this->convsize = 0;
+ this->bufsize = INIT_BUFSIZE;
+ this->buf = calloc(1, INIT_BUFSIZE);
+ this->size = 0;
+
vorbis_info_init(&this->vi);
vorbis_comment_init(&this->vc);
@@ -327,7 +359,7 @@ static void *init_plugin (xine_t *xine, void *data) {
vorbis_class_t *this;
- this = (vorbis_class_t *) xine_xmalloc (sizeof (vorbis_class_t));
+ this = (vorbis_class_t *) calloc(1, sizeof(vorbis_class_t));
this->decoder_class.open_plugin = open_plugin;
this->decoder_class.get_identifier = get_identifier;