summaryrefslogtreecommitdiffstats
path: root/include/freerdp/channels/video.h
blob: b552475baff4b8633d7272536204b5113d4f0b49 (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
/**
 * FreeRDP: A Remote Desktop Protocol Implementation
 * Video Optimized Remoting Virtual Channel Extension
 *
 * Copyright 2018 David Fort <contact@hardening-consulting.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FREERDP_CHANNEL_VIDEO_H
#define FREERDP_CHANNEL_VIDEO_H

#include <winpr/wtypes.h>
#include <freerdp/types.h>

#define VIDEO_CHANNEL_NAME "video"
#define VIDEO_CONTROL_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Video::Control::v08.01"
#define VIDEO_DATA_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Video::Data::v08.01"

#ifdef __cplusplus
extern "C"
{
#endif

	/** @brief TSNM packet type */
	enum
	{
		TSMM_PACKET_TYPE_PRESENTATION_REQUEST = 1,
		TSMM_PACKET_TYPE_PRESENTATION_RESPONSE = 2,
		TSMM_PACKET_TYPE_CLIENT_NOTIFICATION = 3,
		TSMM_PACKET_TYPE_VIDEO_DATA = 4
	};

	/** @brief TSMM_PRESENTATION_REQUEST commands */
	enum
	{
		TSMM_START_PRESENTATION = 1,
		TSMM_STOP_PRESENTATION = 2
	};

	/** @brief presentation request struct */
	typedef struct
	{
		BYTE PresentationId;
		BYTE Version;
		BYTE Command;
		BYTE FrameRate;
		UINT32 SourceWidth, SourceHeight;
		UINT32 ScaledWidth, ScaledHeight;
		UINT64 hnsTimestampOffset;
		UINT64 GeometryMappingId;
		BYTE VideoSubtypeId[16];
		UINT32 cbExtra;
		BYTE* pExtraData;
	} TSMM_PRESENTATION_REQUEST;

	/** @brief response to a TSMM_PRESENTATION_REQUEST */
	typedef struct
	{
		BYTE PresentationId;
	} TSMM_PRESENTATION_RESPONSE;

	/** @brief TSMM_VIDEO_DATA flags */
	enum
	{
		TSMM_VIDEO_DATA_FLAG_HAS_TIMESTAMPS = 0x01,
		TSMM_VIDEO_DATA_FLAG_KEYFRAME = 0x02,
		TSMM_VIDEO_DATA_FLAG_NEW_FRAMERATE = 0x04
	};

	/** @brief a video data packet */
	typedef struct
	{
		BYTE PresentationId;
		BYTE Version;
		BYTE Flags;
		UINT64 hnsTimestamp;
		UINT64 hnsDuration;
		UINT16 CurrentPacketIndex;
		UINT16 PacketsInSample;
		UINT32 SampleNumber;
		UINT32 cbSample;
		BYTE* pSample;
	} TSMM_VIDEO_DATA;

	/** @brief values for NotificationType in TSMM_CLIENT_NOTIFICATION */
	enum
	{
		TSMM_CLIENT_NOTIFICATION_TYPE_NETWORK_ERROR = 1,
		TSMM_CLIENT_NOTIFICATION_TYPE_FRAMERATE_OVERRIDE = 2
	};

	/** @brief struct used when NotificationType is FRAMERATE_OVERRIDE */
	typedef struct
	{
		UINT32 Flags;
		UINT32 DesiredFrameRate;
	} TSMM_CLIENT_NOTIFICATION_FRAMERATE_OVERRIDE;

	/** @brief a client to server notification struct */
	typedef struct
	{
		BYTE PresentationId;
		BYTE NotificationType;
		TSMM_CLIENT_NOTIFICATION_FRAMERATE_OVERRIDE FramerateOverride;
	} TSMM_CLIENT_NOTIFICATION;

#ifdef __cplusplus
}
#endif

#endif /* FREERDP_CHANNEL_VIDEO_H */