Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
533fde66
Commit
533fde66
authored
Oct 01, 2014
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3281 from a-wi:MSMF_remove_ATL_dependency
parents
5bd18155
e3f1d722
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
34 deletions
+83
-34
cap_msmf.cpp
modules/highgui/src/cap_msmf.cpp
+3
-1
cap_msmf.hpp
modules/highgui/src/cap_msmf.hpp
+80
-33
No files found.
modules/highgui/src/cap_msmf.cpp
View file @
533fde66
...
...
@@ -72,6 +72,7 @@
#include <stdarg.h>
#include <string.h>
#ifdef _MSC_VER
#pragma warning(disable:4503)
#pragma comment(lib, "mfplat")
#pragma comment(lib, "mf")
...
...
@@ -81,6 +82,7 @@
#if (WINVER >= 0x0602) // Available since Win 8
#pragma comment(lib, "MinCore_Downlevel")
#endif
#endif
#include <mferror.h>
...
...
@@ -260,7 +262,7 @@ public:
#include "ppltasks_winrt.h"
#endif
#else
#include <
atlbase
.h>
#include <
comdef
.h>
#endif
struct
IMFMediaType
;
...
...
modules/highgui/src/cap_msmf.hpp
View file @
533fde66
...
...
@@ -600,27 +600,65 @@ hr = orig.As(&obj);
#define _ComPtr Microsoft::WRL::ComPtr
#else
#define _COM_SMARTPTR_DECLARE(T,var) T ## Ptr var
template
<
class
T
>
class
ComPtr
:
public
ATL
::
CComPtr
<
T
>
class
ComPtr
{
public
:
ComPtr
()
throw
()
{
}
ComPtr
(
int
nNull
)
throw
()
:
CComPtr
<
T
>
((
T
*
)
nNull
)
ComPtr
(
int
nNull
)
throw
()
{
assert
(
nNull
==
0
);
p
=
NULL
;
}
ComPtr
(
T
*
lp
)
throw
()
{
p
=
lp
;
}
ComPtr
(
_In_
const
ComPtr
<
T
>&
lp
)
throw
()
{
p
=
lp
.
p
;
}
virtual
~
ComPtr
()
{
}
T
**
operator
&
()
throw
()
{
assert
(
p
==
NULL
);
return
p
.
operator
&
();
}
T
*
operator
->
()
const
throw
()
{
assert
(
p
!=
NULL
);
return
p
.
operator
->
();
}
bool
operator
!
()
const
throw
()
{
return
p
.
operator
==
(
NULL
);
}
bool
operator
==
(
_In_opt_
T
*
pT
)
const
throw
()
{
return
p
.
operator
==
(
pT
);
}
// For comparison to NULL
bool
operator
==
(
int
nNull
)
const
{
assert
(
nNull
==
0
);
return
p
.
operator
==
(
NULL
);
}
ComPtr
(
T
*
lp
)
throw
()
:
CComPtr
<
T
>
(
lp
)
bool
operator
!=
(
_In_opt_
T
*
pT
)
const
throw
()
{
return
p
.
operator
!=
(
pT
);
}
ComPtr
(
_In_
const
CComPtr
<
T
>&
lp
)
throw
()
:
CComPtr
<
T
>
(
lp
.
p
)
operator
bool
()
{
return
p
.
operator
!=
(
NULL
);
}
virtual
~
ComPtr
()
{}
T
*
const
*
GetAddressOf
()
const
throw
()
{
...
...
@@ -634,7 +672,7 @@ public:
T
**
ReleaseAndGetAddressOf
()
throw
()
{
Internal
Release
();
p
.
Release
();
return
&
p
;
}
...
...
@@ -642,27 +680,38 @@ public:
{
return
p
;
}
ComPtr
&
operator
=
(
decltype
(
__nullptr
))
throw
()
// Attach to an existing interface (does not AddRef)
void
Attach
(
_In_opt_
T
*
p2
)
throw
()
{
InternalRelease
();
return
*
this
;
p
.
Attach
(
p2
);
}
ComPtr
&
operator
=
(
_In_
const
int
nNull
)
throw
()
// Detach the interface (does not Release)
T
*
Detach
()
throw
()
{
ASSERT
(
nNull
==
0
);
(
void
)
nNull
;
InternalRelease
();
return
*
this
;
return
p
.
Detach
();
}
unsigned
long
Reset
()
_Check_return_
HRESULT
CopyTo
(
_Deref_out_opt_
T
**
ppT
)
throw
()
{
return
InternalRelease
();
assert
(
ppT
!=
NULL
);
if
(
ppT
==
NULL
)
return
E_POINTER
;
*
ppT
=
p
;
if
(
p
!=
NULL
)
p
->
AddRef
();
return
S_OK
;
}
void
Reset
()
{
p
.
Release
();
}
// query for U interface
template
<
typename
U
>
HRESULT
As
(
_Inout_
U
**
lp
)
const
throw
()
{
return
p
->
QueryInterface
(
__uuidof
(
U
),
(
void
**
)
lp
);
return
p
->
QueryInterface
(
__uuidof
(
U
),
reinterpret_cast
<
void
**>
(
lp
)
);
}
// query for U interface
template
<
typename
U
>
...
...
@@ -671,19 +720,8 @@ public:
return
p
->
QueryInterface
(
__uuidof
(
U
),
reinterpret_cast
<
void
**>
(
lp
->
ReleaseAndGetAddressOf
()));
}
private
:
unsigned
long
InternalRelease
()
throw
()
{
unsigned
long
ref
=
0
;
T
*
temp
=
p
;
if
(
temp
!=
nullptr
)
{
p
=
nullptr
;
ref
=
temp
->
Release
();
}
return
ref
;
}
_COM_SMARTPTR_TYPEDEF
(
T
,
__uuidof
(
T
));
_COM_SMARTPTR_DECLARE
(
T
,
p
);
};
#define _ComPtr ComPtr
...
...
@@ -2262,6 +2300,11 @@ public:
// succeed but return a nullptr pointer. By default, the list does not allow nullptr
// pointers.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4127) // constant expression
#endif
template
<
class
T
,
bool
NULLABLE
=
FALSE
>
class
ComPtrList
:
public
List
<
T
*>
{
...
...
@@ -2352,6 +2395,10 @@ protected:
}
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
/* Be sure to declare webcam device capability in manifest
For better media capture support, add the following snippet with correct module name to the project manifest
(highgui needs DLL activation class factoryentry points):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment