-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathCustomExtendedProperty.h
More file actions
125 lines (106 loc) · 3.96 KB
/
CustomExtendedProperty.h
File metadata and controls
125 lines (106 loc) · 3.96 KB
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
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
//
// CustomExtendedProperty.h
//
#pragma once
#include "KsStructures.h"
#define KSCAMERA_EXTENDEDPROP_VERSION 1
//
// Helper class for using and accessing KSPROPERTYSETID_ExtendedCameraControl and their payloads
//
namespace CustomExtendedProperties
{
//
//
//
template<class T>
class CustomExtendedProperty
{
public:
static HRESULT CreateCustomExtendedProperty(Platform::String^ strPropId, BYTE* pbData, DWORD cbData, CustomExtendedProperty<T>** ppControl)
{
HRESULT hr = S_OK;
if (nullptr == ppControl || nullptr == pbData)
{
return E_POINTER;
}
*ppControl = nullptr;
if (cbData < (sizeof(KSCAMERA_EXTENDEDPROP_HEADER) + sizeof(T)))
{
return E_INVALIDARG;
}
*ppControl = new CustomExtendedProperty<T>(strPropId, pbData, cbData);
if (*ppControl == nullptr)
{
hr = E_OUTOFMEMORY;
}
return hr;
}
virtual ~CustomExtendedProperty();
Platform::Array<unsigned char>^ GetData();
// Property functions
__declspec(property(get = get_Id))UINT32 Id;
UINT32 get_Id()
{
return m_uiPropId;
};
__declspec(property(get = get_Header, put = set_Header))KSCAMERA_EXTENDEDPROP_HEADER* Header;
KSCAMERA_EXTENDEDPROP_HEADER* get_Header()
{
return m_pExtPropHeader;
};
void set_Header(KSCAMERA_EXTENDEDPROP_HEADER* pHeader)
{
m_pExtPropHeader = pHeader;
};
__declspec(property(get = get_Value, put = set_Value))T* Value;
T* get_Value()
{
return m_pExtPropValue;
};
void set_Value(T* pValue)
{
m_pExtPropValue = pValue;
};
__declspec(property(get = get_DataSize))DWORD DataSize;
DWORD get_DataSize()
{
return m_cbData;
};
protected:
CustomExtendedProperty(Platform::String^ strPropId, BYTE* pbData, DWORD cbData);
private:
KSCAMERA_EXTENDEDPROP_HEADER* m_pExtPropHeader;
T* m_pExtPropValue;
BYTE* m_pbData;
DWORD m_cbData;
Platform::String^ m_strPropId;
};
template<class T>
class CExtendedPropertyHelperBase
{
public:
static HRESULT GetDeviceProperty(Windows::Media::Devices::VideoDeviceController^ vdc, Platform::String^ strPropId, CustomExtendedProperty<T>** ppControl);
static HRESULT SetDeviceProperty(Windows::Media::Devices::VideoDeviceController^ vdc, Platform::String^ strPropId, CustomExtendedProperty<T>* pControl);
};
class ExtendedPropertyValueHelper
{
public:
static HRESULT GetDeviceProperty(Windows::Media::Devices::VideoDeviceController^ vdc, Platform::String^ strPropId, CustomExtendedProperty<KSCAMERA_EXTENDEDPROP_VALUE>** ppControl);
static HRESULT SetDeviceProperty(Windows::Media::Devices::VideoDeviceController^ vdc, Platform::String^ strPropId, CustomExtendedProperty<KSCAMERA_EXTENDEDPROP_VALUE>* pControl);
};
class ExtendedPropertyVideoProcSettingHelper
{
public:
static HRESULT GetDeviceProperty(Windows::Media::Devices::VideoDeviceController^ vdc, Platform::String^ strPropId, CustomExtendedProperty<KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING>** ppControl);
static HRESULT SetDeviceProperty(Windows::Media::Devices::VideoDeviceController^ vdc, Platform::String^ strPropId, CustomExtendedProperty<KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING>* pControl);
};
}