Commit 15b3bb2d authored by Cory Quammen's avatar Cory Quammen

ffmpeg: check for existence of avcodec_end_packet

vtkFFMPEGVideoSource requires functions in FFPMEG 3.1 or greater.
This commit adds a CMake compilation test that checks for one of these
functions in FFMPEG, and if it isn't available, the class and its test
are not added to the build.
parent 5765319a
......@@ -60,4 +60,14 @@ int main()
}\n")
check_c_source_compiles("${_source}" VTK_FFMPEG_AVCODECID)
endif()
if (NOT DEFINED VTK_FFMPEG_AVCODEC_SEND_PACKET)
set(_source "
#include <${FFMEG_CODEC_HEADER_PATH}/avcodec.h>
int main()
{
avcode_send_packet(0, 0);
return 0;
}\n")
check_c_source_compiles("${_source}" VTK_FFMPEG_AVCODEC_SEND_PACKET)
endif()
endif()
......@@ -2,10 +2,16 @@ find_package(FFMPEG)
include(vtkTestFFMPEG)
set(Module_SRCS
vtkFFMPEGVideoSource.cxx
vtkFFMPEGWriter.cxx
)
# vtkFFMPEGVideoSource equires ffmpeg 3.1 or later
if (VTK_FFMPEG_AVCODEC_SEND_PACKET)
list(APPEND Module_SRCS
vtkFFMPEGVideoSource.cxx
)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkFFMPEGConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkFFMPEGConfig.h @ONLY
)
......
vtk_add_test_cxx(vtkIOFFMPEGCxxTests tests
TestFFMPEGVideoSource.cxx
TestFFMPEGWriter.cxx,NO_VALID
)
if (VTK_FFMPEG_AVCODEC_SEND_PACKET)
vtk_add_test_cxx(vtkIOFFMPEGCxxTests tests
TestFFMPEGVideoSource.cxx
)
endif()
vtk_test_cxx_executable(vtkIOFFMPEGCxxTests tests)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment