mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 11:42:31 +01:00
- attempt for better support for older versions of libvlc
This commit is contained in:
parent
5d5224b4a2
commit
32b4925f31
@ -9,6 +9,7 @@
|
||||
# LIBVLC_LIBRARY
|
||||
# LIBVLC_VERSION
|
||||
# LIBVLC_VERSION_PRE_V2
|
||||
# LIBVLC_VERSION_PRE_1_1_13
|
||||
|
||||
if(NOT LIBVLC_MIN_VERSION)
|
||||
set(LIBVLC_MIN_VERSION "0.0")
|
||||
@ -83,6 +84,9 @@ if (LIBVLC_FOUND)
|
||||
if(LIBVLC_VERSION STRLESS "2.0.0")
|
||||
set(LIBVLC_VERSION_PRE_V2 TRUE)
|
||||
ENDIF()
|
||||
if(LIBVLC_VERSION STRLESS "1.1.13")
|
||||
set(LIBVLC_VERSION_PRE_1_1_13 TRUE)
|
||||
ENDIF()
|
||||
|
||||
if (NOT LIBVLC_FIND_QUIETLY)
|
||||
message(STATUS "Found LibVLC include-dir path: ${LIBVLC_INCLUDE_DIR}")
|
||||
|
@ -22,7 +22,7 @@ sync_support_libs(){
|
||||
local _cp="/bin/cp"
|
||||
#local skip_deps="libm.so libpthread.so libstdc++.so libgcc_s.so libc.so libdl.so libX11.so libpulse libfusion libdirect libnvidia libXext librt libxcb libICE libSM libXtst libwrap libdbus libXau libXdmcp libnsl libFLAC libGL"
|
||||
local skip_deps=""
|
||||
local keep_deps="libcurl libgnu libicu liblua libxerces libjpeg libpng libwx libgtk libgdk libftgl libfreetype"
|
||||
local keep_deps="libcurl libgnu libicu liblua libxerces libjpeg libpng libwx libgtk libgdk libftgl libfreetype libvlc"
|
||||
|
||||
local scan_via_skiplist=1
|
||||
|
||||
|
@ -31,7 +31,9 @@ elif [ "$OSTYPE" = "i686" ] && [ "$version" = "Ubuntu" ]; then
|
||||
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
|
||||
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 libminiupnpc-dev libglew-dev librtmp-dev libluajit-5.1-dev libvlc-dev
|
||||
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
|
||||
|
||||
sudo apt-get install libminiupnpc-dev librtmp-dev
|
||||
else
|
||||
echo "=====> Using build deps for debian based 32 or 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 libminiupnpc-dev libglew-dev librtmp-dev libluajit-5.1-dev libvlc-dev
|
||||
|
@ -241,6 +241,10 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
||||
IF(LIBVLC_VERSION_PRE_V2)
|
||||
ADD_DEFINITIONS(-DLIBVLC_VERSION_PRE_2)
|
||||
ENDIF()
|
||||
IF(LIBVLC_VERSION_PRE_1_1_13)
|
||||
ADD_DEFINITIONS(-DLIBVLC_VERSION_PRE_1_1_13)
|
||||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
MESSAGE(STATUS "**WARNING: LIBVLC NOT found so intro videos are NOT supported.")
|
||||
ENDIF()
|
||||
|
@ -24,31 +24,31 @@
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
/**
|
||||
* @param location The location of the registry key. For example "Software\\Bethesda Softworks\\Morrowind"
|
||||
* @param name the name of the registry key, for example "Installed Path"
|
||||
* @return the value of the key or an empty string if an error occured.
|
||||
*/
|
||||
std::string getRegKey(const std::string& location, const std::string& name){
|
||||
HKEY key;
|
||||
CHAR value[1024];
|
||||
DWORD bufLen = 1024*sizeof(CHAR);
|
||||
long ret;
|
||||
ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, location.c_str(), 0, KEY_QUERY_VALUE, &key);
|
||||
if( ret != ERROR_SUCCESS ){
|
||||
return std::string();
|
||||
}
|
||||
ret = RegQueryValueExA(key, name.c_str(), 0, 0, (LPBYTE) value, &bufLen);
|
||||
RegCloseKey(key);
|
||||
if ( (ret != ERROR_SUCCESS) || (bufLen > 1024*sizeof(TCHAR)) ){
|
||||
return std::string();
|
||||
}
|
||||
string stringValue = value;
|
||||
size_t i = stringValue.length();
|
||||
while( i > 0 && stringValue[i-1] == '\0' ){
|
||||
--i;
|
||||
}
|
||||
return stringValue.substr(0,i);
|
||||
/**
|
||||
* @param location The location of the registry key. For example "Software\\Bethesda Softworks\\Morrowind"
|
||||
* @param name the name of the registry key, for example "Installed Path"
|
||||
* @return the value of the key or an empty string if an error occured.
|
||||
*/
|
||||
std::string getRegKey(const std::string& location, const std::string& name){
|
||||
HKEY key;
|
||||
CHAR value[1024];
|
||||
DWORD bufLen = 1024*sizeof(CHAR);
|
||||
long ret;
|
||||
ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, location.c_str(), 0, KEY_QUERY_VALUE, &key);
|
||||
if( ret != ERROR_SUCCESS ){
|
||||
return std::string();
|
||||
}
|
||||
ret = RegQueryValueExA(key, name.c_str(), 0, 0, (LPBYTE) value, &bufLen);
|
||||
RegCloseKey(key);
|
||||
if ( (ret != ERROR_SUCCESS) || (bufLen > 1024*sizeof(TCHAR)) ){
|
||||
return std::string();
|
||||
}
|
||||
string stringValue = value;
|
||||
size_t i = stringValue.length();
|
||||
while( i > 0 && stringValue[i-1] == '\0' ){
|
||||
--i;
|
||||
}
|
||||
return stringValue.substr(0,i);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -106,7 +106,7 @@ static void display(void *data, void *id) {
|
||||
(void) data;
|
||||
}
|
||||
|
||||
#if defined(HAS_LIBVLC) && defined(LIBVLC_VERSION_PRE_2)
|
||||
#if defined(HAS_LIBVLC) && defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||
static void catchError(libvlc_exception_t *ex) {
|
||||
if(libvlc_exception_raised(ex)) {
|
||||
fprintf(stderr, "exception: %s\n", libvlc_exception_get_message(ex));
|
||||
@ -160,7 +160,7 @@ void VideoPlayer::PlayVideo() {
|
||||
std::vector<const char *> vlc_argv;
|
||||
vlc_argv.push_back("--no-xlib" /* tell VLC to not use Xlib */);
|
||||
vlc_argv.push_back("--no-video-title-show");
|
||||
#ifdef LIBVLC_VERSION_PRE_2
|
||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||
char clock[64], cunlock[64], cdata[64];
|
||||
char cwidth[32], cheight[32], cpitch[32];
|
||||
/*
|
||||
@ -235,7 +235,7 @@ void VideoPlayer::PlayVideo() {
|
||||
*/
|
||||
if(verboseEnabled) printf("Trying [%s]\n",getenv("VLC_PLUGIN_PATH"));
|
||||
|
||||
#ifdef LIBVLC_VERSION_PRE_2
|
||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||
libvlc_exception_t ex;
|
||||
libvlc_exception_init(&ex);
|
||||
|
||||
@ -294,7 +294,7 @@ void VideoPlayer::PlayVideo() {
|
||||
*/
|
||||
|
||||
if(libvlc != NULL) {
|
||||
#ifdef LIBVLC_VERSION_PRE_2
|
||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||
m = libvlc_media_new(libvlc, filename.c_str(), &ex);
|
||||
catchError(&ex);
|
||||
|
||||
@ -303,12 +303,12 @@ void VideoPlayer::PlayVideo() {
|
||||
#endif
|
||||
libvlc_media_release(m);
|
||||
|
||||
#ifndef LIBVLC_VERSION_PRE_2
|
||||
#if !defined(LIBVLC_VERSION_PRE_2) && !defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||
libvlc_video_set_callbacks(mp, lock, unlock, display, &ctx);
|
||||
libvlc_video_set_format(mp, "RV16", width, height, this->surface->pitch);
|
||||
#endif
|
||||
|
||||
#ifdef LIBVLC_VERSION_PRE_2
|
||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||
libvlc_media_player_play(mp,&ex);
|
||||
#else
|
||||
libvlc_media_player_play(mp);
|
||||
@ -384,7 +384,7 @@ void VideoPlayer::PlayVideo() {
|
||||
/*
|
||||
* Stop stream and clean up libVLC
|
||||
*/
|
||||
#ifdef LIBVLC_VERSION_PRE_2
|
||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||
libvlc_media_player_stop(mp,&ex);
|
||||
catchError(&ex);
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user