vlc_player.h 1.97 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*****************************************************************************
 * Copyright  2002-2011 VideoLAN and VLC authors
 * $Id$
 *
 * Authors: Sergey Radionov <rsatom_gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#pragma once

24
#include <vlcpp/vlc.hpp>
25 26 27 28 29 30 31 32 33 34 35 36 37

enum vlc_player_action_e
{
    pa_play,
    pa_pause,
    pa_stop,
    pa_next,
    pa_prev
};

class vlc_player
{
public:
38
    bool open(VLC::Instance& inst);
39 40 41

    int add_item(const char * mrl, unsigned int optc, const char **optv);
    int add_item(const char * mrl)
42
        { return add_item( mrl, 0, nullptr ); }
43 44 45 46 47 48 49 50

    int  current_item();
    int  items_count();
    bool delete_item(unsigned int idx);
    void clear_items();

    void play();

51
    VLC::MediaPlayer& get_mp()
52 53 54 55 56 57 58 59
    {
        return _mp;
    }

    VLC::MediaListPlayer& mlp()
    {
        return _ml_p;
    }
60

61 62 63 64 65 66 67 68
    int currentAudioTrack();
    int currentSubtitleTrack();

private:
    // Returns a 0-based track index, instead of the internal libvlc one
    int getTrack( int currentId, const std::vector<VLC::TrackDescription>& tracks );


69
private:
70 71 72 73
    VLC::Instance           _libvlc_instance;
    VLC::MediaPlayer        _mp;
    VLC::MediaList          _ml;
    VLC::MediaListPlayer    _ml_p;
74
};