mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- possibly fixed #763
This commit is contained in:
parent
57a36e77f3
commit
39feb24d64
@ -5,7 +5,7 @@
|
||||
#include <SDL.h>
|
||||
#include "SDL_Extensions.h"
|
||||
#include "CPlayerInterface.h"
|
||||
#include "boost/filesystem.hpp"
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
extern SystemOptions GDefaultOptions;
|
||||
//reads events and returns true on key down
|
||||
@ -573,7 +573,7 @@ bool CVideoPlayer::playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey)
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
#include <../client/SDL_framerate.h>
|
||||
#include "SDL_framerate.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
@ -638,7 +638,7 @@ static URLProtocol lod_protocol = {
|
||||
lod_open,
|
||||
lod_read,
|
||||
NULL, // no write
|
||||
lod_seek,
|
||||
lod_seek,
|
||||
lod_close
|
||||
};
|
||||
|
||||
@ -657,7 +657,11 @@ CVideoPlayer::CVideoPlayer()
|
||||
av_register_all();
|
||||
|
||||
// Register our protocol 'lod' so we can directly read from mmaped memory
|
||||
#ifdef WITH_AV_REGISTER_PROTOCOL2
|
||||
av_register_protocol2(&lod_protocol, sizeof(lod_protocol));
|
||||
#else
|
||||
av_register_protocol(&lod_protocol);
|
||||
#endif
|
||||
|
||||
vidh = new CVidHandler(std::string(DATA_DIR "/Data/VIDEO.VID"));
|
||||
vidh_ab = new CVidHandler(std::string(DATA_DIR "/Data/H3ab_ahd.vid"));
|
||||
@ -704,7 +708,7 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
|
||||
// Find the first video stream
|
||||
stream = -1;
|
||||
for(unsigned int i=0; i<format->nb_streams; i++) {
|
||||
if (format->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) {
|
||||
if (format->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
|
||||
stream = i;
|
||||
break;
|
||||
}
|
||||
|
40
configure
vendored
40
configure
vendored
@ -16424,6 +16424,46 @@ if test "x$ac_cv_lib_avcodec_avcodec_decode_video2" = x""yes; then :
|
||||
AVCODEC_DECODE_VIDEO2="-DWITH_AVCODEC_DECODE_VIDEO2"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_register_protocol2 in -lavcodec" >&5
|
||||
$as_echo_n "checking for av_register_protocol2 in -lavcodec... " >&6; }
|
||||
if test "${ac_cv_lib_avcodec_av_register_protocol2+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lavcodec $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_avcodec_av_register_protocol2=yes
|
||||
else
|
||||
ac_cv_lib_avcodec_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_avcodec_av_register_protocol2" >&5
|
||||
$as_echo "$ac_cv_lib_avcodec_av_register_protocol2" >&6; }
|
||||
if test "x$ac_cv_lib_avcodec_av_register_protocol2" = x""yes; then :
|
||||
AVCODEC_DECODE_VIDEO2="-DWITH_AV_REGISTER_PROTOCOL2"
|
||||
fi
|
||||
|
||||
|
||||
FFMPEG_LIBS="$LIBS"
|
||||
FFMPEG_CXXFLAGS="$CFLAGS $AVCODEC_DECODE_VIDEO2"
|
||||
|
@ -92,6 +92,7 @@ CFLAGS="$CFLAGS `pkg-config --cflags libavformat libswscale`"
|
||||
AC_CHECK_LIB(avformat,av_open_input_file,,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.]))
|
||||
AC_CHECK_LIB(avcodec,avcodec_decode_video2,AVCODEC_DECODE_VIDEO2="-DWITH_AVCODEC_DECODE_VIDEO2",)
|
||||
AC_CHECK_LIB(avcodec,av_register_protocol2,AVCODEC_DECODE_VIDEO2="-DWITH_AV_REGISTER_PROTOCOL2",)
|
||||
|
||||
FFMPEG_LIBS="$LIBS"
|
||||
FFMPEG_CXXFLAGS="$CFLAGS $AVCODEC_DECODE_VIDEO2"
|
||||
|
Loading…
Reference in New Issue
Block a user