Commit 6b8cd1df authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Remove exceptions usage from Instance

parent 3388694d
......@@ -57,21 +57,12 @@ Instance::~Instance()
}
Instance::Instance() {
m_obj = libvlc_new(0, NULL);
if (!m_obj) {
throw Exception();
}
}
Instance::Instance(int argc, const char *const * argv)
Instance* Instance::create(int argc, const char *const * argv)
{
m_obj = libvlc_new(argc, argv);
if (!m_obj)
{
throw Exception("Can't construct Instance");
}
InternalPtr ptr = libvlc_new(argc, argv);
if ( ptr == NULL )
return NULL;
return new Instance(ptr);
}
int Instance::addIntf(const std::string& name)
......@@ -166,6 +157,11 @@ libvlc_audio_output_device_t * Instance::audioOutputDeviceList(const std::string
return result;
}
Instance::Instance(Internal::InternalPtr ptr)
: Internal( ptr )
{
}
void Instance::release()
{
libvlc_release(m_obj);
......
......@@ -58,13 +58,6 @@ public:
~Instance();
// overriden_libvlc_new
/**
* Create and initialize a libvlc instance.
*/
Instance();
// libvlc_new
/**
* Create and initialize a libvlc instance. This functions accept a list
* of "command line" arguments similar to the main(). These arguments
......@@ -87,7 +80,7 @@ public:
*
* \param argv list of arguments (should be NULL)
*/
Instance(int argc, const char *const * argv);
static Instance* create(int argc, const char *const * argv);
/**
* Try to start a user interface for the libvlc instance.
......@@ -284,6 +277,7 @@ public:
libvlc_audio_output_device_t * audioOutputDeviceList(const std::string& aout);
private:
Instance(InternalPtr ptr);
/**
* Decrement the reference count of a libvlc instance, and destroy it if
* it reaches zero.
......
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