コード例 #1
0
ファイル: volume.c プロジェクト: CSRedRat/vlc
static int vlclua_volume_get( lua_State *L )
{
    playlist_t *p_this = vlclua_get_playlist_internal( L );
    audio_volume_t i_volume = aout_VolumeGet( p_this );
    lua_pushnumber( L, i_volume );
    return 1;
}
コード例 #2
0
static int vlclua_sd_remove( lua_State *L )
{
    const char *psz_sd = luaL_checkstring( L, 1 );
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    int i_ret = playlist_ServicesDiscoveryRemove( p_playlist, psz_sd );
    return vlclua_push_ret( L, i_ret );
}
コード例 #3
0
ファイル: volume.c プロジェクト: CSRedRat/vlc
/*****************************************************************************
 * Volume related
 *****************************************************************************/
static int vlclua_volume_set( lua_State *L )
{
    playlist_t *p_this = vlclua_get_playlist_internal( L );
    int i_volume = VLC_CLIP( luaL_checkint( L, 1 ), 0, AOUT_VOLUME_MAX );
    int i_ret = aout_VolumeSet( p_this, i_volume );
    return vlclua_push_ret( L, i_ret );
}
コード例 #4
0
static int vlclua_sd_is_loaded( lua_State *L )
{
    const char *psz_sd = luaL_checkstring( L, 1 );
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    lua_pushboolean( L, playlist_IsServicesDiscoveryLoaded( p_playlist, psz_sd ));
    return 1;
}
コード例 #5
0
/****************************************************************************
* Enable/disable Equalizer
*****************************************************************************/
static int vlclua_equalizer_enable ( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    bool state = luaL_checkboolean ( L , 1 );
    aout_EnableFilter( p_playlist, "equalizer", state );
    return 0;
}
コード例 #6
0
static int vlclua_playlist_skip( lua_State * L )
{
    int i_skip = luaL_checkint( L, 1 );
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    playlist_Skip( p_playlist, i_skip );
    return 0;
}
コード例 #7
0
static int vlclua_playlist_clear( lua_State * L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    playlist_Stop( p_playlist ); /* Isn't this already implied by Clear? */
    playlist_Clear( p_playlist, pl_Unlocked );
    return 0;
}
コード例 #8
0
ファイル: volume.c プロジェクト: CSRedRat/vlc
static int vlclua_volume_down( lua_State *L )
{
    audio_volume_t i_volume;
    playlist_t *p_this = vlclua_get_playlist_internal( L );
    aout_VolumeDown( p_this, luaL_optint( L, 1, 1 ), &i_volume );
    lua_pushnumber( L, i_volume );
    return 1;
}
コード例 #9
0
ファイル: playlist.c プロジェクト: CSRedRat/vlc
static int vlclua_playlist_delete( lua_State * L )
{
    int i_id = luaL_checkint( L, 1 );
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    PL_LOCK;
    int i_ret = playlist_DeleteFromInput(p_playlist, playlist_ItemGetById( p_playlist, i_id ) -> p_input, true );
    PL_UNLOCK;
    return vlclua_push_ret( L, i_ret );
}
コード例 #10
0
static int vlclua_playlist_search( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    const char *psz_string = luaL_optstring( L, 1, "" );
    PL_LOCK;
    playlist_LiveSearchUpdate( p_playlist, p_playlist->p_root, psz_string, true );
    PL_UNLOCK;
    push_playlist_item( L, p_playlist->p_root );
    return 1;
}
コード例 #11
0
ファイル: playlist.c プロジェクト: moto-timo/vlc
static int vlclua_playlist_gotoitem( lua_State * L )
{
    int i_id = luaL_checkinteger( L, 1 );
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    PL_LOCK;
    playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL,
                      playlist_ItemGetById( p_playlist, i_id ) );
    PL_UNLOCK;
    return vlclua_push_ret( L, VLC_SUCCESS );
}
コード例 #12
0
static int vlclua_playlist_enqueue( lua_State *L )
{
    int i_count;
    vlc_object_t *p_this = vlclua_get_this( L );
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
                                            NULL, false );
    lua_pushinteger( L, i_count );
    return 1;
}
コード例 #13
0
ファイル: volume.c プロジェクト: banketree/faplayer
static int vlclua_volume_get( lua_State *L )
{
    playlist_t *p_this = vlclua_get_playlist_internal( 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;
}
コード例 #14
0
ファイル: objects.c プロジェクト: iamnpc/myfaplayer
static int vlclua_get_playlist( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    if( p_playlist )
    {
        vlclua_push_vlc_object( L, p_playlist, vlclua_gc_release );
        vlc_object_hold( p_playlist );
    }
    else lua_pushnil( L );
    return 1;
}
コード例 #15
0
static int vlclua_playlist_sort( lua_State *L )
{
    /* allow setting the different sort keys */
    int i_mode = vlc_sort_key_from_string( luaL_checkstring( L, 1 ) );
    if( i_mode == -1 )
        return luaL_error( L, "Invalid search key." );
    int i_type = luaL_optboolean( L, 2, 0 ) ? ORDER_REVERSE : ORDER_NORMAL;
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    PL_LOCK;
    int i_ret = playlist_RecursiveNodeSort( p_playlist, p_playlist->p_playing,
                                            i_mode, i_type );
    PL_UNLOCK;
    return vlclua_push_ret( L, i_ret );
}
コード例 #16
0
ファイル: objects.c プロジェクト: BossKing/vlc
static int vlclua_get_aout( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    if( p_playlist != NULL )
    {
        audio_output_t *p_aout = playlist_GetAout( p_playlist );
        if( p_aout != NULL )
        {
            vlclua_push_vlc_object( L, (vlc_object_t *)p_aout );
            return 1;
        }
    }
    lua_pushnil( L );
    return 1;
}
コード例 #17
0
input_thread_t * vlclua_get_input_internal( lua_State *L )
{
    extension_t *p_extension = vlclua_extension_get( L );
    if( p_extension )
    {
        input_thread_t *p_input = p_extension->p_sys->p_input;
        if( p_input )
        {
            vlc_object_hold(p_input);
            return p_input;
        }
    }
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
    return p_input;
}
コード例 #18
0
static int vlclua_playlist_get( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    PL_LOCK;
    playlist_item_t *p_item = NULL;

    if( lua_isnumber( L, 1 ) )
    {
        int i_id = lua_tointeger( L, 1 );
        p_item = playlist_ItemGetById( p_playlist, i_id );
        if( !p_item )
        {
            PL_UNLOCK;
            return 0; /* Should we return an error instead? */
        }
    }
    else if( lua_isstring( L, 1 ) )
    {
        const char *psz_what = lua_tostring( L, 1 );
        if( !strcasecmp( psz_what, "normal" )
         || !strcasecmp( psz_what, "playlist" ) )
            p_item = p_playlist->p_playing;
        else if( !strcasecmp( psz_what, "ml" )
              || !strcasecmp( psz_what, "media library" ) )
            p_item = p_playlist->p_media_library;
        else if( !strcasecmp( psz_what, "root" ) )
            p_item = p_playlist->p_root;
        else
        {
            /* currently, psz_what must be SD module's longname! */
            p_item = playlist_ChildSearchName( p_playlist->p_root, psz_what );

            if( !p_item )
            {
                PL_UNLOCK;
                return 0; /* Should we return an error instead? */
            }
        }
    }
    else
    {
        p_item = p_playlist->p_root;
    }
    push_playlist_item( L, p_item );
    PL_UNLOCK;
    return 1;
}
コード例 #19
0
static int vlclua_playlist_current( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
    int id = -1;

    if( p_input )
    {
        input_item_t *p_item = input_GetItem( p_input );
        if( p_item )
            id = p_item->i_id;
        vlc_object_release( p_input );
    }

#warning Indexing input items by ID is unsafe,
    lua_pushinteger( L, id );
    return 1;
}
コード例 #20
0
ファイル: playlist.c プロジェクト: AsamQi/vlc
static int vlclua_playlist_move( lua_State * L )
{
    int i_item = luaL_checkint( L, 1 );
    int i_target = luaL_checkint( L, 2 );
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    PL_LOCK;
    playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_item );
    playlist_item_t *p_target = playlist_ItemGetById( p_playlist, i_target );
    if( !p_item || !p_target )
    {
       PL_UNLOCK;
       return vlclua_push_ret( L, -1 );
    }
    int i_ret;
    if( p_target->i_children != -1 )
        i_ret = playlist_TreeMove( p_playlist, p_item, p_target, 0 );
    else
    	i_ret = playlist_TreeMove( p_playlist, p_item, p_target->p_parent, p_target->i_id - p_target->p_parent->pp_children[0]->i_id + 1 );
    PL_UNLOCK;
    return vlclua_push_ret( L, i_ret );
}
コード例 #21
0
static int vlclua_playlist_status( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    PL_LOCK;
    switch( playlist_Status( p_playlist ) )
    {
        case PLAYLIST_STOPPED:
            lua_pushliteral( L, "stopped" );
            break;
        case PLAYLIST_RUNNING:
            lua_pushliteral( L, "playing" );
            break;
        case PLAYLIST_PAUSED:
            lua_pushliteral( L, "paused" );
            break;
        default:
            lua_pushliteral( L, "unknown" );
            break;
    }
    PL_UNLOCK;
    return 1;
}
コード例 #22
0
static int vlclua_sd_get_services_names( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    char **ppsz_longnames;
    char **ppsz_names = vlc_sd_GetNames( p_playlist, &ppsz_longnames, NULL );
    if( !ppsz_names )
        return 0;

    char **ppsz_longname = ppsz_longnames;
    char **ppsz_name = ppsz_names;
    lua_settop( L, 0 );
    lua_newtable( L );
    for( ; *ppsz_name; ppsz_name++,ppsz_longname++ )
    {
        lua_pushstring( L, *ppsz_longname );
        lua_setfield( L, -2, *ppsz_name );
        free( *ppsz_name );
        free( *ppsz_longname );
    }
    free( ppsz_names );
    free( ppsz_longnames );
    return 1;
}
コード例 #23
0
static int vlclua_playlist_random( lua_State * L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "random" );
    return i_ret;
}
コード例 #24
0
static int vlclua_playlist_stop( lua_State * L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    playlist_Stop( p_playlist );
    return 0;
}
コード例 #25
0
static int vlclua_playlist_pause( lua_State * L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    playlist_Pause( p_playlist );
    return 0;
}
コード例 #26
0
static int vlclua_playlist_next( lua_State * L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    playlist_Next( p_playlist );
    return 0;
}