summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich J Wareham <richwareham@users.sourceforge.net>2001-06-18 09:39:05 +0000
committerRich J Wareham <richwareham@users.sourceforge.net>2001-06-18 09:39:05 +0000
commit32693b7bdcac89e60654ad3f01d1739be45c1d1f (patch)
tree29f31b90f6e3ad64ca609788f79379a081e11426
parent7ab2e7c31144b68d3f550e470fd2d1cc9dc441d7 (diff)
downloadxine-lib-32693b7bdcac89e60654ad3f01d1739be45c1d1f.tar.gz
xine-lib-32693b7bdcac89e60654ad3f01d1739be45c1d1f.tar.bz2
Added first step towards integrating SPU decoder into the new framework.
CVS patchset: 207 CVS date: 2001/06/18 09:39:05
-rw-r--r--src/xine-engine/Makefile.am2
-rw-r--r--src/xine-engine/spu_decoder.c86
-rw-r--r--src/xine-engine/xine.c11
-rw-r--r--src/xine-engine/xine_internal.h20
4 files changed, 112 insertions, 7 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index a171246de..3444d2833 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -9,7 +9,7 @@ EXTRA_DIST = cpu_accel.c
lib_LTLIBRARIES = libxine.la
libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c monitor.c \
- utils.c load_plugins.c video_decoder.c \
+ utils.c load_plugins.c video_decoder.c spu_decoder.c \
audio_decoder.c video_out.c
libxine_la_LIBADD = cpu_accel.lo \
## $(top_srcdir)/src/libspudec/libspudec.la \
diff --git a/src/xine-engine/spu_decoder.c b/src/xine-engine/spu_decoder.c
new file mode 100644
index 000000000..a1af8045a
--- /dev/null
+++ b/src/xine-engine/spu_decoder.c
@@ -0,0 +1,86 @@
+/*
+ * 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: spu_decoder.c,v 1.1 2001/06/18 09:39:05 richwareham Exp $
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "xine_internal.h"
+
+void *spu_decoder_loop (void *this_gen) {
+
+ buf_element_t *buf;
+ xine_t *this = (xine_t *) this_gen;
+ int running = 1;
+ int streamtype;
+
+ while (running) {
+
+ /* printf ("video_decoder: getting buffer...\n"); */
+
+ buf = this->video_fifo->get (this->spu_fifo);
+ if (buf->input_pos)
+ this->cur_input_pos = buf->input_pos;
+
+ /* printf ("spu_decoder: got buffer %d\n", buf->type); */
+
+ switch (buf->type) {
+ case BUF_CONTROL_START:
+ break;
+
+ case BUF_CONTROL_END:
+ break;
+
+ case BUF_CONTROL_QUIT:
+ running = 0;
+ break;
+
+ }
+
+ buf->free_buffer (buf);
+ }
+
+ pthread_exit(NULL);
+}
+
+void spu_decoder_init (xine_t *this) {
+
+ this->spu_fifo = fifo_buffer_new (1500, 4096);
+
+ pthread_create (&this->spu_thread, NULL, spu_decoder_loop, this) ;
+}
+
+void spu_decoder_shutdown (xine_t *this) {
+
+ buf_element_t *buf;
+ void *p;
+
+ this->spu_fifo->clear(this->spu_fifo);
+
+ buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo);
+ buf->type = BUF_CONTROL_QUIT;
+ this->spu_fifo->put (this->spu_fifo, buf);
+
+ pthread_join (this->spu_thread, &p);
+}
+
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 1844d0974..142a29452 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.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.c,v 1.26 2001/06/17 19:14:26 guenter Exp $
+ * $Id: xine.c,v 1.27 2001/06/18 09:39:05 richwareham Exp $
*
* top-level xine functions
*
@@ -325,6 +325,10 @@ void xine_exit (xine_t *this) {
pthread_mutex_unlock (&this->xine_lock);
+ printf ("xine_exit: shutdown spu\n");
+
+ spu_decoder_shutdown (this);
+
printf ("xine_exit: shutdown audio\n");
audio_decoder_shutdown (this);
@@ -430,10 +434,7 @@ xine_t *xine_init (vo_driver_t *vo,
/*
* init SPU decoder
*/
-
-
- this->spu_fifo = fifo_buffer_new (1000, 4096);
- /* FIXME spudec_init(NULL); */
+ spu_decoder_init (this);
return this;
}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 22a5a5128..a6e44b2a8 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.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: xine_internal.h,v 1.23 2001/06/16 18:03:22 guenter Exp $
+ * $Id: xine_internal.h,v 1.24 2001/06/18 09:39:05 richwareham Exp $
*
*/
@@ -129,6 +129,7 @@ typedef struct xine_s {
char cur_mrl[1024];
fifo_buffer_t *spu_fifo;
+ pthread_t spu_thread;
int audio_channel;
int spu_channel;
@@ -301,6 +302,23 @@ void video_decoder_init (xine_t *this);
void video_decoder_shutdown (xine_t *this);
/*
+ * spu decoder stuff
+ */
+
+/*
+ * init spu decoder, allocate spu fifo,
+ * start spu decoder thread
+ */
+
+void spu_decoder_init (xine_t *this);
+
+/*
+ * quit spu thread
+ */
+
+void spu_decoder_shutdown (xine_t *this);
+
+/*
* init audio decoders, allocate audio fifo,
* start audio decoder thread
*/