From 785d2c7cc95e816d43188e1c431b4a429ca381d3 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Mon, 8 Sep 2014 15:24:39 +1000 Subject: [PATCH] Remove incomplete implementation to support planar formats. Make libswresample a prerequisite. --- CMakeLists.txt | 11 ++------ apps/openmw/mwrender/videoplayer.cpp | 42 +++------------------------- 2 files changed, 6 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7c3cf010..b89844a52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,16 +140,9 @@ set(OPENMW_LIBS_HEADER) # Sound setup 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() +find_package(FFmpeg REQUIRED) 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() +set(SOUND_INPUT_LIBRARY ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARIES} ${SWRESAMPLE_LIBRARIES}) # TinyXML option(USE_SYSTEM_TINYXML "Use system TinyXML library instead of internal." OFF) diff --git a/apps/openmw/mwrender/videoplayer.cpp b/apps/openmw/mwrender/videoplayer.cpp index 0b22e204c..2b1612675 100644 --- a/apps/openmw/mwrender/videoplayer.cpp +++ b/apps/openmw/mwrender/videoplayer.cpp @@ -52,47 +52,13 @@ extern "C" #include #endif + // From version 54.56 binkaudio encoding format changed from S16 to FLTP. See: + // https://gitorious.org/ffmpeg/ffmpeg/commit/7bfd1766d1c18f07b0a2dd042418a874d49ea60d + // http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=872 // WARNING: avcodec versions up to 54.54.100 potentially crashes on Windows 64bit. + #include } -// From version 54.56 binkaudio encoding format changed from S16 to FLTP. See: -// https://gitorious.org/ffmpeg/ffmpeg/commit/7bfd1766d1c18f07b0a2dd042418a874d49ea60d -// http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=872 -#ifdef HAVE_LIBSWRESAMPLE -extern "C" { -#include -} -#else -/* nasty hack to support FLTP, but no other formats, on systems without libswresample */ -int swr_init(int *n) { return 1; } -int swr_convert(int *s, uint8_t** output, int outs, const uint8_t** input, int ins) { - uint8_t *stream = *output; - float *outputStream = (float *)&stream[0]; - float* inputChannel0 = (float *)input[0]; - float* inputChannel1 = (float *)input[1]; - float sample0, sample1 = 0; - for (int i = 0 ; i < ins ; ++i) { - sample0 = *inputChannel0++; - sample1 = *inputChannel1++; - outputStream[i*2] = sample0; - outputStream[i*2+1] = sample1; - } - return ins; -} -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(1); - } else { - throw std::runtime_error( - std::string("Unsupported sample format: ")+ av_get_sample_fmt_name(inf)); - } - return s; -} -void swr_free(int **s) { delete *s; *s = NULL; } -#define SwrContext int -#endif - #define MAX_AUDIOQ_SIZE (5 * 16 * 1024) #define MAX_VIDEOQ_SIZE (5 * 256 * 1024) #define AV_SYNC_THRESHOLD 0.01