blob: 4c325dda1dd74d82f7d4b0bc292d3ae176e0cb85 (
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
165
166
167
168
169
170
171
172
|
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.
Module Name:
offloadStreamEngine.h
Abstract:
Virtual Streaming Engine - this module controls offload streaming logic for
the device.
Environment:
Kernel mode
--*/
#pragma once
#include "streamengine.h"
#include "PositionSimClock.h"
#define MAX_FILE_WRITE_FRAMES (16)
#define OFFLOAD_PRESENTATION_POSITION_LAG_IN_MS (20)
class COffloadStreamEngine : public CStreamEngine
{
public:
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
COffloadStreamEngine(
_In_ ACXSTREAM Stream,
_In_ ACXDATAFORMAT StreamFormat,
_In_ CSimPeakMeter *circuitPeakmeter
);
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
#pragma code_seg()
~COffloadStreamEngine();
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
PrepareHardware();
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
ReleaseHardware();
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
Run();
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
Pause();
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
#pragma code_seg()
NTSTATUS
GetPresentationPosition(
_Out_ PULONGLONG PositionInBlocks,
_Out_ PULONGLONG QPCPosition
);
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
AssignDrmContentId(
_In_ ULONG DrmContentId,
_In_ PACXDRMRIGHTS DrmRights
);
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
#pragma code_seg()
NTSTATUS
GetLinearBufferPosition(
_Out_ PULONGLONG Position
);
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
SetCurrentWritePosition(
_In_ ULONG Position
);
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
SetLastBufferPosition(
_In_ ULONG Position
);
protected:
WDFTIMER m_BufferReadTimer;
WDFTIMER m_LastBufferTimer;
CPositionSimClock m_LinearBufferClock;
CSaveData m_SaveData;
// Number of packets written by OS
ULONG m_PacketsWritten;
// Number of packets read by hardware
ULONG m_PacketsRead;
ULONG m_SinglePacketPosition;
virtual
__drv_maxIRQL(DISPATCH_LEVEL)
#pragma code_seg()
VOID
ProcessPacket();
virtual
__drv_maxIRQL(PASSIVE_LEVEL)
PAGED_CODE_SEG
NTSTATUS
SetCurrentWritePositionSinglePacket(
_In_ ULONG Position
);
static
__drv_maxIRQL(DISPATCH_LEVEL)
_Function_class_(EVT_WDF_TIMER)
#pragma code_seg()
VOID s_EvtBufferReadTimerCallback(
_In_ WDFTIMER Timer
);
static
__drv_maxIRQL(DISPATCH_LEVEL)
_Function_class_(EVT_WDF_TIMER)
#pragma code_seg()
VOID s_EvtLastBufferTimerCallback(
_In_ WDFTIMER Timer
);
// Callback indicating buffer read complete
virtual
__drv_maxIRQL(DISPATCH_LEVEL)
#pragma code_seg()
VOID
BufferReadCallback();
virtual
__drv_maxIRQL(DISPATCH_LEVEL)
#pragma code_seg()
VOID
LastBufferRenderComplete();
};
|