diff --git a/CMakeLists.txt b/CMakeLists.txt index 74f7dddd7..c7c3cf010 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,12 +139,16 @@ set(OPENMW_LIBS ${OENGINE_ALL}) set(OPENMW_LIBS_HEADER) # Sound setup -set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE) -find_package(FFmpeg REQUIRED) +set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE) +find_package(FFmpeg) +if ( NOT AVCODEC_FOUND OR NOT AVFORMAT_FOUND OR NOT AVUTIL_FOUND OR NOT SWSCALE_FOUND ) + message(FATAL_ERROR "FFmpeg component required, but not found!") +endif() set(SOUND_INPUT_INCLUDES ${FFMPEG_INCLUDE_DIRS}) set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARIES}) if( SWRESAMPLE_FOUND ) add_definitions(-DHAVE_LIBSWRESAMPLE) + set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES} ${SWRESAMPLE_LIBRARIES}) endif() # TinyXML diff --git a/apps/openmw/mwrender/videoplayer.cpp b/apps/openmw/mwrender/videoplayer.cpp index 881ab7479..0e90a354b 100644 --- a/apps/openmw/mwrender/videoplayer.cpp +++ b/apps/openmw/mwrender/videoplayer.cpp @@ -71,7 +71,7 @@ int swr_convert(int *s, uint8_t** output, int outs, const uint8_t** input, int float* inputChannel0 = (float *)input[0]; float* inputChannel1 = (float *)input[1]; float sample0, sample1 = 0; - for (unsigned int i = 0 ; i < (unsigned int)ins ; ++i) { + for (i = 0 ; i < ins ; ++i) { sample0 = *inputChannel0++; sample1 = *inputChannel1++; outputStream[i*2] = sample0; @@ -81,10 +81,7 @@ int swr_convert(int *s, uint8_t** output, int outs, const uint8_t** input, int } int * swr_alloc_set_opts(int *s, int64_t outc, AVSampleFormat outf, int outr, int64_t inc, AVSampleFormat inf, int inr, int o, void* l) { - if(inf == AV_SAMPLE_FMT_FLTP) { - s = new int; - *s = 1; - } + if(inf == AV_SAMPLE_FMT_FLTP) { s = new int(1); } return s; } void swr_free(int **s) { delete *s; } diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index 2280d37ff..c3c25d2f9 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -144,7 +144,7 @@ if (NOT FFMPEG_LIBRARIES) endif () # Now set the noncached _FOUND vars for the components. -foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE) +foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE SWRESAMPLE) set_component_found(${_component}) endforeach ()