mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Make cmake more reliably detect libswresample
This commit is contained in:
parent
801b9446b7
commit
c6cad5adc5
3 changed files with 9 additions and 8 deletions
|
@ -139,12 +139,16 @@ set(OPENMW_LIBS ${OENGINE_ALL})
|
||||||
set(OPENMW_LIBS_HEADER)
|
set(OPENMW_LIBS_HEADER)
|
||||||
|
|
||||||
# Sound setup
|
# Sound setup
|
||||||
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE)
|
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE)
|
||||||
find_package(FFmpeg REQUIRED)
|
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_INCLUDES ${FFMPEG_INCLUDE_DIRS})
|
||||||
set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARIES})
|
set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARIES})
|
||||||
if( SWRESAMPLE_FOUND )
|
if( SWRESAMPLE_FOUND )
|
||||||
add_definitions(-DHAVE_LIBSWRESAMPLE)
|
add_definitions(-DHAVE_LIBSWRESAMPLE)
|
||||||
|
set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES} ${SWRESAMPLE_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TinyXML
|
# TinyXML
|
||||||
|
|
|
@ -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* inputChannel0 = (float *)input[0];
|
||||||
float* inputChannel1 = (float *)input[1];
|
float* inputChannel1 = (float *)input[1];
|
||||||
float sample0, sample1 = 0;
|
float sample0, sample1 = 0;
|
||||||
for (unsigned int i = 0 ; i < (unsigned int)ins ; ++i) {
|
for (i = 0 ; i < ins ; ++i) {
|
||||||
sample0 = *inputChannel0++;
|
sample0 = *inputChannel0++;
|
||||||
sample1 = *inputChannel1++;
|
sample1 = *inputChannel1++;
|
||||||
outputStream[i*2] = sample0;
|
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,
|
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) {
|
int64_t inc, AVSampleFormat inf, int inr, int o, void* l) {
|
||||||
if(inf == AV_SAMPLE_FMT_FLTP) {
|
if(inf == AV_SAMPLE_FMT_FLTP) { s = new int(1); }
|
||||||
s = new int;
|
|
||||||
*s = 1;
|
|
||||||
}
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
void swr_free(int **s) { delete *s; }
|
void swr_free(int **s) { delete *s; }
|
||||||
|
|
|
@ -144,7 +144,7 @@ if (NOT FFMPEG_LIBRARIES)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Now set the noncached _FOUND vars for the components.
|
# 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})
|
set_component_found(${_component})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue