Commit e78e3889 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Completely removed LibVLCpp::Exception

As they're no longer used in libvlc.
parent 48d1a8ae
......@@ -75,7 +75,6 @@ SET(VLMC_SRCS
Gui/wizard/VideoPage.cpp
Gui/wizard/WelcomePage.cpp
Library/Library.cpp
LibVLCpp/VLCException.cpp
LibVLCpp/VLCInstance.cpp
LibVLCpp/VLCMedia.cpp
LibVLCpp/VLCMediaPlayer.cpp
......
/*****************************************************************************
* VLCException.cpp: Binding for libvlc_exception
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* 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.
*****************************************************************************/
#include <QtDebug>
#include "vlc/vlc.h"
#include "VLCException.h"
using namespace LibVLCpp;
Exception::errorCallback Exception::m_errorCallback = NULL;
void* Exception::m_datas = NULL;
Exception::Exception()
{
m_internalPtr = new libvlc_exception_t;
libvlc_exception_init( m_internalPtr );
}
Exception::~Exception()
{
clear();
delete m_internalPtr;
}
void Exception::setErrorCallback( Exception::errorCallback handler, void* datas /*= NULL*/ )
{
Exception::m_datas = datas;
Exception::m_errorCallback = handler;
}
const char* Exception::getErrorText() const
{
return libvlc_errmsg();
// return libvlc_exception_get_message( m_internalPtr );
}
void Exception::clear()
{
libvlc_exception_clear( m_internalPtr );
}
int Exception::raised() const
{
return libvlc_exception_raised( m_internalPtr );
}
void Exception::checkThrow( const char* file, int line, const char* funcName )
{
if ( raised() == Exception::Raised )
{
if ( Exception::m_errorCallback != NULL )
Exception::m_errorCallback( getErrorText(), Exception::m_datas );
else
qWarning() << "A VLC exception was raised in" << file << ":" << line << '(' << funcName << "):" << getErrorText() << "\"";
clear();
}
}
/*****************************************************************************
* VLCException.h: Binding for libvlc_exception
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* 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 VLCEXCEPTION_H
#define VLCEXCEPTION_H
#include "VLCpp.hpp"
struct libvlc_exception_t;
#define CheckVlcppException(ex) (ex.checkThrow(__FILE__, __LINE__, __func__))
namespace LibVLCpp
{
class Exception : public Internal< libvlc_exception_t >
{
public:
typedef void (*errorCallback)( const char* msg, void* data );
Exception();
~Exception();
const char* getErrorText() const;
void clear();
int raised() const;
void checkThrow( const char* file, int line, const char* funcName );
static const int Raised = 1;
static const int NotRaised = 0;
static void silentExceptionHandler( const char*, void* )
{
}
static void setErrorCallback( errorCallback, void* data = NULL );
private:
static errorCallback m_errorCallback;
static void* m_datas;
};
}
#endif // VLCEXCEPTION_H
......@@ -42,7 +42,6 @@ Instance::Instance()
int argc = sizeof( argv ) / sizeof( *argv );
m_internalPtr = libvlc_new( argc, argv );
CheckVlcppException(m_ex);
}
Instance::~Instance()
......
......@@ -24,7 +24,6 @@
#define VLCINSTANCE_H
#include "VLCpp.hpp"
#include "VLCException.h"
#include "Singleton.hpp"
struct libvlc_instance_t;
......@@ -41,7 +40,6 @@ namespace LibVLCpp
~Instance();
private:
Exception m_ex;
friend class Singleton<Instance>;
};
}
......
......@@ -31,8 +31,6 @@ using namespace LibVLCpp;
MediaPlayer::MediaPlayer() : m_media( NULL )
{
m_internalPtr = libvlc_media_player_new( LibVLCpp::Instance::getInstance()->getInternalPtr() );
CheckVlcppException( m_ex );
// Initialize the event manager
p_em = libvlc_media_player_event_manager( m_internalPtr );
registerEvents();
......@@ -41,7 +39,6 @@ MediaPlayer::MediaPlayer() : m_media( NULL )
MediaPlayer::MediaPlayer( Media* media ) : m_media( media )
{
m_internalPtr = libvlc_media_player_new_from_media( media->getInternalPtr() );
CheckVlcppException( m_ex );
// Initialize the event manager
p_em = libvlc_media_player_event_manager( m_internalPtr );
......@@ -76,7 +73,6 @@ MediaPlayer::registerEvents()
libvlc_event_attach( p_em, libvlc_MediaPlayerEncounteredError,callbacks, this );
libvlc_event_attach( p_em, libvlc_MediaPlayerPausableChanged, callbacks, this );
libvlc_event_attach( p_em, libvlc_MediaPlayerSeekableChanged, callbacks, this );
CheckVlcppException( m_ex );
}
/**
......@@ -158,7 +154,6 @@ void MediaPlayer::stop()
qint64 MediaPlayer::getTime()
{
qint64 t = libvlc_media_player_get_time( m_internalPtr );
CheckVlcppException( m_ex );
return t;
}
......
......@@ -31,8 +31,6 @@ struct libvlc_media_player_t;
struct libvlc_event_t;
struct libvlc_event_manager_t;
#include "VLCException.h"
namespace LibVLCpp
{
class Media;
......@@ -70,7 +68,6 @@ namespace LibVLCpp
static void callbacks( const libvlc_event_t* event, void* self );
void registerEvents();
Exception m_ex;
libvlc_event_manager_t* p_em;
Media* m_media;
......
......@@ -110,12 +110,10 @@ MetaDataWorker::metaDataAvailable()
//will trigger exception... so we shut it up.
if ( m_media->getFileType() != Media::Audio )
{
LibVLCpp::Exception::setErrorCallback( LibVLCpp::Exception::silentExceptionHandler );
while ( m_mediaPlayer->hasVout() == false )
{
SleepMS( 1 ); //Ugly isn't it :)
}
LibVLCpp::Exception::setErrorCallback( NULL );
quint32 width, height;
m_mediaPlayer->getSize( &width, &height );
......
......@@ -231,7 +231,7 @@ void WorkflowRenderer::nextFrame()
void WorkflowRenderer::previousFrame()
{
if ( m_paused == true )
m_mainWorkflow->previousFrame( MainWorkflow::VideoTrack );
m_mainWorkflow->previousFrame( MainWorkflow::VideoTrack );
}
void WorkflowRenderer::togglePlayPause( bool forcePause )
......
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