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

Wrap libvlc's raw type into an internal class

parent 2f0dee1e
......@@ -28,12 +28,12 @@
#define LIBVLC_CXX_INSTANCE_H
#include <libvlc_common.hpp>
#include "libvlcpp.hpp"
namespace VLC
{
class Instance
class Instance : public Internal<libvlc_instance_t>
{
public:
/**
......@@ -295,9 +295,6 @@ private:
* reference count is 1 after Instance::Instance() returns.
*/
void retain();
libvlc_instance_t* m_obj;
};
} // namespace VLC
......
......@@ -28,12 +28,13 @@
#define LIBVLC_CXX_MEDIA_H
#include <libvlc_common.hpp>
#include "libvlcpp.hpp"
namespace VLC
{
class Media
class Media : public Internal<libvlc_media_t>
{
public:
/**
......@@ -358,9 +359,6 @@ private:
* not be used again.
*/
void release();
libvlc_media_t* m_obj;
};
} // namespace VLC
......
......@@ -28,12 +28,13 @@
#define LIBVLC_CXX_MEDIADISCOVERER_H
#include <libvlc_common.hpp>
#include "libvlcpp.hpp"
namespace VLC
{
class MediaDiscoverer
class MediaDiscoverer : public Internal<libvlc_media_discoverer_t>
{
public:
/**
......@@ -96,8 +97,6 @@ private:
MediaDiscoverer& operator=(const MediaDiscoverer& another);
MediaDiscoverer(const MediaDiscoverer& another);
bool operator==(const MediaDiscoverer& another);
libvlc_media_discoverer_t* m_obj;
};
} // namespace VLC
......
......@@ -28,12 +28,13 @@
#define LIBVLC_CXX_MEDIALIBRARY_H
#include <libvlc_common.hpp>
#include "libvlcpp.hpp"
namespace VLC
{
class MediaLibrary
class MediaLibrary : public Internal<libvlc_media_library_t>
{
public:
/**
......@@ -87,9 +88,6 @@ private:
* MediaLibrary::release() to decrement the reference count.
*/
void retain();
libvlc_media_library_t* m_obj;
};
} // namespace VLC
......
......@@ -28,12 +28,13 @@
#define LIBVLC_CXX_MEDIALIST_H
#include <libvlc_common.hpp>
#include "libvlcpp.hpp"
namespace VLC
{
class MediaList
class MediaList : public Internal<libvlc_media_list_t>
{
public:
/**
......@@ -202,9 +203,6 @@ private:
* Retain reference to a media list
*/
void retain();
libvlc_media_list_t* m_obj;
};
} // namespace VLC
......
......@@ -28,12 +28,13 @@
#define LIBVLC_CXX_MEDIALISTPLAYER_H
#include <libvlc_common.hpp>
#include "libvlcpp.hpp"
namespace VLC
{
class MediaListPlayer
class MediaListPlayer : public Internal<libvlc_media_list_player_t>
{
public:
/**
......@@ -170,9 +171,6 @@ private:
* MediaListPlayer::release() to decrement reference count.
*/
void retain();
libvlc_media_list_player_t* m_obj;
};
} // namespace VLC
......
......@@ -28,12 +28,13 @@
#define LIBVLC_CXX_MEDIAPLAYER_H
#include <libvlc_common.hpp>
#include "libvlcpp.hpp"
namespace VLC
{
class MediaPlayer
class MediaPlayer : public Internal<libvlc_media_player_t>
{
public:
/**
......@@ -1218,9 +1219,6 @@ private:
* MediaPlayer::release() to decrement reference count.
*/
void retain();
libvlc_media_player_t* m_obj;
};
} // namespace VLC
......
/*****************************************************************************
* libvlcpp.hpp: Handles an internal vlc type.
*****************************************************************************
* Copyright (C) 2008-2014 VideoLAN
*
* Authors: 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 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLCPP_H
#define VLCPP_H
#include <cassert>
#include <stdlib.h>
#include <vlc/libvlc.h>
namespace VLC
{
template < typename T >
class Internal
{
public:
typedef T* internalPtr;
T* getInternalPtr()
{
assert( m_obj != NULL );
return m_obj;
}
operator T*() { return m_obj; }
protected:
Internal() : m_obj( NULL ) {}
Internal(T* obj) : m_obj( obj ) {}
~Internal(){}
T* m_obj;
};
}
#endif // VLCPP_H
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