Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First ffmpeg reader #928

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ set (USE_QT ON CACHE BOOL "Include Qt support")
set (FORCE_OPENGL_1 OFF CACHE BOOL "Force iv to use OpenGL's fixed pipeline")
set (USE_PYTHON ON CACHE BOOL "Build the Python bindings")
set (USE_FIELD3D ON CACHE BOOL "Use Field3D if found")
set (USE_FFMPEG ON CACHE BOOL "Use FFmpeg if found")
set (USE_OPENJPEG ON CACHE BOOL "Use OpenJpeg if found")
set (USE_OCIO ON CACHE BOOL "Use OpenColorIO for color management if found")
set (USE_OPENCV ON CACHE BOOL "Use OpenCV if found")
Expand Down Expand Up @@ -314,6 +315,7 @@ if (NOT EMBEDPLUGINS)
add_subdirectory (src/cineon.imageio)
add_subdirectory (src/dds.imageio)
add_subdirectory (src/dpx.imageio)
add_subdirectory (src/ffmpeg.imageio)
add_subdirectory (src/field3d.imageio)
add_subdirectory (src/fits.imageio)
add_subdirectory (src/gif.imageio)
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ ifneq (${PYTHON_VERSION},)
MY_CMAKE_FLAGS += -DPYTHON_VERSION:STRING=${PYTHON_VERSION}
endif

ifneq (${USE_FFMPEG},)
MY_CMAKE_FLAGS += -DUSE_FFMPEG:BOOL=${USE_FFMPEG}
endif

ifneq (${USE_FIELD3D},)
MY_CMAKE_FLAGS += -DUSE_FIELD3D:BOOL=${USE_FIELD3D}
endif
Expand Down Expand Up @@ -339,6 +343,7 @@ help:
@echo " make FORCE_OPENGL_1=1 ... Force iv to use OpenGL's fixed pipeline"
@echo " make USE_PYTHON=0 ... Don't build the Python binding"
@echo " make PYTHON_VERSION=2.6 ... Specify the Python version"
@echo " make USE_FFMPEG=0 ... Don't build the FFmpeg plugin"
@echo " make USE_FIELD3D=0 ... Don't build the Field3D plugin"
@echo " make USE_OPENJPEG=0 ... Don't build the JPEG-2000 plugin"
@echo " make USE_GIF=0 ... Don't build the GIF plugin"
Expand Down
20 changes: 20 additions & 0 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,26 @@ endif (USE_OPENGL)
###########################################################################


###########################################################################
# FFmpeg

if (USE_FFMPEG)
find_package (FFmpeg)
if (FFMPEG_INCLUDE_DIR AND FFMPEG_LIBRARIES)
set (FFMPEG_FOUND TRUE)
if (VERBOSE)
message (STATUS "FFMPEG includes = ${FFMPEG_INCLUDE_DIR}")
message (STATUS "FFMPEG library = ${FFMPEG_LIBRARIES}")
endif ()
else ()
message (STATUS "FFMPEG not found")
endif ()
endif()

# end FFmpeg setup
###########################################################################


###########################################################################
# Field3d

Expand Down
85 changes: 85 additions & 0 deletions src/cmake/modules/FindFFmpeg.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil)
# Once done this will define
#
# FFMPEG_FOUND - system has ffmpeg or libav
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
# FFMPEG_LIBRARIES - Link these to use ffmpeg
# FFMPEG_LIBAVCODEC
# FFMPEG_LIBAVFORMAT
# FFMPEG_LIBAVUTIL
#
# Copyright (c) 2008 Andreas Schneider <[email protected]>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
# Modified for Hedgewars by Stepik777
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
#

if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
# in cache already
set(FFMPEG_FOUND TRUE)
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
pkg_check_modules(_FFMPEG_AVUTIL libavutil)
pkg_check_modules(_FFMPEG_SWSCALE libswscale)
endif (PKG_CONFIG_FOUND)

find_path(FFMPEG_AVCODEC_INCLUDE_DIR
NAMES libavcodec/avcodec.h
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
PATH_SUFFIXES ffmpeg libav
)

find_library(FFMPEG_LIBAVCODEC
NAMES avcodec
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)

find_library(FFMPEG_LIBAVFORMAT
NAMES avformat
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)

find_library(FFMPEG_LIBAVUTIL
NAMES avutil
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)

find_library(FFMPEG_LIBSWSCALE
NAMES swscale
PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)

if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
set(FFMPEG_FOUND TRUE)
endif()

if (FFMPEG_FOUND)
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})

set(FFMPEG_LIBRARIES
${FFMPEG_LIBAVCODEC}
${FFMPEG_LIBAVFORMAT}
${FFMPEG_LIBAVUTIL}
${FFMPEG_LIBSWSCALE}
)

endif (FFMPEG_FOUND)

if (FFMPEG_FOUND)
if (NOT FFMPEG_FIND_QUIETLY)
message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
endif (NOT FFMPEG_FIND_QUIETLY)
else (FFMPEG_FOUND)
if (FFMPEG_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil or libswscale")
endif (FFMPEG_FIND_REQUIRED)
endif (FFMPEG_FOUND)

endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
10 changes: 10 additions & 0 deletions src/ffmpeg.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if (USE_FFMPEG)
if (FFMPEG_FOUND)
include_directories (${FFMPEG_INCLUDE_DIR})
add_oiio_plugin (ffmpeginput.cpp ffmpegoutput.cpp
LINK_LIBRARIES ${FFMPEG_LIBRARY}
)
else()
message (STATUS "FFmpeg not found: ffmpeg plugin will not be built")
endif()
endif()
Loading