Commit a5c50aed authored by Amy Squillacote's avatar Amy Squillacote
Browse files

ENH: improvements to FFMPEG installation

parent a46c7386
#
# Find the native FFMPEG includes and library
#
# This module defines
# FFMPEG_INCLUDE_DIR, where to find avcodec.h, avformat.h ...
# FFMPEG_LIBRARIES, the libraries to link against to use FFMPEG.
# FFMPEG_FOUND, If false, do not try to use FFMPEG.
# also defined, but not for general use are
# FFMPEG_avformat_LIBRARY and FFMPEG_avcodec_LIBRARY, where to find the FFMPEG library.
# This is usefull to do it this way so that we can always add more libraries
# if needed to FFMPEG_LIBRARIES if ffmpeg ever changes...
FIND_PATH(FFMPEG_INCLUDE_DIR ffmpeg/avformat.h
/usr/local/include
/usr/include
)
FIND_LIBRARY(FFMPEG_avformat_LIBRARY avformat
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_avcodec_LIBRARY avcodec
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_avutil_LIBRARY avutil
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_vorbis_LIBRARY vorbis
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_dc1394_LIBRARY dc1394_control
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_vorbisenc_LIBRARY vorbisenc
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_theora_LIBRARY theora
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_dts_LIBRARY dts
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_gsm_LIBRARY gsm
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(FFMPEG_z_LIBRARY z
/usr/local/lib
/usr/lib
)
IF(FFMPEG_INCLUDE_DIR)
IF(FFMPEG_avformat_LIBRARY)
IF(FFMPEG_avcodec_LIBRARY)
IF(FFMPEG_avutil_LIBRARY)
SET( FFMPEG_FOUND "YES" )
SET( FFMPEG_BASIC_LIBRARIES
${FFMPEG_avcodec_LIBRARY}
${FFMPEG_avformat_LIBRARY}
${FFMPEG_avutil_LIBRARY}
)
SET( FFMPEG_LIBRARIES
${FFMPEG_BASIC_LIBRARIES}
${FFMPEG_vorbis_LIBRARY}
${FFMPEG_dc1394_LIBRARY}
${FFMPEG_vorbisenc_LIBRARY}
${FFMPEG_theora_LIBRARY}
${FFMPEG_dts_LIBRARY}
${FFMPEG_gsm_LIBRARY}
${FFMPEG_z_LIBRARY})
ENDIF(FFMPEG_avutil_LIBRARY)
ENDIF(FFMPEG_avcodec_LIBRARY)
ENDIF(FFMPEG_avformat_LIBRARY)
ENDIF(FFMPEG_INCLUDE_DIR)
MARK_AS_ADVANCED(
FFMPEG_INCLUDE_DIR
FFMPEG_avformat_LIBRARY
FFMPEG_avcodec_LIBRARY
FFMPEG_avutil_LIBRARY
FFMPEG_vorbis_LIBRARY
FFMPEG_dc1394_LIBRARY
FFMPEG_vorbisenc_LIBRARY
FFMPEG_theora_LIBRARY
FFMPEG_dts_LIBRARY
FFMPEG_gsm_LIBRARY
FFMPEG_z_LIBRARY
)
......@@ -1339,6 +1339,16 @@ FIND_PATH(VTK_DATA_ROOT VTKData.readme
${VTK_SOURCE_DIR}/../../VTKData
$ENV{VTK_DATA_ROOT})
#-----------------------------------------------------------------------------
# FFMPEG
# If the ffmpeg library is available, use it.
IF (NOT VTK_USE_VIDEO_FOR_WINDOWS)
INCLUDE(${VTK_SOURCE_DIR}/CMake/FindFFMPEG.cmake OPTIONAL)
IF(FFMPEG_FOUND)
SET(VTK_USE_FFMPEG_ENCODER CACHE BOOL "If the FFMPEG library is available, should VTK use it for saving .avi animation files?")
ENDIF(FFMPEG_FOUND)
ENDIF (NOT VTK_USE_VIDEO_FOR_WINDOWS)
#-----------------------------------------------------------------------------
# Configure files with settings for use by the build.
CONFIGURE_FILE(${VTK_SOURCE_DIR}/vtkConfigure.h.in
......
......@@ -184,6 +184,15 @@ IF(WIN32)
ENDIF(VTK_USE_VIDEO_FOR_WINDOWS)
ENDIF(WIN32)
#-----------------------------------------------------------------------------
# FFMPEG
# If the ffmpeg library is available, compile vtkFFMPEGWriter.
IF (VTK_USE_FFMPEG_ENCODER)
INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIR})
SET(Kit_SRCS ${Kit_SRCS} vtkFFMPEGWriter.cxx)
SET(KIT_LIBS ${KIT_LIBS} ${FFMPEG_BASIC_LIBRARIES})
ENDIF (VTK_USE_FFMPEG_ENCODER)
# Include mpeg2 writer if the mpeg2 lib has been defined
IF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
......@@ -192,27 +201,6 @@ IF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
SET(KIT_LIBS ${KIT_LIBS} vtkMPEG2Encode)
ENDIF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
# If the ffmpeg library is available, compile vtkFFMPEGWriter.
IF (NOT VTK_USE_VIDEO_FOR_WINDOWS)
SET (FFMPEG_INCLUDE_PATH CACHE PATH "Location of the ffmpeg header files avformat.h and avcodec.h")
MARK_AS_ADVANCED (FFMPEG_INCLUDE_PATH)
SET (FFMPEG_LIBRARY_PATH CACHE PATH "Location of the ffmpeg library files ${CMAKE_SHARED_LIBRARY_PREFIX}avformat${CMAKE_SHARED_LIBRARY_SUFFIX} and ${CMAKE_SHARED_LIBRARY_PREFIX}avcodec${CMAKE_SHARED_LIBRARY_SUFFIX}")
MARK_AS_ADVANCED (FFMPEG_LIBRARY_PATH)
IF (FFMPEG_INCLUDE_PATH AND FFMPEG_LIBRARY_PATH)
SET(Kit_SRCS ${Kit_SRCS} vtkFFMPEGWriter.cxx)
INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_PATH})
SET(KIT_LIBS ${KIT_LIBS} ${FFMPEG_LIBRARY_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avformat${CMAKE_SHARED_LIBRARY_SUFFIX} ${FFMPEG_LIBRARY_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avcodec${CMAKE_SHARED_LIBRARY_SUFFIX})
SET(VTK_USE_FFMPEG_ENCODER ON CACHE INTERNAL "" FORCE)
ELSE (FFMPEG_INCLUDE_PATH AND FFMPEG_LIBRARY_PATH)
SET(VTK_USE_FFMPEG_ENCODER OFF CACHE INTERNAL "" FORCE)
ENDIF (FFMPEG_INCLUDE_PATH AND FFMPEG_LIBRARY_PATH)
ENDIF (NOT VTK_USE_VIDEO_FOR_WINDOWS)
SET_SOURCE_FILES_PROPERTIES(
vtkPLY
vtkXMLWriterC
......
......@@ -20,7 +20,7 @@
#include "vtkErrorCode.h"
extern "C" {
#include <avformat.h>
#include <ffmpeg/avformat.h>
}
//---------------------------------------------------------------------------
......@@ -352,7 +352,7 @@ void vtkFFMPEGWriterInternal::End()
//---------------------------------------------------------------------------
vtkStandardNewMacro(vtkFFMPEGWriter);
vtkCxxRevisionMacro(vtkFFMPEGWriter, "1.1.2.1");
vtkCxxRevisionMacro(vtkFFMPEGWriter, "1.1.2.2");
//---------------------------------------------------------------------------
vtkFFMPEGWriter::vtkFFMPEGWriter()
......
......@@ -17,7 +17,13 @@
// vtkFFMPEGWriter is an adapter that allows VTK to use the LGPL'd FFMPEG
// library to write movie files. FFMPEG can create a variety of multimedia
// file formats and can use a variety of encoding algorithms (codecs).
// This class creates .avi files containing MP43 encoded video without audio.
// This class creates .avi files containing MP43 encoded video without
// audio.
//
// The FFMPEG multimedia library source code can be obtained from
// the sourceforge web site at http://ffmpeg.sourceforge.net/download.php
// or is a tarball along with installation instructions at
// http://www.vtk.org/files/support/ffmpeg_source.tar.gz
//
// .SECTION See Also vtkGenericMovieWriter vtkAVIWriter vtkMPEG2Writer
......
......@@ -89,7 +89,7 @@
/* Whether Tk widgets are NOT initialized when vtkRendering loads. */
#cmakedefine VTK_USE_TK
/* Wheter the Tcl/Tk support files are copied to the build dir */
/* Whether the Tcl/Tk support files are copied to the build dir */
#cmakedefine VTK_TCL_TK_COPY_SUPPORT_LIBRARY
/* Configure internal Tk headers. */
......
......@@ -89,6 +89,9 @@
/* Whether the real python debug library has been provided. */
#cmakedefine VTK_WINDOWS_PYTHON_DEBUGGABLE
/* Whether FFMPEG is found or not */
#cmakedefine VTK_USE_FFMPEG_ENCODER
/*--------------------------------------------------------------------------*/
/* Setup VTK based on platform features and configuration. */
......
Supports Markdown
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