summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2005-09-24 19:08:26 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2005-09-24 19:08:26 +0000
commit37cc903c609ca656a71852e5f50731f0b43bdda0 (patch)
tree50d8c59540de4b6ef20b24acd784903764b99522 /src/xine-engine
parent097426600056a112752e92eb1c13f0d6900f3907 (diff)
downloadxine-lib-37cc903c609ca656a71852e5f50731f0b43bdda0.tar.gz
xine-lib-37cc903c609ca656a71852e5f50731f0b43bdda0.tar.bz2
- rename all clip_top, clip_left, clip_color... to hili_xxxx. that
"clip" thing has caused too much confusion already since these variables define a highlight area. - add overlay offset support to video_out.c/alphablend/vo drivers - use overlay offset to implement proper croping of frames when vo driver doesn't support it - add clipping checks to alphablend to avoid buffer overflow, buffer "underflow" and wrapping. - increase vo api number - note: dxr3 support is incomplete about overlay offset CVS patchset: 7739 CVS date: 2005/09/24 19:08:26
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/osd.c12
-rw-r--r--src/xine-engine/video_out.c10
-rw-r--r--src/xine-engine/video_out.h23
-rw-r--r--src/xine-engine/video_overlay.c36
-rw-r--r--src/xine-engine/video_overlay.h12
-rw-r--r--src/xine-engine/xine_plugin.h4
6 files changed, 55 insertions, 42 deletions
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index e76f22167..2f40d73b1 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -238,10 +238,10 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
this->event.object.overlay->width = osd->x2 - osd->x1;
this->event.object.overlay->height = osd->y2 - osd->y1;
- this->event.object.overlay->clip_top = 0;
- this->event.object.overlay->clip_bottom = this->event.object.overlay->height;
- this->event.object.overlay->clip_left = 0;
- this->event.object.overlay->clip_right = this->event.object.overlay->width;
+ this->event.object.overlay->hili_top = 0;
+ this->event.object.overlay->hili_bottom = this->event.object.overlay->height;
+ this->event.object.overlay->hili_left = 0;
+ this->event.object.overlay->hili_right = this->event.object.overlay->width;
/* there will be at least that many rle objects (one for each row) */
required = osd->y2 - osd->y1;
@@ -298,8 +298,8 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) {
#endif
lprintf("num_rle = %d\n", this->event.object.overlay->num_rle);
- memcpy(this->event.object.overlay->clip_color, osd->color, sizeof(osd->color));
- memcpy(this->event.object.overlay->clip_trans, osd->trans, sizeof(osd->trans));
+ memcpy(this->event.object.overlay->hili_color, osd->color, sizeof(osd->color));
+ memcpy(this->event.object.overlay->hili_trans, osd->trans, sizeof(osd->trans));
memcpy(this->event.object.overlay->color, osd->color, sizeof(osd->color));
memcpy(this->event.object.overlay->trans, osd->trans, sizeof(osd->trans));
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 7e3ce577c..4928cc0c6 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.218 2005/02/14 14:04:55 holstsn Exp $
+ * $Id: video_out.c,v 1.219 2005/09/24 19:08:26 miguelfreitas Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -338,6 +338,8 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen,
img->crop_right = 0;
img->crop_top = 0;
img->crop_bottom = 0;
+ img->overlay_offset_x = 0;
+ img->overlay_offset_y = 0;
img->stream = NULL;
_x_extra_info_reset ( img->extra_info );
@@ -451,6 +453,8 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
(this->grab_only ||
!(this->driver->get_capabilities (this->driver) & VO_CAP_CROP)) ) {
if (img->format == XINE_IMGFMT_YV12 || img->format == XINE_IMGFMT_YUY2) {
+ img->overlay_offset_x -= img->crop_left;
+ img->overlay_offset_y -= img->crop_top;
img = crop_frame( img->port, img );
img_already_locked = 1;
} else {
@@ -626,6 +630,8 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) {
dupl->crop_right = img->crop_right;
dupl->crop_top = img->crop_top;
dupl->crop_bottom = img->crop_bottom;
+ dupl->overlay_offset_x = img->overlay_offset_x;
+ dupl->overlay_offset_y = img->overlay_offset_y;
this->driver->update_frame_format (this->driver, dupl, dupl->width, dupl->height,
dupl->ratio, dupl->format, dupl->flags);
@@ -1604,6 +1610,8 @@ static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) {
dupl->progressive_frame = img->progressive_frame;
dupl->repeat_first_field = img->repeat_first_field;
dupl->top_field_first = img->top_field_first;
+ dupl->overlay_offset_x = img->overlay_offset_x;
+ dupl->overlay_offset_y = img->overlay_offset_y;
switch (img->format) {
case XINE_IMGFMT_YV12:
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index 31680992d..12d6b6f02 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.112 2004/10/08 21:08:26 mroi Exp $
+ * $Id: video_out.h,v 1.113 2005/09/24 19:08:26 miguelfreitas Exp $
*
*
* xine version of video_out.h
@@ -150,6 +150,9 @@ struct vo_frame_s {
vo_driver_t *driver;
xine_stream_t *stream;
+ /* displacement for overlays */
+ int overlay_offset_x, overlay_offset_y;
+
/*
* that part is used only by video_out.c for frame management
* obs: changing anything here will require recompiling vo drivers
@@ -285,7 +288,7 @@ struct xine_video_port_s {
* from generic vo functions.
*/
-#define VIDEO_OUT_DRIVER_IFACE_VERSION 20
+#define VIDEO_OUT_DRIVER_IFACE_VERSION 21
struct vo_driver_s {
@@ -400,13 +403,15 @@ struct vo_overlay_s {
uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */
int rgb_clut; /* true if clut was converted to rgb */
- int clip_top;
- int clip_bottom;
- int clip_left;
- int clip_right;
- uint32_t clip_color[OVL_PALETTE_SIZE];
- uint8_t clip_trans[OVL_PALETTE_SIZE];
- int clip_rgb_clut; /* true if clut was converted to rgb */
+ /* define a highlight area with different colors */
+ int hili_top;
+ int hili_bottom;
+ int hili_left;
+ int hili_right;
+ uint32_t hili_color[OVL_PALETTE_SIZE];
+ uint8_t hili_trans[OVL_PALETTE_SIZE];
+ int hili_rgb_clut; /* true if clut was converted to rgb */
+
int unscaled; /* true if it should be blended unscaled */
};
diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c
index 36584b78a..346c3c9a6 100644
--- a/src/xine-engine/video_overlay.c
+++ b/src/xine-engine/video_overlay.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_overlay.c,v 1.37 2004/12/08 18:18:23 miguelfreitas Exp $
+ * $Id: video_overlay.c,v 1.38 2005/09/24 19:08:26 miguelfreitas Exp $
*
*/
@@ -320,11 +320,11 @@ static void video_overlay_print_overlay( vo_overlay_t *ovl ) {
printf ("video_overlay: \ttrans [%d %d %d %d]\n",
ovl->trans[0], ovl->trans[1], ovl->trans[2], ovl->trans[3]);
printf ("video_overlay: \tclip top=%d bottom=%d left=%d right=%d\n",
- ovl->clip_top, ovl->clip_bottom, ovl->clip_left, ovl->clip_right);
+ ovl->hili_top, ovl->hili_bottom, ovl->hili_left, ovl->hili_right);
printf ("video_overlay: \tclip_clut [%x %x %x %x]\n",
- ovl->clip_color[0], ovl->clip_color[1], ovl->clip_color[2], ovl->clip_color[3]);
- printf ("video_overlay: \tclip_trans [%d %d %d %d]\n",
- ovl->clip_trans[0], ovl->clip_trans[1], ovl->clip_trans[2], ovl->clip_trans[3]);
+ ovl->hili_color[0], ovl->hili_color[1], ovl->hili_color[2], ovl->hili_color[3]);
+ printf ("video_overlay: \thili_trans [%d %d %d %d]\n",
+ ovl->hili_trans[0], ovl->hili_trans[1], ovl->hili_trans[2], ovl->hili_trans[3]);
return;
}
#endif
@@ -436,19 +436,19 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) {
printf ("video_overlay:overlay present\n");
#endif
this->objects[handle].handle = handle;
- overlay->clip_top = event_overlay->clip_top;
- overlay->clip_bottom = event_overlay->clip_bottom;
- overlay->clip_left = event_overlay->clip_left;
- overlay->clip_right = event_overlay->clip_right;
- overlay->clip_color[0] = event_overlay->clip_color[0];
- overlay->clip_color[1] = event_overlay->clip_color[1];
- overlay->clip_color[2] = event_overlay->clip_color[2];
- overlay->clip_color[3] = event_overlay->clip_color[3];
- overlay->clip_trans[0] = event_overlay->clip_trans[0];
- overlay->clip_trans[1] = event_overlay->clip_trans[1];
- overlay->clip_trans[2] = event_overlay->clip_trans[2];
- overlay->clip_trans[3] = event_overlay->clip_trans[3];
- overlay->clip_rgb_clut = event_overlay->clip_rgb_clut;
+ overlay->hili_top = event_overlay->hili_top;
+ overlay->hili_bottom = event_overlay->hili_bottom;
+ overlay->hili_left = event_overlay->hili_left;
+ overlay->hili_right = event_overlay->hili_right;
+ overlay->hili_color[0] = event_overlay->hili_color[0];
+ overlay->hili_color[1] = event_overlay->hili_color[1];
+ overlay->hili_color[2] = event_overlay->hili_color[2];
+ overlay->hili_color[3] = event_overlay->hili_color[3];
+ overlay->hili_trans[0] = event_overlay->hili_trans[0];
+ overlay->hili_trans[1] = event_overlay->hili_trans[1];
+ overlay->hili_trans[2] = event_overlay->hili_trans[2];
+ overlay->hili_trans[3] = event_overlay->hili_trans[3];
+ overlay->hili_rgb_clut = event_overlay->hili_rgb_clut;
#ifdef LOG_DEBUG
video_overlay_print_overlay( this->events[this_event].event->object.overlay ) ;
#endif
diff --git a/src/xine-engine/video_overlay.h b/src/xine-engine/video_overlay.h
index f236c29c6..67562759f 100644
--- a/src/xine-engine/video_overlay.h
+++ b/src/xine-engine/video_overlay.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_overlay.h,v 1.19 2004/12/08 18:18:24 miguelfreitas Exp $
+ * $Id: video_overlay.h,v 1.20 2005/09/24 19:08:26 miguelfreitas Exp $
*
*/
@@ -60,10 +60,10 @@ typedef struct vo_buttons_s {
/* The following clipping coordinates are relative to the left upper corner
* of the OVERLAY, not of the target FRAME. Please do not mix them up! */
- int32_t clip_top;
- int32_t clip_bottom;
- int32_t clip_left;
- int32_t clip_right;
+ int32_t hili_top;
+ int32_t hili_bottom;
+ int32_t hili_left;
+ int32_t hili_right;
int32_t up;
int32_t down;
int32_t left;
@@ -74,7 +74,7 @@ typedef struct vo_buttons_s {
uint32_t active_color[OVL_PALETTE_SIZE];
uint8_t active_trans[OVL_PALETTE_SIZE];
xine_event_t active_event;
- int32_t clip_rgb_clut; /* true if clut was converted to rgb*/
+ int32_t hili_rgb_clut; /* true if clut was converted to rgb*/
/* FIXME: Probably not needed ^^^ */
} vo_buttons_t;
diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h
index d85364521..e9a50ff14 100644
--- a/src/xine-engine/xine_plugin.h
+++ b/src/xine-engine/xine_plugin.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_plugin.h,v 1.18 2005/04/10 09:31:16 tmattern Exp $
+ * $Id: xine_plugin.h,v 1.19 2005/09/24 19:08:26 miguelfreitas Exp $
*
* generic plugin definitions
*
@@ -97,7 +97,7 @@ typedef struct {
* info is a list of plugin_info_t terminated by PLUGIN_NONE
* example:
* plugin_info_t acme_plugin_info[] = {
- * { PLUGIN_VIDEO_OUT, 20, "acme", XINE_VERSION_CODE, &vo_info_acme,
+ * { PLUGIN_VIDEO_OUT, 21, "acme", XINE_VERSION_CODE, &vo_info_acme,
* init_class_acme },
* { PLUGIN_NONE, 0, "", 0, NULL, NULL }
* };