[MPlayer-dev-eng] Allow progress bar osd to be moved to bottom of window

Nicolas George nicolas.george at normalesup.org
Wed Feb 22 10:44:51 CET 2012


Le tridi 3 ventôse, an CCXX, ironyman13 at gmail.com a écrit :
> This patch adds the option bottomprogbar which moves the progress bar
> to the bottom of the window if enabled. Comments?
> 
> 
> Index: cfg-mplayer.h
> ===================================================================
> --- cfg-mplayer.h	(revision 34753)
> +++ cfg-mplayer.h	(working copy)
> @@ -351,6 +351,7 @@
>      {"h", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
> 
>      {"vd", vd_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
> +    {"bottomprogbar", &bottom_progbar, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},

I find it a little bit too specific: what if someone wants to put it at the
top: add the topprogbar option?

Maybe progbar-align is a better idea: 0 for top, 50 for the current default
behaviour, 100 for bottom.

>      {NULL, NULL, 0, 0, 0, 0, NULL}
>  };
> 
> Index: sub/sub.c
> ===================================================================
> --- sub/sub.c	(revision 34753)
> +++ sub/sub.c	(working copy)
> @@ -528,6 +528,7 @@
> 
>  int vo_osd_progbar_type=-1;
>  int vo_osd_progbar_value=100;   // 0..256
> +int bottom_progbar;
> 
>  // if we have n=256 bars then OSD progbar looks like below
>  //
> @@ -537,6 +538,7 @@
>  //
>  //  the above schema is rescalled to n=elems bars
> 
> +

Looks unrelated.

>  static inline void vo_update_text_progbar(mp_osd_obj_t *obj, int dxs, int dys)
>  {
> 
> @@ -573,10 +575,16 @@
>  	    delta = (x-delta > 0) ? delta : x;
>  	    h=get_height(vo_osd_progbar_type,h);
>  	}
> +
> +	int progbar_dy = 0;

I believe we try to avoid mixing declarations and code as it may confuse
some older compilers.

> +	if(bottom_progbar){
> +	    progbar_dy = -y + vo_image_height-get_height(OSD_PB_START,h);
> +	}

Initing a variable called _dy with -y seems rather inelegant. Why don't you
just change the formula for y in the first place?

> +
>  	obj->bbox.x1=obj->x=x;
> -	obj->bbox.y1=obj->y=y;
> +	obj->bbox.y1=obj->y=y+progbar_dy;
>  	obj->bbox.x2=x+width+delimw;
> -	obj->bbox.y2=y+h; //vo_font->height;
> +	obj->bbox.y2=y+h+progbar_dy; //vo_font->height;
>  	obj->flags|=OSDFLAG_BBOX;
>  	obj->params.progbar.elems=elems;
>  	obj->bbox.x1-=delta; // space for an icon
> Index: mplayer.h
> ===================================================================
> --- mplayer.h	(revision 34753)
> +++ mplayer.h	(working copy)
> @@ -33,6 +33,7 @@
>  extern int slave_mode;
>  extern int player_idle_mode;
>  extern int use_menu;
> +extern int bottom_progbar;
> 
>  extern float  audio_delay;
>  extern double start_pts;

The update of he man page is also missing.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20120222/06c7b4fe/attachment.asc>


More information about the MPlayer-dev-eng mailing list