mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-28 18:18:52 +00:00
b39d69e98c
- Fix rindex overflow - Fix audio sample size bugs (was using sample_fmt and channel count of the decoder, instead of the resampled settings). We didn't notice this bug before, because the OpenAL MovieAudioFactory tries to resample to a format of the same byte size. - Add support for play/pause and seeking controls (not used by cutscenes in OpenMW) - Closing the video when arriving at the stream end is now handled by the user (we may also want to keep the video open and seek back) The video player now has a standalone demo, at https://github.com/scrawl/ogre-ffmpeg-videoplayer
43 lines
1.4 KiB
CMake
43 lines
1.4 KiB
CMake
set(OGRE_FFMPEG_VIDEOPLAYER_LIBRARY "ogre-ffmpeg-videoplayer")
|
|
|
|
# Sources
|
|
|
|
set(OGRE_FFMPEG_VIDEOPLAYER_SOURCE_FILES
|
|
videoplayer.cpp
|
|
videostate.cpp
|
|
videodefs.hpp
|
|
libavwrapper.cpp
|
|
audiodecoder.cpp
|
|
audiofactory.hpp
|
|
)
|
|
|
|
# Find FFMPEG
|
|
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE AVRESAMPLE)
|
|
unset(FFMPEG_LIBRARIES CACHE)
|
|
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(VIDEO_FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARIES})
|
|
if( SWRESAMPLE_FOUND )
|
|
add_definitions(-DHAVE_LIBSWRESAMPLE)
|
|
set(VIDEO_FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${SWRESAMPLE_LIBRARIES})
|
|
else()
|
|
if( AVRESAMPLE_FOUND )
|
|
set(VIDEO_FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVRESAMPLE_LIBRARIES})
|
|
else()
|
|
message(FATAL_ERROR "Install either libswresample (FFmpeg) or libavresample (Libav).")
|
|
endif()
|
|
endif()
|
|
include_directories(${FFMPEG_INCLUDE_DIRS})
|
|
|
|
# Find Boost
|
|
set(BOOST_COMPONENTS thread)
|
|
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
|
|
|
add_library(${OGRE_FFMPEG_VIDEOPLAYER_LIBRARY} STATIC ${OGRE_FFMPEG_VIDEOPLAYER_SOURCE_FILES})
|
|
target_link_libraries(${OGRE_FFMPEG_VIDEOPLAYER_LIBRARY} ${VIDEO_FFMPEG_LIBRARIES} ${Boost_LIBRARIES})
|
|
|
|
link_directories(${CMAKE_CURRENT_BINARY_DIR})
|