diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index fac407ed..c30c780b 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -1188,6 +1188,8 @@ if(MSVC) endif() if(FFMPEG) + add_definitions(-DUSE_FFMPEG) + if(CMAKE_CL_64) include_directories(libs/ffmpeg-win64/include) include_directories(libs/ffmpeg-win64/include/libswscale) @@ -1322,7 +1324,9 @@ else() if(UNIX) if(FFMPEG) - find_package(FFMPEG) + find_package(FFMPEG REQUIRED) + add_definitions(-DUSE_FFMPEG) + include_directories(${FFMPEG_INCLUDE_DIR}) link_directories(${FFMPEG_LIBRARIES_DIRS}) endif() diff --git a/neo/renderer/Cinematic.cpp b/neo/renderer/Cinematic.cpp index 606e1610..631b89cf 100644 --- a/neo/renderer/Cinematic.cpp +++ b/neo/renderer/Cinematic.cpp @@ -375,7 +375,7 @@ idCinematicLocal::idCinematicLocal() #if defined(USE_FFMPEG) // Carl: ffmpeg stuff, for bink and normal video files: isRoQ = false; - fmt_ctx = avformat_alloc_context(); +// fmt_ctx = avformat_alloc_context(); frame = avcodec_alloc_frame(); frame2 = avcodec_alloc_frame(); dec_ctx = NULL; @@ -462,11 +462,6 @@ bool idCinematicLocal::InitFromFFMPEGFile( const char* qpath, bool amilooping ) CIN_WIDTH = DEFAULT_CIN_WIDTH; idStr fullpath = fileSystem->RelativePathToOSPath( qpath, "fs_basepath" ); - if( !fmt_ctx ) - { - return false; - } - if( ( ret = avformat_open_input( &fmt_ctx, fullpath, NULL, NULL ) ) < 0 ) { common->Warning( "idCinematic: Cannot open FFMPEG video file: '%s', %d\n", qpath, looping ); @@ -561,7 +556,7 @@ bool idCinematicLocal::InitFromFile( const char* qpath, bool amilooping ) Close(); inMemory = 0; - animationLength = 15000; //Carl: We can't tell how long an RoQ file is, so say it's 15 seconds + animationLength = 100000; // Carl: if no folder is specified, look in the video folder if( strstr( qpath, "/" ) == NULL && strstr( qpath, "\\" ) == NULL ) @@ -596,6 +591,7 @@ bool idCinematicLocal::InitFromFile( const char* qpath, bool amilooping ) idLib::Warning( "New filename: '%s'\n", fileName.c_str() ); return InitFromFFMPEGFile( fileName.c_str(), amilooping ); #else + animationLength = 0; return false; #endif } @@ -722,6 +718,12 @@ cinData_t idCinematicLocal::ImageForTime( int thisTime ) return cinData; } + if( !iFile ) + { + // RB: neither .bik or .roq found + return cinData; + } + if( status == FMV_EOF || status == FMV_IDLE ) { return cinData;