Commit 608f1131 authored by David Cole's avatar David Cole
Browse files

ENH: Remove building the MPEG2 library from VTK's build instructions. This...

ENH: Remove building the MPEG2 library from VTK's build instructions. This library has patents associated with it, so it should not be *included* in VTK. Make it available separately for clients who are willing to accept using patented code. Change use of the MPEG2 library to be based on a CMake configure-time option: VTK_USE_MPEG2_ENCODER. This set of changes is to conform with VTK's "patent free" policy which prohibits including patented code in the VTK source tree.
parent 8801112d
......@@ -23,7 +23,6 @@ ENDIF("@CMAKE_SYSTEM@" MATCHES "OSF")
SET(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
"Utilities/vtktiff/"
"[Uu]tilities[/\\\\]vtkmpeg2encode"
"xtree.[0-9]+. : warning C4702: unreachable code"
"warning LNK4221"
"variable .var_args[2]*. is used before its value is set"
......
#
# Find the MPEG2 includes and library
#
# This module (forces the user to) provide:
# vtkMPEG2Encode_INCLUDE_PATH, for use with INCLUDE_DIRECTORIES commands
# vtkMPEG2Encode_LIBRARIES, for use with TARGET_LINK_LIBRARIES commands
#
# If VTK_USE_MPEG2_ENCODER is ON, it is an error to end up with empty values
# for vtkMPEG2Encode_INCLUDE_PATH or vtkMPEG2Encode_LIBRARIES.
# The only way to fix this error, if it occurs, is to provide non-empty
# values or to turn OFF VTK_USE_MPEG2_ENCODER.
#
# Cache NOTFOUND initial values. The user will have to provide them unless
# they were provided in the initial cache.
# vtkMPEG2Encode_INCLUDE_PATH should be "/path/to/source;/path/to/binary"
# where source contains "mpeg2enc.h" and binary contains "mpeg2encDllConfig.h"
#
SET(vtkMPEG2Encode_INCLUDE_PATH "vtkMPEG2Encode_INCLUDE_PATH-NOTFOUND" CACHE STRING "Semi-colon delimited list of paths to vtkmpeg2encode header files")
# vtkMPEG2Encode_LIBRARIES should be "/path/to/binary/vtkMPEG2Encode.lib"
#
SET(vtkMPEG2Encode_LIBRARIES "vtkMPEG2Encode_LIBRARIES-NOTFOUND" CACHE STRING "Semi-colon delimited list of vtkMPEG2Encode library full path names")
# Error if values are empty:
#
IF(VTK_USE_MPEG2_ENCODER)
IF(NOT vtkMPEG2Encode_INCLUDE_PATH)
MESSAGE(SEND_ERROR "Could not determine value for vtkMPEG2Encode_INCLUDE_PATH. Provide value or turn off VTK_USE_MPEG2_ENCODER. Value should be a semi-colon delimited list of paths to vtkmpeg2encode header files.")
ENDIF(NOT vtkMPEG2Encode_INCLUDE_PATH)
IF(NOT vtkMPEG2Encode_LIBRARIES)
MESSAGE(SEND_ERROR "Could not determine value for vtkMPEG2Encode_LIBRARIES. Provide value or turn off VTK_USE_MPEG2_ENCODER. Value should be a semi-colon delimited list of vtkMPEG2Encode library full path names.")
ENDIF(NOT vtkMPEG2Encode_LIBRARIES)
ENDIF(VTK_USE_MPEG2_ENCODER)
......@@ -1432,6 +1432,37 @@ IF (VTK_USE_FFMPEG_ENCODER)
INCLUDE(${VTK_SOURCE_DIR}/CMake/FindFFMPEG.cmake OPTIONAL)
ENDIF (VTK_USE_FFMPEG_ENCODER)
#-----------------------------------------------------------------------------
# MPEG2
#
# Portions of the mpeg2 library are patented. VTK does not enable linking to
# this library by default so VTK can remain "patent free". Users who wish to
# link in mpeg2 functionality must build that library separately and then
# turn on VTK_USE_MPEG2_ENCODER when configuring VTK. After turning on
# VTK_USE_MPEG2_ENCODER, you must also set the CMake variables
# vtkMPEG2Encode_INCLUDE_PATH and vtkMPEG2Encode_LIBRARIES.
#
# To use the patented mpeg2 library, first build it, then set the following
# CMake variables during the VTK configure step:
# VTK_USE_MPEG2_ENCODER = ON
# vtkMPEG2Encode_INCLUDE_PATH = /path/to/vtkmpeg2encode;/path/to/vtkmpeg2encode-bin
# vtkMPEG2Encode_LIBRARIES = /path/to/vtkmpeg2encode-bin/vtkMPEG2Encode.lib
#
# Or using -D args on the cmake/ccmake command line:
# -DVTK_USE_MPEG2_ENCODER:BOOL=ON
# "-DvtkMPEG2Encode_INCLUDE_PATH:PATH=/path/to/vtkmpeg2encode;/path/to/vtkmpeg2encode-bin"
# "-DvtkMPEG2Encode_LIBRARIES:STRING=/path/to/vtkmpeg2encode-bin/vtkMPEG2Encode.lib"
#
# You are solely responsible for any legal issues associated with using
# patented code in your software.
#
OPTION (VTK_USE_MPEG2_ENCODER
"Enable use of the patented mpeg2 library. You are solely responsible for any legal issues associated with using patented code in your software."
OFF)
IF (VTK_USE_MPEG2_ENCODER)
INCLUDE(${VTK_SOURCE_DIR}/CMake/FindMPEG2.cmake OPTIONAL)
ENDIF (VTK_USE_MPEG2_ENCODER)
#-----------------------------------------------------------------------------
# Configure files with settings for use by the build.
CONFIGURE_FILE(${VTK_SOURCE_DIR}/vtkConfigure.h.in
......
......@@ -221,14 +221,20 @@ IF (VTK_USE_FFMPEG_ENCODER)
${FFMPEG_avutil_LIBRARY})
ENDIF (VTK_USE_FFMPEG_ENCODER)
# Include mpeg2 writer if the mpeg2 lib has been defined
IF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
SET(Kit_SRCS ${Kit_SRCS} vtkMPEG2Writer.cxx)
#-----------------------------------------------------------------------------
# MPEG2
#
# Only include the vtkMPEG2Writer if the user has explicitly turned on
# VTK_USE_MPEG2_ENCODER. If so, user should also have set
# vtkMPEG2Encode_INCLUDE_PATH and vtkMPEG2Encode_LIBRARIES.
#
IF (VTK_USE_MPEG2_ENCODER)
INCLUDE_DIRECTORIES(${vtkMPEG2Encode_INCLUDE_PATH})
SET(KIT_LIBS ${KIT_LIBS} vtkMPEG2Encode)
ENDIF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
SET(Kit_SRCS ${Kit_SRCS} vtkMPEG2Writer.cxx)
SET(KIT_LIBS ${KIT_LIBS} ${vtkMPEG2Encode_LIBRARIES})
ENDIF (VTK_USE_MPEG2_ENCODER)
#-----------------------------------------------------------------------------
SET_SOURCE_FILES_PROPERTIES(
vtkPLY
vtkXMLWriterC
......
......@@ -2,11 +2,11 @@ SET(KIT IO)
SET(ConditionalTests)
IF(WIN32 AND VTK_USE_VIDEO_FOR_WINDOWS)
SET(ConditionalTests TestAVIWriter.cxx)
SET(ConditionalTests ${ConditionalTests} TestAVIWriter.cxx)
ENDIF(WIN32 AND VTK_USE_VIDEO_FOR_WINDOWS)
IF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
IF(VTK_USE_MPEG2_ENCODER)
SET(ConditionalTests ${ConditionalTests} TestMovieWriter.cxx)
ENDIF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
ENDIF(VTK_USE_MPEG2_ENCODER)
IF(VTK_USE_FFMPEG_ENCODER)
SET(ConditionalTests ${ConditionalTests} TestFFMPEGWriter.cxx)
ENDIF(VTK_USE_FFMPEG_ENCODER)
......@@ -45,13 +45,11 @@ ENDIF (VTK_DATA_ROOT)
IF(WIN32 AND VTK_USE_VIDEO_FOR_WINDOWS)
ADD_TEST(TestAVIWriter ${CXX_TEST_PATH}/${KIT}CxxTests TestAVIWriter)
ENDIF(WIN32 AND VTK_USE_VIDEO_FOR_WINDOWS)
IF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
IF(VTK_USE_MPEG2_ENCODER)
ADD_TEST(TestMovieWriter ${CXX_TEST_PATH}/${KIT}CxxTests TestMovieWriter)
ENDIF(DEFINED vtkMPEG2Encode_INCLUDE_PATH)
ENDIF(VTK_USE_MPEG2_ENCODER)
IF(VTK_USE_FFMPEG_ENCODER)
ADD_TEST(TestFFMPEGWriter ${CXX_TEST_PATH}/${KIT}CxxTests TestFFMPEGWriter)
ENDIF(VTK_USE_FFMPEG_ENCODER)
ADD_TEST(TestDataObjectIO ${CXX_TEST_PATH}/${KIT}CxxTests TestDataObjectIO)
......@@ -13,11 +13,30 @@
=========================================================================*/
// .NAME vtkMPEG2Writer - Writes MPEG2 Movie files.
//
// .SECTION Description
// vtkMPEG2Writer writes Movie files. The data type
// of the file is unsigned char regardless of the input type.
//
// This class is conditionally compiled into VTK only if VTK's CMake
// option VTK_USE_MPEG2_ENCODER is ON. It is OFF by default.
//
// Portions of the mpeg2 library are patented. VTK does not enable linking to
// this library by default so VTK can remain "patent free". Users who wish to
// link in mpeg2 functionality must build that library separately and then
// turn on VTK_USE_MPEG2_ENCODER when configuring VTK. After turning on
// VTK_USE_MPEG2_ENCODER, you must also set the CMake variables
// vtkMPEG2Encode_INCLUDE_PATH and vtkMPEG2Encode_LIBRARIES.
//
// You are solely responsible for any legal issues associated with using
// patented code in your software.
//
// You can download a "CMake-ified" source tree of the MPEG2 library by
// visiting the download page at http://www.vtk.org and scrolling down to
// the "Download Additional Components" section.
//
// .SECTION See Also
// vtkGenericMovieWriter vtkAVIWriter
// vtkGenericMovieWriter vtkAVIWriter vtkFFMPEGWriter
#ifndef __vtkMPEG2Writer_h
#define __vtkMPEG2Writer_h
......@@ -34,14 +53,14 @@ public:
static vtkMPEG2Writer *New();
vtkTypeRevisionMacro(vtkMPEG2Writer,vtkGenericMovieWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// These methods start writing an Movie file, write a frame to the file
// and then end the writing process.
void Start();
void Write();
void End();
protected:
vtkMPEG2Writer();
~vtkMPEG2Writer();
......@@ -63,6 +82,3 @@ private:
};
#endif
......@@ -21,7 +21,6 @@ SET( verdict_INSTALL_INCLUDE_DIR ${VTK_INSTALL_INCLUDE_DIR_CM24})
SET( verdict_INSTALL_BIN_DIR ${VTK_INSTALL_BIN_DIR_CM24})
SET( verdict_INSTALL_LIB_DIR ${VTK_INSTALL_LIB_DIR_CM24})
SUBDIRS(vtkmpeg2encode)
SUBDIRS(verdict)
SUBDIRS(vtknetcdf)
......
......@@ -6,7 +6,7 @@ INCLUDE_REGULAR_EXPRESSION("^.*$")
# directory so that it gets built and then you will use the following variables
# in your CMakeLists files to get the proper include paths and libraries
SET (vtkMPEG2Encode_INCLUDE_PATH
"${vtkMPEG2Encode_SOURCE_DIR}"
"${vtkMPEG2Encode_SOURCE_DIR};${vtkMPEG2Encode_BINARY_DIR}"
CACHE INTERNAL "include paths for vtkMPEG2Encode"
)
SET (vtkMPEG2Encode_LIBRARIES vtkMPEG2Encode
......@@ -28,8 +28,6 @@ SET(srcs
idct.c predict.c putmpg.c putvlc.c readpic.c writepic.c
)
ADD_LIBRARY(vtkMPEG2Encode ${srcs})
ADD_DEFINITIONS(-DVTK_IN_MPEG2ENC)
IF(NOT BUILD_SHARED_LIBS)
SET(VTK_MPEG2ENC_STATIC 1)
......@@ -40,14 +38,22 @@ CONFIGURE_FILE(${vtkMPEG2Encode_SOURCE_DIR}/.NoDartCoverage
CONFIGURE_FILE(${vtkMPEG2Encode_SOURCE_DIR}/mpeg2encDllConfig.h.in
${vtkMPEG2Encode_BINARY_DIR}/mpeg2encDllConfig.h)
INCLUDE_DIRECTORIES(${vtkMPEG2Encode_INCLUDE_PATH})
ADD_LIBRARY(vtkMPEG2Encode ${srcs})
# Apply user-defined properties to the library target.
IF(VTK_LIBRARY_PROPERTIES)
SET_TARGET_PROPERTIES(vtkMPEG2Encode PROPERTIES ${VTK_LIBRARY_PROPERTIES})
ENDIF(VTK_LIBRARY_PROPERTIES)
IF(NOT VTK_INSTALL_NO_LIBRARIES)
IF(VTK_INSTALL_BIN_DIR_CM24)
IF(VTK_INSTALL_LIB_DIR_CM24)
INSTALL(TARGETS vtkMPEG2Encode
RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT Development)
ENDIF(VTK_INSTALL_LIB_DIR_CM24)
ENDIF(VTK_INSTALL_BIN_DIR_CM24)
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
#-----------------------------------------------------------------------------
# vtkmpeg2encode
#-----------------------------------------------------------------------------
This source tree for the mpeg2 library is designed to be built as a
standalone library using CMake. This is an implementation specifically
designed to link into VTK. It is not included directly with any VTK
distributions because VTK has a "patent free" policy which prohibits
including patented code in the VTK source tree...
First, build the vtkMPEG2Encode library using CMake to configure the build.
Then, assuming you are willing to take on the responsibility of including
patented code in your software project, you can turn on the
VTK_USE_MPEG2_ENCODER option and link vtkMPEG2Encode into your build of VTK
to enable the vtkMPEG2Writer class.
See the comments at the top of the source code files for the disclaimer of
warranty and comments regarding royalty payments to MPEG patent holders.
The following comments are copied from VTK's main CMakeLists.txt file -
these comments appear just prior to the definition of the
VTK_USE_MPEG2_ENCODER CMake option.
#-----------------------------------------------------------------------------
# MPEG2
#
# Portions of the mpeg2 library are patented. VTK does not enable linking to
# this library by default so VTK can remain "patent free". Users who wish to
# link in mpeg2 functionality must build that library separately and then
# turn on VTK_USE_MPEG2_ENCODER when configuring VTK. After turning on
# VTK_USE_MPEG2_ENCODER, you must also set the CMake variables
# vtkMPEG2Encode_INCLUDE_PATH and vtkMPEG2Encode_LIBRARIES.
#
# To use the patented mpeg2 library, first build it, then set the following
# CMake variables during the VTK configure step:
# VTK_USE_MPEG2_ENCODER = ON
# vtkMPEG2Encode_INCLUDE_PATH = /path/to/vtkmpeg2encode;/path/to/vtkmpeg2encode-bin
# vtkMPEG2Encode_LIBRARIES = /path/to/vtkmpeg2encode-bin/vtkMPEG2Encode.lib
#
# Or using -D args on the cmake/ccmake command line:
# -DVTK_USE_MPEG2_ENCODER:BOOL=ON
# "-DvtkMPEG2Encode_INCLUDE_PATH:PATH=/path/to/vtkmpeg2encode;/path/to/vtkmpeg2encode-bin"
# "-DvtkMPEG2Encode_LIBRARIES:STRING=/path/to/vtkmpeg2encode-bin/vtkMPEG2Encode.lib"
#
# You are solely responsible for any legal issues associated with using
# patented code in your software.
#
#-----------------------------------------------------------------------------
......@@ -30,7 +30,7 @@
extern "C" {
#endif
#include <vtkmpeg2encode/mpeg2encDllConfig.h>
#include <mpeg2encDllConfig.h>
/* VTK_MPEG2ENC_EXPORT designates exported functions...
*/
......
......@@ -95,6 +95,9 @@
/* Whether FFMPEG is found or not */
#cmakedefine VTK_USE_FFMPEG_ENCODER
/* Whether the user has linked in the MPEG2 library or not */
#cmakedefine VTK_USE_MPEG2_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