summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authoruid32519 <none@none>2001-07-04 17:10:24 +0000
committeruid32519 <none@none>2001-07-04 17:10:24 +0000
commit507e81ddf0454a0b740a69f69d917ce67075065f (patch)
treed935d772f266ee49a6a73341e1a34afda4b383d8 /src/xine-engine
parentc8d64e87f29e42dc2f6f0068e575dd10188999af (diff)
downloadxine-lib-507e81ddf0454a0b740a69f69d917ce67075065f.tar.gz
xine-lib-507e81ddf0454a0b740a69f69d917ce67075065f.tar.bz2
spu support updated (unfinished) from James
CVS patchset: 250 CVS date: 2001/07/04 17:10:24
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am8
-rw-r--r--src/xine-engine/load_plugins.c65
-rw-r--r--src/xine-engine/metronom.c3
-rw-r--r--src/xine-engine/metronom.h4
-rw-r--r--src/xine-engine/monitor.h26
-rw-r--r--src/xine-engine/spu_decoder.c99
-rw-r--r--src/xine-engine/spu_decoder.h152
-rw-r--r--src/xine-engine/video_out.c31
-rw-r--r--src/xine-engine/video_out.h38
-rw-r--r--src/xine-engine/xine.c23
-rw-r--r--src/xine-engine/xine_internal.h12
11 files changed, 361 insertions, 100 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 17558fdd2..4726c331d 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -8,14 +8,14 @@ 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 spu_decoder.c \
+libxine_la_SOURCES = xine.c metronom.c configfile.c spu_decoder.c buffer.c monitor.c \
+ utils.c load_plugins.c video_decoder.c \
audio_decoder.c video_out.c
libxine_la_LIBADD = cpu_accel.lo \
- $(top_srcdir)/src/libspudec/libspudec.la \
$(THREAD_LIBS) \
- $(DYNAMIC_LD_LIBS)
+ $(DYNAMIC_LD_LIBS) \
-lm
+
libxine_la_LDFLAGS = -version-info 5:0:5
include_HEADERS = buffer.h metronom.h configfile.h \
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 1a7d97424..a7b1aa924 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.27 2001/07/01 23:37:05 guenter Exp $
+ * $Id: load_plugins.c,v 1.28 2001/07/04 17:10:24 uid32519 Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -268,6 +268,9 @@ void load_decoder_plugins (xine_t *this,
/*
* clean up first
*/
+ this->cur_spu_decoder_plugin = NULL;
+ for (i=0; i<DECODER_PLUGIN_MAX; i++)
+ this->spu_decoder_plugins[i] = NULL;
this->cur_video_decoder_plugin = NULL;
for (i=0; i<DECODER_PLUGIN_MAX; i++)
@@ -312,6 +315,29 @@ void load_decoder_plugins (xine_t *this,
} else {
void *(*initplug) (int, config_values_t *);
+
+ /*
+ * does this plugin provide an spu decoder plugin?
+ */
+
+ if((initplug = dlsym(plugin, "init_spu_decoder_plugin")) != NULL) {
+
+ spu_decoder_t *sdp;
+ int streamtype;
+
+ sdp = (spu_decoder_t *) initplug(iface_version, config);
+ printf("SPU Can Handle ?\n");
+ for (streamtype = 0; streamtype<256; streamtype++) {
+ if (sdp->can_handle (sdp, (streamtype<<16) | BUF_SPU_BASE))
+ printf("SPU Can Handle yes %x\n",streamtype);
+ this->spu_decoder_plugins[streamtype] = sdp;
+ }
+
+ printf("spu decoder plugin found : %s\n",
+ sdp->get_identifier());
+ }
+
+
/*
* does this plugin provide an video decoder plugin?
@@ -360,6 +386,7 @@ void load_decoder_plugins (xine_t *this,
}
}
+ this->cur_spu_decoder_plugin = NULL;
this->cur_video_decoder_plugin = NULL;
this->cur_audio_decoder_plugin = NULL;
}
@@ -498,22 +525,30 @@ vo_driver_t *xine_load_video_output_plugin(config_values_t *config,
if ((getinfo = dlsym(plugin, "get_video_out_plugin_info")) != NULL) {
vo_info = getinfo();
-
- if (!strcmp(id, vo_info->id)) {
- void *(*initplug) (config_values_t *, void *);
+
+ if (!strcmp(id, vo_info->id) ) {
+
+ if (vo_info->interface_version == VIDEO_OUT_IFACE_VERSION) {
+
+ void *(*initplug) (config_values_t *, void *);
- if((initplug = dlsym(plugin, "init_video_out_plugin")) != NULL) {
-
- vod = (vo_driver_t *) initplug(config, visual);
-
- if (vod)
- printf("load_plugins: video output plugin %s successfully"
- " loaded.\n", id);
- else
- printf("load_plugins: video output plugin %s: "
- "init_video_out_plugin failed.\n", str);
+ if((initplug = dlsym(plugin, "init_video_out_plugin")) != NULL) {
+
+ vod = (vo_driver_t *) initplug(config, visual);
+
+ if (vod)
+ printf("load_plugins: video output plugin %s successfully"
+ " loaded.\n", id);
+ else
+ printf("load_plugins: video output plugin %s: "
+ "init_video_out_plugin failed.\n", str);
+
+ return vod;
+ }
+ } else {
- return vod;
+ printf("load_plugins: video output plugin %s: "
+ "wrong interface version %d.\n", str, vo_info->interface_version);
}
}
}
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index de24dad76..ef6706ebf 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.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: metronom.c,v 1.13 2001/07/03 21:25:04 guenter Exp $
+ * $Id: metronom.c,v 1.14 2001/07/04 17:10:24 uid32519 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -390,7 +390,6 @@ static uint32_t metronom_got_audio_samples (metronom_t *this, uint32_t pts, uint
pthread_mutex_lock (&this->lock);
if (pts) {
- int32_t diff;
/*
* first audio pts ?
diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h
index 6422d4f62..e7080b57d 100644
--- a/src/xine-engine/metronom.h
+++ b/src/xine-engine/metronom.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: metronom.h,v 1.5 2001/06/24 02:19:29 guenter Exp $
+ * $Id: metronom.h,v 1.6 2001/07/04 17:10:24 uid32519 Exp $
*
* metronom: general pts => virtual calculation/assoc
*
@@ -125,7 +125,7 @@ struct metronom_s {
/*
* start metronom clock (no clock reset)
*/
- void (*start_clock) (metronom_t *this, int32_t pts);
+ void (*start_clock) (metronom_t *this, uint32_t pts);
/*
diff --git a/src/xine-engine/monitor.h b/src/xine-engine/monitor.h
index e338be535..f4033a1d5 100644
--- a/src/xine-engine/monitor.h
+++ b/src/xine-engine/monitor.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: monitor.h,v 1.1 2001/04/18 22:36:07 f1rmb Exp $
+ * $Id: monitor.h,v 1.2 2001/07/04 17:10:24 uid32519 Exp $
*
* debug print and profiling functions
*
@@ -30,18 +30,18 @@
extern uint32_t xine_debug;
-#define VERBOSE (xine_debug & 0x8000>>1)
-#define METRONOM (xine_debug & 0x8000>>2)
-#define AUDIO (xine_debug & 0x8000>>3)
-#define DEMUX (xine_debug & 0x8000>>4)
-#define INPUT (xine_debug & 0x8000>>5)
-#define VIDEO (xine_debug & 0x8000>>6)
-#define VPTS (xine_debug & 0x8000>>7)
-#define MPEG (xine_debug & 0x8000>>8)
-#define VAVI (xine_debug & 0x8000>>9)
-#define AC3 (xine_debug & 0x8000>>10)
-#define LOOP (xine_debug & 0x8000>>11)
-#define GUI (xine_debug & 0x8000>>12)
+#define VERBOSE (xine_debug & 0x8000>>1) // 16384
+#define METRONOM (xine_debug & 0x8000>>2) // 8192
+#define AUDIO (xine_debug & 0x8000>>3) // 4096
+#define DEMUX (xine_debug & 0x8000>>4) // 2048
+#define INPUT (xine_debug & 0x8000>>5) // 1024
+#define VIDEO (xine_debug & 0x8000>>6) // 512
+#define VPTS (xine_debug & 0x8000>>7) // 256
+#define MPEG (xine_debug & 0x8000>>8) // 128
+#define VAVI (xine_debug & 0x8000>>9) // 64
+#define AC3 (xine_debug & 0x8000>>10) // 32
+#define LOOP (xine_debug & 0x8000>>11) // 16
+#define GUI (xine_debug & 0x8000>>12) // 8
#define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);}
diff --git a/src/xine-engine/spu_decoder.c b/src/xine-engine/spu_decoder.c
index 03f008367..0878bf06a 100644
--- a/src/xine-engine/spu_decoder.c
+++ b/src/xine-engine/spu_decoder.c
@@ -17,8 +17,10 @@
* 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.2 2001/06/18 15:43:01 richwareham Exp $
+ * $Id: spu_decoder.c,v 1.3 2001/07/04 17:10:24 uid32519 Exp $
*
+
+ * functions that implement spu decoding
*/
#ifdef HAVE_CONFIG_H
@@ -27,52 +29,95 @@
#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;
+ int i;
+ spu_decoder_t *decoder;
- decoder = this->spu_decoder;
while (running) {
- /* printf ("video_decoder: getting buffer...\n"); */
-
buf = this->spu_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); */
+ this->cur_input_pos = buf->input_pos;
switch (buf->type) {
+
case BUF_CONTROL_START:
+ if (this->cur_spu_decoder_plugin) {
+ this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin);
+ this->cur_spu_decoder_plugin = NULL;
+ }
+
+ pthread_mutex_lock (&this->xine_lock);
+ this->spu_finished = 0;
+ pthread_mutex_unlock (&this->xine_lock);
+
+ for (i=0 ; i<50; i++)
+ this->spu_track_map[0] = 0;
+
+ this->spu_track_map_entries = 0;
+
break;
case BUF_CONTROL_END:
+ if (this->cur_spu_decoder_plugin) {
+ this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin);
+ this->cur_spu_decoder_plugin = NULL;
+ }
+
+ pthread_mutex_lock (&this->xine_lock);
+
+ this->spu_finished = 1;
+
+ if (this->video_finished) {
+ pthread_mutex_unlock (&this->xine_lock);
+ xine_notify_stream_finished (this);
+ } else
+ pthread_mutex_unlock (&this->xine_lock);
+
break;
case BUF_CONTROL_QUIT:
+ if (this->cur_spu_decoder_plugin) {
+ this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin);
+ this->cur_spu_decoder_plugin = NULL;
+ }
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);
+
+ /* now, decode this buffer if it's the right track */
+
+ if ( (buf->type & 0xFFFF)== this->spu_channel) {
+
+ int streamtype = (buf->type>>16) & 0xFF;
+ decoder = this->spu_decoder_plugins [streamtype];
+ printf("SPU DECODER: %p\n",decoder);
+ if (decoder) {
+ if (this->cur_spu_decoder_plugin != decoder) {
+
+ if (this->cur_spu_decoder_plugin)
+ this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin);
+
+ this->cur_spu_decoder_plugin = decoder;
+
+ this->cur_spu_decoder_plugin->init (this->cur_spu_decoder_plugin, this->video_out);
+ }
+
+ printf ("spu_decoder: decoder data sent\n");
+ decoder->decode_data (decoder, buf);
+ }
}
- }
+ } else
+ fprintf (stderr,"spu_decoder: unknown buffer type: %08x\n", buf->type);
}
-
+
buf->free_buffer (buf);
}
@@ -80,15 +125,9 @@ 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);
+ printf ("spu_decoder_init: thread starting %p\n",this->video_out);
pthread_create (&this->spu_thread, NULL, spu_decoder_loop, this) ;
}
@@ -98,15 +137,13 @@ void spu_decoder_shutdown (xine_t *this) {
buf_element_t *buf;
void *p;
- this->spu_fifo->clear(this->spu_fifo);
+ /* 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);
- spudec_close(this->spu_decoder);
- this->spu_decoder = NULL;
-
pthread_join (this->spu_thread, &p);
}
+
diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h
new file mode 100644
index 000000000..7ece22335
--- /dev/null
+++ b/src/xine-engine/spu_decoder.h
@@ -0,0 +1,152 @@
+/*
+ * 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.h,v 1.1 2001/07/04 17:10:24 uid32519 Exp $
+ */
+#ifndef HAVE_SPU_OUT_H
+#define HAVE_SPU_OUT_H
+
+#include <inttypes.h>
+
+#if defined(XINE_COMPILE)
+#include "metronom.h"
+#include "configfile.h"
+#endif
+
+
+#define SPU_OUT_IFACE_VERSION 1
+
+/*
+ * spu_functions_s contains the functions every spu output
+ * driver plugin has to implement.
+ */
+
+typedef struct spu_functions_s spu_functions_t;
+
+struct spu_functions_s {
+
+ /*
+ *
+ * find out what output modes + capatilities are supported by
+ * this plugin (constants for the bit vector to return see above)
+ *
+ * See SPU_CAP_* bellow.
+ */
+ uint32_t (*get_capabilities) (spu_functions_t *this);
+
+ /*
+ * connect this driver to the xine engine
+ */
+ void (*connect) (spu_functions_t *this, metronom_t *metronom);
+
+ /*
+ * open the driver and make it ready to receive spu data
+ * buffers may be flushed(!)
+ *
+ * return value: <=0 : failure, 1 : ok
+ */
+
+ int (*open)(spu_functions_t *this, uint32_t bits, uint32_t rate, int mode);
+
+ /*
+ * write spu data to output buffer - may block
+ * spu driver must sync sample playback with metronom
+ */
+
+ void (*write_spu_data)(spu_functions_t *this,
+ int16_t* spu_data, uint32_t num_samples,
+ uint32_t pts);
+
+ /*
+ * this is called when the decoder no longer uses the spu
+ * output driver - the driver should get ready to get opened() again
+ */
+
+ void (*close)(spu_functions_t *this);
+
+ /*
+ * shut down this spu output driver plugin and
+ * free all resources allocated
+ */
+
+ void (*exit) (spu_functions_t *this);
+
+ /*
+ * Get, Set a property of spu driver.
+ *
+ * get_property() return 1 in success, 0 on failure.
+ * set_property() return value on success, ~value on failure.
+ *
+ * See AC_PROP_* bellow for available properties.
+ */
+ int (*get_property) (spu_functions_t *this, int property);
+
+ int (*set_property) (spu_functions_t *this, int property, int value);
+
+};
+
+
+/*
+ * to build a dynamic spu output plugin,
+ * you have to implement these functions:
+ *
+ *
+ * spu_functions_t *init_spu_out_plugin (config_values_t *config)
+ *
+ * init this plugin, check if device is available
+ *
+ * spu_info_t *get_spu_out_plugin_info ()
+ *
+ * peek at some (static) information about the plugin without initializing it
+ *
+ */
+
+/*
+ * spu output modes + capabilities
+ */
+
+#define SPU_CAP_NOCAP 0x00000000 /* Driver have no capabilities */
+#define SPU_CAP_MODE_AC3 0x00000001 /* Driver support AC3 output */
+#define SPU_CAP_MODE_AC5 0x00000002 /* Driver support AC5 output */
+/* 1 sample == 2 bytes */
+#define SPU_CAP_MODE_MONO 0x00000004 /* Driver support mono output */
+ /* 1 sample == 4 bytes */
+#define SPU_CAP_MODE_STEREO 0x00000008 /* Driver support stereo output */
+ /* 1 sample == 8 bytes */
+#define SPU_CAP_MODE_4CHANNEL 0x00000010 /* Driver support 4 channels */
+/* 1 sample == 10 bytes */
+#define SPU_CAP_MODE_5CHANNEL 0x00000020 /* Driver support 5 channels */
+#define SPU_CAP_MIXER_VOL 0x00000040 /* Driver support mixer control */
+#define SPU_CAP_PCM_VOL 0x00000080 /* Driver support pcm control */
+#define SPU_CAP_MUTE_VOL 0x00000100 /* Driver can mute volume */
+
+/* properties supported by get/set_property() */
+#define SPU_PROP_MIXER_VOL 0
+#define SPU_PROP_PCM_VOL 1
+#define SPU_PROP_MUTE_VOL 2
+
+typedef struct spu_info_s {
+
+ int interface_version;
+ char *id;
+ char *description;
+ int priority;
+} spu_info_t ;
+
+#endif
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 3fb974022..b6a98e8d1 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000 the xine project
+ * Copyright (C) 2000, 2001 the xine project
*
* This file is part of xine, a unix video player.
*
@@ -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.27 2001/07/04 14:14:39 uid56437 Exp $
+ * $Id: video_out.c,v 1.28 2001/07/04 17:10:24 uid32519 Exp $
*
*/
@@ -29,15 +29,13 @@
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
+#include <string.h>
#include "video_out.h"
#include "utils.h"
#include "monitor.h"
-#include "libspudec/spudec.h"
-
#define NUM_FRAME_BUFFERS 20
struct img_buf_fifo_s {
@@ -148,7 +146,7 @@ static void *video_out_loop (void *this_gen) {
/*
int dummysignum;
*/
- struct timespec ts;
+ /* struct timespec ts; */
/* printf ("%d video_out start\n", getpid()); */
/*
@@ -278,11 +276,6 @@ static void *video_out_loop (void *this_gen) {
img->bDisplayLock = 0;
pthread_mutex_unlock (&img->mutex);
- /* 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);
}
@@ -496,7 +489,18 @@ 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, spudec_t *spu_decoder) {
+static vo_overlay_t *vo_get_overlay (vo_instance_t *this,
+ int width, int height) {
+ /* FIXME: implement */
+ return NULL;
+}
+
+static void vo_queue_overlay (vo_instance_t *this, vo_overlay_t *overlay) {
+
+ /* FIXME: implement */
+}
+
+vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
vo_instance_t *this;
int i;
@@ -505,13 +509,14 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom, spude
this->driver = driver;
this->metronom = metronom;
- this->spu_decoder = spu_decoder;
this->open = vo_open;
this->get_frame = vo_get_frame;
this->close = vo_close;
this->exit = vo_exit;
this->get_capabilities = vo_get_capabilities;
+ this->get_overlay = vo_get_overlay;
+ this->queue_overlay = vo_queue_overlay;
this->num_frames_delivered = 0;
this->num_frames_skipped = 0;
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index becfba058..a4826c61f 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2000-2001 the xine project
*
- * This file is part of xine, a unix video player.
+ * This file is part of xine, a free 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
@@ -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.8 2001/06/18 15:43:01 richwareham Exp $
+ * $Id: video_out.h,v 1.9 2001/07/04 17:10:24 uid32519 Exp $
*
*
* xine version of video_out.h
@@ -48,8 +48,8 @@ typedef struct vo_frame_s vo_frame_t;
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 vo_overlay_s vo_overlay_t;
-typedef struct spudec_s spudec_t;
/* public part, video drivers may add private fields */
struct vo_frame_s {
@@ -111,6 +111,10 @@ struct vo_instance_s {
vo_frame_t* (*get_frame) (vo_instance_t *this, uint32_t width,
uint32_t height, int ratio_code,
int format, uint32_t duration);
+
+ /* overlay stuff */
+ vo_overlay_t* (*get_overlay) (vo_instance_t *this);
+ void (*queue_overlay) (vo_instance_t *this, vo_overlay_t *overlay);
/* video driver is no longer used by decoder => close */
void (*close) (vo_instance_t *this);
@@ -122,7 +126,6 @@ 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;
@@ -188,7 +191,7 @@ struct vo_instance_s {
* from generic vo functions.
*/
-#define VIDEO_OUT_IFACE_VERSION 1
+#define VIDEO_OUT_IFACE_VERSION 2
struct vo_driver_s {
@@ -212,6 +215,10 @@ struct vo_driver_s {
/* display a given frame */
void (*display_frame) (vo_driver_t *this, vo_frame_t *vo_img);
+ /* overlay functions */
+ void (*set_overlay) (vo_driver_t *this, vo_overlay_t *overlay);
+
+
/*
* these can be used by the gui directly:
*/
@@ -236,13 +243,32 @@ struct vo_driver_s {
};
+struct vo_overlay_s {
+ uint8_t *data; /* 7-4: mixer key, 3-0: color index */
+ int x; /* x start of subpicture area */
+ int y; /* y start of subpicture area */
+ int width; /* width of subpicture area */
+ int height; /* height of subpicture area */
+
+ uint8_t clut[4]; /* color lookup table */
+ uint8_t trans[4]; /* mixer key table */
+
+ uint32_t PTS, duration; /* 1/90000 s */
+
+ struct overlay_s *next; /* optionally more overlays */
+
+ /* private stuff */
+ int _x; /* current destination x, y */
+ int _y;
+ int offset[2]; /* address in PXD to fetch next rle-code from, one per field */
+};
/*
* build a video_out_instance from
* a given video driver
*/
-vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom, spudec_t *spu_decoder) ;
+vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) ;
/*
* to build a dynamic video output plugin
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 000401caa..c8fd4dc2a 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.31 2001/07/03 21:25:04 guenter Exp $
+ * $Id: xine.c,v 1.32 2001/07/04 17:10:24 uid32519 Exp $
*
* top-level xine functions
*
@@ -49,7 +49,8 @@
#ifdef ARCH_X86
#include "libw32dll/w32codec.h"
#endif
-#include "libspudec/spudec.h"
+#include "libspudec/spu_decoder_api.h"
+#include "spu_decoder.h"
#include "input/input_plugin.h"
#include "metronom.h"
#include "configfile.h"
@@ -95,8 +96,6 @@ void xine_stop (xine_t *this) {
this->cur_input_plugin = NULL;
}
- this->spu_fifo->clear(this->spu_fifo);
-
printf ("xine_stop: done\n");
pthread_mutex_unlock (&this->xine_lock);
@@ -364,6 +363,7 @@ xine_t *xine_init (vo_driver_t *vo,
gui_branched_cb_t branched_cb) {
xine_t *this = xmalloc (sizeof (xine_t));
+ printf("xine_init entered\n");
this->stream_end_cb = stream_end_cb;
this->get_next_mrl_cb = get_next_mrl_cb;
@@ -398,26 +398,25 @@ 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->spu_decoder);
+ this->video_out = vo_new_instance (vo, this->metronom);
video_decoder_init (this);
+ /*
+ * init SPU decoder (must be done before video decoder
+ * so that this->spu_decoder is valid).
+ */
+ spu_decoder_init (this);
if(ao) {
this->audio_out = ao;
this->audio_out->connect (this->audio_out, this->metronom);
}
audio_decoder_init (this);
-
+ printf("xine_init returning\n");
return this;
}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 9712196cf..2269c2117 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.26 2001/06/23 14:05:47 f1rmb Exp $
+ * $Id: xine_internal.h,v 1.27 2001/07/04 17:10:24 uid32519 Exp $
*
*/
@@ -30,6 +30,8 @@
#include "video_out.h"
#include "audio_out.h"
#include "metronom.h"
+#include "spu_decoder.h"
+#include "libspudec/spu_decoder_api.h"
#define INPUT_PLUGIN_MAX 50
#define DEMUXER_PLUGIN_MAX 50
@@ -128,9 +130,15 @@ typedef struct xine_s {
off_t cur_input_pos;
char cur_mrl[1024];
+ spu_functions_t *spu_out;
fifo_buffer_t *spu_fifo;
pthread_t spu_thread;
- spudec_t *spu_decoder;
+ spu_decoder_t *spu_decoder_plugins[DECODER_PLUGIN_MAX];
+ int num_spu_decoder_plugins;
+ spu_decoder_t *cur_spu_decoder_plugin;
+ uint32_t spu_track_map[50];
+ int spu_track_map_entries;
+ int spu_finished;
int audio_channel;
int spu_channel;