/*****************************************************************************
* vlcpeer.cpp: scriptable peer descriptor
*****************************************************************************
- * Copyright (C) 2002 VideoLAN
+ * Copyright (C) 2002-2005 the VideoLAN team
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
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()
{
if( p_plugin->i_vlc )
{
- *i_position = VLC_PositionGet( p_plugin->i_vlc );
+ *i_position = (PRInt64)VLC_PositionGet( p_plugin->i_vlc );
}
return NS_OK;
}