From 072076c18b081d30051142c188770a7c74964da9 Mon Sep 17 00:00:00 2001 From: Mike Lampard Date: Wed, 3 Apr 2002 09:40:40 +0000 Subject: bugfix for non-X frontends (tvout only). move overlay update into its own function (thanks to Michael Roitzsch). CVS patchset: 1668 CVS date: 2002/04/03 09:40:40 --- src/dxr3/dxr3_video_out.c | 29 +++++++---------------------- src/dxr3/dxr3_video_out.h | 8 +++++--- src/dxr3/dxr3_vo_core.c | 31 +++++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/dxr3/dxr3_video_out.c b/src/dxr3/dxr3_video_out.c index b341c8a2c..079f7c2a0 100644 --- a/src/dxr3/dxr3_video_out.c +++ b/src/dxr3/dxr3_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: dxr3_video_out.c,v 1.13 2002/04/02 14:05:59 mlampard Exp $ + * $Id: dxr3_video_out.c,v 1.14 2002/04/03 09:40:40 mlampard Exp $ * * mpeg1 encoding video out plugin for the dxr3. * @@ -211,7 +211,7 @@ static void dxr3_update_frame_format (vo_driver_t *this_gen, int image_size, oheight; /* update the overlay window co-ords if required */ - dxr3_redraw_needed((vo_driver_t *)this); + dxr3_overlay_update(this); /* reset the copy calls counter (number of calls to dxr3_frame_copy) */ frame->copy_calls = 0; @@ -402,24 +402,10 @@ static void dxr3_update_frame_format (vo_driver_t *this_gen, int dxr3_redraw_needed(vo_driver_t *this_gen) { - dxr3_driver_t *this = (dxr3_driver_t *) this_gen; - int gui_win_x, gui_win_y, gypos,gxpos,gw,gh; - - if(this->overlay_enabled){ - this->frame_output_cb (this->user_data, - this->video_width, this->video_height, - &gxpos, &gypos, &gw, &gh, - &gui_win_x, &gui_win_y ); - - if(this->xpos!=gxpos || this->ypos!=gypos || - this->width !=gw || this->height!=gh) { - this->xpos=gxpos+1; - this->ypos=gypos+1; - this->width=gw; - this->height=gh; - dxr3_overlay_adapt_area(this, this->xpos, this->ypos, this->width, this->height, gui_win_x, gui_win_y); - } - } + dxr3_driver_t *this = (dxr3_driver_t *)this_gen; + + dxr3_overlay_update(this); + if (this->need_redraw) { this->need_redraw = 0; return 1; @@ -634,8 +620,7 @@ printf("dxr3_video_out:init_plugin\n"); this->overlay_enabled = 0; this->aspectratio = ASPECT_FULL; - gather_screen_vars(this, visual_gen); - dxr3_read_config(this); + dxr3_read_config(this, visual_gen); if (this->overlay_enabled) { dxr3_get_keycolor(this); diff --git a/src/dxr3/dxr3_video_out.h b/src/dxr3/dxr3_video_out.h index d225fd534..f1d356999 100644 --- a/src/dxr3/dxr3_video_out.h +++ b/src/dxr3/dxr3_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: dxr3_video_out.h,v 1.17 2002/04/02 13:31:04 mlampard Exp $ + * $Id: dxr3_video_out.h,v 1.18 2002/04/03 09:40:40 mlampard Exp $ * */ @@ -172,11 +172,13 @@ int dxr3_overlay_set_attributes(dxr3_overlay_t *this); int dxr3_overlay_set_screen(dxr3_overlay_t *this); int dxr3_overlay_set_window(dxr3_overlay_t *this, int xpos, int ypos, int width, int height); - +void dxr3_overlay_adapt_area(dxr3_driver_t *this, + int xpos, int ypos, int width, int height); +void dxr3_overlay_update(dxr3_driver_t *this); void dxr3_overlay_buggy_preinit(dxr3_overlay_t *this, int fd); int dxr3_overlay_read_state(dxr3_overlay_t *this); void dxr3_get_keycolor(dxr3_driver_t *this); -void dxr3_read_config(dxr3_driver_t *this); +void dxr3_read_config(dxr3_driver_t *this, void *visual_gen); void *malloc_aligned (size_t alignment, size_t size, void **mem); void gather_screen_vars(dxr3_driver_t *this, x11_visual_t *vis); diff --git a/src/dxr3/dxr3_vo_core.c b/src/dxr3/dxr3_vo_core.c index fbd729d15..a7bc04e50 100644 --- a/src/dxr3/dxr3_vo_core.c +++ b/src/dxr3/dxr3_vo_core.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: dxr3_vo_core.c,v 1.19 2002/04/02 13:31:03 mlampard Exp $ + * $Id: dxr3_vo_core.c,v 1.20 2002/04/03 09:40:40 mlampard Exp $ * ************************************************************************* * core functions common to both Standard and RT-Encoding vo plugins * @@ -58,6 +58,28 @@ void *malloc_aligned (size_t alignment, size_t size, void **mem) { return aligned; } +/****** update the overlay window ******/ +void dxr3_overlay_update(dxr3_driver_t *this) +{ + if(this->overlay_enabled) { + int gui_win_x, gui_win_y, gypos,gxpos,gw,gh; + + this->frame_output_cb (this->user_data, + this->video_width, this->video_height, + &gxpos, &gypos, &gw, &gh, + &gui_win_x, &gui_win_y ); + + if(this->xpos!=gxpos || this->ypos!=gypos || + this->width !=gw || this->height!=gh) { + this->xpos=gxpos+1; + this->ypos=gypos+1; + this->width=gw; + this->height=gh; + dxr3_overlay_adapt_area(this, this->xpos, this->ypos, this->width, this->height); + } + } +} + /****** detect true window position and adapt overlay to it *******/ void dxr3_overlay_adapt_area(dxr3_driver_t *this, @@ -99,7 +121,7 @@ void dxr3_get_keycolor(dxr3_driver_t *this) * overlay setup data is read from ~/.overlay/res* in the * * overlay section below * ***************************************************************/ -void dxr3_read_config(dxr3_driver_t *this) +void dxr3_read_config(dxr3_driver_t *this, void * visual_gen) { char* str; config_values_t *config=this->config; @@ -125,6 +147,7 @@ void dxr3_read_config(dxr3_driver_t *this) } else if (!strcasecmp(str, "overlay")) { this->tv_mode = EM8300_VIDEOMODE_DEFAULT; printf("dxr3_vo: setting up overlay mode\n"); + gather_screen_vars(this, visual_gen); if (dxr3_overlay_read_state(&this->overlay) == 0) { this->overlay_enabled = 1; this->tv_switchable=1; @@ -408,7 +431,7 @@ int dxr3_gui_data_exchange (vo_driver_t *this_gen, /************************************************************************* * FIXME: Removed due to changes in XV by Guenter, but don't know what to replace it with * Update 2/4/02 - Mike Lampard: - * This functionality is now incorporated into dxr3_redraw_needed until + * This functionality is now incorporated into dxr3_overlay_update until * a cleaner way can be found to update window changes. case GUI_DATA_EX_DEST_POS_SIZE_CHANGED:{ @@ -427,7 +450,7 @@ int dxr3_gui_data_exchange (vo_driver_t *this_gen, XFillRectangle(this->display, this->win, this->gc, 0, 0, this->width, this->height); XUnlockDisplay(this->display); - dxr3_redraw_needed((vo_driver_t*)this); + dxr3_overlay_update(this); } break; case GUI_DATA_EX_DRAWABLE_CHANGED:{ -- cgit v1.2.3