diff options
Diffstat (limited to 'src/libxineadec/fooaudio.c')
-rw-r--r-- | src/libxineadec/fooaudio.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/libxineadec/fooaudio.c b/src/libxineadec/fooaudio.c index 5ab4fa1f6..776136fc2 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; @@ -126,7 +130,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) * the accumulator buffer size as necessary */ if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "fooaudio: increasing source buffer to %d to avoid overflow.\n", this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -147,8 +151,8 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) * This decoder generates a continuous sine pattern based on the pts * values sent by the xine engine. Two pts values are needed to know * how long to make the audio. Thus, If this is the first frame or - * a seek has occurred (indicated by this->last_pts = -1), - * log the pts but do not create any audio. + * a seek has occurred (indicated by this->last_pts = -1), + * log the pts but do not create any audio. * * When a valid pts delta is generated, create n audio samples, where * n is given as: @@ -177,7 +181,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) /* get an audio buffer */ audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "fooaudio: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -192,7 +196,7 @@ static void fooaudio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) #define WAVE_HZ 300 /* fill up the samples in the buffer */ for (i = 0; i < samples_to_send; i++) - audio_buffer->mem[i] = + audio_buffer->mem[i] = (short)(sin(2 * M_PI * this->iteration++ / WAVE_HZ) * 32767); /* final prep for audio buffer dispatch */ @@ -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; @@ -304,7 +308,7 @@ static void dispose_class (audio_decoder_class_t *this_gen) { free (this); } -/* This function allocates a private audio decoder class and initializes +/* This function allocates a private audio decoder class and initializes * the class's member functions. */ static void *init_plugin (xine_t *xine, void *data) { @@ -320,18 +324,18 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -/* This is a list of all of the internal xine audio buffer types that +/* This is a list of all of the internal xine audio buffer types that * this decoder is able to handle. Check src/xine-engine/buffer.h for a * list of valid buffer types (and add a new one if the one you need does * not exist). Terminate the list with a 0. */ -static uint32_t audio_types[] = { +static uint32_t audio_types[] = { /* BUF_AUDIO_FOO, */ 0 }; /* This data structure combines the list of supported xine buffer types and * the priority that the plugin should be given with respect to other - * plugins that handle the same buffer type. A plugin with priority (n+1) + * plugins that handle the same buffer type. A plugin with priority (n+1) * will be used instead of a plugin with priority (n). */ static const decoder_info_t dec_info_audio = { audio_types, /* supported types */ |