Commit 45e30edc authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Rework MediaLibrary construction

parent 928b6e05
......@@ -4,6 +4,7 @@
* Copyright © 2014 the VideoLAN team
*
* Authors: Alexey Sokolov <alexey@alexeysokolov.co.cc>
* Hugo Beauzée-Luyssen <hugo@beauzee.fr>
*
* 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
......@@ -20,14 +21,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/* This file is autogenerated */
#include <vlc.hpp>
namespace VLC {
MediaLibrary::MediaLibrary(const MediaLibrary& another)
MediaLibrary*MediaLibrary::create(Instance& instance)
{
InternalPtr ptr = libvlc_media_library_new( instance );
if ( ptr == NULL )
return NULL;
return new MediaLibrary(ptr);
}
MediaLibrary::MediaLibrary(const MediaLibrary& another)
{
m_obj = another.m_obj;
retain();
......@@ -55,16 +61,6 @@ MediaLibrary::~MediaLibrary()
release();
}
MediaLibrary::MediaLibrary(Instance & p_instance)
{
m_obj = libvlc_media_library_new(p_instance.get_c_object());
if (!m_obj)
{
throw Exception("Can't construct MediaLibrary");
}
}
int MediaLibrary::load()
{
int c_result = libvlc_media_library_load(m_obj);
......@@ -72,6 +68,11 @@ int MediaLibrary::load()
return result;
}
MediaLibrary::MediaLibrary(Internal::InternalPtr ptr)
: Internal( ptr )
{
}
void MediaLibrary::release()
{
libvlc_media_library_release(m_obj);
......
......@@ -37,6 +37,12 @@ namespace VLC
class MediaLibrary : public Internal<libvlc_media_library_t>
{
public:
/**
* Create an new Media Library object
*
* \param p_instance the libvlc instance
*/
static MediaLibrary* create(Instance & p_instance);
/**
* Copy libvlc_media_library_t from another to new MediaLibrary object.
* \param another existing MediaLibrary
......@@ -59,14 +65,6 @@ public:
~MediaLibrary();
// libvlc_media_library_new
/**
* Create an new Media Library object
*
* \param p_instance the libvlc instance
*/
MediaLibrary(Instance & p_instance);
/**
* Load media library.
*
......@@ -75,6 +73,7 @@ public:
int load();
private:
MediaLibrary(InternalPtr ptr);
/**
* Release media library object. This functions decrements the reference
* count of the media library object. If it reaches 0, then the object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment