[vlc-devel] commit: libvlcpp: fix the compilation and throw an exception if the constructor fail. ( Rémi Duraffort )
git version control
git at videolan.org
Wed Feb 3 12:02:38 CET 2010
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Feb 3 10:13:55 2010 +0100| [b92cb882029d25f4c01d324fcd1f30084e9220e6] | committer: Rémi Duraffort
libvlcpp: fix the compilation and throw an exception if the constructor fail.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b92cb882029d25f4c01d324fcd1f30084e9220e6
---
bindings/libvlcpp/src/media.cpp | 8 ++++----
bindings/libvlcpp/src/media_player.cpp | 5 +++++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/bindings/libvlcpp/src/media.cpp b/bindings/libvlcpp/src/media.cpp
index 800bbd0..9e16652 100644
--- a/bindings/libvlcpp/src/media.cpp
+++ b/bindings/libvlcpp/src/media.cpp
@@ -28,8 +28,9 @@ using namespace libvlc;
Media::Media( libVLC &libvlcInstance, const char *psz_mrl )
{
- Exception ex;
- m_media = libvlc_media_new( libvlcInstance.m_instance, psz_mrl, &ex.ex );
+ m_media = libvlc_media_new( libvlcInstance.m_instance, psz_mrl );
+ if( !m_media )
+ throw libvlc_errmsg();
}
Media::Media( const Media& original )
@@ -54,8 +55,7 @@ void Media::addOption( const char *ppsz_options, libvlc_media_option_t flag )
int64_t Media::duration()
{
- Exception ex;
- return libvlc_media_get_duration( m_media, &ex.ex );
+ return libvlc_media_get_duration( m_media );
}
int Media::isPreparsed()
diff --git a/bindings/libvlcpp/src/media_player.cpp b/bindings/libvlcpp/src/media_player.cpp
index 420c4ac..e9f66d6 100644
--- a/bindings/libvlcpp/src/media_player.cpp
+++ b/bindings/libvlcpp/src/media_player.cpp
@@ -28,6 +28,8 @@ using namespace libvlc;
MediaPlayer::MediaPlayer( libVLC &libvlcInstance )
{
m_player = libvlc_media_player_new( libvlcInstance.m_instance );
+ if( !m_player )
+ throw libvlc_errmsg();
m_audio.setMediaPlayer( m_player );
m_video.setMediaPlayer( m_player );
}
@@ -35,7 +37,10 @@ MediaPlayer::MediaPlayer( libVLC &libvlcInstance )
MediaPlayer::MediaPlayer( Media &media )
{
m_player = libvlc_media_player_new_from_media( media.m_media );
+ if( !m_player )
+ throw libvlc_errmsg();
m_audio.setMediaPlayer( m_player );
+ m_video.setMediaPlayer( m_player );
}
MediaPlayer::~MediaPlayer()
More information about the vlc-devel
mailing list