summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schaefer <heikos@users.sourceforge.net>2001-10-07 03:53:10 +0000
committerHeiko Schaefer <heikos@users.sourceforge.net>2001-10-07 03:53:10 +0000
commit19e1a971393f6a1737273fed544b975688990238 (patch)
tree74d2589120c02785009d4f2f968c4e91ec4a19c3
parent8fbac532702fbe9fe399441e7e8ab775de7a4bff (diff)
downloadxine-lib-19e1a971393f6a1737273fed544b975688990238.tar.gz
xine-lib-19e1a971393f6a1737273fed544b975688990238.tar.bz2
initial ogg/vorbis support added
CVS patchset: 755 CVS date: 2001/10/07 03:53:10
-rw-r--r--configure.in1
-rw-r--r--src/Makefile.am3
-rw-r--r--src/demuxers/Makefile.am13
-rw-r--r--src/demuxers/demux_ogg.c392
-rw-r--r--src/libvorbis/Makefile.am50
-rw-r--r--src/libvorbis/xine_decoder.c248
-rw-r--r--src/xine-engine/audio_decoder.c4
-rw-r--r--src/xine-engine/buffer.h3
8 files changed, 706 insertions, 8 deletions
diff --git a/configure.in b/configure.in
index ba5156315..2b700ce37 100644
--- a/configure.in
+++ b/configure.in
@@ -705,6 +705,7 @@ src/libw32dll/Makefile
src/libw32dll/wine/Makefile
src/libspudec/Makefile
src/libvfill/Makefile
+src/libvorbis/Makefile
src/input/Makefile
src/xine-engine/Makefile
misc/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index b5f081872..24a6fc0c2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,7 @@
SUBDIRS = audio_out video_out dxr3 input libmpeg2 libspudec demuxers \
- liba52 libffmpeg liblpcm libw32dll libmad libdts libvfill xine-engine
+ liba52 libffmpeg liblpcm libw32dll libmad libdts libvfill \
+ libvorbis xine-engine
debug:
@list='$(SUBDIRS)'; for subdir in $$list; do \
diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am
index ac47e4058..227b268e6 100644
--- a/src/demuxers/Makefile.am
+++ b/src/demuxers/Makefile.am
@@ -9,10 +9,15 @@ libdir = $(XINE_PLUGINDIR)
# ---------
# All of xine demuxer plugins should be named like the scheme "xineplug_dmx_"
#
-lib_LTLIBRARIES = xineplug_dmx_avi.la xineplug_dmx_mpeg_block.la \
- xineplug_dmx_mpeg.la xineplug_dmx_mpeg_elem.la \
- xineplug_dmx_mpeg_audio.la xineplug_dmx_mpeg_pes.la \
- xineplug_dmx_mpeg_ts.la xineplug_dmx_qt.la
+lib_LTLIBRARIES = xineplug_dmx_ogg.la xineplug_dmx_avi.la \
+ xineplug_dmx_mpeg_block.la xineplug_dmx_mpeg.la \
+ xineplug_dmx_mpeg_elem.la xineplug_dmx_mpeg_audio.la \
+ xineplug_dmx_mpeg_pes.la xineplug_dmx_mpeg_ts.la \
+ xineplug_dmx_qt.la
+
+xineplug_dmx_ogg_la_SOURCES = demux_ogg.c
+xineplug_dmx_ogg_la_LIBADD = -logg
+xineplug_dmx_ogg_la_LDFLAGS = -avoid-version -module
xineplug_dmx_avi_la_SOURCES = demux_avi.c
xineplug_dmx_avi_la_LDFLAGS = -avoid-version -module
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
new file mode 100644
index 000000000..eabd60880
--- /dev/null
+++ b/src/demuxers/demux_ogg.c
@@ -0,0 +1,392 @@
+/*
+ * Copyright (C) 2000, 2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: demux_ogg.c,v 1.1 2001/10/07 03:53:11 heikos Exp $
+ *
+ * demultiplexer for ogg program streams
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <ogg/ogg.h>
+
+#include "xine_internal.h"
+#include "monitor.h"
+#include "demux.h"
+#include "utils.h"
+
+#define CHUNKSIZE 8500
+
+#define MAX_STREAMS 16
+
+static uint32_t xine_debug;
+
+typedef struct demux_ogg_s {
+ demux_plugin_t demux_plugin;
+
+ fifo_buffer_t *audio_fifo;
+ fifo_buffer_t *video_fifo;
+
+ input_plugin_t *input;
+
+ pthread_t thread;
+
+ int status;
+
+ int send_end_buffers;
+
+ gui_get_next_mrl_cb_t next_mrl_cb;
+ gui_branched_cb_t branched_cb;
+
+ ogg_sync_state oy;
+ ogg_stream_state os;
+ ogg_page og;
+
+ ogg_stream_state oss[MAX_STREAMS];
+ uint32_t buf_types[MAX_STREAMS];
+ int num_streams;
+} demux_ogg_t ;
+
+
+static void *demux_ogg_loop (void *this_gen) {
+ buf_element_t *buf;
+
+ demux_ogg_t *this = (demux_ogg_t *) this_gen;
+
+ char *buffer;
+ long bytes;
+
+ /* printf ("demux_ogg: demux loop starting...\n"); */
+
+ this->input->seek (this->input, 0, SEEK_SET);
+
+ this->send_end_buffers = 1;
+
+ while (1) {
+ int i;
+ int stream_num = -1;
+ int cur_serno;
+
+ ogg_packet op;
+
+ int ret = ogg_sync_pageout(&this->oy,&this->og);
+
+ /* printf("demux_ogg: pageout: %d\n", ret); */
+
+ if (ret == 0) {
+ buffer = ogg_sync_buffer(&this->oy, CHUNKSIZE);
+ bytes = this->input->read(this->input, buffer, CHUNKSIZE);
+
+ if (bytes < CHUNKSIZE)
+ break;
+
+ ogg_sync_wrote(&this->oy, bytes);
+ } else if (ret > 0) {
+ /* now we've got at least one new page */
+
+ cur_serno = ogg_page_serialno (&this->og);
+
+ if (ogg_page_bos(&this->og)) {
+ printf("demux_ogg: beginning of stream\n");
+ printf("demux_ogg: serial number %d\n",
+ ogg_page_serialno (&this->og));
+ }
+
+ for (i = 0; i<this->num_streams; i++) {
+ if (this->oss[i].serialno == cur_serno) {
+ stream_num = i;
+ break;
+ }
+ }
+
+ if (stream_num < 0) {
+ ogg_stream_init(&this->oss[this->num_streams], cur_serno);
+ stream_num = this->num_streams;
+ this->buf_types[stream_num] = 0;
+
+ printf("demux_ogg: found a new stream, serialnumber %d\n", cur_serno);
+
+ this->num_streams++;
+ }
+
+ ogg_stream_pagein(&this->oss[stream_num], &this->og);
+
+ while (ogg_stream_packetout(&this->oss[stream_num], &op) == 1) {
+ /* printf("demux_ogg: packet: %.8s\n", op.packet); */
+ /* printf("demux_ogg: got a packet\n"); */
+
+ if (!this->buf_types[stream_num]) {
+ /* detect buftype */
+ if (!strncmp (&op.packet[1], "vorbis", 6)) {
+ this->buf_types[stream_num] = BUF_AUDIO_VORBIS;
+ } else {
+ printf ("demux_ogg: unknown streamtype, signature: >%.8s<\n",
+ op.packet);
+ this->buf_types[stream_num] = BUF_CONTROL_NOP;
+ }
+ }
+
+ if ( this->audio_fifo
+ && (this->buf_types[stream_num] & 0xFF000000) == BUF_AUDIO_BASE) {
+ buf_element_t *buf;
+
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+
+ buf->content = buf->mem;
+
+ {
+ int op_size = sizeof(op);
+ ogg_packet *og_ghost;
+ op_size += (4 - (op_size % 4));
+
+ /* nasty hack to pack op as well as (vorbis) content
+ in one xine buffer */
+ memcpy (buf->content + op_size, op.packet, op.bytes);
+ memcpy (buf->content, &op, sizeof(op));
+ og_ghost = (ogg_packet *) buf->content;
+ og_ghost->packet = buf->content + op_size;
+
+ }
+
+ buf->PTS = 0; /* FIXME */
+ buf->size = op.bytes;
+
+ buf->input_pos = 0;
+ buf->input_time = 0;
+
+ buf->type = this->buf_types[stream_num];
+
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+ }
+ }
+ }
+
+ /*
+ printf ("demux_ogg: demux loop finished (status: %d)\n",
+ this->status);
+ */
+
+ this->status = DEMUX_FINISHED;
+
+ if (this->send_end_buffers) {
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+
+ }
+
+ pthread_exit(NULL);
+
+ return NULL;
+}
+
+static void demux_ogg_close (demux_plugin_t *this_gen) {
+
+ demux_ogg_t *this = (demux_ogg_t *) this_gen;
+ free (this);
+
+}
+
+static void demux_ogg_stop (demux_plugin_t *this_gen) {
+
+ demux_ogg_t *this = (demux_ogg_t *) this_gen;
+ buf_element_t *buf;
+ void *p;
+
+ if (this->status != DEMUX_OK) {
+ printf ("demux_ogg: stop...ignored\n");
+ return;
+ }
+
+ this->send_end_buffers = 0;
+ this->status = DEMUX_FINISHED;
+
+ pthread_cancel (this->thread);
+ pthread_join (this->thread, &p);
+
+ this->video_fifo->clear(this->video_fifo);
+ if (this->audio_fifo)
+ this->audio_fifo->clear(this->audio_fifo);
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
+
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
+
+static int demux_ogg_get_status (demux_plugin_t *this_gen) {
+ demux_ogg_t *this = (demux_ogg_t *) this_gen;
+
+ return this->status;
+}
+
+static void demux_ogg_start (demux_plugin_t *this_gen,
+ fifo_buffer_t *video_fifo,
+ fifo_buffer_t *audio_fifo,
+ off_t start_pos, int start_time,
+ gui_get_next_mrl_cb_t next_mrl_cb,
+ gui_branched_cb_t branched_cb)
+{
+
+ demux_ogg_t *this = (demux_ogg_t *) this_gen;
+ buf_element_t *buf;
+ int err;
+
+ this->video_fifo = video_fifo;
+ this->audio_fifo = audio_fifo;
+ this->next_mrl_cb = next_mrl_cb;
+ this->branched_cb = branched_cb;
+
+ /*
+ * send start buffer
+ */
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_START;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_START;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+
+ /*
+ * initialize ogg engine
+ */
+
+ ogg_sync_init(&this->oy);
+
+ this->num_streams = 0;
+
+ /*
+ * now start demuxing
+ */
+
+ this->status = DEMUX_OK;
+
+ if ((err = pthread_create (&this->thread,
+ NULL, demux_ogg_loop, this)) != 0) {
+ fprintf (stderr, "demux_ogg: can't create new thread (%s)\n",
+ strerror(err));
+ exit (1);
+ }
+}
+
+static int demux_ogg_open(demux_plugin_t *this_gen,
+ input_plugin_t *input, int stage) {
+
+ demux_ogg_t *this = (demux_ogg_t *) this_gen;
+
+ switch(stage) {
+
+ case STAGE_BY_CONTENT:
+ return DEMUX_CANNOT_HANDLE;
+ break;
+
+ case STAGE_BY_EXTENSION: {
+ char *ending;
+ char *MRL;
+
+ MRL = input->get_mrl (input);
+
+ /*
+ * check ending
+ */
+
+ ending = strrchr(MRL, '.');
+
+ if(!ending)
+ return DEMUX_CANNOT_HANDLE;
+
+ if(!strcasecmp(ending, ".ogg")) {
+ this->input = input;
+ return DEMUX_CAN_HANDLE;
+ }
+ }
+ break;
+ }
+
+ return DEMUX_CANNOT_HANDLE;
+}
+
+static char *demux_ogg_get_id(void) {
+ return "OGG";
+}
+
+static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) {
+
+ demux_ogg_t *this = (demux_ogg_t *) this_gen;
+
+ return 0;
+}
+
+demux_plugin_t *init_demuxer_plugin(int iface, config_values_t *config) {
+
+ demux_ogg_t *this;
+
+ if (iface != 3) {
+ printf( "demux_ogg: plugin doesn't support plugin API version %d.\n"
+ "demux_ogg: this means there's a version mismatch between xine and this "
+ "demux_ogg: demuxer plugin.\nInstalling current demux plugins should help.\n",
+ iface);
+ return NULL;
+ }
+
+ this = xmalloc (sizeof (demux_ogg_t));
+ xine_debug = config->lookup_int (config, "xine_debug", 0);
+
+ this->demux_plugin.interface_version = DEMUXER_PLUGIN_IFACE_VERSION;
+ this->demux_plugin.open = demux_ogg_open;
+ this->demux_plugin.start = demux_ogg_start;
+ this->demux_plugin.stop = demux_ogg_stop;
+ this->demux_plugin.close = demux_ogg_close;
+ this->demux_plugin.get_status = demux_ogg_get_status;
+ this->demux_plugin.get_identifier = demux_ogg_get_id;
+ this->demux_plugin.get_stream_length = demux_ogg_get_stream_length;
+
+ return (demux_plugin_t *) this;
+}
diff --git a/src/libvorbis/Makefile.am b/src/libvorbis/Makefile.am
new file mode 100644
index 000000000..8beec93b8
--- /dev/null
+++ b/src/libvorbis/Makefile.am
@@ -0,0 +1,50 @@
+CFLAGS = @GLOBAL_CFLAGS@
+
+LIBTOOL = $(SHELL) $(top_builddir)/libtool-nofpic
+
+libdir = $(XINE_PLUGINDIR)
+
+lib_LTLIBRARIES = xineplug_decode_vorbis.la
+
+xineplug_decode_vorbis_la_SOURCES = xine_decoder.c
+xineplug_decode_vorbis_la_LIBADD = -lvorbis
+xineplug_decode_vorbis_la_LDFLAGS = -avoid-version -module
+
+
+
+##
+## Install header files (default=$includedir/xine)
+##
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(includedir)/xine
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p; \
+ done
+
+
+##
+## Remove them
+##
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ list='$(include_HEADERS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(includedir)/xine/$$p; \
+ done
+
+
+debug:
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+
+install-debug: debug
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+mostlyclean-generic:
+ -rm -f *~ \#* .*~ .\#*
+
+maintainer-clean-generic:
+ -@echo "This command is intended for maintainers to use;"
+ -@echo "it deletes files that may require special tools to rebuild."
+ -rm -f Makefile.in
diff --git a/src/libvorbis/xine_decoder.c b/src/libvorbis/xine_decoder.c
new file mode 100644
index 000000000..53d90c55c
--- /dev/null
+++ b/src/libvorbis/xine_decoder.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * 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.1 2001/10/07 03:53:11 heikos Exp $
+ *
+ * (ogg/)vorbis audio decoder plugin (libvorbis wrapper) for xine
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "audio_out.h"
+#include "buffer.h"
+#include "xine_internal.h"
+
+#include <ogg/ogg.h>
+#include <vorbis/codec.h>
+
+#define MAX_NUM_SAMPLES 4096
+
+typedef struct vorbis_decoder_s {
+ audio_decoder_t audio_decoder;
+
+ uint32_t pts;
+
+ ao_instance_t *audio_out;
+ int output_sampling_rate;
+ int output_open;
+ int output_mode;
+
+ /* vorbis stuff */
+ vorbis_info vi;
+ vorbis_comment vc;
+ vorbis_dsp_state vd;
+ vorbis_block vb;
+
+ int16_t convbuffer[MAX_NUM_SAMPLES];
+ int convsize;
+
+ int header_count;
+
+} vorbis_decoder_t;
+
+static int vorbis_can_handle (audio_decoder_t *this_gen, int buf_type) {
+ return ((buf_type & 0xFFFF0000) == BUF_AUDIO_VORBIS) ;
+}
+
+
+static void vorbis_init (audio_decoder_t *this_gen, ao_instance_t *audio_out) {
+
+ vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
+
+ this->audio_out = audio_out;
+ this->output_open = 0;
+ this->header_count = 3;
+ this->convsize = 0;
+
+ vorbis_info_init(&this->vi);
+ vorbis_comment_init(&this->vc);
+
+
+ printf ("libvorbis: init\n");
+
+}
+
+static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
+
+ vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
+ ogg_packet *op = (ogg_packet *) buf->content;
+
+ /*
+ printf ("vorbisdecoder: before buf=%08x content=%08x op=%08x packet=%08x\n",
+ buf, buf->content, op, op->packet);
+ */
+
+ /* if (buf->decoder_info[0] >0) { */
+
+
+ if (this->header_count) {
+
+ if(vorbis_synthesis_headerin(&this->vi,&this->vc,op)<0){
+ /* error case; not a vorbis header */
+ printf("libvorbis: this bitstream does not contain Vorbis "
+ "audio data.\n");
+ /* FIXME: handle error */
+ }
+
+ this->header_count--;
+
+ if (!this->header_count) {
+
+ int mode = AO_CAP_MODE_MONO;
+
+ {
+ char **ptr=this->vc.user_comments;
+ while(*ptr){
+ printf("libvorbis: %s\n",*ptr);
+ ++ptr;
+ }
+ printf ("\nlibvorbis: bitstream is %d channel, %ldHz\n",
+ this->vi.channels, this->vi.rate);
+ printf("libvorbis: encoded by: %s\n\n",this->vc.vendor);
+ }
+
+ switch (this->vi.channels) {
+ case 1:
+ mode = AO_CAP_MODE_MONO;
+ break;
+ case 2:
+ mode = AO_CAP_MODE_STEREO;
+ break;
+ case 4:
+ mode = AO_CAP_MODE_4CHANNEL;
+ break;
+ case 5:
+ mode = AO_CAP_MODE_5CHANNEL;
+ break;
+ case 6:
+ mode = AO_CAP_MODE_5_1CHANNEL;
+ break;
+ default:
+ printf ("libvorbis: help, %d channels ?!\n",
+ this->vi.channels);
+ /* FIXME: handle error */
+ }
+
+ this->convsize=MAX_NUM_SAMPLES/this->vi.channels;
+
+ if (!this->output_open) {
+ this->output_open = this->audio_out->open(this->audio_out,
+ 16,
+ this->vi.rate,
+ mode) ;
+ }
+
+ vorbis_synthesis_init(&this->vd,&this->vi);
+ vorbis_block_init(&this->vd,&this->vb);
+
+ }
+ } else if (this->output_open) {
+
+ float **pcm;
+ int samples;
+
+
+ if(vorbis_synthesis(&this->vb,op)==0)
+ vorbis_synthesis_blockin(&this->vd,&this->vb);
+
+ while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){
+
+ int i,j;
+ int clipflag=0;
+ int bout=(samples<this->convsize?samples:this->convsize);
+
+ /* convert floats to 16 bit signed ints (host order) and
+ interleave */
+ for(i=0;i<this->vi.channels;i++){
+ ogg_int16_t *ptr=this->convbuffer+i;
+ float *mono=pcm[i];
+ for(j=0;j<bout;j++){
+ int val=mono[j]*32767.f;
+ /* might as well guard against clipping */
+ if(val>32767){
+ val=32767;
+ clipflag=1;
+ }
+ if(val<-32768){
+ val=-32768;
+ clipflag=1;
+ }
+ *ptr=val;
+ ptr+=this->vi.channels;
+ }
+ }
+
+ this->audio_out->write (this->audio_out,
+ this->convbuffer,
+ bout,
+ buf->PTS);
+ buf->PTS=0;
+ vorbis_synthesis_read(&this->vd,bout);
+ }
+ }
+}
+
+static void vorbis_close (audio_decoder_t *this_gen) {
+
+ vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
+
+ vorbis_block_clear(&this->vb);
+ vorbis_dsp_clear(&this->vd);
+ vorbis_comment_clear(&this->vc);
+ vorbis_info_clear(&this->vi); /* must be called last */
+
+ if (this->output_open)
+ this->audio_out->close (this->audio_out);
+}
+
+static char *vorbis_get_id(void) {
+ return "vorbis";
+}
+
+audio_decoder_t *init_audio_decoder_plugin (int iface_version, config_values_t *cfg) {
+
+ vorbis_decoder_t *this ;
+
+ if (iface_version != 2) {
+ printf( "libvorbis: plugin doesn't support plugin API version %d.\n"
+ "libvorbis: this means there's a version mismatch between xine and this "
+ "libvorbis: decoder plugin.\nInstalling current plugins should help.\n",
+ iface_version);
+
+ return NULL;
+ }
+
+ this = (vorbis_decoder_t *) malloc (sizeof (vorbis_decoder_t));
+
+ this->audio_decoder.interface_version = 2;
+ this->audio_decoder.can_handle = vorbis_can_handle;
+ this->audio_decoder.init = vorbis_init;
+ this->audio_decoder.decode_data = vorbis_decode_data;
+ this->audio_decoder.close = vorbis_close;
+ this->audio_decoder.get_identifier = vorbis_get_id;
+ this->audio_decoder.priority = 5;
+
+ return (audio_decoder_t *) this;
+}
+
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 9ab3a8d24..e2160b271 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_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: audio_decoder.c,v 1.45 2001/10/06 01:02:01 jcdutton Exp $
+ * $Id: audio_decoder.c,v 1.46 2001/10/07 03:53:11 heikos Exp $
*
*
* functions that implement audio decoding
@@ -210,7 +210,7 @@ void audio_decoder_init (xine_t *this) {
return;
}
- this->audio_fifo = fifo_buffer_new (1500, 4096);
+ this->audio_fifo = fifo_buffer_new (1500, 8192);
pthread_attr_init(&pth_attrs);
pthread_attr_getschedparam(&pth_attrs, &pth_params);
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index abed6122d..99ea88b4b 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -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: buffer.h,v 1.14 2001/09/18 17:41:48 jkeil Exp $
+ * $Id: buffer.h,v 1.15 2001/10/07 03:53:11 heikos Exp $
*
*
* contents:
@@ -104,6 +104,7 @@ extern "C" {
#define BUF_AUDIO_MSADPCM 0x03060000
#define BUF_AUDIO_IMAADPCM 0x03070000
#define BUF_AUDIO_MSGSM 0x03080000
+#define BUF_AUDIO_VORBIS 0x03090000
/* spu buffer types: */