Commit 4703f455 authored by Alexander Smorkalov's avatar Alexander Smorkalov

Experimental MS Media Foundation API support added

parent c6cab50c
...@@ -140,7 +140,8 @@ OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF ...@@ -140,7 +140,8 @@ OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) ) 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_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) ) OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) )
OCV_OPTION(WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON IF WIN32 AND NOT ARM ) OCV_OPTION(WITH_DSHOW "Build HighGUI with DirectShow support" ON IF (WIN32 AND NOT ARM) )
OCV_OPTION(WITH_MSMF "Build HighGUI with Media Foundation support" OFF )
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT APPLE) ) OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT APPLE) )
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" OFF IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" OFF IF (NOT ANDROID AND NOT IOS) )
...@@ -753,9 +754,13 @@ if(DEFINED WITH_V4L) ...@@ -753,9 +754,13 @@ if(DEFINED WITH_V4L)
ELSE "${HAVE_CAMV4L_STR}/${HAVE_CAMV4L2_STR}") ELSE "${HAVE_CAMV4L_STR}/${HAVE_CAMV4L2_STR}")
endif(DEFINED WITH_V4L) endif(DEFINED WITH_V4L)
if(DEFINED WITH_VIDEOINPUT) if(DEFINED WITH_DSHOW)
status(" DirectShow:" HAVE_VIDEOINPUT THEN YES ELSE NO) status(" DirectShow:" HAVE_DSHOW THEN YES ELSE NO)
endif(DEFINED WITH_VIDEOINPUT) endif(DEFINED WITH_DSHOW)
if(DEFINED WITH_MSMF)
status(" Media Foundation:" HAVE_MSMF THEN YES ELSE NO)
endif(DEFINED WITH_MSMF)
if(DEFINED WITH_XIMEA) if(DEFINED WITH_XIMEA)
status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO) status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
......
...@@ -184,11 +184,16 @@ if(WITH_FFMPEG) ...@@ -184,11 +184,16 @@ if(WITH_FFMPEG)
endif(APPLE) endif(APPLE)
endif(WITH_FFMPEG) endif(WITH_FFMPEG)
# --- VideoInput --- # --- VideoInput/DirectShow ---
if(WITH_VIDEOINPUT) if(WITH_DSHOW)
# always have VideoInput on Windows # always have VideoInput on Windows
set(HAVE_VIDEOINPUT 1) set(HAVE_DSHOW 1)
endif(WITH_VIDEOINPUT) endif(WITH_DSHOW)
# --- VideoInput/Microsoft Media Foundation ---
if(WITH_MSMF)
check_include_file(Mfapi.h HAVE_MSMF)
endif(WITH_MSMF)
# --- Extra HighGUI libs on Windows --- # --- Extra HighGUI libs on Windows ---
if(WIN32) if(WIN32)
......
...@@ -214,8 +214,11 @@ ...@@ -214,8 +214,11 @@
/* AMD's Basic Linear Algebra Subprograms Library*/ /* AMD's Basic Linear Algebra Subprograms Library*/
#cmakedefine HAVE_CLAMDBLAS #cmakedefine HAVE_CLAMDBLAS
/* VideoInput library */ /* DirectShow Video Capture library */
#cmakedefine HAVE_VIDEOINPUT #cmakedefine HAVE_DSHOW
/* Microsoft Media Foundation Capture library */
#cmakedefine HAVE_MSMF
/* XIMEA camera support */ /* XIMEA camera support */
#cmakedefine HAVE_XIMEA #cmakedefine HAVE_XIMEA
......
...@@ -106,7 +106,19 @@ elseif(APPLE) ...@@ -106,7 +106,19 @@ elseif(APPLE)
endif() endif()
if(WIN32 AND NOT ARM) if(WIN32 AND NOT ARM)
list(APPEND highgui_srcs src/cap_dshow.cpp src/cap_vfw.cpp src/cap_cmu.cpp) list(APPEND highgui_srcs src/cap_cmu.cpp)
endif()
if (WIN32 AND HAVE_DSHOW)
list(APPEND highgui_srcs src/cap_dshow.cpp)
endif()
if (WIN32 AND HAVE_MSMF)
list(APPEND highgui_srcs src/cap_msmf.cpp)
endif()
if (WIN32 AND HAVE_VFW)
list(APPEND highgui_srcs src/cap_vfw.cpp)
endif() endif()
if(HAVE_XINE) if(HAVE_XINE)
......
...@@ -297,6 +297,7 @@ enum ...@@ -297,6 +297,7 @@ enum
CV_CAP_UNICAP =600, // Unicap drivers CV_CAP_UNICAP =600, // Unicap drivers
CV_CAP_DSHOW =700, // DirectShow (via videoInput) CV_CAP_DSHOW =700, // DirectShow (via videoInput)
CV_CAP_MSMF =1400, // Microsoft Media Foundation (via videoInput)
CV_CAP_PVAPI =800, // PvAPI, Prosilica GigE SDK CV_CAP_PVAPI =800, // PvAPI, Prosilica GigE SDK
......
...@@ -114,7 +114,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) ...@@ -114,7 +114,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
{ {
int domains[] = int domains[] =
{ {
#ifdef HAVE_VIDEOINPUT #ifdef HAVE_DSHOW
CV_CAP_DSHOW, CV_CAP_DSHOW,
#endif #endif
#if 1 #if 1
...@@ -168,7 +168,8 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) ...@@ -168,7 +168,8 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
// try every possibly installed camera API // try every possibly installed camera API
for (int i = 0; domains[i] >= 0; i++) for (int i = 0; domains[i] >= 0; i++)
{ {
#if defined(HAVE_VIDEOINPUT) || \ #if defined(HAVE_DSHOW) || \
defined(HAVE_MSMF) || \
defined(HAVE_TYZX) || \ defined(HAVE_TYZX) || \
defined(HAVE_VFW) || \ defined(HAVE_VFW) || \
defined(HAVE_LIBV4L) || \ defined(HAVE_LIBV4L) || \
...@@ -195,7 +196,14 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) ...@@ -195,7 +196,14 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
switch (domains[i]) switch (domains[i])
{ {
#ifdef HAVE_VIDEOINPUT #ifdef HAVE_MSMF
case CV_CAP_MSMF:
capture = cvCreateCameraCapture_MSMF (index);
if (capture)
return capture;
break;
#endif
#ifdef HAVE_DSHOW
case CV_CAP_DSHOW: case CV_CAP_DSHOW:
capture = cvCreateCameraCapture_DShow (index); capture = cvCreateCameraCapture_DShow (index);
if (capture) if (capture)
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "precomp.hpp" #include "precomp.hpp"
#if (defined WIN32 || defined _WIN32) && defined HAVE_VIDEOINPUT #if (defined WIN32 || defined _WIN32) && defined HAVE_DSHOW
/* /*
DirectShow-based Video Capturing module is based on DirectShow-based Video Capturing module is based on
...@@ -3100,6 +3100,7 @@ HRESULT videoInput::routeCrossbar(ICaptureGraphBuilder2 **ppBuild, IBaseFilter * ...@@ -3100,6 +3100,7 @@ HRESULT videoInput::routeCrossbar(ICaptureGraphBuilder2 **ppBuild, IBaseFilter *
return hr; return hr;
} }
/********************* Capturing video from camera via DirectShow *********************/ /********************* Capturing video from camera via DirectShow *********************/
class CvCaptureCAM_DShow : public CvCapture class CvCaptureCAM_DShow : public CvCapture
......
This diff is collapsed.
...@@ -118,6 +118,7 @@ CvVideoWriter* cvCreateVideoWriter_Win32( const char* filename, int fourcc, ...@@ -118,6 +118,7 @@ CvVideoWriter* cvCreateVideoWriter_Win32( const char* filename, int fourcc,
CvVideoWriter* cvCreateVideoWriter_VFW( const char* filename, int fourcc, CvVideoWriter* cvCreateVideoWriter_VFW( const char* filename, int fourcc,
double fps, CvSize frameSize, int is_color ); double fps, CvSize frameSize, int is_color );
CvCapture* cvCreateCameraCapture_DShow( int index ); CvCapture* cvCreateCameraCapture_DShow( int index );
CvCapture* cvCreateCameraCapture_MSMF( int index );
CvCapture* cvCreateCameraCapture_OpenNI( int index ); CvCapture* cvCreateCameraCapture_OpenNI( int index );
CvCapture* cvCreateFileCapture_OpenNI( const char* filename ); CvCapture* cvCreateFileCapture_OpenNI( const char* filename );
CvCapture* cvCreateCameraCapture_Android( int index ); CvCapture* cvCreateCameraCapture_Android( int index );
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include <iostream> #include <iostream>
#if defined(HAVE_VIDEOINPUT) || \ #if defined(HAVE_DSHOW) || \
defined(HAVE_TYZX) || \ defined(HAVE_TYZX) || \
defined(HAVE_VFW) || \ defined(HAVE_VFW) || \
defined(HAVE_LIBV4L) || \ defined(HAVE_LIBV4L) || \
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
defined(HAVE_OPENNI) || \ defined(HAVE_OPENNI) || \
defined(HAVE_XIMEA) || \ defined(HAVE_XIMEA) || \
defined(HAVE_AVFOUNDATION) || \ defined(HAVE_AVFOUNDATION) || \
defined(HAVE_GIGE_API) || \ defined(HAVE_GIGE_API) || \
(0) (0)
//defined(HAVE_ANDROID_NATIVE_CAMERA) || - enable after #1193 //defined(HAVE_ANDROID_NATIVE_CAMERA) || - enable after #1193
# define BUILD_WITH_CAMERA_SUPPORT 1 # define BUILD_WITH_CAMERA_SUPPORT 1
......
Markdown is supported
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