Commit 0fe1eea2 authored by Clément Stenac's avatar Clément Stenac

* Add hooks for getting/setting variables (not working yet)

* Really change VLC_Get to VLC_VariableGet
parent e04b8850
......@@ -16,6 +16,15 @@ interface VlcIntf : nsISupports
PRInt64 get_volume();
void mute();
/* Get/Set variable */
void set_int_variable( in string psz_var, in PRInt64 i_value );
void set_bool_variable( in string psz_var, in PRBool b_value );
void set_str_variable( in string psz_var, in string psz_value );
PRInt64 get_int_variable( in string psz_var );
PRBool get_bool_variable( in string psz_var );
string get_str_variable( in string psz_var );
/* Playlist management */
void clear_playlist();
void add_item( in string psz_name);
......
......@@ -128,6 +128,82 @@ NS_IMETHODIMP VlcPeer::Fullscreen()
return NS_OK;
}
/* Set/Get vlc variables */
NS_IMETHODIMP VlcPeer::Set_int_variable(const char *psz_var, PRInt64 value )
{
vlc_value_t val;
val.i_int = value;
if( p_plugin )
{
VLC_VariableSet( p_plugin->i_vlc, psz_var, val );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Set_str_variable(const char *psz_var, const char *value )
{
vlc_value_t val;
val.psz_string = strdup( value );
if( p_plugin )
{
VLC_VariableSet( p_plugin->i_vlc, psz_var, val );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Set_bool_variable(const char *psz_var, PRBool value )
{
vlc_value_t val;
val.b_bool = value >= 1 ? VLC_TRUE : VLC_FALSE;
if( p_plugin )
{
VLC_VariableSet( p_plugin->i_vlc, psz_var, val );
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Get_int_variable( const char *psz_var, PRInt64 *result )
{
vlc_value_t val;
if( p_plugin )
{
fprintf(stderr, "Choppage de %s\n", psz_var );
VLC_VariableGet( p_plugin->i_vlc, psz_var, &val );
fprintf(stderr, "Valeur %i\n", val.i_int );
*result = (PRInt64)val.i_int;
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Get_bool_variable( const char *psz_var,PRBool *result )
{
vlc_value_t val;
if( p_plugin )
{
VLC_VariableGet( p_plugin->i_vlc, psz_var, &val );
*result = (PRBool)val.b_bool;
}
return NS_OK;
}
NS_IMETHODIMP VlcPeer::Get_str_variable( const char *psz_var, char **result )
{
vlc_value_t val;
if( p_plugin )
{
fprintf(stderr, "Choppage de %s\n", psz_var );
VLC_VariableGet( p_plugin->i_vlc, psz_var, &val );
if( val.psz_string )
{
*result = strdup( val.psz_string );
}
else
{
*result = strdup( "" );
}
}
return NS_OK;
}
/* Playlist control */
NS_IMETHODIMP VlcPeer::Clear_playlist()
......
......@@ -2,7 +2,7 @@
* vlcpeer.h: scriptable peer descriptor
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcpeer.h,v 1.3 2003/04/09 16:18:36 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......
......@@ -2,7 +2,7 @@
* vlcplugin.cpp: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcplugin.cpp,v 1.6 2003/10/23 17:04:39 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......
......@@ -2,7 +2,7 @@
* vlcplugin.h: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcplugin.h,v 1.13 2003/10/23 17:04:40 sam Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......
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