Commit f85f712e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

osd_parser/osdmenu: remove dead plugins

parent 03c911f3
...@@ -186,7 +186,6 @@ Section $Name_Section01 SEC01 ...@@ -186,7 +186,6 @@ Section $Name_Section01 SEC01
!insertmacro InstallFolder plugins !insertmacro InstallFolder plugins
!insertmacro InstallFolder locale !insertmacro InstallFolder locale
!insertmacro InstallFolder sdk !insertmacro InstallFolder sdk
@BUILD_OSDMENU_TRUE@ !insertmacro InstallFolder osdmenu
@BUILD_SKINS_TRUE@ !insertmacro InstallFolder skins @BUILD_SKINS_TRUE@ !insertmacro InstallFolder skins
@BUILD_LUA_TRUE@ !insertmacro InstallFolder lua @BUILD_LUA_TRUE@ !insertmacro InstallFolder lua
......
...@@ -54,14 +54,6 @@ if BUILD_SKINS ...@@ -54,14 +54,6 @@ if BUILD_SKINS
cp -r $(prefix)/share/vlc/skins2 $(win32_destdir)/skins cp -r $(prefix)/share/vlc/skins2 $(win32_destdir)/skins
endif endif
if BUILD_OSDMENU
cp -r $(prefix)/share/vlc/osdmenu "$(win32_destdir)/"
for file in $(win32_destdir)/osdmenu/*.cfg; do \
sed -e 's%share/osdmenu%osdmenu%g' -e 's%/%\\%g' "$$file" > "$${file}.tmp"; \
mv -f "$${file}.tmp" "$${file}"; \
done
endif
cp "$(top_builddir)/npapi-vlc/activex/axvlc.dll.manifest" "$(win32_destdir)/" cp "$(top_builddir)/npapi-vlc/activex/axvlc.dll.manifest" "$(win32_destdir)/"
cp "$(top_builddir)/npapi-vlc/installed/lib/axvlc.dll" "$(win32_destdir)/" cp "$(top_builddir)/npapi-vlc/installed/lib/axvlc.dll" "$(win32_destdir)/"
cp "$(top_builddir)/npapi-vlc/npapi/package/npvlc.dll.manifest" "$(win32_destdir)/" cp "$(top_builddir)/npapi-vlc/npapi/package/npvlc.dll.manifest" "$(win32_destdir)/"
......
...@@ -232,8 +232,6 @@ $Id$ ...@@ -232,8 +232,6 @@ $Id$
* opensles_android: OpenSL ES audio output for Android * opensles_android: OpenSL ES audio output for Android
* opus: a opus audio decoder/packetizer using the libopus library * opus: a opus audio decoder/packetizer using the libopus library
* os2drive: service discovery for OS/2 drives * os2drive: service discovery for OS/2 drives
* osd_parser: OSD import module
* osdmenu: video_filter for displaying and streaming a On Screen Display menu
* oss: audio output module using the OSS /dev/dsp interface * oss: audio output module using the OSS /dev/dsp interface
* packetizer_copy: Simple copy packetizer * packetizer_copy: Simple copy packetizer
* packetizer_dirac: Dirac video packetizer * packetizer_dirac: Dirac video packetizer
......
...@@ -21,14 +21,6 @@ endif ...@@ -21,14 +21,6 @@ endif
EXTRA_LTLIBRARIES += libgnutls_plugin.la EXTRA_LTLIBRARIES += libgnutls_plugin.la
libvlc_LTLIBRARIES += $(LTLIBgnutls) libvlc_LTLIBRARIES += $(LTLIBgnutls)
libosd_parser_plugin_la_SOURCES = \
osd/parser.c osd/osd_menu.c osd/osd_menu.h osd/simple.c osd/xml.c
libosd_parser_plugin_la_CFLAGS = $(AM_CFLAGS)
libosd_parser_plugin_la_LIBADD = $(AM_LIBADD)
if BUILD_OSDMENU
libvlc_LTLIBRARIES += libosd_parser_plugin.la
endif
libxdg_screensaver_plugin_la_SOURCES = inhibit/xdg.c libxdg_screensaver_plugin_la_SOURCES = inhibit/xdg.c
libxdg_screensaver_plugin_la_CFLAGS = $(AM_CFLAGS) libxdg_screensaver_plugin_la_CFLAGS = $(AM_CFLAGS)
libxdg_screensaver_plugin_la_LIBADD = $(AM_LIBADD) libxdg_screensaver_plugin_la_LIBADD = $(AM_LIBADD)
......
/*****************************************************************************
* osd_menu.c : OSD import module
*****************************************************************************
* Copyright (C) 2007-2008 M2X
* $Id$
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_image.h>
#include <vlc_osd.h>
#include "osd_menu.h"
#undef OSD_MENU_DEBUG
const char * const ppsz_button_states[] = { "unselect", "select", "pressed" };
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/*****************************************************************************
* Create a new Menu structure
*****************************************************************************/
osd_menu_t *osd_MenuNew( osd_menu_t *p_menu, const char *psz_path,
int i_x, int i_y )
{
if( !p_menu ) return NULL;
p_menu->p_state = calloc( 1, sizeof( osd_menu_state_t ) );
if( !p_menu->p_state )
return NULL;
p_menu->psz_path = psz_path ? strdup( 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;
}
/*****************************************************************************
* Free the menu
*****************************************************************************/
void osd_MenuFree( osd_menu_t *p_menu )
{
msg_Dbg( p_menu, "freeing menu" );
osd_ButtonFree( p_menu, p_menu->p_button );
free( p_menu->psz_path );
free( p_menu->p_state );
p_menu->p_button = NULL;
p_menu->p_last_button = NULL;
p_menu->psz_path = NULL;
p_menu->p_state = NULL;
}
/*****************************************************************************
* Create a new button
*****************************************************************************/
osd_button_t *osd_ButtonNew( const char *psz_action, int i_x, int i_y )
{
osd_button_t *p_button = NULL;
p_button = calloc( 1, sizeof(osd_button_t) );
if( !p_button )
return NULL;
p_button->psz_action = strdup(psz_action);
p_button->psz_action_down = NULL;
p_button->i_x = i_x;
p_button->i_y = i_y;
return p_button;
}
/*****************************************************************************
* Free a button
*****************************************************************************/
void osd_ButtonFree( osd_menu_t *p_menu, osd_button_t *p_button )
{
osd_button_t *p_current = p_button;
osd_button_t *p_next = NULL;
osd_button_t *p_prev = NULL;
if( !p_current ) return;
/* First walk to the end. */
while( p_current->p_next )
{
p_next = p_current->p_next;
p_current = p_next;
}
/* Then free end first and walk to the start. */
while( p_current->p_prev )
{
msg_Dbg( p_menu, "+ freeing button %s [%p]",
p_current->psz_action, p_current );
p_prev = p_current->p_prev;
p_current = p_prev;
if( p_current->p_next )
{
free( p_current->p_next->psz_name );
free( p_current->p_next->psz_action );
free( p_current->p_next->psz_action_down );
/* Free all states first */
if( p_current->p_next->p_states )
osd_StatesFree( p_menu, p_current->p_next->p_states );
free( p_current->p_next );
p_current->p_next = NULL;
}
if( p_current->p_up )
{
free( p_current->p_up->psz_name );
free( p_current->p_up->psz_action );
free( p_current->p_up->psz_action_down );
/* Free all states first */
if( p_current->p_up->p_states )
osd_StatesFree( p_menu, p_current->p_up->p_states );
free( p_current->p_up );
p_current->p_up = NULL;
}
}
/* Free the last one. */
if( p_button )
{
msg_Dbg( p_menu, "+ freeing button %s [%p]",
p_button->psz_action, p_button );
free( p_button->psz_name );
free( p_button->psz_action );
free( p_button->psz_action_down );
if( p_button->p_states )
osd_StatesFree( p_menu, p_button->p_states );
free( p_button );
}
}
/*****************************************************************************
* Create a new state image
*****************************************************************************/
osd_state_t *osd_StateNew( osd_menu_t *p_menu, const char *psz_file,
const char *psz_state )
{
osd_state_t *p_state = NULL;
video_format_t fmt_in, fmt_out;
p_state = calloc( 1, sizeof(osd_state_t) );
if( !p_state )
return NULL;
memset( &fmt_in, 0, sizeof(video_format_t) );
memset( &fmt_out, 0, sizeof(video_format_t) );
fmt_out.i_chroma = VLC_CODEC_YUVA;
if( p_menu->p_image )
{
p_state->p_pic = image_ReadUrl( p_menu->p_image, psz_file,
&fmt_in, &fmt_out );
if( p_state->p_pic )
{
p_state->i_width = p_state->p_pic->p[Y_PLANE].i_visible_pitch;
p_state->i_height = p_state->p_pic->p[Y_PLANE].i_visible_lines;
}
}
if( psz_state )
{
p_state->psz_state = strdup( psz_state );
if( strncmp( ppsz_button_states[0], psz_state,
strlen(ppsz_button_states[0]) ) == 0 )
p_state->i_state = OSD_BUTTON_UNSELECT;
else if( strncmp( ppsz_button_states[1], psz_state,
strlen(ppsz_button_states[1]) ) == 0 )
p_state->i_state = OSD_BUTTON_SELECT;
else if( strncmp( ppsz_button_states[2], psz_state,
strlen(ppsz_button_states[2]) ) == 0 )
p_state->i_state = OSD_BUTTON_PRESSED;
}
return p_state;
}
/*****************************************************************************
* Free state images
*****************************************************************************/
void osd_StatesFree( osd_menu_t *p_menu, osd_state_t *p_states )
{
osd_state_t *p_state = p_states;
osd_state_t *p_next = NULL;
osd_state_t *p_prev = NULL;
if( !p_state ) return;
while( p_state->p_next )
{
p_next = p_state->p_next;
p_state = p_next;
}
/* Then free end first and walk to the start. */
while( p_state->p_prev )
{
msg_Dbg( p_menu, " |- freeing state %s [%p]",
p_state->psz_state, p_state );
p_prev = p_state->p_prev;
p_state = p_prev;
if( p_state->p_next )
{
if( p_state->p_next->p_pic )
picture_Release( p_state->p_next->p_pic );
free( p_state->p_next->psz_state );
free( p_state->p_next );
p_state->p_next = NULL;
}
}
/* Free the last one. */
if( p_states )
{
msg_Dbg( p_menu, " |- freeing state %s [%p]",
p_state->psz_state, p_states );
if( p_states->p_pic )
picture_Release( p_state->p_next->p_pic );
free( p_state->psz_state );
free( p_states );
}
}
/*****************************************************************************
* osd_menu.h : OSD import module
*****************************************************************************
* Copyright (C) 2007 M2X
* $Id$
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _OSD_MENU_PARSER_H_
#define _OSD_MENU_PARSER_H_
extern const char * const ppsz_button_states[3];
/* OSD Menu structure support routines for internal use by
* OSD Menu configuration file parsers only.
*/
osd_menu_t *osd_MenuNew( osd_menu_t *, const char *, int, int );
osd_button_t *osd_ButtonNew( const char *, int, int );
osd_state_t *osd_StateNew( osd_menu_t *, const char *, const char * );
void osd_MenuFree ( osd_menu_t * );
void osd_ButtonFree( osd_menu_t *, osd_button_t * );
void osd_StatesFree( osd_menu_t *, osd_state_t * );
#endif
/*****************************************************************************
* parser.c : OSD import module
*****************************************************************************
* Copyright (C) 2007 M2X
* $Id$
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_osd.h>
#include "osd_menu.h"
/***************************************************************************
* Prototypes
***************************************************************************/
int osd_parser_simpleOpen ( vlc_object_t *p_this );
int osd_parser_xmlOpen ( vlc_object_t *p_this );
static void osd_parser_Close( vlc_object_t *p_this );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin ()
add_submodule ()
set_description( N_("OSD configuration importer") )
add_shortcut( "import-osd" )
set_capability( "osd parser", 0)
set_callbacks( osd_parser_simpleOpen, osd_parser_Close )
add_submodule ()
set_description( N_("XML OSD configuration importer") )
add_shortcut( "import-osd-xml" )
set_capability( "osd parser", 0)
set_callbacks( osd_parser_xmlOpen, osd_parser_Close )
vlc_module_end ()
/*****************************************************************************
* osd_parser_Close: Free all osd menu structure resources
*****************************************************************************/
void osd_parser_Close ( vlc_object_t *p_this )
{
osd_menu_t *p_menu = (osd_menu_t *) p_this;
if( p_menu )
osd_MenuFree( p_menu );
}
/*****************************************************************************
* simple.c - The OSD Menu simple parser code.
*****************************************************************************
* Copyright (C) 2005-2008 M2X
* $Id$
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_osd.h>
#include <vlc_fs.h>
#include <limits.h>
#include "osd_menu.h"
int osd_parser_simpleOpen( vlc_object_t *p_this );
/*****************************************************************************
* Simple parser open function
*****************************************************************************/
int osd_parser_simpleOpen( vlc_object_t *p_this )
{
osd_menu_t *p_menu = (osd_menu_t *) p_this;
osd_button_t *p_current = NULL; /* button currently processed */
osd_button_t *p_prev = NULL; /* previous processed button */
FILE *fd = NULL;
int result = 0;
if( !p_menu ) return VLC_ENOOBJ;
msg_Dbg( p_this, "opening osdmenu definition file %s", p_menu->psz_file );
fd = vlc_fopen( p_menu->psz_file, "r" );
if( !fd )
{
msg_Err( p_this, "failed to open osdmenu definition file %s",
p_menu->psz_file );
return VLC_EGENERIC;
}
/* Read first line */
if( !feof( fd ) )
{
char action[25] = "";
char cmd[25] = "";
char path[PATH_MAX] = "";
char *psz_path = NULL;
size_t i_len = 0;
long pos = 0;
result = fscanf(fd, "%24s %255s", action, path );
/* override images path ? */
psz_path = var_InheritString( p_this, "osdmenu-file-path" );
if( psz_path )
{
/* psz_path is not null and therefor path cannot be NULL
* it might be null terminated.
*/
strncpy( path, psz_path, PATH_MAX );
free( psz_path );
psz_path = NULL;
}
/* NULL terminate before asking the length of path[] */
path[PATH_MAX-1] = '\0';
i_len = strlen(path);
/* Protect against buffer overflow:
* max index is PATH_MAX-1 and we increment by 1 after
* so PATH_MAX-2 is the bigest we can have */
if( i_len > PATH_MAX - 2 )
i_len = PATH_MAX - 2;
#if defined(WIN32) || defined(__OS2__)
if( (i_len > 0) && path[i_len] != '\\' )
path[i_len] = '\\';
#else
if( (i_len > 0) && path[i_len] != '/' )
path[i_len] = '/';
#endif
path[i_len+1] = '\0';
if( result == 0 || result == EOF )
goto error;
msg_Dbg( p_this, "osdmenu dir %s", path );
if( i_len == 0 )
p_menu = osd_MenuNew( p_menu, NULL, 0, 0 );
else
p_menu = osd_MenuNew( p_menu, path, 0, 0 );
/* Peek for 'style' argument */
pos = ftell( fd );
if( pos < 0 )
goto error;
result = fscanf(fd, "%24s %24s", cmd, action );
if( result == 0 || result == EOF )
goto error;
msg_Dbg( p_this, "osdmenu %s %s", cmd, action );
if( strncmp( cmd, "style", 5 ) == 0 )
{
if( strncmp( action, "default", 7) == 0 )
{
p_menu->i_style = OSD_MENU_STYLE_SIMPLE;
}
else if( strncmp( action, "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 )
goto error;
/* read successive lines */
while( !feof( fd ) )
{
osd_state_t *p_state_current = NULL; /* button state currently processed */
osd_state_t *p_state_prev = NULL; /* previous state processed button */
char cmd[25] = "";
char action[25] = "";
char state[25] = "";
char file[256] = "";
char path[PATH_MAX] = "";
int i_x = 0;
int i_y = 0;
result = fscanf( fd, "%24s %24s (%d,%d)", cmd, action, &i_x, &i_y );
if( result == 0 )
goto error;
if( strncmp( &cmd[0], "action", 6 ) != 0 )
break;
msg_Dbg( p_this, " + %s hotkey=%s (%d,%d)", cmd, action, i_x, i_y );
p_prev = p_current;
p_current = osd_ButtonNew( action, i_x, i_y );
if( !p_current )
goto error;
if( p_prev )
p_prev->p_next = p_current;
else
p_menu->p_button = p_current;
p_current->p_prev = p_prev;
/* parse all states */
while( !feof( fd ) )
{
char type[25] = "";
result = fscanf( fd, "\t%24s", state );
if( result == 0 )
goto error;
/* FIXME: We only parse one level deep now */
if( strncmp( state, "action", 6 ) == 0 )
{
osd_button_t *p_up = NULL;
result = fscanf( fd, "%24s (%d,%d)", action, &i_x, &i_y );
if( result == 0 )
goto error;
/* create new button */
p_up = osd_ButtonNew( action, i_x, i_y );
if( !p_up )
goto error;
/* Link to list */
p_up->p_down = p_current;
p_current->p_up = p_up;
msg_Dbg( p_this, " + (menu up) hotkey=%s (%d,%d)", action, i_x, i_y );
/* Parse type state */
result = fscanf( fd, "\t%24s %24s", cmd, type );
if( result == 0 )
goto error;
if( strncmp( cmd, "type", 4 ) == 0 )
{
if( strncmp( type, "volume", 6 ) == 0 )
{
p_menu->p_state->p_volume = p_up;
msg_Dbg( p_this, " + type=%s", type );
}
}
/* Parse range state */
result = fscanf( fd, "\t%24s", state );
if( result == 0 )
goto error;
/* Parse the range state */
if( strncmp( state, "range", 5 ) == 0 )
{
osd_state_t *p_range_current = NULL; /* range state currently processed */
osd_state_t *p_range_prev = NULL; /* previous state processed range */
int i_index = 0;
p_up->b_range = true;
result = fscanf( fd, "\t%24s", action );
if( result == 0 )
goto error;
result = fscanf( fd, "\t%d", &i_index );
if( result == 0 )
goto error;
msg_Dbg( p_this, " + (menu up) hotkey down %s, file=%s%s",
action, p_menu->psz_path, file );
free( p_up->psz_action_down );
p_up->psz_action_down = strdup( action );
/* Parse range contstruction :
* range <hotkey>
* <state1> <file1>
*
* <stateN> <fileN>
* end
*/
while( !feof( fd ) )
{
result = fscanf( fd, "\t%255s", file );
if( result == 0 )
goto error;
if( strncmp( file, "end", 3 ) == 0 )
break;
p_range_prev = p_range_current;
if( p_menu->psz_path )
{
size_t i_path_size = strlen( p_menu->psz_path );
size_t i_file_size = strlen( file );
if( (i_path_size + i_file_size >= PATH_MAX) ||
(i_path_size >= PATH_MAX) )
goto error;
strncpy( path, p_menu->psz_path, i_path_size );
strncpy( &path[i_path_size], file,
PATH_MAX - (i_path_size + i_file_size) );
path[ i_path_size + i_file_size ] = '\0';
p_range_current = osd_StateNew( p_menu, path, "pressed" );
}
else /* absolute paths are used. */
p_range_current = osd_StateNew( p_menu, file, "pressed" );
if( !p_range_current )
goto error;
if( !p_range_current->p_pic )
{
osd_StatesFree( p_menu, p_range_current );
goto error;
}
p_range_current->i_x = i_x;
p_range_current->i_y = i_y;
/* increment the number of ranges for this button */
p_up->i_ranges++;
if( p_range_prev )
p_range_prev->p_next = p_range_current;
else
p_up->p_states = p_range_current;
p_range_current->p_prev = p_range_prev;
msg_Dbg( p_this, " |- range=%d, file=%s%s",
p_up->i_ranges,
p_menu->psz_path, file );
}
if( i_index > 0 )
{
osd_state_t *p_range = NULL;
/* Find the default index for state range */
p_range = p_up->p_states;
while( (--i_index > 0) && p_range->p_next )
{
osd_state_t *p_temp = NULL;
p_temp = p_range->p_next;
p_range = p_temp;
}
p_up->p_current_state = p_range;
}
else p_up->p_current_state = p_up->p_states;
}
result = fscanf( fd, "\t%24s", state );
if( result == 0 )
goto error;
if( strncmp( state, "end", 3 ) != 0 )
goto error;
/* Continue at the beginning of the while() */
continue;
}
/* Parse the range state */
if( strncmp( state, "range", 5 ) == 0 )
{
osd_state_t *p_range_current = NULL; /* range state currently processed */
osd_state_t *p_range_prev = NULL; /* previous state processed range */
int i_index = 0;
p_current->b_range = true;
result = fscanf( fd, "\t%24s", action );
if( result == 0 )
goto error;
result = fscanf( fd, "\t%d", &i_index );
if( result == 0 )
goto error;
msg_Dbg( p_this, " + hotkey down %s, file=%s%s",
action, p_menu->psz_path, file );
free( p_current->psz_action_down );
p_current->psz_action_down = strdup( action );
/* Parse range contstruction :
* range <hotkey>
* <state1> <file1>
*
* <stateN> <fileN>
* end
*/
while( !feof( fd ) )
{
result = fscanf( fd, "\t%255s", file );
if( result == 0 )
goto error;
if( strncmp( file, "end", 3 ) == 0 )
break;
p_range_prev = p_range_current;
if( p_menu->psz_path )
{
size_t i_path_size = strlen( p_menu->psz_path );
size_t i_file_size = strlen( file );
if( (i_path_size + i_file_size >= PATH_MAX) ||
(i_path_size >= PATH_MAX) )
goto error;
strncpy( path, p_menu->psz_path, i_path_size );
strncpy( &path[i_path_size], file,
PATH_MAX - (i_path_size + i_file_size) );
path[ i_path_size + i_file_size ] = '\0';
p_range_current = osd_StateNew( p_menu, path, "pressed" );
}
else /* absolute paths are used. */
p_range_current = osd_StateNew( p_menu, file, "pressed" );
if( !p_range_current )
goto error;
if( !p_range_current->p_pic )
{
osd_StatesFree( p_menu, p_range_current );
goto error;
}
p_range_current->i_x = i_x;
p_range_current->i_y = i_y;
/* increment the number of ranges for this button */
p_current->i_ranges++;
if( p_range_prev )
p_range_prev->p_next = p_range_current;
else
p_current->p_states = p_range_current;
p_range_current->p_prev = p_range_prev;
msg_Dbg( p_this, " |- range=%d, file=%s%s",
p_current->i_ranges,
p_menu->psz_path, file );
}
if( i_index > 0 )
{
osd_state_t *p_range = NULL;
/* Find the default index for state range */
p_range = p_current->p_states;
while( (--i_index > 0) && p_range->p_next )
{
osd_state_t *p_temp = NULL;
p_temp = p_range->p_next;
p_range = p_temp;
}
p_current->p_current_state = p_range;
}
else p_current->p_current_state = p_current->p_states;
/* Continue at the beginning of the while() */
continue;
}
if( strncmp( state, "end", 3 ) == 0 )
break;
result = fscanf( fd, "\t%255s", file );
if( result == 0 )
goto error;
p_state_prev = p_state_current;
if( ( strncmp( ppsz_button_states[0], state, strlen(ppsz_button_states[0]) ) != 0 ) &&
( strncmp( ppsz_button_states[1], state, strlen(ppsz_button_states[1]) ) != 0 ) &&
( strncmp( ppsz_button_states[2], state, strlen(ppsz_button_states[2]) ) != 0 ) )
{
msg_Err( p_this, "invalid button state %s for button %s "
"expected %u: unselect, select or pressed)",
state, action, (unsigned)strlen(state));
goto error;
}
if( p_menu->psz_path )
{
size_t i_path_size = strlen( p_menu->psz_path );
size_t i_file_size = strlen( file );
if( (i_path_size + i_file_size >= PATH_MAX) ||
(i_path_size >= PATH_MAX) )
goto error;
strncpy( path, p_menu->psz_path, i_path_size );
strncpy( &path[i_path_size], file,
PATH_MAX - (i_path_size + i_file_size) );
path[ i_path_size + i_file_size ] = '\0';
p_state_current = osd_StateNew( p_menu, path, state );
}
else /* absolute paths are used. */
p_state_current = osd_StateNew( p_menu, file, state );
if( !p_state_current )
goto error;
if( !p_state_current->p_pic )
{
osd_StatesFree( p_menu, p_state_current );
goto error;
}
p_state_current->i_x = i_x;
p_state_current->i_y = i_y;
if( p_state_prev )
p_state_prev->p_next = p_state_current;
else
p_current->p_states = p_state_current;
p_state_current->p_prev = p_state_prev;
msg_Dbg( p_this, " |- state=%s, file=%s%s", state,
p_menu->psz_path, file );
}
p_current->p_current_state = p_current->p_states;
}
/* Find the last button and store its pointer.
* The OSD menu behaves like a roundrobin list.
*/
p_current = p_menu->p_button;
while( p_current && p_current->p_next )
{
osd_button_t *p_temp = NULL;
p_temp = p_current->p_next;
p_current = p_temp;
}
p_menu->p_last_button = p_current;
fclose( fd );
return VLC_SUCCESS;
error:
msg_Err( p_this, "parsing file failed (returned %d)", result );
if( p_menu )
osd_MenuFree( p_menu );
fclose( fd );
return VLC_EGENERIC;
}
/*****************************************************************************
* xml.c - The OSD Menu XML parser code.
*****************************************************************************
* Copyright (C) 2005-2007 M2X
* $Id$
*
* Authors: Jean-Paul Saman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include "osd_menu.h"
int osd_parser_xmlOpen ( vlc_object_t *p_this );
/****************************************************************************
* Local structures
****************************************************************************/
int osd_parser_xmlOpen( vlc_object_t *p_this )
{
VLC_UNUSED(p_this);
return VLC_SUCCESS;
}
...@@ -46,13 +46,6 @@ if !HAVE_WIN32 ...@@ -46,13 +46,6 @@ if !HAVE_WIN32
libvlc_LTLIBRARIES += libdynamicoverlay_plugin.la libvlc_LTLIBRARIES += libdynamicoverlay_plugin.la
endif endif
libosdmenu_plugin_la_SOURCES = osdmenu.c
libosdmenu_plugin_la_CFLAGS = $(AM_CFLAGS) -DPKGDATADIR=\"$(vlcdatadir)\"
libosdmenu_plugin_la_LIBADD = $(AM_LIBADD)
if BUILD_OSDMENU
libvlc_LTLIBRARIES += libosdmenu_plugin.la
endif
libremoteosd_plugin_la_SOURCES = remoteosd.c remoteosd_rfbproto.h libremoteosd_plugin_la_SOURCES = remoteosd.c remoteosd_rfbproto.h
libremoteosd_plugin_la_CFLAGS = $(AM_CFLAGS) $(GCRYPT_CFLAGS) libremoteosd_plugin_la_CFLAGS = $(AM_CFLAGS) $(GCRYPT_CFLAGS)
libremoteosd_plugin_la_LIBADD = $(AM_LIBADD) $(GCRYPT_LIBS) $(LIBS_remoteosd) libremoteosd_plugin_la_LIBADD = $(AM_LIBADD) $(GCRYPT_LIBS) $(LIBS_remoteosd)
......
/*****************************************************************************
* osdmenu.c: osd filter module
*****************************************************************************
* Copyright (C) 2004-2007 M2X
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman #_at_# m2x dot nl>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implid warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_osd.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
/* FIXME: Future extension make the definition file in XML format. */
#define OSD_FILE_TEXT N_("Configuration file")
#define OSD_FILE_LONGTEXT N_( \
"Configuration file for the OSD Menu." )
#define OSD_PATH_TEXT N_("Path to OSD menu images")
#define OSD_PATH_LONGTEXT N_( \
"Path to the OSD menu images. This will override the path defined in the " \
"OSD configuration file." )
#define POSX_TEXT N_("X coordinate")
#define POSX_LONGTEXT N_("You can move the OSD menu by left-clicking on it." )
#define POSY_TEXT N_("Y coordinate")
#define POSY_LONGTEXT N_("You can move the OSD menu by left-clicking on it." )
#define POS_TEXT N_("Menu position")
#define POS_LONGTEXT N_( \
"You can enforce the OSD menu position on the video " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values, eg. 6 = top-right).")
#define TIMEOUT_TEXT N_("Menu timeout")
#define TIMEOUT_LONGTEXT N_( \
"OSD menu pictures get a default timeout of 15 seconds added to their " \
"remaining time. This will ensure that they are at least the specified " \
"time visible.")
#define OSD_UPDATE_TEXT N_("Menu update interval" )
#define OSD_UPDATE_LONGTEXT N_( \
"The default is to update the OSD menu picture every 200 ms. Shorten the" \
" update time for environments that experience transmissions errors. " \
"Be careful with this option as encoding OSD menu pictures is very " \
"computing intensive. The range is 0 - 1000 ms." )
#define OSD_ALPHA_TEXT N_("Alpha transparency value (default 255)")
#define OSD_ALPHA_LONGTEXT N_( \
"The transparency of the OSD menu can be changed by giving a value " \
"between 0 and 255. A lower value specifies more transparency a higher " \
"means less transparency. The default is being not transparent " \
"(value 255) the minimum is fully transparent (value 0)." )
static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static const char *const ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
/* subsource functions */
static int CreateFilter ( vlc_object_t * );
static void DestroyFilter( vlc_object_t * );
static subpicture_t *Filter( filter_t *, mtime_t );
static int OSDMenuUpdateEvent( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int OSDMenuVisibleEvent( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int OSDMenuCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int MouseEvent( filter_t *,
const vlc_mouse_t *,
const vlc_mouse_t *,
const video_format_t * );
#define OSD_CFG "osdmenu-"
#if defined( WIN32 )
#define OSD_DEFAULT_CFG "osdmenu/default.cfg"
#else
#define OSD_DEFAULT_CFG PKGDATADIR"/osdmenu/default.cfg"
#endif
#define OSD_UPDATE_MIN 0
#define OSD_UPDATE_DEFAULT 300
#define OSD_UPDATE_MAX 1000
vlc_module_begin ()
set_capability( "sub source", 100 )
set_description( N_("On Screen Display menu") )
set_shortname( N_("OSD menu") )
add_shortcut( "osdmenu" )
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_SUBPIC )
set_callbacks( CreateFilter, DestroyFilter )
add_integer( OSD_CFG "x", -1, POSX_TEXT, POSX_LONGTEXT, false )
add_integer( OSD_CFG "y", -1, POSY_TEXT, POSY_LONGTEXT, false )
add_integer( OSD_CFG "position", 8, POS_TEXT, POS_LONGTEXT,
false )
change_integer_list( pi_pos_values, ppsz_pos_descriptions )
add_loadfile( OSD_CFG "file", OSD_DEFAULT_CFG, OSD_FILE_TEXT,
OSD_FILE_LONGTEXT, false )
add_directory( OSD_CFG "file-path", NULL, OSD_PATH_TEXT,
OSD_PATH_LONGTEXT, false )
add_integer( OSD_CFG "timeout", 15, TIMEOUT_TEXT,
TIMEOUT_LONGTEXT, false )
add_integer_with_range( OSD_CFG "update", OSD_UPDATE_DEFAULT,
OSD_UPDATE_MIN, OSD_UPDATE_MAX, OSD_UPDATE_TEXT,
OSD_UPDATE_LONGTEXT, true )
add_integer_with_range( OSD_CFG "alpha", 255, 0, 255,
OSD_ALPHA_TEXT, OSD_ALPHA_LONGTEXT, true )
vlc_module_end ()
/*****************************************************************************
* Sub source code
*****************************************************************************/
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct filter_sys_t
{
int i_position; /* relative positioning of SPU images */
int i_x; /* absolute positioning of SPU images */
int i_y; /* absolute positioning of SPU images */
mtime_t i_last_date; /* last mdate SPU object has been sent to SPU subsytem */
mtime_t i_timeout; /* duration SPU object is valid on the video output in seconds */
bool b_absolute; /* do we use absolute positioning or relative? */
bool b_update; /* Update OSD Menu by sending SPU objects */
bool b_visible; /* OSD Menu is visible */
mtime_t i_update; /* Update the OSD menu every n ms */
mtime_t i_end_date; /* End data of display OSD menu */
int i_alpha; /* alpha transparency value */
char *psz_file; /* OSD Menu configuration file */
char *psz_path; /* Path to OSD Menu pictures */
osd_menu_t *p_menu; /* pointer to OSD Menu object */
/* menu interaction */
bool b_clicked;
uint32_t i_mouse_x;
uint32_t i_mouse_y;
};
/*****************************************************************************
* CreateFilter: Create the filter and open the definition file
*****************************************************************************/
static int CreateFilter ( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = NULL;
p_filter->p_sys = p_sys = (filter_sys_t *) malloc( sizeof(filter_sys_t) );
if( !p_filter->p_sys )
return VLC_ENOMEM;
memset( p_sys, 0, sizeof(filter_sys_t) );
/* Populating struct */
p_sys->psz_path = var_CreateGetString( p_this, OSD_CFG "file-path" );
p_sys->psz_file = var_CreateGetString( p_this, OSD_CFG "file" );
if( (p_sys->psz_file == NULL) ||
(*p_sys->psz_file == '\0') )
{
msg_Err( p_filter, "unable to get filename" );
goto error;
}
p_sys->i_x = var_CreateGetIntegerCommand( p_this, OSD_CFG "x" );
p_sys->i_y = var_CreateGetIntegerCommand( p_this, OSD_CFG "y" );
p_sys->i_position = var_CreateGetIntegerCommand( p_this, OSD_CFG "position" );
p_sys->i_alpha = var_CreateGetIntegerCommand( p_this, OSD_CFG "alpha" );
/* in micro seconds - divide by 2 to match user expectations */
p_sys->i_timeout = var_CreateGetIntegerCommand( p_this, OSD_CFG "timeout" );
p_sys->i_timeout = (mtime_t)(p_sys->i_timeout * 1000000) >> 2;
p_sys->i_update = var_CreateGetIntegerCommand( p_this, OSD_CFG "update" );
p_sys->i_update = (mtime_t)(p_sys->i_update * 1000); /* in micro seconds */
var_AddCallback( p_filter, OSD_CFG "position", OSDMenuCallback, p_sys );
var_AddCallback( p_filter, OSD_CFG "timeout", OSDMenuCallback, p_sys );
var_AddCallback( p_filter, OSD_CFG "update", OSDMenuCallback, p_sys );
var_AddCallback( p_filter, OSD_CFG "alpha", OSDMenuCallback, p_sys );
/* Load the osd menu subsystem */
p_sys->p_menu = osd_MenuCreate( p_this, p_sys->psz_file );
if( p_sys->p_menu == NULL )
goto error;
/* FIXME: this plugin is not at all thread-safe w.r.t. callbacks */
p_sys->p_menu->i_position = p_sys->i_position;
/* Check if menu position was overridden */
p_sys->b_absolute = true;
if( (p_sys->i_x < 0) || (p_sys->i_y < 0) )
{
p_sys->b_absolute = false;
p_sys->p_menu->i_x = 0;
p_sys->p_menu->i_y = 0;
}
else
{
p_sys->p_menu->i_x = p_sys->i_x;
p_sys->p_menu->i_y = p_sys->i_y;
}
/* Set up p_filter */
p_sys->i_last_date = mdate();
/* Keep track of OSD Events */
p_sys->b_update = false;
p_sys->b_visible = false;
p_sys->b_clicked = false;
/* Listen to osd menu core updates/visible settings. */
var_AddCallback( p_sys->p_menu, "osd-menu-update",
OSDMenuUpdateEvent, p_filter );
var_AddCallback( p_sys->p_menu, "osd-menu-visible",
OSDMenuVisibleEvent, p_filter );
/* Attach subpicture source callback */
p_filter->pf_sub_source = Filter;
p_filter->pf_sub_mouse = MouseEvent;
es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_CODEC_SPU );
p_filter->fmt_out.i_priority = 0;
return VLC_SUCCESS;
error:
msg_Err( p_filter, "osdmenu filter discarded" );
free( p_sys->psz_path );
free( p_sys->psz_file );
free( p_sys );
return VLC_EGENERIC;
}
/*****************************************************************************
* DestroyFilter: Make a clean exit of this plugin
*****************************************************************************/
static void DestroyFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
var_DelCallback( p_filter, OSD_CFG "position", OSDMenuCallback, p_sys );
var_DelCallback( p_filter, OSD_CFG "timeout", OSDMenuCallback, p_sys );
var_DelCallback( p_filter, OSD_CFG "update", OSDMenuCallback, p_sys );
var_DelCallback( p_filter, OSD_CFG "alpha", OSDMenuCallback, p_sys );
var_DelCallback( p_sys->p_menu, "osd-menu-update",
OSDMenuUpdateEvent, p_filter );
var_DelCallback( p_sys->p_menu, "osd-menu-visible",
OSDMenuVisibleEvent, p_filter );
var_Destroy( p_this, OSD_CFG "file-path" );
var_Destroy( p_this, OSD_CFG "file" );
var_Destroy( p_this, OSD_CFG "x" );
var_Destroy( p_this, OSD_CFG "y" );
var_Destroy( p_this, OSD_CFG "position" );
var_Destroy( p_this, OSD_CFG "timeout" );
var_Destroy( p_this, OSD_CFG "update" );
var_Destroy( p_this, OSD_CFG "alpha" );
osd_MenuDelete( p_filter, p_sys->p_menu );
free( p_sys->psz_path );
free( p_sys->psz_file );
free( p_sys );
}
/*****************************************************************************
* OSDMenuEvent: callback for OSD Menu events
*****************************************************************************/
static int OSDMenuVisibleEvent( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(oldval);
VLC_UNUSED(newval);
filter_t *p_filter = (filter_t *) p_data;
p_filter->p_sys->b_visible = true;
p_filter->p_sys->b_update = true;
return VLC_SUCCESS;
}
static int OSDMenuUpdateEvent( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(oldval);
VLC_UNUSED(newval);
filter_t *p_filter = (filter_t *) p_data;
filter_sys_t *p_sys = p_filter->p_sys;
p_sys->b_update = p_sys->b_visible ? true : false;
p_sys->i_end_date = (mtime_t) 0;
return VLC_SUCCESS;
}
#if 0
/*****************************************************************************
* create_text_region : compose a text region SPU
*****************************************************************************/
static subpicture_region_t *create_text_region( filter_t *p_filter, subpicture_t *p_spu,
int i_width, int i_height, const char *psz_text )
{
subpicture_region_t *p_region;
video_format_t fmt;
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_sar_num = fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = i_width;
fmt.i_height = fmt.i_visible_height = i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_region = subpicture_region_New( &fmt );
if( !p_region )
{
msg_Err( p_filter, "cannot allocate another SPU region" );
return NULL;
}
p_region->psz_text = strdup( psz_text );
p_region->i_x = 0;
p_region->i_y = 40;
#if 0
msg_Dbg( p_filter, "SPU text region position (%d,%d) (%d,%d) [%s]",
p_region->i_x, p_region->i_y,
p_region->fmt.i_width, p_region->fmt.i_height, p_region->psz_text );
#endif
return p_region;
}
#endif
/*****************************************************************************
* create_picture_region : compose a picture region SPU
*****************************************************************************/
static subpicture_region_t *create_picture_region( filter_t *p_filter, subpicture_t *p_spu,
int i_width, int i_height, picture_t *p_pic )
{
subpicture_region_t *p_region = NULL;
video_format_t fmt;
video_palette_t palette;
if( !p_spu ) return NULL;
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = (p_pic == NULL) ? VLC_CODEC_YUVP : VLC_CODEC_YUVA;
fmt.i_sar_num = fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = i_width;
fmt.i_height = fmt.i_visible_height = i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
if( fmt.i_chroma == VLC_CODEC_YUVP )
{
fmt.p_palette = &palette;
fmt.p_palette->i_entries = 0;
fmt.i_visible_width = 0;
fmt.i_visible_height = 0;
}
p_region = subpicture_region_New( &fmt );
if( !p_region )
{
msg_Err( p_filter, "cannot allocate SPU region" );
p_filter->pf_sub_buffer_del( p_filter, p_spu );
return NULL;
}
/* FIXME the copy is probably not needed anymore */
if( p_pic )
picture_Copy( p_region->p_picture, p_pic );
p_region->i_x = 0;
p_region->i_y = 0;
p_region->i_align = p_filter->p_sys->i_position;
p_region->i_alpha = p_filter->p_sys->i_alpha;
#if 0
msg_Dbg( p_filter, "SPU picture region position (%d,%d) (%d,%d) [%p]",
p_region->i_x, p_region->i_y,
p_region->fmt.i_width, p_region->fmt.i_height, p_pic );
#endif
return p_region;
}
/****************************************************************************
* Filter: the whole thing
****************************************************************************
* This function outputs subpictures at regular time intervals.
****************************************************************************/
static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
{
filter_sys_t *p_sys = p_filter->p_sys;
subpicture_t *p_spu = NULL;
subpicture_region_t *p_region = NULL;
int i_x, i_y;
if( !p_sys->b_update || (p_sys->i_update <= 0) )
return NULL;
/* Am I too early?
*/
if( ( ( p_sys->i_last_date + p_sys->i_update ) > i_date ) &&
( p_sys->i_end_date > 0 ) )
return NULL; /* we are too early, so wait */
/* Allocate the subpicture internal data. */
p_spu = filter_NewSubpicture( p_filter );
if( !p_spu )
return NULL;
p_spu->b_ephemer = true;
p_spu->b_fade = true;
if( p_filter->p_sys->p_menu->i_style == OSD_MENU_STYLE_CONCAT )
p_spu->b_absolute = true;
else
p_spu->b_absolute = p_sys->b_absolute;
/* Determine the duration of the subpicture */
if( p_sys->i_end_date > 0 )
{
/* Display the subpicture again. */
p_spu->i_stop = p_sys->i_end_date - i_date;
if( ( i_date + p_sys->i_update ) >= p_sys->i_end_date )
p_sys->b_update = false;
}
else
{
/* There is a new OSD picture to display */
p_spu->i_stop = i_date + p_sys->i_timeout;
p_sys->i_end_date = p_spu->i_stop;
}
p_spu->i_start = p_sys->i_last_date = i_date;
/* Send an empty subpicture to clear the display
* when OSD menu should be hidden and menu picture is not allocated.
*/
if( !p_filter->p_sys->p_menu->p_state->p_pic ||
!p_filter->p_sys->b_visible )
{
p_spu->i_alpha = 0xFF; /* Picture is completely non transparent. */
return p_spu;
}
if( p_sys->b_clicked )
{
p_sys->b_clicked = false;
osd_MenuActivate( p_filter );
}
/* Create new spu regions
*/
p_region = create_picture_region( p_filter, p_spu,
p_filter->p_sys->p_menu->p_state->i_width,
p_filter->p_sys->p_menu->p_state->i_height,
p_filter->p_sys->p_menu->p_state->p_pic );
if( !p_region )
{
p_filter->pf_sub_buffer_del( p_filter, p_spu );
return NULL;
}
p_spu->i_alpha = p_filter->p_sys->i_alpha;
/* proper positioning of OSD menu image */
if( p_filter->p_sys->p_menu->i_style == OSD_MENU_STYLE_CONCAT )
{
i_x = p_filter->p_sys->p_menu->p_button->i_x;
i_y = p_filter->p_sys->p_menu->p_button->i_y;
}
else
{
i_x = p_filter->p_sys->p_menu->p_state->i_x;
i_y = p_filter->p_sys->p_menu->p_state->i_y;
}
p_region->i_x = i_x;
p_region->i_y = i_y;
if( p_filter->p_sys->p_menu->i_style == OSD_MENU_STYLE_CONCAT )
{
subpicture_region_t *p_region_list = NULL;
subpicture_region_t *p_region_tail = NULL;
osd_menu_t *p_osd = p_filter->p_sys->p_menu;
osd_button_t *p_button = p_osd->p_button;
/* Construct the entire OSD from individual images */
while( p_button != NULL )
{
osd_button_t *p_tmp = NULL;
subpicture_region_t *p_new = NULL;
p_new = create_picture_region( p_filter, p_spu,
p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
p_button->p_current_state->p_pic );
if( !p_new )
{
/* Cleanup when bailing out */
subpicture_region_ChainDelete( p_region_list );
subpicture_region_Delete( p_region );
p_filter->pf_sub_buffer_del( p_filter, p_spu );
return NULL;
}
if( !p_region_list )
{
p_region_list = p_new;
p_region_tail = p_new;
}
else
{
p_new->i_x = i_x+p_region_tail->fmt.i_visible_width;
p_new->i_y = i_y+p_button->i_y;
p_region_tail->p_next = p_new;
p_region_tail = p_new;
}
p_tmp = p_button->p_next;
p_button = p_tmp;
};
p_region->p_next = p_region_list;
}
#if 0
p_region->p_next = create_text_region( p_filter, p_spu,
p_filter->p_sys->p_menu->p_state->i_width, p_filter->p_sys->p_menu->p_state->i_height,
p_filter->p_sys->p_menu->p_state->p_visible->psz_action );
#endif
p_spu->p_region = p_region;
return p_spu;
}
static int OSDMenuCallback( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
{
VLC_UNUSED(p_this); VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *) p_data;
if( !p_sys )
return VLC_SUCCESS;
if( !strcmp( psz_var, OSD_CFG"position") )
{
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
unsigned int i;
for( i=0; i < ARRAY_SIZE(pi_pos_values); i++ )
{
if( newval.i_int == pi_pos_values[i] )
{
p_sys->i_position = newval.i_int % 11;
break;
}
}
#undef ARRAY_SIZE
}
else if( !strcmp( psz_var, OSD_CFG"x") ||
!strcmp( psz_var, OSD_CFG"y"))
{
p_sys->b_absolute = true;
if( (p_sys->i_x < 0) || (p_sys->i_y < 0) )
{
p_sys->b_absolute = false;
p_sys->p_menu->i_x = 0;
p_sys->p_menu->i_y = 0;
}
else if( (p_sys->i_x >= 0) || (p_sys->i_y >= 0) )
{
p_sys->p_menu->i_x = p_sys->i_x;
p_sys->p_menu->i_y = p_sys->i_y;
}
}
else if( !strcmp( psz_var, OSD_CFG"update") )
p_sys->i_update = newval.i_int * INT64_C(1000);
else if( !strcmp( psz_var, OSD_CFG"timeout") )
p_sys->i_update = newval.i_int % 1000;
else if( !strcmp( psz_var, OSD_CFG"alpha") )
p_sys->i_alpha = newval.i_int % 256;
p_sys->b_update = p_sys->b_visible ? true : false;
return VLC_SUCCESS;
}
static int MouseEvent( filter_t *p_filter,
const vlc_mouse_t *p_old,
const vlc_mouse_t *p_new,
const video_format_t *p_fmt )
{
filter_sys_t *p_sys = p_filter->p_sys;
if( !vlc_mouse_HasPressed( p_old, p_new, MOUSE_BUTTON_LEFT ) )
return VLC_SUCCESS;
osd_button_t *p_button = osd_ButtonFind( VLC_OBJECT(p_filter),
p_new->i_x,
p_new->i_y,
p_fmt->i_width,
p_fmt->i_height,
1000, 1000 );
if( !p_button )
return VLC_SUCCESS;
osd_ButtonSelect( VLC_OBJECT(p_filter), p_button );
p_sys->b_update = p_sys->b_visible ? true : false;
p_sys->b_clicked = true;
msg_Dbg( p_filter, "mouse clicked %s (%d,%d)", p_button->psz_name, p_new->i_x, p_new->i_y );
return VLC_SUCCESS;
}
...@@ -947,11 +947,6 @@ modules/misc/inhibit/dbus.c ...@@ -947,11 +947,6 @@ modules/misc/inhibit/dbus.c
modules/misc/inhibit/mce.c modules/misc/inhibit/mce.c
modules/misc/inhibit/xdg.c modules/misc/inhibit/xdg.c
modules/misc/logger.c modules/misc/logger.c
modules/misc/osd/osd_menu.c
modules/misc/osd/osd_menu.h
modules/misc/osd/parser.c
modules/misc/osd/simple.c
modules/misc/osd/xml.c
modules/misc/playlist/export.c modules/misc/playlist/export.c
modules/misc/playlist/html.c modules/misc/playlist/html.c
modules/misc/playlist/m3u.c modules/misc/playlist/m3u.c
...@@ -1116,7 +1111,6 @@ modules/video_filter/motionblur.c ...@@ -1116,7 +1111,6 @@ modules/video_filter/motionblur.c
modules/video_filter/motiondetect.c modules/video_filter/motiondetect.c
modules/video_filter/opencv_example.cpp modules/video_filter/opencv_example.cpp
modules/video_filter/opencv_wrapper.c modules/video_filter/opencv_wrapper.c
modules/video_filter/osdmenu.c
modules/video_filter/panoramix.c modules/video_filter/panoramix.c
modules/video_filter/posterize.c modules/video_filter/posterize.c
modules/video_filter/postproc.c modules/video_filter/postproc.c
......
vlc.desktop vlc.desktop
osdmenu/default.cfg
...@@ -42,29 +42,17 @@ EXTRA_DIST += \ ...@@ -42,29 +42,17 @@ EXTRA_DIST += \
$(DIST_skins2) \ $(DIST_skins2) \
$(DIST_icons) \ $(DIST_icons) \
$(DIST_http_lua) \ $(DIST_http_lua) \
osdmenu/default.cfg.in \
$(DIST_osdmenu_default) \
$(DIST_solid) $(DIST_solid)
CLEANFILES += osdmenu/default.cfg
nobase_vlcdata_DATA = nobase_vlcdata_DATA =
if BUILD_SKINS if BUILD_SKINS
nobase_vlcdata_DATA += skins2/default.vlt nobase_vlcdata_DATA += skins2/default.vlt
nobase_vlcdata_DATA += $(DIST_skins2) nobase_vlcdata_DATA += $(DIST_skins2)
endif endif
if BUILD_OSDMENU
nobase_vlcdata_DATA += \
osdmenu/default.cfg \
$(DIST_osdmenu_default)
endif
if KDE_SOLID if KDE_SOLID
soliddata_DATA = $(DIST_solid) soliddata_DATA = $(DIST_solid)
endif endif
osdmenu/default.cfg: osdmenu/default.cfg.in $(top_builddir)/config.status
$(AM_V_GEN)mkdir -p osdmenu; \
sed -e 's,\@vlcdatadir\@,$(vlcdatadir),g' < "$<" > $@
DIST_icons = \ DIST_icons = \
vlc512x512.png vlc512x512.png
...@@ -93,35 +81,6 @@ skins2/default.vlt: $(skins2_default_vlt_FILES) ...@@ -93,35 +81,6 @@ skins2/default.vlt: $(skins2_default_vlt_FILES)
LC_ALL=C sort -z | \ LC_ALL=C sort -z | \
tar cvv --exclude .svn --no-recursion --null -T -) | \ tar cvv --exclude .svn --no-recursion --null -T -) | \
gzip -n > skins2/default.vlt gzip -n > skins2/default.vlt
DIST_osdmenu_default = \
osdmenu/default/unselected.png \
osdmenu/default/selection/bw.png \
osdmenu/default/selection/esc.png \
osdmenu/default/selection/fw.png \
osdmenu/default/selection/volume.png \
osdmenu/default/selection/next.png \
osdmenu/default/selection/play_pause.png \
osdmenu/default/selection/previous.png \
osdmenu/default/selection/stop.png \
osdmenu/default/selected/bw.png \
osdmenu/default/selected/next.png \
osdmenu/default/selected/play_pause.png \
osdmenu/default/selected/fw.png \
osdmenu/default/selected/stop.png \
osdmenu/default/selected/previous.png \
osdmenu/default/selected/esc.png \
osdmenu/default/selected/volume.png \
osdmenu/default/volume/volume_00.png \
osdmenu/default/volume/volume_01.png \
osdmenu/default/volume/volume_02.png \
osdmenu/default/volume/volume_03.png \
osdmenu/default/volume/volume_04.png \
osdmenu/default/volume/volume_05.png \
osdmenu/default/volume/volume_06.png \
osdmenu/default/volume/volume_07.png \
osdmenu/default/volume/volume_08.png \
osdmenu/default/volume/volume_09.png \
osdmenu/default/volume/volume_10.png
# #
# LUA # LUA
......
dir @vlcdatadir@/osdmenu/default
action key-play-pause (0,0)
unselect unselected.png
select selection/play_pause.png
pressed selected/play_pause.png
end
action key-stop (0,0)
unselect unselected.png
select selection/stop.png
pressed selected/stop.png
end
action key-chapter-prev (0,0)
unselect unselected.png
select selection/previous.png
pressed selected/previous.png
end
action key-jump-medium (0,0)
unselect unselected.png
select selection/bw.png
pressed selected/bw.png
end
action key-jump+medium (0,0)
unselect unselected.png
select selection/fw.png
pressed selected/fw.png
end
action key-chapter-next (0,0)
unselect unselected.png
select selection/next.png
pressed selected/next.png
end
action key-quit (0,0)
unselect unselected.png
select selection/esc.png
pressed selected/esc.png
end
action key-vol-up (0,0)
unselect unselected.png
select selection/volume.png
pressed selected/volume.png
action key-vol-up (480,0)
type volume
range key-vol-down 3
volume/volume_00.png
volume/volume_01.png
volume/volume_02.png
volume/volume_03.png
volume/volume_04.png
volume/volume_05.png
volume/volume_06.png
volume/volume_07.png
volume/volume_08.png
volume/volume_09.png
volume/volume_10.png
end
end
end
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