mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-02 08:51:57 +00:00
Fixed crashes in cinematic code
This commit is contained in:
parent
899982b0b2
commit
647a3ebad8
2 changed files with 14 additions and 8 deletions
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue