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

Use smart pointers only when necessary

parent a79d424e
...@@ -19,22 +19,15 @@ include(cpp11) ...@@ -19,22 +19,15 @@ include(cpp11)
add_definitions("-Wall -Wextra -pedantic") add_definitions("-Wall -Wextra -pedantic")
EnableCpp11() EnableCpp11()
file(GLOB LIBVLCPP_HEADERS "${CMAKE_SOURCE_DIR}/src/*.hpp")
add_executable(${PROJECT_NAME} add_executable(${PROJECT_NAME}
test/main.cpp test/main.cpp
${LIBVLCPP_HEADERS}
) )
include_directories("${CMAKE_SOURCE_DIR}/src/") include_directories("${CMAKE_SOURCE_DIR}/src/")
file(GLOB LIBVLCPP_PUBLIC_HEADERS "${CMAKE_SOURCE_DIR}/src/*.hpp")
set_target_properties(${PROJECT_NAME} PROPERTIES
PUBLIC_HEADER "${LIBVLCPP_PUBLIC_HEADERS}"
)
find_package(LIBVLC REQUIRED) find_package(LIBVLC REQUIRED)
target_link_libraries( ${PROJECT_NAME} ${LIBVLC_LIBRARY} ${LIBVLCCORE_LIBRARY} ) target_link_libraries( ${PROJECT_NAME} ${LIBVLC_LIBRARY} ${LIBVLCCORE_LIBRARY} )
include_directories(${LIBVLC_INCLUDE_DIR}) include_directories(${LIBVLC_INCLUDE_DIR})
file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}")
set(CONF_INCLUDE_DIRS "\${LIBVLCPP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
...@@ -135,7 +135,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t> ...@@ -135,7 +135,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t>
return false; return false;
if ( type < libvlc_MediaMetaChanged || type > libvlc_MediaSubItemTreeAdded ) if ( type < libvlc_MediaMetaChanged || type > libvlc_MediaSubItemTreeAdded )
return false; return false;
libvlc_event_attach( get(), type, &handleMediaEvent, cb ); libvlc_event_attach( *this,type, &handleMediaEvent, cb );
return true; return true;
} }
...@@ -145,7 +145,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t> ...@@ -145,7 +145,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t>
return false; return false;
if ( type < libvlc_MediaPlayerMediaChanged || type > libvlc_MediaPlayerESSelected ) if ( type < libvlc_MediaPlayerMediaChanged || type > libvlc_MediaPlayerESSelected )
return false; return false;
libvlc_event_attach( get(), type, &handleMediaPlayerEvent, cb ); libvlc_event_attach( *this,type, &handleMediaPlayerEvent, cb );
return true; return true;
} }
...@@ -155,7 +155,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t> ...@@ -155,7 +155,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t>
return false; return false;
if ( type < libvlc_MediaListItemAdded || type > libvlc_MediaListWillDeleteItem ) if ( type < libvlc_MediaListItemAdded || type > libvlc_MediaListWillDeleteItem )
return false; return false;
libvlc_event_attach( get(), type, &handleMediaListEvent, cb ); libvlc_event_attach( *this,type, &handleMediaListEvent, cb );
return true; return true;
} }
...@@ -165,7 +165,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t> ...@@ -165,7 +165,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t>
return false; return false;
if ( type < libvlc_MediaListPlayerPlayed || type > libvlc_MediaListPlayerStopped ) if ( type < libvlc_MediaListPlayerPlayed || type > libvlc_MediaListPlayerStopped )
return false; return false;
libvlc_event_attach( get(), type, &handleMediaListPlayerEvent, cb ); libvlc_event_attach( *this,type, &handleMediaListPlayerEvent, cb );
return true; return true;
} }
...@@ -175,7 +175,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t> ...@@ -175,7 +175,7 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t>
return false; return false;
if ( type < libvlc_MediaDiscovererStarted || type > libvlc_MediaDiscovererEnded ) if ( type < libvlc_MediaDiscovererStarted || type > libvlc_MediaDiscovererEnded )
return false; return false;
libvlc_event_attach( get(), type, &handleMediaDiscovererEvent, cb ); libvlc_event_attach( *this,type, &handleMediaDiscovererEvent, cb );
return true; return true;
} }
...@@ -185,38 +185,38 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t> ...@@ -185,38 +185,38 @@ class VLCPP_API EventManager : public Internal<libvlc_event_manager_t>
return false; return false;
if ( type < libvlc_VlmMediaAdded || type > libvlc_VlmMediaInstanceStatusError ) if ( type < libvlc_VlmMediaAdded || type > libvlc_VlmMediaInstanceStatusError )
return false; return false;
libvlc_event_attach( get(), type, &handleVLMEvent, cb ); libvlc_event_attach( *this,type, &handleVLMEvent, cb );
return true; return true;
} }
void detach( libvlc_event_type_t type, IMediaEventCb* cb ) void detach( libvlc_event_type_t type, IMediaEventCb* cb )
{ {
libvlc_event_detach( get(), type, &handleMediaEvent, cb ); libvlc_event_detach( *this,type, &handleMediaEvent, cb );
} }
void detach( libvlc_event_type_t type, IMediaPlayerEventCb* cb ) void detach( libvlc_event_type_t type, IMediaPlayerEventCb* cb )
{ {
libvlc_event_detach( get(), type, &handleMediaPlayerEvent, cb ); libvlc_event_detach( *this,type, &handleMediaPlayerEvent, cb );
} }
void detach( libvlc_event_type_t type, IMediaListEventCb* cb ) void detach( libvlc_event_type_t type, IMediaListEventCb* cb )
{ {
libvlc_event_detach( get(), type, &handleMediaListEvent, cb ); libvlc_event_detach( *this,type, &handleMediaListEvent, cb );
} }
void detach( libvlc_event_type_t type, IMediaListPlayerEventCb* cb ) void detach( libvlc_event_type_t type, IMediaListPlayerEventCb* cb )
{ {
libvlc_event_detach( get(), type, &handleMediaListPlayerEvent, cb ); libvlc_event_detach( *this,type, &handleMediaListPlayerEvent, cb );
} }
void detach( libvlc_event_type_t type, IMediaDiscovererEventCb* cb ) void detach( libvlc_event_type_t type, IMediaDiscovererEventCb* cb )
{ {
libvlc_event_detach( get(), type, &handleMediaDiscovererEvent, cb ); libvlc_event_detach( *this,type, &handleMediaDiscovererEvent, cb );
} }
void detach( libvlc_event_type_t type, IVLMEventCb* cb ) void detach( libvlc_event_type_t type, IVLMEventCb* cb )
{ {
libvlc_event_detach( get(), type, &handleVLMEvent, cb ); libvlc_event_detach( *this,type, &handleVLMEvent, cb );
} }
private: private:
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
*/ */
int addIntf(const std::string& name) int addIntf(const std::string& name)
{ {
return libvlc_add_intf( get(), name.c_str() ); return libvlc_add_intf( *this, name.c_str() );
} }
/** /**
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
*/ */
void setExitHandler(void(*cb)(void *), void * opaque) void setExitHandler(void(*cb)(void *), void * opaque)
{ {
libvlc_set_exit_handler( get(), cb, opaque ); libvlc_set_exit_handler( *this, cb, opaque );
} }
/** /**
...@@ -124,7 +124,7 @@ public: ...@@ -124,7 +124,7 @@ public:
*/ */
void setUserAgent(const std::string& name, const std::string& http) void setUserAgent(const std::string& name, const std::string& http)
{ {
libvlc_set_user_agent( get(), name.c_str(), http.c_str() ); libvlc_set_user_agent( *this, name.c_str(), http.c_str() );
} }
/** /**
...@@ -141,7 +141,7 @@ public: ...@@ -141,7 +141,7 @@ public:
*/ */
void setAppId(const std::string& id, const std::string& version, const std::string& icon) void setAppId(const std::string& id, const std::string& version, const std::string& icon)
{ {
libvlc_set_app_id( get(), id.c_str(), version.c_str(), icon.c_str() ); libvlc_set_app_id( *this, id.c_str(), version.c_str(), icon.c_str() );
} }
/** /**
...@@ -155,7 +155,7 @@ public: ...@@ -155,7 +155,7 @@ public:
*/ */
void logUnset() void logUnset()
{ {
libvlc_log_unset( get() ); libvlc_log_unset( *this );
} }
/** /**
...@@ -178,7 +178,7 @@ public: ...@@ -178,7 +178,7 @@ public:
*/ */
void logSet(libvlc_log_cb cb, void * data) void logSet(libvlc_log_cb cb, void * data)
{ {
libvlc_log_set(get(), cb, data); libvlc_log_set(*this, cb, data);
} }
/** /**
...@@ -191,7 +191,7 @@ public: ...@@ -191,7 +191,7 @@ public:
*/ */
void logSetFile(FILE * stream) void logSetFile(FILE * stream)
{ {
libvlc_log_set_file( get(), stream ); libvlc_log_set_file( *this, stream );
} }
/** /**
...@@ -207,7 +207,7 @@ public: ...@@ -207,7 +207,7 @@ public:
*/ */
std::vector<ModuleDescription> audioFilterList() std::vector<ModuleDescription> audioFilterList()
{ {
libvlc_module_description_t* result = libvlc_audio_filter_list_get(get()); libvlc_module_description_t* result = libvlc_audio_filter_list_get(*this);
std::vector<ModuleDescription> res; std::vector<ModuleDescription> res;
if ( result == NULL ) if ( result == NULL )
return res; return res;
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
*/ */
std::vector<ModuleDescription> videoFilterList() std::vector<ModuleDescription> videoFilterList()
{ {
libvlc_module_description_t* result = libvlc_video_filter_list_get(get()); libvlc_module_description_t* result = libvlc_video_filter_list_get(*this);
std::vector<ModuleDescription> res; std::vector<ModuleDescription> res;
if ( result == NULL ) if ( result == NULL )
return res; return res;
...@@ -260,7 +260,7 @@ public: ...@@ -260,7 +260,7 @@ public:
*/ */
std::vector<AudioOutputDescription> audioOutputList() std::vector<AudioOutputDescription> audioOutputList()
{ {
libvlc_audio_output_t* result = libvlc_audio_output_list_get(get()); libvlc_audio_output_t* result = libvlc_audio_output_list_get(*this);
std::vector<AudioOutputDescription> res; std::vector<AudioOutputDescription> res;
if ( result == NULL ) if ( result == NULL )
return res; return res;
...@@ -298,7 +298,7 @@ public: ...@@ -298,7 +298,7 @@ public:
*/ */
std::vector<AudioOutputDeviceDescription> audioOutputDeviceList(const std::string& aout) std::vector<AudioOutputDeviceDescription> audioOutputDeviceList(const std::string& aout)
{ {
libvlc_audio_output_device_t* devices = libvlc_audio_output_device_list_get( get(), aout.c_str() ); libvlc_audio_output_device_t* devices = libvlc_audio_output_device_list_get( *this, aout.c_str() );
std::vector<AudioOutputDeviceDescription> res; std::vector<AudioOutputDeviceDescription> res;
if ( devices == NULL ) if ( devices == NULL )
return res; return res;
......
...@@ -38,17 +38,24 @@ class Internal ...@@ -38,17 +38,24 @@ class Internal
public: public:
using InternalType = T; using InternalType = T;
using InternalPtr = T*; using InternalPtr = T*;
using Pointer = std::unique_ptr<T, Releaser>; using Pointer = std::shared_ptr<T>;
InternalPtr get() const { return m_obj.get(); }
InternalPtr get() { return m_obj.get(); }
bool isValid() const { return (bool)m_obj; } bool isValid() const { return (bool)m_obj; }
operator T*() const { return m_obj.get(); }
protected: protected:
Internal() = default;
Internal( InternalPtr obj, Releaser releaser ) Internal( InternalPtr obj, Releaser releaser )
: m_obj{ obj, releaser } : m_obj{ obj, releaser }
{ {
if ( obj == nullptr ) if ( obj == nullptr )
throw std::runtime_error("Wrapping a NULL instance"); throw std::runtime_error("Wrapping a NULL instance");
} }
Internal(Releaser releaser) Internal(Releaser releaser)
: m_obj{ nullptr, releaser } : m_obj{ nullptr, releaser }
{ {
......
...@@ -34,6 +34,8 @@ namespace VLC ...@@ -34,6 +34,8 @@ namespace VLC
class MediaPlayer; class MediaPlayer;
class EventManager; class EventManager;
class Instance;
class MediaList;
class VLCPP_API Media : public Internal<libvlc_media_t> class VLCPP_API Media : public Internal<libvlc_media_t>
{ {
...@@ -67,27 +69,27 @@ public: ...@@ -67,27 +69,27 @@ public:
* @param mrl A path, location, or node name, depending on the 3rd parameter * @param mrl A path, location, or node name, depending on the 3rd parameter
* @param type The type of the 2nd argument. \sa{FromType} * @param type The type of the 2nd argument. \sa{FromType}
*/ */
Media(InstancePtr instance, const std::string& mrl, FromType type) Media(Instance& instance, const std::string& mrl, FromType type)
: Internal{ libvlc_media_release } : Internal{ libvlc_media_release }
{ {
InternalPtr ptr = nullptr; InternalPtr ptr = nullptr;
switch (type) switch (type)
{ {
case FromLocation: case FromLocation:
ptr = libvlc_media_new_location( instance->get(), mrl.c_str() ); ptr = libvlc_media_new_location( getInternalPtr<libvlc_instance_t>( instance ), mrl.c_str() );
break; break;
case FromPath: case FromPath:
ptr = libvlc_media_new_path( instance->get(), mrl.c_str() ); ptr = libvlc_media_new_path( getInternalPtr<libvlc_instance_t>( instance ), mrl.c_str() );
break; break;
case AsNode: case AsNode:
ptr = libvlc_media_new_as_node( instance->get(), mrl.c_str() ); ptr = libvlc_media_new_as_node( getInternalPtr<libvlc_instance_t>( instance ), mrl.c_str() );
break; break;
default: default:
break; break;
} }
if ( ptr == nullptr ) if ( ptr == nullptr )
throw std::runtime_error("Failed to construct a media"); throw std::runtime_error("Failed to construct a media");
m_obj.reset( ptr ); m_obj.reset( ptr, libvlc_media_release );
} }
/** /**
...@@ -110,8 +112,9 @@ public: ...@@ -110,8 +112,9 @@ public:
* \param fd open file descriptor * \param fd open file descriptor
* \return the newly created media or NULL on error * \return the newly created media or NULL on error
*/ */
Media(InstancePtr instance, int fd) Media(Instance& instance, int fd)
: Internal { libvlc_media_new_fd( instance->get(), fd ), libvlc_media_release } : Internal { libvlc_media_new_fd( getInternalPtr<libvlc_instance_t>( instance ), fd ),
libvlc_media_release }
{ {
} }
...@@ -123,13 +126,13 @@ public: ...@@ -123,13 +126,13 @@ public:
* \param p_ml a media list instance * \param p_ml a media list instance
* \return media instance * \return media instance
*/ */
Media(MediaListPtr list) Media(MediaList& list)
: Internal{ libvlc_media_list_media( getInternalPtr<libvlc_media_list_t>( list ) ), : Internal{ libvlc_media_list_media( getInternalPtr<libvlc_media_list_t>( list ) ),
libvlc_media_release } libvlc_media_release }
{ {
} }
explicit Media(Internal::InternalPtr ptr, bool incrementRefCount) explicit Media( Internal::InternalPtr ptr, bool incrementRefCount)
: Internal{ ptr, libvlc_media_release } : Internal{ ptr, libvlc_media_release }
{ {
if (incrementRefCount) if (incrementRefCount)
...@@ -166,7 +169,7 @@ public: ...@@ -166,7 +169,7 @@ public:
*/ */
void addOption(const std::string& psz_options) void addOption(const std::string& psz_options)
{ {
libvlc_media_add_option(get(), psz_options.c_str()); libvlc_media_add_option(*this,psz_options.c_str());
} }
/** /**
...@@ -188,7 +191,7 @@ public: ...@@ -188,7 +191,7 @@ public:
*/ */
void addOptionFlag(const std::string& psz_options, unsigned i_flags) void addOptionFlag(const std::string& psz_options, unsigned i_flags)
{ {
libvlc_media_add_option_flag(get(), psz_options.c_str(), i_flags); libvlc_media_add_option_flag(*this,psz_options.c_str(), i_flags);
} }
/** /**
...@@ -198,7 +201,7 @@ public: ...@@ -198,7 +201,7 @@ public:
*/ */
std::string mrl() std::string mrl()
{ {
char* c_result = libvlc_media_get_mrl(get()); char* c_result = libvlc_media_get_mrl(*this);
if ( c_result == NULL ) if ( c_result == NULL )
return std::string(); return std::string();
std::string result = c_result; std::string result = c_result;
...@@ -211,7 +214,7 @@ public: ...@@ -211,7 +214,7 @@ public:
*/ */
MediaPtr duplicate() MediaPtr duplicate()
{ {
InternalPtr obj = libvlc_media_duplicate(get()); auto obj = libvlc_media_duplicate(*this);
return std::make_shared<Media>( obj, false ); return std::make_shared<Media>( obj, false );
} }
...@@ -237,7 +240,7 @@ public: ...@@ -237,7 +240,7 @@ public:
*/ */
std::string meta(libvlc_meta_t e_meta) std::string meta(libvlc_meta_t e_meta)
{ {
char* c_result = libvlc_media_get_meta(get(), e_meta); char* c_result = libvlc_media_get_meta(*this, e_meta);
if ( c_result == NULL ) if ( c_result == NULL )
return std::string(); return std::string();
std::string result = c_result; std::string result = c_result;
...@@ -255,7 +258,7 @@ public: ...@@ -255,7 +258,7 @@ public:
*/ */
void setMeta(libvlc_meta_t e_meta, const std::string& psz_value) void setMeta(libvlc_meta_t e_meta, const std::string& psz_value)
{ {
libvlc_media_set_meta(get(), e_meta, psz_value.c_str()); libvlc_media_set_meta(*this, e_meta, psz_value.c_str());
} }
...@@ -266,7 +269,7 @@ public: ...@@ -266,7 +269,7 @@ public:
*/ */
int saveMeta() int saveMeta()
{ {
return libvlc_media_save_meta(get()); return libvlc_media_save_meta(*this);
} }
/** /**
...@@ -281,7 +284,7 @@ public: ...@@ -281,7 +284,7 @@ public:
*/ */
libvlc_state_t state() libvlc_state_t state()
{ {
return libvlc_media_get_state(get()); return libvlc_media_get_state(*this);
} }
/** /**
...@@ -294,7 +297,7 @@ public: ...@@ -294,7 +297,7 @@ public:
*/ */
bool stats(libvlc_media_stats_t * p_stats) bool stats(libvlc_media_stats_t * p_stats)
{ {
return libvlc_media_get_stats(get(), p_stats); return libvlc_media_get_stats(*this,p_stats);
} }
/** /**
...@@ -307,7 +310,7 @@ public: ...@@ -307,7 +310,7 @@ public:
{ {
if ( m_eventManager == NULL ) if ( m_eventManager == NULL )
{ {
libvlc_event_manager_t* obj = libvlc_media_event_manager(get()); libvlc_event_manager_t* obj = libvlc_media_event_manager(*this);
m_eventManager = std::make_shared<EventManager>( obj ); m_eventManager = std::make_shared<EventManager>( obj );
} }
return m_eventManager; return m_eventManager;
...@@ -320,7 +323,7 @@ public: ...@@ -320,7 +323,7 @@ public:
*/ */
libvlc_time_t duration() libvlc_time_t duration()
{ {
return libvlc_media_get_duration(get()); return libvlc_media_get_duration(*this);
} }
/** /**
...@@ -337,7 +340,7 @@ public: ...@@ -337,7 +340,7 @@ public:
*/ */
void parse() void parse()
{ {
libvlc_media_parse(get()); libvlc_media_parse(*this);
} }
/** /**
...@@ -360,7 +363,7 @@ public: ...@@ -360,7 +363,7 @@ public:
*/ */
void parseAsync() void parseAsync()
{ {
libvlc_media_parse_async(get()); libvlc_media_parse_async(*this);
} }
/** /**
...@@ -373,7 +376,7 @@ public: ...@@ -373,7 +376,7 @@ public:
*/ */
bool isParsed() bool isParsed()
{ {
return libvlc_media_is_parsed(get()); return libvlc_media_is_parsed(*this);
} }
/** /**
...@@ -385,7 +388,7 @@ public: ...@@ -385,7 +388,7 @@ public:
*/ */
void setUserData(void * p_new_user_data) void setUserData(void * p_new_user_data)
{ {
libvlc_media_set_user_data(get(), p_new_user_data); libvlc_media_set_user_data(*this, p_new_user_data);
} }
/** /**
...@@ -395,7 +398,7 @@ public: ...@@ -395,7 +398,7 @@ public:
*/ */
void* userData() void* userData()
{ {
return libvlc_media_get_user_data(get()); return libvlc_media_get_user_data(*this);
} }
/** /**
...@@ -412,7 +415,7 @@ public: ...@@ -412,7 +415,7 @@ public:
std::vector<MediaTrack> tracks() std::vector<MediaTrack> tracks()
{ {
libvlc_media_track_t** tracks; libvlc_media_track_t** tracks;
uint32_t nbTracks = libvlc_media_tracks_get(get(), &tracks); uint32_t nbTracks = libvlc_media_tracks_get(*this, &tracks);
std::vector<MediaTrack> res; std::vector<MediaTrack> res;
if ( nbTracks == 0 ) if ( nbTracks == 0 )
...@@ -434,7 +437,7 @@ private: ...@@ -434,7 +437,7 @@ private:
void retain() void retain()
{ {
if ( isValid() ) if ( isValid() )
libvlc_media_retain(get()); libvlc_media_retain(*this);
} }
......
...@@ -32,6 +32,7 @@ namespace VLC ...@@ -32,6 +32,7 @@ namespace VLC
{ {
class EventManager; class EventManager;
class Instance;
class VLCPP_API MediaDiscoverer : public Internal<libvlc_media_discoverer_t> class VLCPP_API MediaDiscoverer : public Internal<libvlc_media_discoverer_t>
{ {
...@@ -46,8 +47,8 @@ public: ...@@ -46,8 +47,8 @@ public:
* \warning This is returned as a pointer, as this is not refcounter by VLC, and is * \warning This is returned as a pointer, as this is not refcounter by VLC, and is
* fairly expensive to instantiate. * fairly expensive to instantiate.
*/ */
MediaDiscoverer(InstancePtr inst, const std::string& name) MediaDiscoverer(Instance& inst, const std::string& name)
: Internal{ libvlc_media_discoverer_new_from_name(inst->get(), name.c_str()), : Internal{ libvlc_media_discoverer_new_from_name(getInternalPtr<libvlc_instance_t>( inst ), name.c_str()),
libvlc_media_discoverer_release } libvlc_media_discoverer_release }
{ {
} }
...@@ -59,7 +60,7 @@ public: ...@@ -59,7 +60,7 @@ public:
*/ */
std::string localizedName() std::string localizedName()
{ {
char* c_result = libvlc_media_discoverer_localized_name(get()); char* c_result = libvlc_media_discoverer_localized_name(*this);
if ( c_result == NULL ) if ( c_result == NULL )
return std::string(); return std::string();
std::string result = c_result; std::string result = c_result;
...@@ -76,7 +77,7 @@ public: ...@@ -76,7 +77,7 @@ public:
{ {
if ( m_eventManager ) if ( m_eventManager )
{ {
libvlc_event_manager_t* obj = libvlc_media_discoverer_event_manager( get() ); libvlc_event_manager_t* obj = libvlc_media_discoverer_event_manager( *this );
m_eventManager = std::make_shared<EventManager>( obj ); m_eventManager = std::make_shared<EventManager>( obj );
} }
return m_eventManager; return m_eventManager;
...@@ -89,7 +90,7 @@ public: ...@@ -89,7 +90,7 @@ public:
*/ */
bool isRunning() bool isRunning()
{ {
return libvlc_media_discoverer_is_running(get()); return libvlc_media_discoverer_is_running(*this);
} }