summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/events.h10
-rw-r--r--src/xine-engine/load_plugins.c4
-rw-r--r--src/xine-engine/video_out.c137
-rw-r--r--src/xine-engine/video_out.h42
-rw-r--r--src/xine-engine/xine.c30
-rw-r--r--src/xine-engine/xine_internal.h4
6 files changed, 57 insertions, 170 deletions
diff --git a/src/xine-engine/events.h b/src/xine-engine/events.h
index 19db8b618..a1ec552f5 100644
--- a/src/xine-engine/events.h
+++ b/src/xine-engine/events.h
@@ -63,6 +63,16 @@ typedef struct overlay_event_s {
vo_overlay_t overlay;
} overlay_event_t;
+/**
+ * SPU event - send control events to the spu decoder
+ */
+#define XINE_SPU_EVENT 0x0003
+typedef struct spu_event_s {
+ event_t event;
+ int sub_type;
+ void *data;
+} spu_event_t;
+
#ifdef __cplusplus
}
#endif
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index d15622143..3e18c944b 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.35 2001/07/30 17:13:22 guenter Exp $
+ * $Id: load_plugins.c,v 1.36 2001/08/13 12:52:33 ehasenle Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -371,7 +371,7 @@ void load_decoder_plugins (xine_t *this,
spu_decoder_t *sdp;
int streamtype;
- sdp = (spu_decoder_t *) initplug(iface_version, config);
+ sdp = (spu_decoder_t *) initplug(3, config);
if (sdp) {
sdp->metronom = this->metronom;
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 1a01d8cc6..93f6766de 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.38 2001/08/05 08:24:56 ehasenle Exp $
+ * $Id: video_out.c,v 1.39 2001/08/13 12:52:33 ehasenle Exp $
*
*/
@@ -140,8 +140,6 @@ static void *video_out_loop (void *this_gen) {
uint32_t cur_pts;
int pts_absdiff, diff, absdiff, pts=0;
vo_frame_t *img;
- vo_overlay_t *overlay;
- int count;
uint32_t video_step, video_step_new;
vo_instance_t *this = (vo_instance_t *) this_gen;
sigset_t vo_mask;
@@ -276,65 +274,19 @@ static void *video_out_loop (void *this_gen) {
xprintf (VERBOSE|VIDEO, "video_out : passing to video driver, image with pts = %d\n", pts);
-
- overlay=this->first_overlay;
- while (overlay) {
- if(overlay->state==OVERLAY_SHOWING) {
- if (this->driver->overlay_blend) this->driver->overlay_blend (this->driver, img, overlay);
- }
- overlay=overlay->next;
+ if (this->overlay_source) {
+ /* This is the only way for the spu decoder to get pts values
+ * for flushing it's buffers. So don't remove it! */
+ vo_overlay_t *ovl =
+ this->overlay_source->get_overlay (this->overlay_source, img->PTS);
+ if (ovl && this->driver->overlay_blend)
+ this->driver->overlay_blend (this->driver, img, ovl);
}
this->driver->display_frame (this->driver, img);
- /* Control Overlay SHOW/HIDE based on PTS */
- overlay=this->first_overlay;
- count=1;
- while (overlay) {
- switch(overlay->state) {
- case OVERLAY_FREE:
- break;
- case OVERLAY_CREATING:
- break;
- case OVERLAY_READY_TO_SHOW:
- if (cur_pts>overlay->PTS) overlay->state=OVERLAY_SHOWING;
- if (abs(cur_pts-overlay->PTS) > pts_absdiff ) overlay->state=OVERLAY_READY_TO_FREE;
- break;
- case OVERLAY_SHOWING:
- /* duration is in frames, Who knows why div 4 ? */
- if ((cur_pts>overlay->PTS+(overlay->duration*video_step/4))) overlay->state=OVERLAY_READY_TO_FREE;
- break;
- case OVERLAY_READY_TO_FREE:
- /* remove overlay from list */
- if (overlay->next) {
- if (overlay->priv)
- overlay->priv->next=overlay->next;
- else
- this->first_overlay=overlay->next;
- overlay->next->priv=overlay->priv;
- } else {
- overlay->state=OVERLAY_FREE;
- break;
- }
- /* Set status to free */
- overlay->state=OVERLAY_FREE;
- /* Insert at end of list */
- overlay->priv=this->last_overlay;
- this->last_overlay->next=overlay;
- overlay->next=NULL;
- this->last_overlay=overlay;
- break;
- default:
- printf("OVERLAY in UNKNOWN state\n");
- }
- overlay=overlay->next;
- }
-
}
-
-
-
/*
* throw away undisplayed frames
*/
@@ -365,15 +317,6 @@ static void vo_open (vo_instance_t *this) {
if (!this->video_loop_running) {
this->video_loop_running = 1;
- if(this->first_overlay) {
- vo_overlay_t *overlay;
- overlay=this->first_overlay;
- while (overlay) {
- overlay->state=OVERLAY_FREE;
- overlay->clut_tbl=NULL;
- overlay=overlay->next;
- }
- }
pthread_create (&this->video_thread, NULL, video_out_loop, this) ;
printf ("video_out: thread created\n");
@@ -558,57 +501,17 @@ static int vo_frame_draw (vo_frame_t *img) {
return frames_to_skip;
}
-/****************************************************************
- * Current assumption is that only one thread will call vo_get_overlay at a time
- * Also mutex locks have not yet been considered or used
- * Also, when one is FREEed, it is moved to the end of the queue, so it will be the first one used
- * The design is based around a dynamic buffer size.
- * The buffer starts at nothing, then increases as needed.
- * If a buffer entry is free, it will be reused.
- * If all buffers are full, xmalloc is called.
- * FIXME: Can someone make this simpler ? It seems a bit long winded to me.
- ***************************************************************/
-static vo_overlay_t *vo_get_overlay (vo_instance_t *this) {
- vo_overlay_t *next_overlay;
- vo_overlay_t *prev_overlay;
- int count_overlay=0;
- if (this->first_overlay==NULL) {
- this->first_overlay = this->last_overlay = xmalloc (sizeof (vo_overlay_t)) ;
- this->first_overlay->data=NULL;
- this->first_overlay->clut_tbl=NULL;
- this->first_overlay->next=NULL;
- this->first_overlay->priv=NULL;
- this->first_overlay->state=OVERLAY_CREATING;
- count_overlay++;
- return this->first_overlay;
- }
- prev_overlay=this->first_overlay;
- next_overlay=this->first_overlay->next;
- while (next_overlay && (prev_overlay->state!=OVERLAY_FREE)) {
- count_overlay++;
- prev_overlay=next_overlay;
- next_overlay=prev_overlay->next;
- }
- if (prev_overlay->state==OVERLAY_FREE) {
- prev_overlay->state=OVERLAY_CREATING;
- return prev_overlay;
- }
- prev_overlay->next = next_overlay = this->last_overlay = xmalloc (sizeof (vo_overlay_t)) ;
- count_overlay++;
- next_overlay->data=NULL;
- next_overlay->next=NULL;
- next_overlay->priv=prev_overlay;
- next_overlay->state=OVERLAY_CREATING;
- return next_overlay;
+static void vo_register_ovl_src (vo_instance_t *this, ovl_src_t *ovl_src)
+{
+ this->overlay_source = ovl_src;
+ ovl_src->metronom = this->metronom;
}
-static void vo_queue_overlay (vo_instance_t *this, vo_overlay_t *overlay) {
- overlay->PTS = this->metronom->got_spu_packet (this->metronom, overlay->PTS,overlay->duration);
- if (overlay->data==NULL) {
- overlay->state=OVERLAY_FREE;
- } else {
- overlay->state=OVERLAY_READY_TO_SHOW;
- }
+static void vo_unregister_ovl_src (vo_instance_t *this, ovl_src_t *ovl_src)
+{
+ /* only remove the source if it is the same as registered */
+ if (this->overlay_source == ovl_src)
+ this->overlay_source = NULL;
}
vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
@@ -617,8 +520,6 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
int i;
this = xmalloc (sizeof (vo_instance_t)) ;
- this->first_overlay=NULL;
- this->last_overlay=NULL;
this->driver = driver;
this->metronom = metronom;
@@ -627,8 +528,8 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
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->register_ovl_src = vo_register_ovl_src;
+ this->unregister_ovl_src = vo_unregister_ovl_src;
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 0e9c366d8..fbe2b9c60 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.15 2001/07/25 23:26:14 richwareham Exp $
+ * $Id: video_out.h,v 1.16 2001/08/13 12:52:33 ehasenle Exp $
*
*
* xine version of video_out.h
@@ -95,6 +95,13 @@ struct vo_frame_s {
void (*dispose) (vo_frame_t *vo_img);
};
+typedef struct ovl_src_s ovl_src_t;
+
+struct ovl_src_s {
+ void *src_gen;
+ vo_overlay_t* (*get_overlay) (ovl_src_t* self, int pts);
+ metronom_t* metronom;
+};
struct vo_instance_s {
@@ -119,8 +126,9 @@ struct vo_instance_s {
int flags);
/* overlay stuff */
- vo_overlay_t* (*get_overlay) (vo_instance_t *this);
- void (*queue_overlay) (vo_instance_t *this, vo_overlay_t *overlay);
+ void (*register_ovl_src) (vo_instance_t *this, ovl_src_t *ovl_src);
+ void (*unregister_ovl_src) (vo_instance_t *this, ovl_src_t *ovl_src);
+ ovl_src_t *overlay_source;
/* video driver is no longer used by decoder => close */
void (*close) (vo_instance_t *this);
@@ -131,8 +139,6 @@ struct vo_instance_s {
/* private stuff */
vo_driver_t *driver;
- vo_overlay_t *first_overlay;
- vo_overlay_t *last_overlay;
metronom_t *metronom;
img_buf_fifo_t *free_img_buf_queue;
@@ -257,34 +263,22 @@ struct vo_driver_s {
};
-#define OVERLAY_FREE 0
-#define OVERLAY_CREATING 1
-#define OVERLAY_READY_TO_SHOW 2
-#define OVERLAY_SHOWING 3
-#define OVERLAY_READY_TO_FREE 4
-
struct vo_overlay_s {
uint8_t *data; /* 7-4: mixer key, 3-0: color index */
+ int data_size; /* useful for deciding realloc */
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 */
+ uint32_t color[4]; /* color lookup table */
uint8_t trans[4]; /* mixer key table */
-
- uint32_t PTS, duration; /* 1/90000 s */
- vo_overlay_t *next; /* optionally more overlays */
- vo_overlay_t *priv; /* optionally more overlays */
- int state; /* State:FREE,SHOWING etc. */
-
- uint32_t *clut_tbl; /* Pointer to CLUT palette */
-
- /* 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 */
+ int clip_top;
+ int clip_bottom;
+ int clip_left;
+ int clip_right;
+
};
/*
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 864641e6d..6123aa18d 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.39 2001/08/12 15:12:54 guenter Exp $
+ * $Id: xine.c,v 1.40 2001/08/13 12:52:33 ehasenle Exp $
*
* top-level xine functions
*
@@ -50,6 +50,7 @@
#include "libw32dll/w32codec.h"
#endif
#include "libspudec/spu_decoder_api.h"
+/* TODO: who uses spu_decoder.h ? */
#include "spu_decoder.h"
#include "input/input_plugin.h"
#include "metronom.h"
@@ -389,29 +390,10 @@ static void event_handler(xine_t *xine, event_t *event, void *data) {
}
}
break;
- case XINE_OVERLAY_EVENT:
- {
- overlay_event_t *oevent = (overlay_event_t*)event;
- if(xine->video_out != NULL) {
- int i;
- vo_overlay_t *overlay = xine->video_out->get_overlay (xine->video_out);
- if(overlay != NULL) {
- overlay->data = oevent->overlay.data;
- overlay->x = oevent->overlay.x;
- overlay->y = oevent->overlay.y;
- overlay->width = oevent->overlay.width;
- overlay->height = oevent->overlay.height;
- for(i=0; i<4; i++) {
- overlay->clut[i] = oevent->overlay.clut[i];
- overlay->trans[i] = oevent->overlay.trans[i];
- }
- overlay->PTS = oevent->overlay.PTS;
- overlay->clut_tbl = oevent->overlay.clut_tbl;
- overlay->duration = oevent->overlay.duration;
- xine->video_out->queue_overlay (xine->video_out, overlay);
- }
- }
- }
+ case XINE_SPU_EVENT:
+ if (xine->cur_spu_decoder_plugin)
+ xine->cur_spu_decoder_plugin->event(xine->cur_spu_decoder_plugin,
+ (spu_event_t*) event);
break;
}
}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 55a4c1ad9..0833438c5 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.36 2001/07/30 17:13:22 guenter Exp $
+ * $Id: xine_internal.h,v 1.37 2001/08/13 12:52:33 ehasenle Exp $
*
*/
@@ -36,8 +36,8 @@ extern "C" {
#include "audio_out.h"
#include "metronom.h"
#include "spu_decoder.h"
-#include "libspudec/spu_decoder_api.h"
#include "events.h"
+#include "libspudec/spu_decoder_api.h"
#define INPUT_PLUGIN_MAX 50
#define DEMUXER_PLUGIN_MAX 50