Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
01a883df
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
01a883df
编写于
9月 27, 2014
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3267 from a-wi:MSMF_capture_fixes_v3
上级
047abb00
302b138a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
9 deletion
+36
-9
cmake/OpenCVFindLibsVideo.cmake
cmake/OpenCVFindLibsVideo.cmake
+1
-0
modules/videoio/CMakeLists.txt
modules/videoio/CMakeLists.txt
+1
-0
modules/videoio/src/cap_msmf.cpp
modules/videoio/src/cap_msmf.cpp
+22
-9
modules/videoio/src/cap_msmf.hpp
modules/videoio/src/cap_msmf.hpp
+12
-0
未找到文件。
cmake/OpenCVFindLibsVideo.cmake
浏览文件 @
01a883df
...
...
@@ -254,6 +254,7 @@ if(WITH_DSHOW)
endif
(
WITH_DSHOW
)
# --- VideoInput/Microsoft Media Foundation ---
ocv_clear_vars
(
HAVE_MSMF
)
if
(
WITH_MSMF
)
check_include_file
(
Mfapi.h HAVE_MSMF
)
endif
(
WITH_MSMF
)
...
...
modules/videoio/CMakeLists.txt
浏览文件 @
01a883df
...
...
@@ -42,6 +42,7 @@ if (WIN32 AND HAVE_DSHOW)
endif
()
if
(
WIN32 AND HAVE_MSMF
)
list
(
APPEND videoio_srcs
${
CMAKE_CURRENT_LIST_DIR
}
/src/cap_msmf.hpp
)
list
(
APPEND videoio_srcs
${
CMAKE_CURRENT_LIST_DIR
}
/src/cap_msmf.cpp
)
endif
()
...
...
modules/videoio/src/cap_msmf.cpp
浏览文件 @
01a883df
...
...
@@ -78,7 +78,9 @@
#pragma comment(lib, "mfuuid")
#pragma comment(lib, "Strmiids")
#pragma comment(lib, "Mfreadwrite")
#if (WINVER >= 0x0602) // Available since Win 8
#pragma comment(lib, "MinCore_Downlevel")
#endif
#include <mferror.h>
...
...
@@ -1469,7 +1471,6 @@ void ImageGrabber::stopGrabbing()
HRESULT
ImageGrabber
::
startGrabbing
(
void
)
{
_ComPtr
<
IMFMediaEvent
>
pEvent
=
NULL
;
PROPVARIANT
var
;
PropVariantInit
(
&
var
);
HRESULT
hr
=
ig_pSession
->
SetTopology
(
0
,
ig_pTopology
);
...
...
@@ -1477,6 +1478,7 @@ HRESULT ImageGrabber::startGrabbing(void)
hr
=
ig_pSession
->
Start
(
&
GUID_NULL
,
&
var
);
for
(;;)
{
_ComPtr
<
IMFMediaEvent
>
pEvent
=
NULL
;
HRESULT
hrStatus
=
S_OK
;
MediaEventType
met
;
if
(
!
ig_pSession
)
break
;
...
...
@@ -1509,11 +1511,13 @@ HRESULT ImageGrabber::startGrabbing(void)
DebugPrintOut
(
L"IMAGEGRABBER VIDEODEVICE %i: MESessionStopped
\n
"
,
ig_DeviceID
);
break
;
}
#if (WINVER >= 0x0602) // Available since Win 8
if
(
met
==
MEVideoCaptureDeviceRemoved
)
{
DebugPrintOut
(
L"IMAGEGRABBER VIDEODEVICE %i: MEVideoCaptureDeviceRemoved
\n
"
,
ig_DeviceID
);
break
;
}
#endif
if
((
met
==
MEError
)
||
(
met
==
MENonFatalError
))
{
pEvent
->
GetStatus
(
&
hrStatus
);
...
...
@@ -2455,7 +2459,7 @@ int videoDevice::findType(unsigned int size, unsigned int frameRate)
fmt
=
vd_CaptureFormats
.
find
(
size
);
if
(
fmt
!=
vd_CaptureFormats
.
end
()
)
FRM
=
fmt
->
second
;
else
else
if
(
!
vd_CaptureFormats
.
empty
()
)
FRM
=
vd_CaptureFormats
.
rbegin
()
->
second
;
if
(
FRM
.
empty
()
)
...
...
@@ -3844,18 +3848,25 @@ bool CvCaptureFile_MSMF::open(const char* filename)
hr
=
enumerateCaptureFormats
(
videoFileSource
);
}
if
(
SUCCEEDED
(
hr
)
)
if
(
captureFormats
.
empty
()
)
{
hr
=
ImageGrabberThread
::
CreateInstance
(
&
grabberThread
,
videoFileSource
,
(
unsigned
int
)
-
2
,
true
)
;
isOpened
=
false
;
}
else
{
if
(
SUCCEEDED
(
hr
))
{
hr
=
ImageGrabberThread
::
CreateInstance
(
&
grabberThread
,
videoFileSource
,
(
unsigned
int
)
-
2
,
true
);
}
if
(
SUCCEEDED
(
hr
))
isOpened
=
SUCCEEDED
(
hr
);
}
if
(
isOpened
)
{
grabberThread
->
start
();
}
isOpened
=
SUCCEEDED
(
hr
);
return
isOpened
;
}
...
...
@@ -3987,7 +3998,9 @@ HRESULT CvCaptureFile_MSMF::enumerateCaptureFormats(IMFMediaSource *pSource)
goto
done
;
}
MediaType
MT
=
FormatReader
::
Read
(
pType
.
Get
());
captureFormats
.
push_back
(
MT
);
// We can capture only RGB video.
if
(
MT
.
MF_MT_SUBTYPE
==
MFVideoFormat_RGB24
)
captureFormats
.
push_back
(
MT
);
}
done:
...
...
@@ -4112,7 +4125,7 @@ const GUID CvVideoWriter_MSMF::FourCC2GUID(int fourcc)
return
MFVideoFormat_DVSD
;
break
;
case
CV_FOURCC_MACRO
(
'd'
,
'v'
,
's'
,
'l'
):
return
MFVideoFormat_DVSL
;
break
;
#if (WINVER >=
_WIN32_WINNT_WIN8
)
#if (WINVER >=
0x0602
)
case
CV_FOURCC_MACRO
(
'H'
,
'2'
,
'6'
,
'3'
):
// Available only for Win 8 target.
return
MFVideoFormat_H263
;
break
;
#endif
...
...
modules/videoio/src/cap_msmf.hpp
浏览文件 @
01a883df
...
...
@@ -333,6 +333,7 @@ MAKE_ENUM(MediaEventType) MediaEventTypePairs[] = {
MAKE_ENUM_PAIR
(
MediaEventType
,
MEAudioSessionDisconnected
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MEAudioSessionExclusiveModeOverride
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MESinkV1Anchor
),
#if (WINVER >= 0x0602) // Available since Win 8
MAKE_ENUM_PAIR
(
MediaEventType
,
MECaptureAudioSessionVolumeChanged
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MECaptureAudioSessionDeviceRemoved
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MECaptureAudioSessionFormatChanged
),
...
...
@@ -340,6 +341,7 @@ MAKE_ENUM(MediaEventType) MediaEventTypePairs[] = {
MAKE_ENUM_PAIR
(
MediaEventType
,
MECaptureAudioSessionExclusiveModeOverride
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MECaptureAudioSessionServerShutdown
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MESinkV2Anchor
),
#endif
MAKE_ENUM_PAIR
(
MediaEventType
,
METrustUnknown
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MEPolicyChanged
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MEContentProtectionMessage
),
...
...
@@ -361,9 +363,11 @@ MAKE_ENUM(MediaEventType) MediaEventTypePairs[] = {
MAKE_ENUM_PAIR
(
MediaEventType
,
METransformHaveOutput
),
MAKE_ENUM_PAIR
(
MediaEventType
,
METransformDrainComplete
),
MAKE_ENUM_PAIR
(
MediaEventType
,
METransformMarker
),
#if (WINVER >= 0x0602) // Available since Win 8
MAKE_ENUM_PAIR
(
MediaEventType
,
MEByteStreamCharacteristicsChanged
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MEVideoCaptureDeviceRemoved
),
MAKE_ENUM_PAIR
(
MediaEventType
,
MEVideoCaptureDevicePreempted
),
#endif
MAKE_ENUM_PAIR
(
MediaEventType
,
MEReservedMax
)
};
MAKE_MAP
(
MediaEventType
)
MediaEventTypeMap
(
MediaEventTypePairs
,
MediaEventTypePairs
+
sizeof
(
MediaEventTypePairs
)
/
sizeof
(
MediaEventTypePairs
[
0
]));
...
...
@@ -1044,7 +1048,11 @@ class StreamSink :
{
public:
// IUnknown methods
#if defined(_MSC_VER) && _MSC_VER >= 1700 // '_Outptr_result_nullonfailure_' SAL is avaialable since VS 2012
STDMETHOD
(
QueryInterface
)(
REFIID
riid
,
_Outptr_result_nullonfailure_
void
**
ppv
)
#else
STDMETHOD
(
QueryInterface
)(
REFIID
riid
,
void
**
ppv
)
#endif
{
if
(
ppv
==
nullptr
)
{
return
E_POINTER
;
...
...
@@ -2383,7 +2391,11 @@ public:
}
return
cRef
;
}
#if defined(_MSC_VER) && _MSC_VER >= 1700 // '_Outptr_result_nullonfailure_' SAL is avaialable since VS 2012
STDMETHOD
(
QueryInterface
)(
REFIID
riid
,
_Outptr_result_nullonfailure_
void
**
ppv
)
#else
STDMETHOD
(
QueryInterface
)(
REFIID
riid
,
void
**
ppv
)
#endif
{
if
(
ppv
==
nullptr
)
{
return
E_POINTER
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录