summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am2
-rw-r--r--src/xine-engine/spu_decoder.c30
-rw-r--r--src/xine-engine/video_out.c11
-rw-r--r--src/xine-engine/video_out.h7
-rw-r--r--src/xine-engine/xine.c26
-rw-r--r--src/xine-engine/xine_internal.h3
6 files changed, 51 insertions, 28 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 3444d2833..17558fdd2 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -12,7 +12,7 @@ libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c monitor.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 \
+ $(top_srcdir)/src/libspudec/libspudec.la \
$(THREAD_LIBS) \
$(DYNAMIC_LD_LIBS)
-lm
diff --git a/src/xine-engine/spu_decoder.c b/src/xine-engine/spu_decoder.c
index a1af8045a..03f008367 100644
--- a/src/xine-engine/spu_decoder.c
+++ b/src/xine-engine/spu_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: spu_decoder.c,v 1.1 2001/06/18 09:39:05 richwareham Exp $
+ * $Id: spu_decoder.c,v 1.2 2001/06/18 15:43:01 richwareham Exp $
*
*/
@@ -27,18 +27,22 @@
#include "xine_internal.h"
+#include "libspudec/spudec.h"
+
void *spu_decoder_loop (void *this_gen) {
buf_element_t *buf;
xine_t *this = (xine_t *) this_gen;
int running = 1;
int streamtype;
+ spudec_t *decoder;
+ decoder = this->spu_decoder;
while (running) {
/* printf ("video_decoder: getting buffer...\n"); */
- buf = this->video_fifo->get (this->spu_fifo);
+ buf = this->spu_fifo->get (this->spu_fifo);
if (buf->input_pos)
this->cur_input_pos = buf->input_pos;
@@ -55,6 +59,18 @@ void *spu_decoder_loop (void *this_gen) {
running = 0;
break;
+ default:
+ if ( (buf->type & 0xFF000000) == BUF_SPU_BASE ) {
+ int stream_id;
+
+ printf ("spu_decoder: got an SPU buffer, type %08x\n", buf->type);
+
+ stream_id = buf->type & 0xFF;
+
+ if(decoder) {
+ decoder->push_packet(decoder, buf);
+ }
+ }
}
buf->free_buffer (buf);
@@ -64,9 +80,16 @@ void *spu_decoder_loop (void *this_gen) {
}
void spu_decoder_init (xine_t *this) {
+ buf_element_t *buf;
+
+ this->spu_decoder = spudec_init(this);
this->spu_fifo = fifo_buffer_new (1500, 4096);
+ buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo);
+ buf->type = BUF_CONTROL_START;
+ this->spu_fifo->put (this->spu_fifo, buf);
+
pthread_create (&this->spu_thread, NULL, spu_decoder_loop, this) ;
}
@@ -81,6 +104,9 @@ void spu_decoder_shutdown (xine_t *this) {
buf->type = BUF_CONTROL_QUIT;
this->spu_fifo->put (this->spu_fifo, buf);
+ spudec_close(this->spu_decoder);
+ this->spu_decoder = NULL;
+
pthread_join (this->spu_thread, &p);
}
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 22dd0fe81..2c624b94d 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.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: video_out.c,v 1.23 2001/06/17 02:22:30 guenter Exp $
+ * $Id: video_out.c,v 1.24 2001/06/18 15:43:01 richwareham Exp $
*
*/
@@ -35,6 +35,7 @@
#include "utils.h"
#include "monitor.h"
+#include "libspudec/spudec.h"
#define NUM_FRAME_BUFFERS 20
@@ -266,9 +267,10 @@ static void *video_out_loop (void *this_gen) {
img->bDisplayLock = 0;
pthread_mutex_unlock (&img->mutex);
- /* FIXME: spudec_overlay_yuv (img->mem[0], img->mem[1], img->mem[2]) */
+ /* Overlay SPU FIXME: Check image format */
+ this->spu_decoder->overlay_yuv (this->spu_decoder, pts,
+ img->base[0], img->base[1], img->base[2]);
-
xprintf (VERBOSE|VIDEO, "video_out : passing to video driver, image with pts = %d\n", pts);
this->driver->display_frame (this->driver, img);
}
@@ -461,7 +463,7 @@ static int vo_frame_draw (vo_frame_t *img) {
return frames_to_skip;
}
-vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
+vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom, spudec_t *spu_decoder) {
vo_instance_t *this;
int i;
@@ -470,6 +472,7 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
this->driver = driver;
this->metronom = metronom;
+ this->spu_decoder = spu_decoder;
this->open = vo_open;
this->get_frame = vo_get_frame;
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index f49464c77..becfba058 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.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: video_out.h,v 1.7 2001/06/09 11:34:01 heikos Exp $
+ * $Id: video_out.h,v 1.8 2001/06/18 15:43:01 richwareham Exp $
*
*
* xine version of video_out.h
@@ -49,6 +49,8 @@ typedef struct vo_driver_s vo_driver_t ;
typedef struct vo_instance_s vo_instance_t;
typedef struct img_buf_fifo_s img_buf_fifo_t;
+typedef struct spudec_s spudec_t;
+
/* public part, video drivers may add private fields */
struct vo_frame_s {
struct vo_frame_s *next;
@@ -120,6 +122,7 @@ struct vo_instance_s {
vo_driver_t *driver;
metronom_t *metronom;
+ spudec_t *spu_decoder;
img_buf_fifo_t *free_img_buf_queue;
img_buf_fifo_t *display_img_buf_queue;
@@ -239,7 +242,7 @@ struct vo_driver_s {
* a given video driver
*/
-vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) ;
+vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom, spudec_t *spu_decoder) ;
/*
* to build a dynamic video output plugin
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 142a29452..d2aef0dc4 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.27 2001/06/18 09:39:05 richwareham Exp $
+ * $Id: xine.c,v 1.28 2001/06/18 15:43:01 richwareham Exp $
*
* top-level xine functions
*
@@ -219,17 +219,6 @@ static void xine_play_internal (xine_t *this, char *mrl,
this->cur_demuxer_plugin->get_identifier());
/*
- * Init SPU decoder with colour lookup table.
- */
-
- /* FIXME
- if(this->cur_input_plugin->get_clut)
- spudec_init(this->cur_input_plugin->get_clut());
- else
- spudec_init(NULL);
- */
-
- /*
* metronom
*/
@@ -417,12 +406,18 @@ xine_t *xine_init (vo_driver_t *vo,
this->cur_input_pos = 0;
/*
+ * init SPU decoder (must be done before video decoder
+ * so that this->spu_decoder is valid).
+ */
+ spu_decoder_init (this);
+
+ /*
* init and start decoder threads
*/
load_decoder_plugins (this, config, DECODER_PLUGIN_IFACE_VERSION);
- this->video_out = vo_new_instance (vo, this->metronom);
+ this->video_out = vo_new_instance (vo, this->metronom, this->spu_decoder);
video_decoder_init (this);
if(ao) {
@@ -431,11 +426,6 @@ xine_t *xine_init (vo_driver_t *vo,
}
audio_decoder_init (this);
- /*
- * init SPU decoder
- */
- spu_decoder_init (this);
-
return this;
}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index a6e44b2a8..716377b04 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.24 2001/06/18 09:39:05 richwareham Exp $
+ * $Id: xine_internal.h,v 1.25 2001/06/18 15:43:01 richwareham Exp $
*
*/
@@ -130,6 +130,7 @@ typedef struct xine_s {
fifo_buffer_t *spu_fifo;
pthread_t spu_thread;
+ spudec_t *spu_decoder;
int audio_channel;
int spu_channel;