|
|
|
@ -8,6 +8,8 @@ |
|
|
|
|
|
|
|
|
|
#include "opencv2/videoio/registry.hpp" |
|
|
|
|
|
|
|
|
|
#include "opencv2/core/utils/filesystem.private.hpp" // OPENCV_HAVE_FILESYSTEM_SUPPORT |
|
|
|
|
|
|
|
|
|
#include "cap_librealsense.hpp" |
|
|
|
|
#include "cap_dshow.hpp" |
|
|
|
|
|
|
|
|
@ -34,15 +36,19 @@ namespace cv { |
|
|
|
|
|
|
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
#if OPENCV_HAVE_FILESYSTEM_SUPPORT && defined(ENABLE_PLUGINS) |
|
|
|
|
#define DECLARE_DYNAMIC_BACKEND(cap, name, mode) \ |
|
|
|
|
{ \
|
|
|
|
|
cap, (BackendMode)(mode), 1000, name, createPluginBackendFactory(cap, name) \
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
#else |
|
|
|
|
#define DECLARE_DYNAMIC_BACKEND(cap, name, mode) /* nothing */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define DECLARE_STATIC_BACKEND(cap, name, mode, createCaptureFile, createCaptureCamera, createWriter) \ |
|
|
|
|
{ \
|
|
|
|
|
cap, (BackendMode)(mode), 1000, name, createBackendFactory(createCaptureFile, createCaptureCamera, createWriter) \
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** Ordering guidelines:
|
|
|
|
|
- modern optimized, multi-platform libraries: ffmpeg, gstreamer, Media SDK |
|
|
|
@ -55,90 +61,90 @@ namespace { |
|
|
|
|
static const struct VideoBackendInfo builtin_backends[] = |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_FFMPEG |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_FFMPEG, "FFMPEG", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, cvCreateFileCapture_FFMPEG_proxy, 0, cvCreateVideoWriter_FFMPEG_proxy), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_FFMPEG, "FFMPEG", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, cvCreateFileCapture_FFMPEG_proxy, 0, cvCreateVideoWriter_FFMPEG_proxy) |
|
|
|
|
#elif defined(ENABLE_PLUGINS) || defined(HAVE_FFMPEG_WRAPPER) |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_FFMPEG, "FFMPEG", MODE_CAPTURE_BY_FILENAME | MODE_WRITER), |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_FFMPEG, "FFMPEG", MODE_CAPTURE_BY_FILENAME | MODE_WRITER) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GSTREAMER |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_GSTREAMER, "GSTREAMER", MODE_CAPTURE_ALL | MODE_WRITER, createGStreamerCapture_file, createGStreamerCapture_cam, create_GStreamer_writer), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_GSTREAMER, "GSTREAMER", MODE_CAPTURE_ALL | MODE_WRITER, createGStreamerCapture_file, createGStreamerCapture_cam, create_GStreamer_writer) |
|
|
|
|
#elif defined(ENABLE_PLUGINS) |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_GSTREAMER, "GSTREAMER", MODE_CAPTURE_ALL | MODE_WRITER), |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_GSTREAMER, "GSTREAMER", MODE_CAPTURE_ALL | MODE_WRITER) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_MFX // Media SDK
|
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_INTEL_MFX, "INTEL_MFX", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, create_MFX_capture, 0, create_MFX_writer), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_INTEL_MFX, "INTEL_MFX", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, create_MFX_capture, 0, create_MFX_writer) |
|
|
|
|
#elif defined(ENABLE_PLUGINS) |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_INTEL_MFX, "INTEL_MFX", MODE_CAPTURE_BY_FILENAME | MODE_WRITER), |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_INTEL_MFX, "INTEL_MFX", MODE_CAPTURE_BY_FILENAME | MODE_WRITER) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Apple platform
|
|
|
|
|
#ifdef HAVE_AVFOUNDATION |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_AVFOUNDATION, "AVFOUNDATION", MODE_CAPTURE_ALL | MODE_WRITER, create_AVFoundation_capture_file, create_AVFoundation_capture_cam, create_AVFoundation_writer), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_AVFOUNDATION, "AVFOUNDATION", MODE_CAPTURE_ALL | MODE_WRITER, create_AVFoundation_capture_file, create_AVFoundation_capture_cam, create_AVFoundation_writer) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Windows
|
|
|
|
|
#ifdef WINRT_VIDEO |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_WINRT, "WINRT", MODE_CAPTURE_BY_INDEX, 0, create_WRT_capture, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_WINRT, "WINRT", MODE_CAPTURE_BY_INDEX, 0, create_WRT_capture, 0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_MSMF |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_MSMF, "MSMF", MODE_CAPTURE_ALL | MODE_WRITER, cvCreateCapture_MSMF, cvCreateCapture_MSMF, cvCreateVideoWriter_MSMF), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_MSMF, "MSMF", MODE_CAPTURE_ALL | MODE_WRITER, cvCreateCapture_MSMF, cvCreateCapture_MSMF, cvCreateVideoWriter_MSMF) |
|
|
|
|
#elif defined(ENABLE_PLUGINS) && defined(_WIN32) |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_MSMF, "MSMF", MODE_CAPTURE_ALL | MODE_WRITER), |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_MSMF, "MSMF", MODE_CAPTURE_ALL | MODE_WRITER) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_DSHOW |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_DSHOW, "DSHOW", MODE_CAPTURE_BY_INDEX, 0, create_DShow_capture, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_DSHOW, "DSHOW", MODE_CAPTURE_BY_INDEX, 0, create_DShow_capture, 0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Linux, some Unix
|
|
|
|
|
#if defined HAVE_CAMV4L2 |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_V4L2, "V4L2", MODE_CAPTURE_ALL, create_V4L_capture_file, create_V4L_capture_cam, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_V4L2, "V4L2", MODE_CAPTURE_ALL, create_V4L_capture_file, create_V4L_capture_cam, 0) |
|
|
|
|
#elif defined HAVE_VIDEOIO |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_V4L, "V4L_BSD", MODE_CAPTURE_ALL, create_V4L_capture_file, create_V4L_capture_cam, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_V4L, "V4L_BSD", MODE_CAPTURE_ALL, create_V4L_capture_file, create_V4L_capture_cam, 0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// RGB-D universal
|
|
|
|
|
#ifdef HAVE_OPENNI2 |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_OPENNI2, "OPENNI2", MODE_CAPTURE_ALL, create_OpenNI2_capture_file, create_OpenNI2_capture_cam, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_OPENNI2, "OPENNI2", MODE_CAPTURE_ALL, create_OpenNI2_capture_file, create_OpenNI2_capture_cam, 0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBREALSENSE |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_REALSENSE, "INTEL_REALSENSE", MODE_CAPTURE_BY_INDEX, 0, create_RealSense_capture, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_REALSENSE, "INTEL_REALSENSE", MODE_CAPTURE_BY_INDEX, 0, create_RealSense_capture, 0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// OpenCV file-based only
|
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_IMAGES, "CV_IMAGES", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, create_Images_capture, 0, create_Images_writer), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_OPENCV_MJPEG, "CV_MJPEG", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, createMotionJpegCapture, 0, createMotionJpegWriter), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_IMAGES, "CV_IMAGES", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, create_Images_capture, 0, create_Images_writer) |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_OPENCV_MJPEG, "CV_MJPEG", MODE_CAPTURE_BY_FILENAME | MODE_WRITER, createMotionJpegCapture, 0, createMotionJpegWriter) |
|
|
|
|
|
|
|
|
|
// special interfaces / stereo cameras / other SDKs
|
|
|
|
|
#if defined(HAVE_DC1394_2) |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_FIREWIRE, "FIREWIRE", MODE_CAPTURE_BY_INDEX, 0, create_DC1394_capture, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_FIREWIRE, "FIREWIRE", MODE_CAPTURE_BY_INDEX, 0, create_DC1394_capture, 0) |
|
|
|
|
#endif |
|
|
|
|
// GigE
|
|
|
|
|
#ifdef HAVE_PVAPI |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_PVAPI, "PVAPI", MODE_CAPTURE_BY_INDEX, 0, create_PvAPI_capture, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_PVAPI, "PVAPI", MODE_CAPTURE_BY_INDEX, 0, create_PvAPI_capture, 0) |
|
|
|
|
#endif |
|
|
|
|
#ifdef HAVE_XIMEA |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_XIAPI, "XIMEA", MODE_CAPTURE_ALL, create_XIMEA_capture_file, create_XIMEA_capture_cam, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_XIAPI, "XIMEA", MODE_CAPTURE_ALL, create_XIMEA_capture_file, create_XIMEA_capture_cam, 0) |
|
|
|
|
#endif |
|
|
|
|
#ifdef HAVE_ARAVIS_API |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_ARAVIS, "ARAVIS", MODE_CAPTURE_BY_INDEX, 0, create_Aravis_capture, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_ARAVIS, "ARAVIS", MODE_CAPTURE_BY_INDEX, 0, create_Aravis_capture, 0) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_UEYE // uEye
|
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_UEYE, "UEYE", MODE_CAPTURE_BY_INDEX, 0, create_ueye_camera, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_UEYE, "UEYE", MODE_CAPTURE_BY_INDEX, 0, create_ueye_camera, 0) |
|
|
|
|
#elif defined(ENABLE_PLUGINS) |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_UEYE, "UEYE", MODE_CAPTURE_BY_INDEX), |
|
|
|
|
DECLARE_DYNAMIC_BACKEND(CAP_UEYE, "UEYE", MODE_CAPTURE_BY_INDEX) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GPHOTO2 |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_GPHOTO2, "GPHOTO2", MODE_CAPTURE_ALL, createGPhoto2Capture, createGPhoto2Capture, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_GPHOTO2, "GPHOTO2", MODE_CAPTURE_ALL, createGPhoto2Capture, createGPhoto2Capture, 0) |
|
|
|
|
#endif |
|
|
|
|
#ifdef HAVE_XINE |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_XINE, "XINE", MODE_CAPTURE_BY_FILENAME, createXINECapture, 0, 0), |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_XINE, "XINE", MODE_CAPTURE_BY_FILENAME, createXINECapture, 0, 0) |
|
|
|
|
#endif |
|
|
|
|
#if defined(HAVE_ANDROID_MEDIANDK) || defined(HAVE_ANDROID_NATIVE_CAMERA) |
|
|
|
|
DECLARE_STATIC_BACKEND(CAP_ANDROID, "ANDROID_NATIVE", |
|
|
|
@ -163,7 +169,7 @@ static const struct VideoBackendInfo builtin_backends[] = |
|
|
|
|
#else |
|
|
|
|
0, |
|
|
|
|
#endif |
|
|
|
|
0), |
|
|
|
|
0) |
|
|
|
|
#endif |
|
|
|
|
// dropped backends: MIL, TYZX
|
|
|
|
|
}; |
|
|
|
|