-int vlclua_volume_get( lua_State *L )
-{
- vlc_object_t *p_this = vlclua_get_this( L );
- audio_volume_t i_volume;
- if( aout_VolumeGet( p_this, &i_volume ) == VLC_SUCCESS )
- lua_pushnumber( L, i_volume );
- else
- lua_pushnil( L );
- return 1;
-}
-
-int vlclua_volume_up( lua_State *L )
-{
- audio_volume_t i_volume;
- aout_VolumeUp( vlclua_get_this( L ),
- luaL_optint( L, 1, 1 ),
- &i_volume );
- lua_pushnumber( L, i_volume );
- return 1;
-}
-
-int vlclua_volume_down( lua_State *L )
-{
- audio_volume_t i_volume;
- aout_VolumeDown( vlclua_get_this( L ),
- luaL_optint( L, 1, 1 ),
- &i_volume );
- lua_pushnumber( L, i_volume );
- return 1;
-}
-
-/*****************************************************************************
- * Stream handling
- *****************************************************************************/
-int vlclua_stream_new( lua_State *L )
-{
- vlc_object_t * p_this = vlclua_get_this( L );
- stream_t * p_stream;
- const char * psz_url;
- psz_url = luaL_checkstring( L, -1 );
- p_stream = stream_UrlNew( p_this, psz_url );
- if( !p_stream )
- return luaL_error( L, "Error when opening url: `%s'", psz_url );
- lua_pushlightuserdata( L, p_stream );
- return 1;
-}
-
-int vlclua_stream_read( lua_State *L )
-{
- stream_t * p_stream;
- int n;
- uint8_t *p_read;
- int i_read;
- p_stream = (stream_t *)luaL_checklightuserdata( L, 1 );
- n = luaL_checkint( L, 2 );
- p_read = malloc( n );
- if( !p_read ) return vlclua_error( L );
- i_read = stream_Read( p_stream, p_read, n );
- lua_pushlstring( L, (const char *)p_read, i_read );
- free( p_read );
- return 1;
-}
-
-int vlclua_stream_readline( lua_State *L )
-{
- stream_t * p_stream;
- p_stream = (stream_t *)luaL_checklightuserdata( L, 1 );
- char *psz_line = stream_ReadLine( p_stream );
- if( psz_line )
- {
- lua_pushstring( L, psz_line );
- free( psz_line );
- }
- else
- lua_pushnil( L );
- return 1;
-}
-
-int vlclua_stream_delete( lua_State *L )
-{
- stream_t * p_stream;
- p_stream = (stream_t *)luaL_checklightuserdata( L, 1 );
- stream_Delete( p_stream );
- return 0;
-}
-
-/*****************************************************************************
- * String transformations
- *****************************************************************************/
-int vlclua_decode_uri( lua_State *L )
-{
- int i_top = lua_gettop( L );
- int i;
- for( i = 1; i <= i_top; i++ )
- {
- const char *psz_cstring = luaL_checkstring( L, 1 );
- char *psz_string = strdup( psz_cstring );
- lua_remove( L, 1 ); /* remove elements to prevent being limited by
- * the stack's size (this function will work with
- * up to (stack size - 1) arguments */
- decode_URI( psz_string );
- lua_pushstring( L, psz_string );
- free( psz_string );
- }
- return i_top;
-}
-
-int vlclua_resolve_xml_special_chars( lua_State *L )
-{
- int i_top = lua_gettop( L );
- int i;
- for( i = 1; i <= i_top; i++ )
- {
- const char *psz_cstring = luaL_checkstring( L, 1 );
- char *psz_string = strdup( psz_cstring );
- lua_remove( L, 1 ); /* remove elements to prevent being limited by
- * the stack's size (this function will work with
- * up to (stack size - 1) arguments */
- resolve_xml_special_chars( psz_string );
- lua_pushstring( L, psz_string );
- free( psz_string );
- }
- return i_top;
-}
-
-int vlclua_convert_xml_special_chars( lua_State *L )
-{
- int i_top = lua_gettop( L );
- int i;
- for( i = 1; i <= i_top; i++ )
- {
- char *psz_string = convert_xml_special_chars( luaL_checkstring(L,1) );
- lua_remove( L, 1 );
- lua_pushstring( L, psz_string );
- free( psz_string );
- }
- return i_top;
-}
-
-/*****************************************************************************
- * Messaging facilities
- *****************************************************************************/
-int vlclua_msg_dbg( lua_State *L )
-{
- int i_top = lua_gettop( L );
- vlc_object_t *p_this = vlclua_get_this( L );
- int i;
- for( i = 1; i <= i_top; i++ )
- msg_Dbg( p_this, "%s", luaL_checkstring( L, 1 ) );
- return 0;
-}
-int vlclua_msg_warn( lua_State *L )
-{
- int i_top = lua_gettop( L );
- vlc_object_t *p_this = vlclua_get_this( L );
- int i;
- for( i = 1; i <= i_top; i++ )
- msg_Warn( p_this, "%s", luaL_checkstring( L, i ) );
- return 0;
-}
-int vlclua_msg_err( lua_State *L )
-{
- int i_top = lua_gettop( L );
- vlc_object_t *p_this = vlclua_get_this( L );
- int i;
- for( i = 1; i <= i_top; i++ )
- msg_Err( p_this, "%s", luaL_checkstring( L, i ) );
- return 0;
-}
-int vlclua_msg_info( lua_State *L )
-{
- int i_top = lua_gettop( L );
- vlc_object_t *p_this = vlclua_get_this( L );
- int i;
- for( i = 1; i <= i_top; i++ )
- msg_Info( p_this, "%s", luaL_checkstring( L, i ) );
- return 0;
-}