summaryrefslogtreecommitdiff
path: root/avstream/avscamera/sys/ExtendedVidProcSetting.h
blob: 11c22caa329491023b383ad04720720f45cb22cf (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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**************************************************************************

    A/V Stream Camera Sample

    Copyright (c) 2013, Microsoft Corporation.

    File:

        ExtendedProperty.h

    Abstract:

        This file contains the helper class CExtendedVidProcSetting.
        The class is provides initialization and accessor functions for
        KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING. 

    History:

        created 5/21/2013

**************************************************************************/

//
//  Helper class for Extended Properties KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING.
//
class CExtendedVidProcSetting
    : public CExtendedHeader
{
public:
    KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING m_Setting;

public:
    //  Standardized ctors to help ensure a consistant definition.
    CExtendedVidProcSetting( ULONGLONG flags=0, ULONG result=STATUS_SUCCESS )
        : CExtendedHeader( flags, result )
    {
        Size = sizeof(*this);
        RtlZeroMemory( &m_Setting, sizeof(m_Setting) );
    }

    CExtendedVidProcSetting( KSCAMERA_EXTENDEDPROP_HEADER &hdr )
        : CExtendedHeader(hdr)
    {
        Size = sizeof(*this);
        RtlZeroMemory( &m_Setting, sizeof(m_Setting) );
    }

    bool isValid()
    {
        return CExtendedHeader::isValid() &&
               (Size    >= sizeof(*this)) ;
    }

    template<class T>
    NTSTATUS
    BoundsCheck( T Value )
    {
        return ::BoundsCheck( Value, m_Setting );
    }

    //  Access operators let you fetch the value from the value field.
    operator LONG()
    {
        return m_Setting.VideoProc.Value.l;
    }
    operator ULONG()
    {
        return m_Setting.VideoProc.Value.ul;
    }
    operator LONGLONG()
    {
        return m_Setting.VideoProc.Value.ll;
    }
    operator ULONGLONG()
    {
        return m_Setting.VideoProc.Value.ull;
    }

    //  Assignment operators let you assign a value to the property.
    CExtendedVidProcSetting &
    operator =( LONG x )
    {
        m_Setting.VideoProc.Value.l = x;
        return *this;
    }

    CExtendedVidProcSetting &
    operator =( LONGLONG x )
    {
        m_Setting.VideoProc.Value.ll = x;
        return *this;
    }

    CExtendedVidProcSetting &
    operator =( ULONG x )
    {
        m_Setting.VideoProc.Value.ul = x;
        return *this;
    }

    CExtendedVidProcSetting &
    operator =( ULONGLONG x )
    {
        m_Setting.VideoProc.Value.ull = x;
        return *this;
    }

    CExtendedVidProcSetting &
    operator =( const KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING &x )
    {
        m_Setting = x;
        return *this;
    }

    LONG &
    Min()
    {
        return m_Setting.Min;
    }

    LONG &
    Max()
    {
        return m_Setting.Max;
    }

    LONG &
    Step()
    {
        return m_Setting.Step;
    }

    ULONG &
    Mode()
    {
        return m_Setting.Mode;
    }

    LONG &
    GetLONG()
    {
        return m_Setting.VideoProc.Value.l;
    }

    LONGLONG &
    GetLONGLONG()
    {
        return m_Setting.VideoProc.Value.ll;
    }

    ULONG &
    GetULONG()
    {
        return m_Setting.VideoProc.Value.ul;
    }

    ULONGLONG &
    GetULONGLONG()
    {
        return m_Setting.VideoProc.Value.ull;
    }

};