# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <vlc_keys.h>
#include <vlc_osd.h>
#include <vlc_image.h>
#undef OSD_MENU_DEBUG
+#if 0
static const char *ppsz_button_states[] = { "unselect", "select", "pressed" };
+#endif
/*****************************************************************************
* Local prototypes
static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * );
static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int );
static int osd_VolumeStep( vlc_object_t *, int, int );
-static vlc_bool_t osd_isVisible( osd_menu_t *p_osd );
+static bool osd_isVisible( osd_menu_t *p_osd );
static osd_menu_t *osd_ParserLoad( vlc_object_t *, const char * );
-static void osd_ParserUnload( vlc_object_t *, osd_menu_t * );
+static void osd_ParserUnload( osd_menu_t * );
-static vlc_bool_t osd_isVisible( osd_menu_t *p_osd )
+static bool osd_isVisible( osd_menu_t *p_osd )
{
vlc_value_t val;
static osd_menu_t *osd_ParserLoad( vlc_object_t *p_this, const char *psz_file )
{
osd_menu_t *p_menu;
+ static const char osdmenu_name[] = "osd menu";
- p_menu = vlc_object_create( p_this, VLC_OBJECT_OSDMENU );
+ p_menu = vlc_custom_create( p_this, sizeof( *p_menu ), VLC_OBJECT_OSDMENU,
+ osdmenu_name );
if( !p_menu )
- {
- msg_Err( p_this, "out of memory" );
return NULL;
- }
- vlc_object_yield( p_menu );
+
vlc_object_attach( p_menu, p_this->p_libvlc );
/* Stuff needed for Parser */
if( !p_menu->p_image || !p_menu->psz_file )
{
msg_Err( p_this, "unable to load images, aborting .." );
- osd_ParserUnload( p_this, p_menu );
+ osd_ParserUnload( p_menu );
return NULL;
}
else
char *psz_ext = strrchr( p_menu->psz_file, '.' );
if( psz_ext && !strcmp( psz_ext, ".cfg") )
- psz_type = "import-osd";
+ psz_type = (char*)"import-osd";
else
- psz_type = "import-osd-xml";
+ psz_type = (char*)"import-osd-xml";
p_menu->p_parser = module_Need( p_menu, "osd parser",
- psz_type, VLC_TRUE );
+ psz_type, true );
if( !p_menu->p_parser )
{
- osd_ParserUnload( p_this, p_menu );
+ osd_ParserUnload( p_menu );
return NULL;
}
}
return p_menu;
}
-static void osd_ParserUnload( vlc_object_t *p_this, osd_menu_t *p_menu )
+static void osd_ParserUnload( osd_menu_t *p_menu )
{
if( p_menu->p_image )
image_HandlerDelete( p_menu->p_image );
module_Unneed( p_menu, p_menu->p_parser );
vlc_object_detach( p_menu );
- vlc_object_destroy( p_menu );
+ vlc_object_release( p_menu );
}
/**
var_Create( p_osd, "osd-menu-update", VLC_VAR_BOOL );
var_Create( p_osd, "osd-menu-visible", VLC_VAR_BOOL );
- val.b_bool = VLC_FALSE;
+ val.b_bool = false;
var_Set( p_osd, "osd-menu-update", val );
var_Set( p_osd, "osd-menu-visible", val );
}
free( p_osd->psz_file );
vlc_object_detach( p_osd );
- vlc_object_destroy( p_osd );
+ vlc_object_release( p_osd );
vlc_mutex_unlock( lockval.p_address );
return NULL;
}
vlc_mutex_lock( lockval.p_address );
vlc_object_release( p_osd );
- if( p_osd->p_internals->i_refcount > 0 )
+ if( vlc_internals( VLC_OBJECT(p_osd) )->i_refcount > 0 )
{
vlc_mutex_unlock( lockval.p_address );
return;
var_Destroy( p_osd, "osd-menu-visible" );
var_Destroy( p_osd, "osd-menu-update" );
- osd_ParserUnload( p_this, p_osd );
+ osd_ParserUnload( p_osd );
p_osd = NULL;
vlc_mutex_unlock( lockval.p_address );
}
p_osd->p_state->p_visible->p_current_state->i_width,
p_osd->p_state->p_visible->p_current_state->i_height,
p_osd->p_state->p_visible->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
}
- osd_SetMenuVisible( p_osd, VLC_TRUE );
+ osd_SetMenuVisible( p_osd, true );
vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address );
osd_UpdateState( p_osd->p_state,
p_osd->p_state->i_x, p_osd->p_state->i_y,
0, 0, NULL );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address );
return;
}
- if( osd_isVisible( p_osd ) == VLC_FALSE )
+ if( osd_isVisible( p_osd ) == false )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
p_osd->p_state->p_visible->p_current_state->i_width,
p_osd->p_state->p_visible->p_current_state->i_height,
p_button->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
- osd_SetMenuVisible( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
+ osd_SetMenuVisible( p_osd, true );
osd_SetKeyPressed( VLC_OBJECT(p_osd->p_libvlc), config_GetInt( p_osd, p_button->psz_action ) );
#if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "select (%d, %s)", config_GetInt( p_osd, p_button->psz_action ), p_button->psz_action );
return;
}
- if( osd_isVisible( p_osd ) == VLC_FALSE )
+ if( osd_isVisible( p_osd ) == false )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
p_osd->p_state->p_visible->p_current_state->i_width,
p_osd->p_state->p_visible->p_current_state->i_height,
p_osd->p_state->p_visible->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
}
#if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "direction right [button %s]", p_osd->p_state->p_visible->psz_action );
return;
}
- if( osd_isVisible( p_osd ) == VLC_FALSE )
+ if( osd_isVisible( p_osd ) == false )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
p_osd->p_state->p_visible->p_current_state->i_width,
p_osd->p_state->p_visible->p_current_state->i_height,
p_osd->p_state->p_visible->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
}
#if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "direction left [button %s]", p_osd->p_state->p_visible->psz_action );
return;
}
- if( osd_isVisible( p_osd ) == VLC_FALSE )
+ if( osd_isVisible( p_osd ) == false )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
p_osd->p_state->p_visible->p_current_state->i_width,
p_osd->p_state->p_visible->p_current_state->i_height,
p_osd->p_state->p_visible->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
/* If this is a range style action with associated images of only one state,
* then perform "menu select" on every menu navigation
*/
return;
}
- if( osd_isVisible( p_osd ) == VLC_FALSE )
+ if( osd_isVisible( p_osd ) == false )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
p_osd->p_state->p_visible->p_current_state->i_width,
p_osd->p_state->p_visible->p_current_state->i_height,
p_osd->p_state->p_visible->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
/* If this is a range style action with associated images of only one state,
* then perform "menu select" on every menu navigation
*/
p_button->p_current_state->i_width,
p_button->p_current_state->i_height,
p_button->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
- osd_SetMenuVisible( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
+ osd_SetMenuVisible( p_osd, true );
}
- vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address );
}
+ vlc_object_release( p_osd );
}
osd_button_t *__osd_ButtonFind( vlc_object_t *p_this, int i_x, int i_y,
return NULL;
}
- if( osd_isVisible( p_osd ) == VLC_FALSE )
+ if( osd_isVisible( p_osd ) == false )
{
- vlc_object_release( (vlc_object_t*) p_osd );
+ vlc_object_release( p_osd );
return NULL;
}
if( ( i_x >= i_x_offset ) && ( i_x <= i_x_offset + i_width ) &&
( i_y >= i_y_offset ) && ( i_y <= i_y_offset + i_height ) )
{
- vlc_object_release( (vlc_object_t*) p_osd );
+ vlc_object_release( p_osd );
vlc_mutex_unlock( lockval.p_address );
return p_button;
}
}
- vlc_object_release( (vlc_object_t*) p_osd );
+ vlc_object_release( p_osd );
vlc_mutex_unlock( lockval.p_address );
return NULL;
}
return;
}
- if( osd_isVisible( p_osd ) == VLC_FALSE )
+ if( osd_isVisible( p_osd ) == false )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
p_osd->p_state->p_visible->p_current_state->i_width,
p_osd->p_state->p_visible->p_current_state->i_height,
p_osd->p_state->p_visible->p_current_state->p_pic );
- osd_SetMenuUpdate( p_osd, VLC_TRUE );
+ osd_SetMenuUpdate( p_osd, true );
}
#if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "button selected is [button %s]", p_osd->p_state->p_visible->psz_action );
#endif
- vlc_object_release( (vlc_object_t*) p_osd );
+ vlc_object_release( p_osd );
vlc_mutex_unlock( lockval.p_address );
}