Commit 4b1fd54a authored by Jean-Paul Saman's avatar Jean-Paul Saman

OSDMenu improvements

- new style concat to indicate that images should be put in a region list
- user selected alpha value for subpictures
- position, x, y, timeout, update, alpha values are changeable during runtime
- vlc_osd.h: documented new osdmenu style concat

Known issues:
In osdmenu concat mode there is one issue left where two subpicture regions are displayed on top of each other when cycling through the menu.
parent e2f3f6cb
......@@ -146,6 +146,12 @@ VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *, video_format_t *, picture_t
* --sout='#transcode{osd}:std{access=udp,mux=ts,dst=dest_ipaddr}'
* --osdmenu-file=share/osdmenu/dvd.cfg
*
* An example for local usage of the OSD menu is:
*
* vlc dvdsimple:///dev/dvd --extraintf rc
* --sub-filter osdmenu
* --osdmenu-file=share/osdmenu/dvd.cfg
*
* Each OSD menu element, called "action", defines a hotkey action. Each action
* can have several states (unselect, select, pressed). Each state has an image
* that represents the state visually. The commands "menu right", "menu left",
......@@ -177,8 +183,9 @@ VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *, video_format_t *, picture_t
*
* CONFIG_FILE = FILENAME '.cfg'
* WS = [ ' ' | '\t' ]+
* OSDMEN_PATH = PATHNAME
* OSDMENU_PATH = PATHNAME
* DIR = 'dir' WS OSDMENU_PATH '\n'
* STYLE = 'style' [ 'default' | 'concat' ] '\n'
* STATE = [ 'unselect' | 'select' | 'pressed' ]
* HOTKEY_ACTION = 'key-' [ 'a' .. 'z', 'A' .. 'Z', '-' ]+
*
......@@ -325,6 +332,20 @@ struct osd_button_t
int i_ranges; /*< number of states */
};
/**
* OSD Menu Style
*
* The images that make up an OSD menu can be created in such away that
* they contain all buttons in the same picture, with the selected one
* highlighted or being a concatenation of all the seperate images. The
* first case is the default.
*
* To change the default style the keyword 'style' should be set to 'concat'.
*/
#define OSD_MENU_STYLE_SIMPLE 0x0
#define OSD_MENU_STYLE_CONCAT 0x1
/**
* OSD Menu State object
*
......@@ -363,6 +384,7 @@ struct osd_menu_t
int i_y; /*< y-position of OSD Menu on the video screen */
int i_width; /*< width of OSD Menu on the video screen */
int i_height; /*< height of OSD Menu on the video screen */
int i_style; /*< style of spu region generation */
char *psz_path; /*< directory where OSD menu images are stored */
osd_button_t *p_button; /*< doubly linked list of buttons */
......
This diff is collapsed.
......@@ -100,6 +100,7 @@ static osd_menu_t *osd_MenuNew( osd_menu_t *p_menu, const char *psz_path, int i_
p_menu->psz_path = NULL;
p_menu->i_x = i_x;
p_menu->i_y = i_y;
p_menu->i_style = OSD_MENU_STYLE_SIMPLE;
return p_menu;
}
......@@ -323,11 +324,11 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
FILE *fd = NULL;
int result = 0;
msg_Dbg( p_this, "opening osd definition file %s", psz_file );
msg_Dbg( p_this, "opening osdmenu definition file %s", psz_file );
fd = utf8_fopen( psz_file, "r" );
if( !fd )
{
msg_Err( p_this, "failed to open OSD definition file %s", psz_file );
msg_Err( p_this, "failed to open osdmenu definition file %s", psz_file );
return VLC_EGENERIC;
}
......@@ -335,9 +336,11 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
if( !feof( fd ) )
{
char action[25] = "";
char cmd[25] = "";
char path[MAX_FILE_PATH] = "";
char *psz_path = NULL;
size_t i_len = 0;
long pos = 0;
/* override images path ? */
psz_path = config_GetPsz( p_this, "osdmenu-file-path" );
......@@ -369,12 +372,40 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
path[i_len+1] = '\0';
if( result == 0 || result == EOF )
goto error;
msg_Dbg( p_this, "%s=%s", &action[0], &path[0] );
msg_Dbg( p_this, "osdmenu dir %s", &path[0] );
if( i_len == 0 )
*p_menu = osd_MenuNew( *p_menu, NULL, 0, 0 );
else
*p_menu = osd_MenuNew( *p_menu, &path[0], 0, 0 );
/* Peek for 'style' argument */
pos = ftell( fd );
if( pos < 0 )
goto error;
result = fscanf(fd, "%24s %24s", &cmd[0], &action[0] );
if( result == 0 || result == EOF )
goto error;
msg_Dbg( p_this, "osdmenu %s %s", &cmd[0], &action[0] );
if( strncmp( &cmd[0], "style", 5 ) == 0 )
{
if( strncmp( &action[0], "default", 7) == 0 )
{
(*p_menu)->i_style = OSD_MENU_STYLE_SIMPLE;
}
else if( strncmp( &action[0], "concat", 6) == 0 )
{
(*p_menu)->i_style = OSD_MENU_STYLE_CONCAT;
}
}
else
{
result = fseek( fd, pos, SEEK_SET );
if( result < 0 )
goto error;
}
}
if( !*p_menu )
......@@ -698,6 +729,7 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
#undef MAX_FILE_PATH
error:
msg_Err( p_this, "parsing file failed (returned %d)", result );
osd_MenuFree( p_this, *p_menu );
fclose( fd );
return 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment