1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

- (linux) use empty video player if av_register_protocol function was not found

This commit is contained in:
Ivan Savenko 2012-08-18 10:29:54 +00:00
parent ea0399db93
commit deb22b3674
6 changed files with 116 additions and 5 deletions

View File

@ -92,6 +92,10 @@ typedef boost::int32_t si32; //signed int 32 bits (4 bytes)
typedef boost::int16_t si16; //signed int 16 bits (2 bytes)
typedef boost::int8_t si8; //signed int 8 bits (1 byte)
#if defined _M_X64 && defined _WIN32 //Win64 -> cannot load 32-bit DLLs for video handling
#define DISABLE_VIDEO
#endif
#ifdef __GNUC__
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__ )
#endif

View File

@ -269,15 +269,15 @@ int main(int argc, char** argv)
tlog0 <<"\tInitializing screen: "<<pomtime.getDiff() << std::endl;
// Initialize video
#if defined _M_X64 && defined _WIN32 //Win64 -> cannot load 32-bit DLLs for video handling
#if DISABLE_VIDEO
CCS->videoh = new CEmptyVideoPlayer;
#else
if (!vm.count("disable-video"))
CCS->videoh = new CVideoPlayer;
else
CCS->videoh = new CEmptyVideoPlayer;
#endif
tlog0<<"\tInitializing video: "<<pomtime.getDiff()<<std::endl;
//we can properly play intro only in the main thread, so we have to move loading to the separate thread
@ -866,4 +866,4 @@ void requestChangingResolution()
ev.user.code = CHANGE_SCREEN_RESOLUTION;
SDL_PushEvent(&ev);
}
*/
*/

View File

@ -567,6 +567,8 @@ bool CVideoPlayer::playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey)
#else
#ifndef DISABLE_VIDEO
//Workaround for compile error in ffmpeg (UINT_64C was not declared)
#define __STDC_CONSTANT_MACROS
#ifdef _STDINT_H
@ -1035,3 +1037,5 @@ CVideoPlayer::~CVideoPlayer()
}
#endif
#endif

View File

@ -223,6 +223,8 @@ public:
#else
#ifndef DISABLE_VIDEO
#include <SDL.h>
#include <SDL_video.h>
#if SDL_VERSION_ATLEAST(1,3,0)
@ -284,6 +286,8 @@ public:
ui32 offset; // current data offset
};
#endif
#define VIDEO_TAVERN "tavern.mjpg"
#define VIDEO_WIN "win3.mjpg"
#define VIDEO_LOSE_BATTLE_START "lbstart.mjpg"

97
configure vendored
View File

@ -17359,8 +17359,103 @@ else
fi
#check for one of register_protocol functions
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_register_protocol in -lavformat" >&5
$as_echo_n "checking for av_register_protocol in -lavformat... " >&6; }
if ${ac_cv_lib_avformat_av_register_protocol+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lavformat $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char av_register_protocol ();
int
main ()
{
return av_register_protocol ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_lib_avformat_av_register_protocol=yes
else
ac_cv_lib_avformat_av_register_protocol=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_register_protocol" >&5
$as_echo "$ac_cv_lib_avformat_av_register_protocol" >&6; }
if test "x$ac_cv_lib_avformat_av_register_protocol" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBAVFORMAT 1
_ACEOF
LIBS="-lavformat $LIBS"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_register_protocol2 in -lavformat" >&5
$as_echo_n "checking for av_register_protocol2 in -lavformat... " >&6; }
if ${ac_cv_lib_avformat_av_register_protocol2+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lavformat $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char av_register_protocol2 ();
int
main ()
{
return av_register_protocol2 ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_lib_avformat_av_register_protocol2=yes
else
ac_cv_lib_avformat_av_register_protocol2=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_register_protocol2" >&5
$as_echo "$ac_cv_lib_avformat_av_register_protocol2" >&6; }
if test "x$ac_cv_lib_avformat_av_register_protocol2" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBAVFORMAT 1
_ACEOF
LIBS="-lavformat $LIBS"
else
DISABLE_VIDEO="-DDISABLE_VIDEO"
fi
fi
FFMPEG_LIBS="$LIBS"
FFMPEG_CXXFLAGS="$CFLAGS $AVCODEC_DECODE_VIDEO2 $AV_REGISTER_PROTOCOL2"
FFMPEG_CXXFLAGS="$CFLAGS $DISABLE_VIDEO"
LIBS=$saved_LIBS
CFLAGS=$saved_CFLAGS

View File

@ -82,8 +82,12 @@ CFLAGS="$CFLAGS `pkg-config --cflags libavformat libswscale`"
AC_CHECK_LIB(avformat,av_register_all,,AC_MSG_ERROR([FFMpeg avformat library not found. Please install it.]))
AC_CHECK_LIB(swscale,sws_getContext,,AC_MSG_ERROR([FFMpeg swscale library not found. Please install it.]))
#check for one of register_protocol functions
AC_CHECK_LIB(avformat, av_register_protocol,,
AC_CHECK_LIB(avformat, av_register_protocol2,, DISABLE_VIDEO="-DDISABLE_VIDEO"))
FFMPEG_LIBS="$LIBS"
FFMPEG_CXXFLAGS="$CFLAGS $AVCODEC_DECODE_VIDEO2 $AV_REGISTER_PROTOCOL2"
FFMPEG_CXXFLAGS="$CFLAGS $DISABLE_VIDEO"
LIBS=$saved_LIBS
CFLAGS=$saved_CFLAGS