Commit 2607ed77 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Make the exception about the width and height silent.

parent e03fbc29
......@@ -40,7 +40,7 @@ Exception::~Exception()
delete m_internalPtr;
}
void Exception::setErrorCallback( Exception::errorCallback handler, void* datas )
void Exception::setErrorCallback( Exception::errorCallback handler, void* datas /*= NULL*/ )
{
Exception::m_datas = datas;
Exception::m_errorCallback = handler;
......
......@@ -33,6 +33,8 @@ namespace LibVLCpp
class Exception : public Internal< libvlc_exception_t >
{
public:
typedef void (*errorCallback)( const char* msg, void* data );
Exception();
~Exception();
......@@ -44,10 +46,10 @@ namespace LibVLCpp
static const int Raised = 1;
static const int NotRaised = 0;
//error handling part :
//TODO: have a private error handling in which we could fall back for some specific cases
typedef void (*errorCallback)( const char* msg, void* data );
static void setErrorCallback( errorCallback, void* data );
static void silentExceptionHandler( const char*, void* )
{
}
static void setErrorCallback( errorCallback, void* data = NULL );
private:
static errorCallback m_errorCallback;
......
......@@ -77,9 +77,15 @@ void MetaDataWorker::getMetaData()
m_lengthHasChanged = true;
//In order to wait for the VOUT to be ready:
//Until we have a way of knowing when it is, both getWidth and getHeight method
//will trigger exception... so we shut it up.
LibVLCpp::Exception::setErrorCallback( LibVLCpp::Exception::silentExceptionHandler );
while ( m_mediaPlayer->getWidth() == 0 )
SleepMS( 1 ); //Ugly isn't it :)
LibVLCpp::Exception::setErrorCallback( NULL );
m_currentMedia->setLength( m_mediaPlayer->getLength() );
m_currentMedia->setWidth( m_mediaPlayer->getWidth() );
m_currentMedia->setHeight( m_mediaPlayer->getHeight() );
m_currentMedia->setFps( static_cast<unsigned int>( m_mediaPlayer->getFps() ) );
......
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