MediaLibrary.hpp 2.27 KB
Newer Older
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
1
/*****************************************************************************
2
 * MediaLibrary.hpp: MediaLibrary API
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
3
 *****************************************************************************
4
 * Copyright © 2015 libvlcpp authors & VideoLAN
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
5
 *
6
 * Authors: Alexey Sokolov <alexey+vlc@asokolov.org>
7
 *          Hugo Beauzée-Luyssen <hugo@beauzee.fr>
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * 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.
 *****************************************************************************/

#ifndef LIBVLC_CXX_MEDIALIBRARY_H
#define LIBVLC_CXX_MEDIALIBRARY_H

27
#include "common.hpp"
28
#include "Internal.hpp"
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
29

30
namespace VLC
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
31 32
{

33
class MediaLibrary : public Internal<libvlc_media_library_t>
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
34 35
{
public:
36 37 38
    /**
     * Create an new Media Library object
     *
39
     * \param instance  the libvlc instance
40
     */
41 42 43
    MediaLibrary(Instance& instance)
        : Internal{ libvlc_media_library_new( getInternalPtr<libvlc_instance_t>( instance ) ),
                    libvlc_media_library_release }
44 45
    {
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
46

47 48 49 50 51 52 53
    /**
     * Create an empty VLC MediaLibrary instance.
     *
     * Calling any method on such an instance is undefined.
    */
    MediaLibrary() = default;

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
54 55 56 57 58
    /**
     * Check if 2 MediaLibrary objects contain the same libvlc_media_library_t.
     * \param another another MediaLibrary
     * \return true if they contain the same libvlc_media_library_t
     */
59 60 61 62
    bool operator==(const MediaLibrary& another) const
    {
        return m_obj == another.m_obj;
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
63 64 65 66

    /**
     * Load media library.
     */
67
    bool load()
68
    {
69
        return libvlc_media_library_load(*this) == 0;
70
    }
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
71 72 73 74 75 76
};

} // namespace VLC

#endif