diff options
-rw-r--r-- | src/video_out/video_out_syncfb.c | 22 | ||||
-rw-r--r-- | src/video_out/video_out_x11.h | 14 | ||||
-rw-r--r-- | src/video_out/video_out_xshm.c | 55 | ||||
-rw-r--r-- | src/video_out/video_out_xv.c | 51 |
4 files changed, 130 insertions, 12 deletions
diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 9084dffa1..f00362621 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.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_syncfb.c,v 1.13 2001/09/26 17:19:49 jkeil Exp $ + * $Id: video_out_syncfb.c,v 1.14 2001/10/10 10:06:52 jkeil Exp $ * * video_out_syncfb.c, Matrox G400 video extension interface for xine * @@ -828,6 +828,26 @@ printf("move to %d %d with %d %d\n",area->x,area->y,area->w,area->h); /* FIXME : implement */ break; + + /* FIXME: implement this + case GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO: + { + x11_rectangle_t *rect = data; + int x1, y1, x2, y2; + xv_translate_gui2video(this, rect->x, rect->y, + &x1, &y1); + xv_translate_gui2video(this, rect->x + rect->w, rect->y + rect->h, + &x2, &y2); + rect->x = x1; + rect->y = y1; + rect->w = x2-x1; + rect->h = y2-y1; + } + break; + */ + + default: + return -1; } return 0; diff --git a/src/video_out/video_out_x11.h b/src/video_out/video_out_x11.h index eeb0d8244..faedf511e 100644 --- a/src/video_out/video_out_x11.h +++ b/src/video_out/video_out_x11.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_x11.h,v 1.6 2001/07/18 21:38:16 f1rmb Exp $ + * $Id: video_out_x11.h,v 1.7 2001/10/10 10:06:59 jkeil Exp $ * * structs and defines specific to all x11 related output plugins * (any x11 base xine ui should include this) @@ -85,17 +85,19 @@ typedef struct { } x11_visual_t; /* - * constants for gui_data_exhange's data_type parameter + * constants for gui_data_exchange's data_type parameter */ /* x11_rectangle_t *data */ -#define GUI_DATA_EX_DEST_POS_SIZE_CHANGED 0 +#define GUI_DATA_EX_DEST_POS_SIZE_CHANGED 0 /* xevent *data */ -#define GUI_DATA_EX_COMPLETION_EVENT 1 +#define GUI_DATA_EX_COMPLETION_EVENT 1 /* Drawable has changed */ -#define GUI_DATA_EX_DRAWABLE_CHANGED 2 +#define GUI_DATA_EX_DRAWABLE_CHANGED 2 /* xevent *data */ -#define GUI_DATA_EX_EXPOSE_EVENT 3 +#define GUI_DATA_EX_EXPOSE_EVENT 3 +/* x11_rectangle_t *data */ +#define GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO 4 #ifdef __cplusplus } diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index b1fd058be..235db0e75 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.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_xshm.c,v 1.43 2001/10/09 22:20:11 miguelfreitas Exp $ + * $Id: video_out_xshm.c,v 1.44 2001/10/10 10:06:59 jkeil Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -889,8 +889,36 @@ static void xshm_get_property_min_max (vo_driver_t *this_gen, static int is_fullscreen_size (xshm_driver_t *this, int w, int h) { - return w == DisplayWidth(this->display, this->screen) - && h == DisplayHeight(this->display, this->screen); + return w == DisplayWidth(this->display, this->screen) + && h == DisplayHeight(this->display, this->screen); +} + +static void xshm_translate_gui2video(xshm_driver_t *this, + int x, int y, + int *vid_x, int *vid_y) +{ + if (this->output_width > 0 && this->output_height > 0) { + /* + * 1. + * the xshm driver may center a small output area inside a larger + * gui area. This is the case in fullscreen mode, where we often + * have black borders on the top/bottom/left/right side. + */ + x -= (this->gui_width - this->output_width) >> 1; + y -= (this->gui_height - this->output_height) >> 1; + + /* + * 2. + * the xshm driver scales the delivered area into an output area. + * translate output area coordianates into the delivered area + * coordiantes. + */ + x = x * this->delivered_width / this->output_width; + y = y * this->delivered_height / this->output_height; + } + + *vid_x = x; + *vid_y = y; } static int xshm_gui_data_exchange (vo_driver_t *this_gen, @@ -930,7 +958,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, / (double) (this->gui_width * this->gui_height) ); /* - * if were near an exact power of 1.2, round the output_scale_factor + * if we are near an exact power of 1.2, round the output_scale_factor * to the exact value, to increase the chance that we can avoid * the software image scaler. */ @@ -1021,6 +1049,25 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, this->gc = XCreateGC (this->display, this->drawable, 0, NULL); break; + + case GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO: + { + int x1, y1, x2, y2; + x11_rectangle_t *rect = data; + + xshm_translate_gui2video(this, rect->x, rect->y, + &x1, &y1); + xshm_translate_gui2video(this, rect->x + rect->w, rect->y + rect->h, + &x2, &y2); + rect->x = x1; + rect->y = y1; + rect->w = x2-x1; + rect->h = y2-y1; + } + break; + + default: + return -1; } return 0; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 18ab8b7a1..500d17ec5 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.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_xv.c,v 1.65 2001/10/03 14:01:03 miguelfreitas Exp $ + * $Id: video_out_xv.c,v 1.66 2001/10/10 10:07:00 jkeil Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -776,6 +776,34 @@ static void xv_get_property_min_max (vo_driver_t *this_gen, *max = this->props[property].max; } +static void xv_translate_gui2video(xv_driver_t *this, + int x, int y, + int *vid_x, int *vid_y) +{ + if (this->output_width > 0 && this->output_height > 0) { + /* + * 1. + * the xv driver may center a small output area inside a larger + * gui area. This is the case in fullscreen mode, where we often + * have black borders on the top/bottom/left/right side. + */ + x -= this->output_xoffset; + y -= this->output_yoffset; + + /* + * 2. + * the xv driver scales the delivered area into an output area. + * translate output area coordianates into the delivered area + * coordiantes. + */ + x = x * this->delivered_width / this->output_width; + y = y * this->delivered_height / this->output_height; + } + + *vid_x = x; + *vid_y = y; +} + static int xv_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { @@ -837,6 +865,27 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, this->drawable = (Drawable) data; this->gc = XCreateGC (this->display, this->drawable, 0, NULL); break; + + /* FIXME: implement this + case GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO: + { + int x1, y1, x2, y2; + x11_rectangle_t *rect = data; + + xv_translate_gui2video(this, rect->x, rect->y, + &x1, &y1); + xv_translate_gui2video(this, rect->x + rect->w, rect->y + rect->h, + &x2, &y2); + rect->x = x1; + rect->y = y1; + rect->w = x2-x1; + rect->h = y2-y1; + } + break; + */ + + default: + return -1; } return 0; |