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
!insertmacro InstallFolder plugins
!insertmacro InstallFolder locale
!insertmacro InstallFolder sdk
@BUILD_OSDMENU_TRUE@ !insertmacro InstallFolder osdmenu
@BUILD_SKINS_TRUE@ !insertmacro InstallFolder skins
@BUILD_LUA_TRUE@ !insertmacro InstallFolder lua
......
......@@ -54,14 +54,6 @@ if BUILD_SKINS
cp -r $(prefix)/share/vlc/skins2 $(win32_destdir)/skins
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/installed/lib/axvlc.dll" "$(win32_destdir)/"
cp "$(top_builddir)/npapi-vlc/npapi/package/npvlc.dll.manifest" "$(win32_destdir)/"
......
......@@ -232,8 +232,6 @@ $Id$
* opensles_android: OpenSL ES audio output for Android
* opus: a opus audio decoder/packetizer using the libopus library
* 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
* packetizer_copy: Simple copy packetizer
* packetizer_dirac: Dirac video packetizer
......
......@@ -21,14 +21,6 @@ endif
EXTRA_LTLIBRARIES += libgnutls_plugin.la
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_CFLAGS = $(AM_CFLAGS)
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 );
}