Skip to content

Commit

Permalink
Merge pull request opencv#13074 from alalek:cleanup_videoio
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek authored Nov 8, 2018
2 parents 35c7cab + 5869415 commit ebc8015
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 4,640 deletions.
20 changes: 1 addition & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT)
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" ON IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" ON IF (NOT IOS AND NOT APPLE) )
OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" (NOT CV_DISABLE_OPTIMIZATION) IF (NOT WINRT AND NOT CMAKE_CROSSCOMPILING) )
OCV_OPTION(WITH_VFW "Include Video for Windows support" ON IF WIN32 )
OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF )
Expand All @@ -253,14 +252,11 @@ OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" OFF
OCV_OPTION(WITH_ARAVIS "Include Aravis GigE support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT WIN32) )
OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 AND NOT WINRT)
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O (OBSOLETE)" OFF IF APPLE )
OCV_OPTION(WITH_QTKIT "Use QTKit Video I/O backend" OFF IF APPLE )
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_HPX "Include Ste||ar Group HPX support" OFF)
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON IF (NOT WIN32 OR MINGW) )
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID AND NOT APPLE) )
OCV_OPTION(WITH_LIBV4L "Use libv4l for Video 4 Linux support" OFF IF (UNIX AND NOT ANDROID AND NOT APPLE) )
OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON IF (WIN32 AND NOT ARM AND NOT WINRT) )
Expand Down Expand Up @@ -1245,15 +1241,9 @@ endif()
status("")
status(" Video I/O:")

if(WITH_VFW OR HAVE_VFW)
status(" Video for Windows:" HAVE_VFW THEN YES ELSE NO)
endif()

if(WITH_1394 OR HAVE_DC1394)
if(WITH_1394 OR HAVE_DC1394_2)
if (HAVE_DC1394_2)
status(" DC1394:" "YES (ver ${ALIASOF_libdc1394-2_VERSION})")
elseif (HAVE_DC1394)
status(" DC1394:" "YES (ver ${ALIASOF_libdc1394_VERSION})")
else()
status(" DC1394:" "NO")
endif()
Expand Down Expand Up @@ -1311,14 +1301,6 @@ if(APPLE)
if(WITH_QUICKTIME OR HAVE_QUICKTIME)
status(" QuickTime:" HAVE_QUICKTIME THEN YES ELSE NO)
endif()
if(WITH_QTKIT OR HAVE_QTKIT)
status(" QTKit:" HAVE_QTKIT THEN "YES (deprecated)" ELSE NO)
endif()
endif()

if(WITH_UNICAP OR HAVE_UNICAP)
status(" UniCap:" HAVE_UNICAP THEN "YES (ver ${ALIASOF_libunicap_VERSION})" ELSE NO)
status(" UniCap ucil:" HAVE_UNICAP_UCIL THEN "YES (ver ${ALIASOF_libucil_VERSION})" ELSE NO)
endif()

if(WITH_V4L OR WITH_LIBV4L OR HAVE_LIBV4L OR HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
Expand Down
29 changes: 0 additions & 29 deletions cmake/OpenCVFindLibsVideo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
# Detect 3rd-party video IO libraries
# ----------------------------------------------------------------------------

ocv_clear_vars(HAVE_VFW)
if(WITH_VFW)
try_compile(HAVE_VFW
"${OpenCV_BINARY_DIR}"
"${OpenCV_SOURCE_DIR}/cmake/checks/vfwtest.cpp"
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=vfw32")
endif(WITH_VFW)

# --- GStreamer ---
ocv_clear_vars(HAVE_GSTREAMER)
# try to find gstreamer 1.x first if 0.10 was not requested
Expand Down Expand Up @@ -62,16 +54,6 @@ if(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)
endif()
endif(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)

# --- unicap ---
ocv_clear_vars(HAVE_UNICAP)
if(WITH_UNICAP)
CHECK_MODULE(libunicap HAVE_UNICAP_ VIDEOIO)
CHECK_MODULE(libucil HAVE_UNICAP_UCIL VIDEOIO)
if(HAVE_UNICAP_ AND HAVE_UNICAP_UCIL)
set(HAVE_UNICAP TRUE)
endif()
endif(WITH_UNICAP)

# --- PvApi ---
ocv_clear_vars(HAVE_PVAPI)
if(WITH_PVAPI)
Expand Down Expand Up @@ -286,12 +268,8 @@ endif(WITH_MSMF)
# --- Extra HighGUI and VideoIO libs on Windows ---
if(WIN32)
list(APPEND HIGHGUI_LIBRARIES comctl32 gdi32 ole32 setupapi ws2_32)
if(HAVE_VFW)
list(APPEND VIDEOIO_LIBRARIES vfw32)
endif()
if(MINGW64)
list(APPEND VIDEOIO_LIBRARIES avifil32 avicap32 winmm msvfw32)
list(REMOVE_ITEM VIDEOIO_LIBRARIES vfw32)
elseif(MINGW)
list(APPEND VIDEOIO_LIBRARIES winmm)
endif()
Expand All @@ -301,13 +279,6 @@ if(APPLE)
if(WITH_AVFOUNDATION)
set(HAVE_AVFOUNDATION YES)
endif()
if(NOT IOS)
if(WITH_QUICKTIME)
set(HAVE_QUICKTIME YES)
elseif(WITH_QTKIT)
set(HAVE_QTKIT YES)
endif()
endif()
endif(APPLE)

# --- Intel librealsense ---
Expand Down
10 changes: 0 additions & 10 deletions cmake/checks/vfwtest.cpp

This file was deleted.

16 changes: 0 additions & 16 deletions cmake/templates/cvconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@
/* Qt OpenGL support */
#cmakedefine HAVE_QT_OPENGL

/* QuickTime video libraries */
#cmakedefine HAVE_QUICKTIME

/* QTKit video libraries */
#cmakedefine HAVE_QTKIT

/* Intel Threading Building Blocks */
#cmakedefine HAVE_TBB

Expand All @@ -178,12 +172,6 @@
/* TIFF codec */
#cmakedefine HAVE_TIFF

/* Unicap video capture library */
#cmakedefine HAVE_UNICAP

/* Video for Windows support */
#cmakedefine HAVE_VFW

/* V4L2 capturing support in videoio.h */
#cmakedefine HAVE_VIDEOIO

Expand Down Expand Up @@ -223,8 +211,6 @@

#if defined(HAVE_XINE) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_QTKIT) || \
defined(HAVE_AVFOUNDATION) || \
/*defined(HAVE_OPENNI) || too specialized */ \
defined(HAVE_FFMPEG) || \
Expand All @@ -234,8 +220,6 @@

#if /*defined(HAVE_XINE) || */\
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_QTKIT) || \
defined(HAVE_AVFOUNDATION) || \
defined(HAVE_FFMPEG) || \
defined(HAVE_MSMF)
Expand Down
24 changes: 0 additions & 24 deletions modules/videoio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ if(HAVE_MFX)
list(APPEND VIDEOIO_LIBRARIES mfx)
endif()

if(WIN32 AND NOT ARM)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_cmu.cpp)
endif()

if (WIN32 AND HAVE_DSHOW)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dshow.cpp)
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dshow.hpp)
Expand All @@ -93,10 +89,6 @@ if (WIN32 AND HAVE_MSMF)
endif()
endif()

if (WIN32 AND HAVE_VFW)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_vfw.cpp)
endif()

if(HAVE_XINE)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_xine.cpp)
endif(HAVE_XINE)
Expand All @@ -105,10 +97,6 @@ if(HAVE_DC1394_2)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dc1394_v2.cpp)
endif(HAVE_DC1394_2)

if(HAVE_DC1394)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dc1394.cpp)
endif(HAVE_DC1394)

if(HAVE_GSTREAMER)
IF(WIN32)
INCLUDE_DIRECTORIES(${GSTREAMER_INCLUDE_DIR})
Expand All @@ -117,10 +105,6 @@ if(HAVE_GSTREAMER)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_gstreamer.cpp)
endif(HAVE_GSTREAMER)

if(HAVE_UNICAP)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_unicap.cpp)
endif(HAVE_UNICAP)

if(HAVE_LIBV4L)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_libv4l.cpp)
elseif(HAVE_CAMV4L2 OR HAVE_VIDEOIO)
Expand Down Expand Up @@ -206,14 +190,6 @@ if(HAVE_AVFOUNDATION)
endif()
endif()

if(HAVE_QUICKTIME)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_qt.cpp)
list(APPEND VIDEOIO_LIBRARIES "-framework Carbon" "-framework QuickTime" "-framework CoreFoundation" "-framework QuartzCore")
elseif(HAVE_QTKIT)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_qtkit.mm)
list(APPEND VIDEOIO_LIBRARIES "-framework QTKit" "-framework QuartzCore" "-framework AppKit")
endif()

if(HAVE_INTELPERC)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_intelperc.cpp)
ocv_include_directories(${INTELPERC_INCLUDE_DIR})
Expand Down
6 changes: 3 additions & 3 deletions modules/videoio/doc/videoio_overview.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ I/O APIs used as backend.

![Video I/O with OpenCV](pics/videoio_overview.svg)

Some backends such as (DSHOW) Direct Show, Video For Windows (VFW), Microsoft Media Foundation (MSMF),
Some backends such as (DSHOW) Direct Show, Microsoft Media Foundation (MSMF),
Video 4 Linux (V4L), etc... are interfaces to the video I/O library provided by the operating system.

Some others backends like OpenNI2 for Kinect, Intel Perceptual Computing SDK, GStreamer,
Expand Down Expand Up @@ -62,11 +62,11 @@ cap.open(filename, cv::CAP_DSHOW);
Backends are available only if they have been built with your OpenCV binaries.

Check in `opencv2/cvconfig.h` to know which APIs are currently available
(e.g. `HAVE_MSMF, HAVE_VFW, HAVE_LIBV4L`, etc...).
(e.g. `HAVE_MSMF, HAVE_V4L2`, etc...).

To enable/disable APIs, you have to:
1. re-configure OpenCV using appropriates CMake switches
(e.g. `-DWITH_MSMF=ON -DWITH_VFW=ON ... `) or checking related switch in cmake-gui
(e.g. `-DWITH_MSMF=ON -DWITH_DSHOW=ON ... `) or checking related switch in cmake-gui
2. rebuild OpenCV itself

#### Use 3rd party drivers or cameras
Expand Down
18 changes: 9 additions & 9 deletions modules/videoio/include/opencv2/videoio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ See @ref videoio_overview for more information.
*/
enum VideoCaptureAPIs {
CAP_ANY = 0, //!< Auto detect == 0
CAP_VFW = 200, //!< Video For Windows (platform native)
CAP_VFW = 200, //!< Video For Windows (obsolete, removed)
CAP_V4L = 200, //!< V4L/V4L2 capturing support via libv4l
CAP_V4L2 = CAP_V4L, //!< Same as CAP_V4L
CAP_FIREWIRE = 300, //!< IEEE 1394 drivers
CAP_FIREWARE = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE
CAP_IEEE1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE
CAP_DC1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE
CAP_CMU1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE
CAP_QT = 500, //!< QuickTime
CAP_UNICAP = 600, //!< Unicap drivers
CAP_FIREWARE = CAP_FIREWIRE, //!< Same value as CAP_FIREWIRE
CAP_IEEE1394 = CAP_FIREWIRE, //!< Same value as CAP_FIREWIRE
CAP_DC1394 = CAP_FIREWIRE, //!< Same value as CAP_FIREWIRE
CAP_CMU1394 = CAP_FIREWIRE, //!< Same value as CAP_FIREWIRE
CAP_QT = 500, //!< QuickTime (obsolete, removed)
CAP_UNICAP = 600, //!< Unicap drivers (obsolete, removed)
CAP_DSHOW = 700, //!< DirectShow (via videoInput)
CAP_PVAPI = 800, //!< PvAPI, Prosilica GigE SDK
CAP_OPENNI = 900, //!< OpenNI (for Kinect)
Expand Down Expand Up @@ -815,8 +815,8 @@ class CV_EXPORTS_W VideoWriter
The constructors/functions initialize video writers.
- On Linux FFMPEG is used to write videos;
- On Windows FFMPEG or VFW is used;
- On MacOSX QTKit is used.
- On Windows FFMPEG or MSWF or DSHOW is used;
- On MacOSX AVFoundation is used.
*/
CV_WRAP VideoWriter();

Expand Down
2 changes: 1 addition & 1 deletion modules/videoio/perf/perf_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame,
const string filename = getDataPath(get<0>(GetParam()));
const bool isColor = get<1>(GetParam());
Mat image = imread(filename, isColor ? IMREAD_COLOR : IMREAD_GRAYSCALE );
#if defined(HAVE_MSMF) && !defined(HAVE_VFW) && !defined(HAVE_FFMPEG) // VFW has greater priority
#if defined(HAVE_MSMF) && !defined(HAVE_FFMPEG)
const string outfile = cv::tempfile(".wmv");
const int fourcc = VideoWriter::fourcc('W', 'M', 'V', '3');
#else
Expand Down
Loading

0 comments on commit ebc8015

Please sign in to comment.