From 42d7760501bc690f00a327a3f83c93cbbbc4df9c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 21 May 2012 18:49:09 +0000 Subject: [PATCH] - removed some invalid event attachments for libvlc --- .../sources/graphics/video_player.cpp | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/source/shared_lib/sources/graphics/video_player.cpp b/source/shared_lib/sources/graphics/video_player.cpp index ce2ba739a..523f7d830 100644 --- a/source/shared_lib/sources/graphics/video_player.cpp +++ b/source/shared_lib/sources/graphics/video_player.cpp @@ -669,14 +669,31 @@ bool VideoPlayer::initPlayer() { //libvlc_event_attach( eventManager, libvlc_MediaPlayerVout, callbacks, ctxPtr ); //libvlc_event_attach( eventManager, libvlc_MediaListPlayerPlayed, callbacks, ctxPtr ); - libvlc_event_attach( eventManager, libvlc_MediaListPlayerNextItemSet, callbacks, ctxPtr ); + int event_added = libvlc_event_attach( eventManager, libvlc_MediaListPlayerNextItemSet, callbacks, ctxPtr ); + if(event_added != 0) { + printf("ERROR CANNOT ADD EVENT [libvlc_MediaListPlayerNextItemSet]\n"); + } //libvlc_event_attach( eventManager, libvlc_MediaListPlayerStopped, callbacks, ctxPtr ); - libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusPlaying, callbacks, ctxPtr ); - libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusPause, callbacks, ctxPtr ); - libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusEnd, callbacks, ctxPtr ); - libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusError, callbacks, ctxPtr ); - +// event_added = libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusPlaying, callbacks, ctxPtr ); +// if(event_added != 0) { +// printf("ERROR CANNOT ADD EVENT [libvlc_VlmMediaInstanceStatusPlaying]\n"); +// } +// +// event_added = libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusPause, callbacks, ctxPtr ); +// if(event_added != 0) { +// printf("ERROR CANNOT ADD EVENT [libvlc_VlmMediaInstanceStatusPause]\n"); +// } +// +// event_added = libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusEnd, callbacks, ctxPtr ); +// if(event_added != 0) { +// printf("ERROR CANNOT ADD EVENT [libvlc_VlmMediaInstanceStatusEnd]\n"); +// } +// +// event_added = libvlc_event_attach( eventManager, libvlc_VlmMediaInstanceStatusError, callbacks, ctxPtr ); +// if(event_added != 0) { +// printf("ERROR CANNOT ADD EVENT [libvlc_VlmMediaInstanceStatusError]\n"); +// } } } else { @@ -773,8 +790,11 @@ bool VideoPlayer::initPlayer() { successLoadingLib = (play_result == 0); - for(;successLoadingLib == true && ctxPtr->error == false && - ctxPtr->started == false;) { + time_t waitStart = time(NULL); + for(;difftime(time(NULL),waitStart) <= 20 && + successLoadingLib == true && + ctxPtr->error == false && + ctxPtr->started == false;) { SDL_Delay(10); }