cmd_input.cpp 2.81 KB
Newer Older
1 2 3
/*****************************************************************************
 * cmd_input.cpp
 *****************************************************************************
4
 * Copyright (C) 2003 the VideoLAN team
Olivier Teulière's avatar
Olivier Teulière committed
5
 * $Id$
6 7
 *
 * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8
 *          Olivier Teulière <ipkiss@via.ecp.fr>
9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
Antoine Cellerier's avatar
Antoine Cellerier committed
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 24
 *****************************************************************************/

Olivier Teulière's avatar
Olivier Teulière committed
25
#include <vlc/aout.h>
26
#include "cmd_input.hpp"
27
#include "cmd_dialogs.hpp"
28 29


30 31 32 33 34 35 36 37
void CmdPlay::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist == NULL )
    {
        return;
    }

38 39 40 41 42 43 44 45 46 47
    if( pPlaylist->i_size )
    {
        playlist_Play( pPlaylist );
    }
    else
    {
        // If the playlist is empty, open a file requester instead
        CmdDlgFile cmd( getIntf() );
        cmd.execute();
    }
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
}


void CmdPause::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist == NULL )
    {
        return;
    }

    playlist_Pause( pPlaylist );
}


63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
void CmdStop::execute()
{
    playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
    if( pPlaylist == NULL )
    {
        return;
    }

    playlist_Stop( pPlaylist );
}


void CmdSlower::execute()
{
    input_thread_t *pInput =
        (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
                                           FIND_ANYWHERE );
    if( pInput )
    {
        vlc_value_t val;
        val.b_bool = VLC_TRUE;

        var_Set( pInput, "rate-slower", val );
        vlc_object_release( pInput );
    }
}


void CmdFaster::execute()
{
    input_thread_t *pInput =
        (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
                                           FIND_ANYWHERE );
    if( pInput )
    {
        vlc_value_t val;
        val.b_bool = VLC_TRUE;

        var_Set( pInput, "rate-faster", val );
        vlc_object_release( pInput );
    }
}

Olivier Teulière's avatar
Olivier Teulière committed
106 107 108 109 110 111

void CmdMute::execute()
{
    aout_VolumeMute( getIntf(), NULL );
}

112 113 114 115 116 117 118 119 120 121 122 123

void CmdVolumeUp::execute()
{
    aout_VolumeUp( getIntf(), 1, NULL );
}


void CmdVolumeDown::execute()
{
    aout_VolumeDown( getIntf(), 1, NULL );
}