summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-10-23 15:17:06 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-10-23 15:17:06 +0000
commit7b65c8b1b967474c2dd6b852fbcefc1e6bcd7240 (patch)
tree2ed3efcbd70780554538f0c696d96ae17e2393d6 /src/xine-engine
parent558b00644651500abb40a7f4d73854312b571343 (diff)
downloadxine-lib-7b65c8b1b967474c2dd6b852fbcefc1e6bcd7240.tar.gz
xine-lib-7b65c8b1b967474c2dd6b852fbcefc1e6bcd7240.tar.bz2
cleanup in video_out.h
* some obsolete VO_CAP_* constants removed * VO_ZOOM_* constants replaced by their XINE_VO_ZOOM_* equivalents from xine.h * moved some bits around * proc_frame() needs only one parameter: the frame * renamed copy_called to proc_called * changed logic in video_out.c to call proc_* functions a bit (call proc_frame() first, then call proc_slice() if proc_frame() has not set proc_called, this allows video out plugins to have both hooks called) CVS patchset: 5576 CVS date: 2003/10/23 15:17:06
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/post.c30
-rw-r--r--src/xine-engine/video_out.c59
-rw-r--r--src/xine-engine/video_out.h123
3 files changed, 96 insertions, 116 deletions
diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c
index bbccf1187..c00b47d28 100644
--- a/src/xine-engine/post.c
+++ b/src/xine-engine/post.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: post.c,v 1.16 2003/10/22 20:38:10 komadori Exp $
+ * $Id: post.c,v 1.17 2003/10/23 15:17:07 mroi Exp $
*/
/*
@@ -132,10 +132,10 @@ static void post_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) {
vo_img->port = &port->port;
}
-static void post_frame_proc_frame(vo_frame_t *vo_img, uint8_t **src) {
+static void post_frame_proc_frame(vo_frame_t *vo_img) {
post_video_port_t *port = (post_video_port_t *)vo_img->port;
vo_img->port = port->original_port;
- port->original_frame.proc_frame(vo_img, src);
+ port->original_frame.proc_frame(vo_img);
vo_img->port = &port->port;
}
@@ -193,25 +193,25 @@ static void post_frame_proc_macro_block(int x,
void post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *port) {
- port->original_frame.port = frame->port;
- port->original_frame.free = frame->free;
- port->original_frame.proc_slice = frame->proc_slice;
- port->original_frame.proc_frame = frame->proc_frame;
- port->original_frame.field = frame->field;
- port->original_frame.draw = frame->draw;
- port->original_frame.lock = frame->lock;
- port->original_frame.dispose = frame->dispose;
+ port->original_frame.port = frame->port;
+ port->original_frame.free = frame->free;
+ port->original_frame.proc_slice = frame->proc_slice;
+ port->original_frame.proc_frame = frame->proc_frame;
port->original_frame.proc_macro_block = frame->proc_macro_block;
+ port->original_frame.field = frame->field;
+ port->original_frame.draw = frame->draw;
+ port->original_frame.lock = frame->lock;
+ port->original_frame.dispose = frame->dispose;
frame->port = &port->port;
frame->free = post_frame_free;
- frame->proc_slice = frame->proc_slice ? post_frame_proc_slice : NULL;
- frame->proc_frame = frame->proc_frame ? post_frame_proc_frame : NULL;
+ frame->proc_slice = frame->proc_slice ? post_frame_proc_slice : NULL;
+ frame->proc_frame = frame->proc_frame ? post_frame_proc_frame : NULL;
+ frame->proc_macro_block = frame->proc_macro_block ? post_frame_proc_macro_block : NULL;
frame->field = post_frame_field;
frame->draw = post_frame_draw;
frame->lock = post_frame_lock;
frame->dispose = post_frame_dispose;
- frame->proc_macro_block = post_frame_proc_macro_block;
}
void post_restore_video_frame(vo_frame_t *frame, post_video_port_t *port) {
@@ -219,11 +219,11 @@ void post_restore_video_frame(vo_frame_t *frame, post_video_port_t *port) {
frame->free = port->original_frame.free;
frame->proc_slice = port->original_frame.proc_slice;
frame->proc_frame = port->original_frame.proc_frame;
+ frame->proc_macro_block = port->original_frame.proc_macro_block;
frame->field = port->original_frame.field;
frame->draw = port->original_frame.draw;
frame->lock = port->original_frame.lock;
frame->dispose = port->original_frame.dispose;
- frame->proc_macro_block = port->original_frame.proc_macro_block;
}
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index f91cf15f3..5fb08867e 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.174 2003/10/22 20:38:10 komadori Exp $
+ * $Id: video_out.c,v 1.175 2003/10/23 15:17:07 mroi Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -50,6 +50,16 @@
#define NUM_FRAME_BUFFERS 15
typedef struct {
+ vo_frame_t *first;
+ vo_frame_t *last;
+ int num_buffers;
+
+ int locked_for_read;
+ pthread_mutex_t mutex;
+ pthread_cond_t not_empty;
+} img_buf_fifo_t;
+
+typedef struct {
xine_video_port_t vo; /* public part */
@@ -100,20 +110,11 @@ typedef struct {
int frame_drop_cpt;
} vos_t;
+
/*
* frame queue (fifo) util functions
*/
-struct img_buf_fifo_s {
- vo_frame_t *first;
- vo_frame_t *last;
- int num_buffers;
-
- int locked_for_read;
- pthread_mutex_t mutex;
- pthread_cond_t not_empty;
-} ;
-
static img_buf_fifo_t *vo_new_img_buf_queue () {
img_buf_fifo_t *queue;
@@ -219,13 +220,15 @@ static void vo_frame_dec_lock (vo_frame_t *img) {
pthread_mutex_unlock (&img->mutex);
}
-/* call vo_driver->copy method for the entire frame */
-static void vo_frame_driver_copy(vo_frame_t *img)
+/* call vo_driver->proc methods for the entire frame */
+static void vo_frame_driver_proc(vo_frame_t *img)
{
if (img->proc_frame) {
- img->proc_frame(img, img->base);
+ img->proc_frame(img);
}
- else if (img->proc_slice) {
+ if (img->proc_called) return;
+
+ if (img->proc_slice) {
if (img->format == XINE_IMGFMT_YV12) {
int height = img->height;
uint8_t* src[3];
@@ -294,7 +297,7 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen,
img->ratio = ratio;
img->format = format;
img->flags = flags;
- img->copy_called = 0;
+ img->proc_called = 0;
img->bad_frame = 0;
img->progressive_frame = 0;
img->repeat_first_field = 0;
@@ -391,9 +394,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
if (!img->bad_frame) {
- /* do not call copy() for frames that will be dropped */
- if( !frames_to_skip && !img->copy_called )
- vo_frame_driver_copy(img);
+ /* do not call proc_*() for frames that will be dropped */
+ if( !frames_to_skip && !img->proc_called )
+ vo_frame_driver_proc(img);
/*
* put frame into FIFO-Buffer
@@ -564,18 +567,18 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) {
xine_fast_memcpy(dupl->base[0], img->base[0], image_size);
}
- dupl->bad_frame = 0;
- dupl->pts = 0;
- dupl->vpts = 0;
- dupl->copy_called = 0;
+ dupl->bad_frame = 0;
+ dupl->pts = 0;
+ dupl->vpts = 0;
+ dupl->proc_called = 0;
dupl->duration = img->duration;
dupl->stream = img->stream;
memcpy( dupl->extra_info, img->extra_info, sizeof(extra_info_t) );
- /* delay frame copying for now, we might not even need it (eg. frame will be discarded) */
- /* vo_frame_driver_copy(dupl); */
+ /* delay frame processing for now, we might not even need it (eg. frame will be discarded) */
+ /* vo_frame_driver_proc(dupl); */
return dupl;
}
@@ -789,11 +792,11 @@ static void overlay_and_display_frame (vos_t *this,
img->vpts);
#endif
- /* no, this is not were copy() is usually called.
+ /* no, this is not were proc_*() is usually called.
* it's just to catch special cases like late or duplicated frames.
*/
- if(!img->copy_called )
- vo_frame_driver_copy(img);
+ if(!img->proc_called )
+ vo_frame_driver_proc(img);
pthread_mutex_lock( &img->stream->current_extra_info_lock );
{
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index 3e132ac94..9eb663cca 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free 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.h,v 1.98 2003/10/22 20:38:10 komadori Exp $
+ * $Id: video_out.h,v 1.99 2003/10/23 15:17:07 mroi Exp $
*
*
* xine version of video_out.h
@@ -52,11 +52,12 @@ extern "C" {
#include <inttypes.h>
#include <pthread.h>
+
typedef struct vo_frame_s vo_frame_t;
-typedef struct img_buf_fifo_s img_buf_fifo_t;
+typedef struct vo_driver_s vo_driver_t;
+typedef struct video_driver_class_s video_driver_class_t;
typedef struct vo_overlay_s vo_overlay_t;
typedef struct video_overlay_manager_s video_overlay_manager_t;
-typedef struct vo_driver_s vo_driver_t;
/* to access extra_info_t contents one have to include xine_internal.h */
#ifndef EXTRA_INFO
@@ -64,51 +65,33 @@ typedef struct vo_driver_s vo_driver_t;
typedef struct extra_info_s extra_info_t;
#endif
+
+typedef struct xine_macroblock_s {
+ short *blockptr; /* pointer to current dct block */
+ short *blockbaseptr; /* pointer to base of dct block array in blocks */
+ short xvmc_accel; /* type of acceleration supported */
+} xine_macroblocks_t;
+
+
/* public part, video drivers may add private fields
*
* Remember that adding new functions to this structure requires
* adaption of the post plugin decoration layer. Be sure to look into
* src/xine-engine/post.[ch].
*/
-
-typedef struct xine_macroblock_s {
- short *blockptr; // pointer to current dct block
- short *blockbaseptr; // pointer to base of dct block array in blocks
- short xvmc_accel; // type of acceleration supported
-} xine_macroblocks_t;
-
struct vo_frame_s {
/*
* member functions
*/
- /* this frame is no longer used by the decoder, video driver, etc */
- void (*free) (vo_frame_t *vo_img);
-
/* tell video driver to copy/convert the whole of this frame, may be NULL */
- /* this function MUST set the variable copy_called above */
- void (*proc_frame) (vo_frame_t *vo_img, uint8_t **src);
+ /* at least one of proc_frame() and proc_slice() MUST set the variable proc_called to 1 */
+ void (*proc_frame) (vo_frame_t *vo_img);
/* tell video driver to copy/convert a slice of this frame, may be NULL */
- /* this function MUST set the variable copy_called above */
+ /* at least one of proc_frame() and proc_slice() MUST set the variable proc_called to 1 */
void (*proc_slice) (vo_frame_t *vo_img, uint8_t **src);
- /* tell video driver that the decoder starts a new field */
- void (*field) (vo_frame_t *vo_img, int which_field);
-
- /* append this frame to the display queue,
- returns number of frames to skip if decoder is late */
- int (*draw) (vo_frame_t *vo_img, xine_stream_t *stream);
-
- /* lock frame as reference, must be paired with free.
- * most decoders/drivers do not need to call this function since
- * newly allocated frames are already locked once.
- */
- void (*lock) (vo_frame_t *vo_img);
-
- /* free memory/resources for this frame */
- void (*dispose) (vo_frame_t *vo_img);
-
/* XvMC routine for rendering macroblocks */
void (*proc_macro_block)(int x,
int y,
@@ -126,6 +109,25 @@ struct vo_frame_s {
int (*f_mot_pmv)[2],
int (*b_mot_pmv)[2]);
+ /* tell video driver that the decoder starts a new field */
+ void (*field) (vo_frame_t *vo_img, int which_field);
+
+ /* append this frame to the display queue,
+ returns number of frames to skip if decoder is late */
+ int (*draw) (vo_frame_t *vo_img, xine_stream_t *stream);
+
+ /* lock frame as reference, must be paired with free.
+ * most decoders/drivers do not need to call this function since
+ * newly allocated frames are already locked once.
+ */
+ void (*lock) (vo_frame_t *vo_img);
+
+ /* this frame is no longer used by the decoder, video driver, etc */
+ void (*free) (vo_frame_t *vo_img);
+
+ /* free memory/resources for this frame */
+ void (*dispose) (vo_frame_t *vo_img);
+
/*
* public variables to decoders and vo drivers
* changing anything here will require recompiling them both
@@ -149,10 +151,6 @@ struct vo_frame_s {
int progressive_frame;
int picture_coding_type;
- /* pan/scan offset */
- int pan_scan_x;
- int pan_scan_y;
-
/* extra info coming from input or demuxers */
extra_info_t *extra_info;
@@ -163,7 +161,7 @@ struct vo_frame_s {
int drawn; /* used by decoder, frame has already been drawn */
int flags; /* remember the frame flags */
- int copy_called; /* track use of copy() method */
+ int proc_called; /* track use of proc_*() methods */
/* used to carry macroblocks information for XvMC acceleration */
xine_macroblocks_t *macroblocks;
@@ -185,6 +183,7 @@ struct vo_frame_s {
int is_first;
};
+
/*
* Remember that adding new functions to this structure requires
* adaption of the post plugin decoration layer. Be sure to look into
@@ -210,24 +209,19 @@ struct xine_video_port_s {
uint32_t height, double ratio,
int format, int flags);
+ /* retrieves the last displayed frame (useful for taking snapshots) */
vo_frame_t* (*get_last_frame) (xine_video_port_t *self);
/* overlay stuff */
void (*enable_ovl) (xine_video_port_t *self, int ovl_enable);
- /* video driver is no longer used by decoder => close */
- void (*close) (xine_video_port_t *self, xine_stream_t *stream);
-
- /* called on xine exit */
- void (*exit) (xine_video_port_t *self);
-
- /* get overlay instance (overlay source) */
+ /* get overlay manager */
video_overlay_manager_t* (*get_overlay_manager) (xine_video_port_t *self);
/* flush video_out fifo */
void (*flush) (xine_video_port_t *self);
- /* * Get/Set video property
+ /* Get/Set video property
*
* See VO_PROP_* bellow
*/
@@ -238,13 +232,18 @@ struct xine_video_port_s {
int (*status) (xine_video_port_t *self, xine_stream_t *stream,
int *width, int *height, int64_t *img_duration);
+ /* video driver is no longer used by decoder => close */
+ void (*close) (xine_video_port_t *self, xine_stream_t *stream);
+
+ /* called on xine exit */
+ void (*exit) (xine_video_port_t *self);
+
/* the driver in use */
vo_driver_t *driver;
};
/* constants for the get/set property functions */
-
#define VO_PROP_INTERLACED 0
#define VO_PROP_ASPECT_RATIO 1
#define VO_PROP_HUE 2
@@ -261,11 +260,6 @@ struct xine_video_port_s {
#define VO_PROP_DISCARD_FRAMES 14 /* not used by drivers */
#define VO_NUM_PROPERTIES 15
-/* zoom specific constants FIXME: generate this from xine.tmpl.in */
-#define VO_ZOOM_STEP 100
-#define VO_ZOOM_MAX 400
-#define VO_ZOOM_MIN 100
-
/* number of colors in the overlay palette. Currently limited to 256
at most, because some alphablend functions use an 8-bit index into
the palette. This should probably be classified as a bug. */
@@ -278,7 +272,6 @@ struct xine_video_port_s {
#define VO_NUM_RECENT_FRAMES 2
/* get_frame flags */
-
#define VO_TOP_FIELD 1
#define VO_BOTTOM_FIELD 2
#define VO_BOTH_FIELDS (VO_TOP_FIELD | VO_BOTTOM_FIELD)
@@ -287,18 +280,10 @@ struct xine_video_port_s {
#define VO_NEW_SEQUENCE_FLAG 16 /* set after MPEG2 Sequence Header Code (used by XvMC) */
/* video driver capabilities */
-
-#define VO_CAP_YV12 0x00000002 /* driver can handle YUV 4:2:0 pictures */
-#define VO_CAP_YUY2 0x00000004 /* driver can handle YUY2 pictures */
-
-#define VO_CAP_HUE 0x00000010 /* driver can set HUE value */
-#define VO_CAP_SATURATION 0x00000020 /* driver can set SATURATION value */
-#define VO_CAP_BRIGHTNESS 0x00000040 /* driver can set BRIGHTNESS value */
-#define VO_CAP_CONTRAST 0x00000080 /* driver can set CONTRAST value */
-#define VO_CAP_COLORKEY 0x00000100 /* driver can set COLORKEY value */
-#define VO_CAP_AUTOPAINT_COLORKEY 0x00000200 /* driver can set AUTOPAINT_COLORKEY value */
-#define VO_CAP_XVMC_MOCOMP 0x00000400 /* driver can set XvMC motion compensation */
-#define VO_CAP_XVMC_IDCT 0x00000800 /* driver can use XvMC idct acceleration */
+#define VO_CAP_YV12 0x00000001 /* driver can handle YUV 4:2:0 pictures */
+#define VO_CAP_YUY2 0x00000002 /* driver can handle YUY2 pictures */
+#define VO_CAP_XVMC_MOCOMP 0x00000004 /* driver can use XvMC motion compensation */
+#define VO_CAP_XVMC_IDCT 0x00000008 /* driver can use XvMC idct acceleration */
/* macroblock modes */
#define XINE_MACROBLOCK_INTRA 1
@@ -347,7 +332,6 @@ struct vo_driver_s {
*/
vo_frame_t* (*alloc_frame) (vo_driver_t *self);
-
/*
* check if the given image fullfills the format specified
* (re-)allocate memory if necessary
@@ -378,7 +362,6 @@ struct vo_driver_s {
/*
* these can be used by the gui directly:
*/
-
int (*get_property) (vo_driver_t *self, int property);
int (*set_property) (vo_driver_t *self,
int property, int value);
@@ -391,7 +374,6 @@ struct vo_driver_s {
* this should be used to propagate events, display data, window sizes
* etc. to the driver
*/
-
int (*gui_data_exchange) (vo_driver_t *self, int data_type,
void *data);
@@ -404,14 +386,11 @@ struct vo_driver_s {
/*
* free all resources, close driver
*/
-
void (*dispose) (vo_driver_t *self);
void *node; /* needed by plugin_loader */
};
-typedef struct video_driver_class_s video_driver_class_t;
-
struct video_driver_class_s {
/*
@@ -433,7 +412,6 @@ struct video_driver_class_s {
/*
* free all class-related resources
*/
-
void (*dispose) (video_driver_class_t *self);
};
@@ -500,7 +478,6 @@ video_overlay_manager_t *video_overlay_new_instance (void);
* build a video_out_port from
* a given video driver
*/
-
xine_video_port_t *vo_new_port (xine_t *xine, vo_driver_t *driver, int grabonly) ;
#ifdef __cplusplus