Make cmake more reliably detect libswresample

deque
cc9cii 10 years ago
parent 801b9446b7
commit c6cad5adc5

@ -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

@ -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; }

@ -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 ()

Loading…
Cancel
Save