blob: 32affaa616dfd4dbe62941291c8680e1c48f6785 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
/**************************************************************************
A/V Stream Camera Sample
Copyright (c) 2013, Microsoft Corporation.
File:
ExtendedProperty.h
Abstract:
This file contains the helper class CExtendedProperty and the coommon
base class CExtendedHeader.
CExtendedHeader provides initialization and accessor functions for
KSCAMERA_EXTENDEDPROP_HEADER.
CExtendedProperty provides initialization and accessor functions for
KSCAMERA_EXTENDEDPROP_VALUE.
CExtendedProperty also combines KSCAMERA_EXTENDEDPROP_HEADER and
KSCAMERA_EXTENDEDPROP_VALUE into a single object for use in the
macros and templates used by our filter and sensor classes.
History:
created 5/21/2013
**************************************************************************/
//
// Helper class for Extended Properties.
//
class CExtendedHeader
: public KSCAMERA_EXTENDEDPROP_HEADER
{
public:
// Standardized ctors to help ensure a consistant definition.
CExtendedHeader( ULONGLONG flags=0, ULONG result=STATUS_SUCCESS )
{
Version = KSCAMERA_EXTENDEDPROP_VERSION;
PinId = KSCAMERA_EXTENDEDPROP_FILTERSCOPE;
Size = sizeof(*this);
Result = result;
Capability = 0;
Flags = flags;
}
CExtendedHeader( KSCAMERA_EXTENDEDPROP_HEADER &hdr )
: KSCAMERA_EXTENDEDPROP_HEADER(hdr)
{
Size = sizeof(*this);
}
bool isValid()
{
return Version == KSCAMERA_EXTENDEDPROP_VERSION;
}
};
class CExtendedProperty
: public CExtendedHeader
{
public:
KSCAMERA_EXTENDEDPROP_VALUE m_Value;
public:
// Standardized ctors to help ensure a consistant definition.
CExtendedProperty( ULONGLONG flags=0, ULONG result=STATUS_SUCCESS )
: CExtendedHeader( flags, result )
{
Size = sizeof(*this);
m_Value.Value.ull = 0;
}
CExtendedProperty( KSCAMERA_EXTENDEDPROP_HEADER &hdr )
: CExtendedHeader(hdr)
{
Size = sizeof(*this);
m_Value.Value.ull = 0;
}
// Access operators let you fetch the value from the value field.
operator LONG()
{
return m_Value.Value.l;
}
operator ULONG()
{
return m_Value.Value.ul;
}
operator LONGLONG()
{
return m_Value.Value.ll;
}
operator ULONGLONG()
{
return m_Value.Value.ull;
}
operator KSCAMERA_EXTENDEDPROP_VALUE()
{
return m_Value;
}
// Assignment operators let you assign a value to the property.
CExtendedProperty &
operator =( LONG x )
{
m_Value.Value.l = x;
return *this;
}
CExtendedProperty &
operator =( LONGLONG x )
{
m_Value.Value.ll = x;
return *this;
}
CExtendedProperty &
operator =( ULONG x )
{
m_Value.Value.ul = x;
return *this;
}
CExtendedProperty &
operator =( ULONGLONG x )
{
m_Value.Value.ull = x;
return *this;
}
bool isValid()
{
return CExtendedHeader::isValid() &&
(Size >= sizeof(*this)) ;
}
};
|