diff --git a/mk/linux/setupBuildDeps.sh b/mk/linux/setupBuildDeps.sh index 12317195..9e6aa7a6 100755 --- a/mk/linux/setupBuildDeps.sh +++ b/mk/linux/setupBuildDeps.sh @@ -28,7 +28,7 @@ elif [ -f /etc/fedora-release ]; then sudo yum install SDL-devel xerces-c-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-dev libircclient-dev glew-devel ftgl-devel elif [ "$OSTYPE" = "i686" ] && [ "$version" = "Ubuntu" ]; then echo "=====> Using build deps for old Ubuntu 8.04..." - sudo apt-get install libsdl1.2-dev libxerces28-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libluajit-5.1-dev libvlc-dev + sudo apt-get install libsdl1.2-dev libxerces28-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libluajit-5.1-dev libvlc-dev libftgl-dev libvlc-dev elif [ "$OSTYPE" = "x86_64" ]; then echo "=====> Using build deps for debian based 64 bit linux..." sudo apt-get install libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev cmake-curses-gui libgtk2.0-dev libxml2-dev libircclient-dev libftgl-dev libglew-dev libluajit-5.1-dev libvlc-dev diff --git a/source/shared_lib/sources/graphics/video_player.cpp b/source/shared_lib/sources/graphics/video_player.cpp index 221426e7..12a48df4 100644 --- a/source/shared_lib/sources/graphics/video_player.cpp +++ b/source/shared_lib/sources/graphics/video_player.cpp @@ -21,15 +21,15 @@ #ifdef HAS_LIBVLC -//MSVC++ 11.0 _MSC_VER = 1700 (Visual Studio 2011) -//MSVC++ 10.0 _MSC_VER = 1600 (Visual Studio 2010) +//MSVC++ 11.0 _MSC_VER = 1700 (Visual Studio 2011) +//MSVC++ 10.0 _MSC_VER = 1600 (Visual Studio 2010) //MSVC++ 9.0 _MSC_VER = 1500 (Visual Studio 2008) #if defined(_MSC_VER) && _MSC_VER < 1600 - -// Older versions of VC++ don't include stdint.h -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; + +// Older versions of VC++ don't include stdint.h +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #endif @@ -67,16 +67,19 @@ std::string getRegKey(const std::string& location, const std::string& name){ #endif struct ctx { - GLuint textureId; // Texture ID + GLuint textureId; // Texture ID SDL_Surface *surf; SDL_mutex *mutex; - int width; - int height; - void *rawData; + int width; + int height; + void *rawData; + bool verboseEnabled; }; // Load a texture static void loadTexture(struct ctx *ctx) { + if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); + void *rawData = ctx->rawData; Uint8 * pixelSource = 0; Uint8 * pixelDestination = (Uint8 *) rawData; @@ -99,6 +102,7 @@ static void loadTexture(struct ctx *ctx) { static void *lock(void *data, void **p_pixels) { struct ctx *ctx = (struct ctx *)data; + if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); SDL_LockMutex(ctx->mutex); SDL_LockSurface(ctx->surf); @@ -109,6 +113,7 @@ static void *lock(void *data, void **p_pixels) { static void unlock(void *data, void *id, void *const *p_pixels) { struct ctx *ctx = (struct ctx *)data; + if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); /* VLC just rendered the video, but we can also render stuff */ SDL_UnlockSurface(ctx->surf); @@ -117,7 +122,8 @@ static void unlock(void *data, void *id, void *const *p_pixels) { static void display(void *data, void *id) { /* VLC wants to display the video */ - (void) data; + struct ctx *ctx = (struct ctx *)data; + if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__); } #if defined(HAS_LIBVLC) && defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13) @@ -160,6 +166,7 @@ void VideoPlayer::PlayVideo() { ctx.width = width; ctx.height = height; ctx.rawData = (void *) malloc(width * height * 4); + ctx.verboseEnabled = verboseEnabled; #ifdef HAS_LIBVLC libvlc_instance_t *libvlc = NULL; @@ -172,7 +179,11 @@ void VideoPlayer::PlayVideo() { // } std::vector vlc_argv; - vlc_argv.push_back("--no-xlib" /* tell VLC to not use Xlib */); + vlc_argv.push_back("-I"); + vlc_argv.push_back("dummy"); /* Don't use any interface */ + vlc_argv.push_back("--no-media-library"); + vlc_argv.push_back("--ignore-config"); /* Don't use VLC's config */ + vlc_argv.push_back("--no-xlib"); /* tell VLC to not use Xlib */ vlc_argv.push_back("--no-video-title-show"); #if defined(LIBVLC_VERSION_PRE_2) string fullPluginsParam = "--plugin-path=" + pluginsPath; @@ -212,6 +223,7 @@ void VideoPlayer::PlayVideo() { #endif if(verboseEnabled) vlc_argv.push_back("--verbose=2"); + if(verboseEnabled) vlc_argv.push_back("--extraintf=logger"); //log anything #if defined(WIN32) if(verboseEnabled) _putenv("VLC_VERBOSE=2"); #endif @@ -263,6 +275,9 @@ void VideoPlayer::PlayVideo() { #else libvlc = libvlc_new(vlc_argc, &vlc_argv[0]); #endif + + if(verboseEnabled) printf("In [%s] Line: %d, libvlc [%p]\n",__FUNCTION__,__LINE__,libvlc); + /* It is meaningless to try all this because we have to restart mg to pickup new env vars #if defined(WIN32) if(libvlc == NULL) { @@ -315,12 +330,18 @@ void VideoPlayer::PlayVideo() { if(libvlc != NULL) { #if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13) m = libvlc_media_new(libvlc, filename.c_str(), &ex); + if(verboseEnabled) printf("In [%s] Line: %d, m [%p]\n",__FUNCTION__,__LINE__,m); + catchError(&ex); mp = libvlc_media_player_new_from_media(m); + if(verboseEnabled) printf("In [%s] Line: %d, mp [%p]\n",__FUNCTION__,__LINE__,mp); #else /* Create a new item */ m = libvlc_media_new_path(libvlc, filename.c_str()); + if(verboseEnabled) printf("In [%s] Line: %d, m [%p]\n",__FUNCTION__,__LINE__,m); + mp = libvlc_media_player_new_from_media(m); + if(verboseEnabled) printf("In [%s] Line: %d, mp [%p]\n",__FUNCTION__,__LINE__,mp); #endif libvlc_media_release(m); @@ -330,11 +351,13 @@ void VideoPlayer::PlayVideo() { #endif #if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13) - libvlc_media_player_play(mp,&ex); + int play_result = libvlc_media_player_play(mp,&ex); #else - libvlc_media_player_play(mp); + int play_result = libvlc_media_player_play(mp); #endif + if(verboseEnabled) printf("In [%s] Line: %d, play_result [%d]\n",__FUNCTION__,__LINE__,play_result); + successLoadingVLC = true; } #endif