cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

rdpecam.h (7881B)


      1/**
      2 * FreeRDP: A Remote Desktop Protocol Implementation
      3 * Video Capture Virtual Channel Extension
      4 *
      5 * Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de>
      6 *
      7 * Licensed under the Apache License, Version 2.0 (the "License");
      8 * you may not use this file except in compliance with the License.
      9 * You may obtain a copy of the License at
     10 *
     11 *     http://www.apache.org/licenses/LICENSE-2.0
     12 *
     13 * Unless required by applicable law or agreed to in writing, software
     14 * distributed under the License is distributed on an "AS IS" BASIS,
     15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 * See the License for the specific language governing permissions and
     17 * limitations under the License.
     18 */
     19
     20#ifndef FREERDP_CHANNEL_RDPECAM_H
     21#define FREERDP_CHANNEL_RDPECAM_H
     22
     23#include <freerdp/api.h>
     24#include <freerdp/dvc.h>
     25#include <freerdp/types.h>
     26
     27#define RDPECAM_DVC_CHANNEL_NAME "rdpecam"
     28#define RDPECAM_CONTROL_DVC_CHANNEL_NAME "RDCamera_Device_Enumerator"
     29
     30typedef enum
     31{
     32	CAM_MSG_ID_SuccessResponse = 0x01,
     33	CAM_MSG_ID_ErrorResponse = 0x02,
     34	CAM_MSG_ID_SelectVersionRequest = 0x03,
     35	CAM_MSG_ID_SelectVersionResponse = 0x04,
     36	CAM_MSG_ID_DeviceAddedNotification = 0x05,
     37	CAM_MSG_ID_DeviceRemovedNotification = 0x06,
     38	CAM_MSG_ID_ActivateDeviceRequest = 0x07,
     39	CAM_MSG_ID_DeactivateDeviceRequest = 0x08,
     40	CAM_MSG_ID_StreamListRequest = 0x09,
     41	CAM_MSG_ID_StreamListResponse = 0x0A,
     42	CAM_MSG_ID_MediaTypeListRequest = 0x0B,
     43	CAM_MSG_ID_MediaTypeListResponse = 0x0C,
     44	CAM_MSG_ID_CurrentMediaTypeRequest = 0x0D,
     45	CAM_MSG_ID_CurrentMediaTypeResponse = 0x0E,
     46	CAM_MSG_ID_StartStreamsRequest = 0x0F,
     47	CAM_MSG_ID_StopStreamsRequest = 0x10,
     48	CAM_MSG_ID_SampleRequest = 0x11,
     49	CAM_MSG_ID_SampleResponse = 0x12,
     50	CAM_MSG_ID_SampleErrorResponse = 0x13,
     51	CAM_MSG_ID_PropertyListRequest = 0x14,
     52	CAM_MSG_ID_PropertyListResponse = 0x15,
     53	CAM_MSG_ID_PropertyValueRequest = 0x16,
     54	CAM_MSG_ID_PropertyValueResponse = 0x17,
     55	CAM_MSG_ID_SetPropertyValueRequest = 0x18,
     56} CAM_MSG_ID;
     57
     58#define CAM_HEADER_SIZE 2
     59
     60typedef struct
     61{
     62	BYTE Version;
     63	CAM_MSG_ID MessageId;
     64} CAM_SHARED_MSG_HEADER;
     65
     66/* Messages Exchanged on the Device Enumeration Channel (2.2.2) */
     67
     68typedef struct
     69{
     70	CAM_SHARED_MSG_HEADER Header;
     71} CAM_SELECT_VERSION_REQUEST;
     72
     73typedef struct
     74{
     75	CAM_SHARED_MSG_HEADER Header;
     76} CAM_SELECT_VERSION_RESPONSE;
     77
     78typedef struct
     79{
     80	CAM_SHARED_MSG_HEADER Header;
     81	WCHAR* DeviceName;
     82	char* VirtualChannelName;
     83} CAM_DEVICE_ADDED_NOTIFICATION;
     84
     85typedef struct
     86{
     87	CAM_SHARED_MSG_HEADER Header;
     88	char* VirtualChannelName;
     89} CAM_DEVICE_REMOVED_NOTIFICATION;
     90
     91/* Messages Exchanged on Device Channels (2.2.3) */
     92
     93typedef struct
     94{
     95	CAM_SHARED_MSG_HEADER Header;
     96} CAM_SUCCESS_RESPONSE;
     97
     98typedef enum
     99{
    100	CAM_ERROR_CODE_UnexpectedError = 0x00000001,
    101	CAM_ERROR_CODE_InvalidMessage = 0x00000002,
    102	CAM_ERROR_CODE_NotInitialized = 0x00000003,
    103	CAM_ERROR_CODE_InvalidRequest = 0x00000004,
    104	CAM_ERROR_CODE_InvalidStreamNumber = 0x00000005,
    105	CAM_ERROR_CODE_InvalidMediaType = 0x00000006,
    106	CAM_ERROR_CODE_OutOfMemory = 0x00000007,
    107	CAM_ERROR_CODE_ItemNotFound = 0x00000008,
    108	CAM_ERROR_CODE_SetNotFound = 0x00000009,
    109	CAM_ERROR_CODE_OperationNotSupported = 0x0000000A,
    110} CAM_ERROR_CODE;
    111
    112typedef struct
    113{
    114	CAM_SHARED_MSG_HEADER Header;
    115	CAM_ERROR_CODE ErrorCode;
    116} CAM_ERROR_RESPONSE;
    117
    118typedef struct
    119{
    120	CAM_SHARED_MSG_HEADER Header;
    121} CAM_ACTIVATE_DEVICE_REQUEST;
    122
    123typedef struct
    124{
    125	CAM_SHARED_MSG_HEADER Header;
    126} CAM_DEACTIVATE_DEVICE_REQUEST;
    127
    128typedef struct
    129{
    130	CAM_SHARED_MSG_HEADER Header;
    131} CAM_STREAM_LIST_REQUEST;
    132
    133typedef enum
    134{
    135	CAM_STREAM_FRAME_SOURCE_TYPE_Color = 0x0001,
    136	CAM_STREAM_FRAME_SOURCE_TYPE_Infrared = 0x0002,
    137	CAM_STREAM_FRAME_SOURCE_TYPE_Custom = 0x0008,
    138} CAM_STREAM_FRAME_SOURCE_TYPES;
    139
    140typedef enum
    141{
    142	CAM_STREAM_CATEGORY_Capture = 0x01,
    143} CAM_STREAM_CATEGORY;
    144
    145typedef struct
    146{
    147	CAM_STREAM_FRAME_SOURCE_TYPES FrameSourceTypes;
    148	CAM_STREAM_CATEGORY StreamCategory;
    149	BYTE Selected;
    150	BYTE CanBeShared;
    151} CAM_STREAM_DESCRIPTION;
    152
    153typedef struct
    154{
    155	CAM_SHARED_MSG_HEADER Header;
    156	BYTE N_Descriptions;
    157	CAM_STREAM_DESCRIPTION StreamDescriptions[255];
    158} CAM_STREAM_LIST_RESPONSE;
    159
    160typedef struct
    161{
    162	CAM_SHARED_MSG_HEADER Header;
    163	BYTE StreamIndex;
    164} CAM_MEDIA_TYPE_LIST_REQUEST;
    165
    166typedef enum
    167{
    168	CAM_MEDIA_FORMAT_H264 = 0x01,
    169	CAM_MEDIA_FORMAT_MJPG = 0x02,
    170	CAM_MEDIA_FORMAT_YUY2 = 0x03,
    171	CAM_MEDIA_FORMAT_NV12 = 0x04,
    172	CAM_MEDIA_FORMAT_I420 = 0x05,
    173	CAM_MEDIA_FORMAT_RGB24 = 0x06,
    174	CAM_MEDIA_FORMAT_RGB32 = 0x07,
    175} CAM_MEDIA_FORMAT;
    176
    177typedef enum
    178{
    179	CAM_MEDIA_TYPE_DESCRIPTION_FLAG_DecodingRequired = 0x01,
    180	CAM_MEDIA_TYPE_DESCRIPTION_FLAG_BottomUpImage = 0x02,
    181} CAM_MEDIA_TYPE_DESCRIPTION_FLAGS;
    182
    183typedef struct
    184{
    185	CAM_MEDIA_FORMAT Format;
    186	UINT32 Width;
    187	UINT32 Height;
    188	UINT32 FrameRateNumerator;
    189	UINT32 FrameRateDenominator;
    190	UINT32 PixelAspectRatioNumerator;
    191	UINT32 PixelAspectRatioDenominator;
    192	CAM_MEDIA_TYPE_DESCRIPTION_FLAGS Flags;
    193} CAM_MEDIA_TYPE_DESCRIPTION;
    194
    195typedef struct
    196{
    197	CAM_SHARED_MSG_HEADER Header;
    198	size_t N_Descriptions;
    199	CAM_MEDIA_TYPE_DESCRIPTION* MediaTypeDescriptions;
    200} CAM_MEDIA_TYPE_LIST_RESPONSE;
    201
    202typedef struct
    203{
    204	CAM_SHARED_MSG_HEADER Header;
    205	BYTE StreamIndex;
    206} CAM_CURRENT_MEDIA_TYPE_REQUEST;
    207
    208typedef struct
    209{
    210	CAM_SHARED_MSG_HEADER Header;
    211	CAM_MEDIA_TYPE_DESCRIPTION MediaTypeDescription;
    212} CAM_CURRENT_MEDIA_TYPE_RESPONSE;
    213
    214typedef struct
    215{
    216	BYTE StreamIndex;
    217	CAM_MEDIA_TYPE_DESCRIPTION MediaTypeDescription;
    218} CAM_START_STREAM_INFO;
    219
    220typedef struct
    221{
    222	CAM_SHARED_MSG_HEADER Header;
    223	BYTE N_Infos;
    224	CAM_START_STREAM_INFO StartStreamsInfo[255];
    225} CAM_START_STREAMS_REQUEST;
    226
    227typedef struct
    228{
    229	CAM_SHARED_MSG_HEADER Header;
    230} CAM_STOP_STREAMS_REQUEST;
    231
    232typedef struct
    233{
    234	CAM_SHARED_MSG_HEADER Header;
    235	BYTE StreamIndex;
    236} CAM_SAMPLE_REQUEST;
    237
    238typedef struct
    239{
    240	CAM_SHARED_MSG_HEADER Header;
    241	BYTE StreamIndex;
    242	size_t SampleSize;
    243	BYTE* Sample;
    244} CAM_SAMPLE_RESPONSE;
    245
    246typedef struct
    247{
    248	CAM_SHARED_MSG_HEADER Header;
    249	BYTE StreamIndex;
    250	CAM_ERROR_CODE ErrorCode;
    251} CAM_SAMPLE_ERROR_RESPONSE;
    252
    253typedef struct
    254{
    255	CAM_SHARED_MSG_HEADER Header;
    256} CAM_PROPERTY_LIST_REQUEST;
    257
    258typedef enum
    259{
    260	CAM_PROPERTY_SET_CameraControl = 0x01,
    261	CAM_PROPERTY_SET_VideoProcAmp = 0x02,
    262} CAM_PROPERTY_SET;
    263
    264/* CameraControl properties */
    265#define CAM_PROPERTY_ID_CAMERA_CONTROL_Exposure 0x01
    266#define CAM_PROPERTY_ID_CAMERA_CONTROL_Focus 0x02
    267#define CAM_PROPERTY_ID_CAMERA_CONTROL_Pan 0x03
    268#define CAM_PROPERTY_ID_CAMERA_CONTROL_Roll 0x04
    269#define CAM_PROPERTY_ID_CAMERA_CONTROL_Tilt 0x05
    270#define CAM_PROPERTY_ID_CAMERA_CONTROL_Zoom 0x06
    271
    272/* VideoProcAmp properties */
    273#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_BacklightCompensation 0x01
    274#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_Brightness 0x02
    275#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_Contrast 0x03
    276#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_Hue 0x04
    277#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_WhiteBalance 0x05
    278
    279typedef enum
    280{
    281	CAM_PROPERTY_CAPABILITY_Manual = 0x01,
    282	CAM_PROPERTY_CAPABILITY_Auto = 0x02,
    283} CAM_PROPERTY_CAPABILITIES;
    284
    285typedef struct
    286{
    287	CAM_PROPERTY_SET PropertySet;
    288	BYTE PropertyId;
    289	CAM_PROPERTY_CAPABILITIES Capabilities;
    290	INT32 MinValue;
    291	INT32 MaxValue;
    292	INT32 Step;
    293	INT32 DefaultValue;
    294} CAM_PROPERTY_DESCRIPTION;
    295
    296typedef struct
    297{
    298	CAM_SHARED_MSG_HEADER Header;
    299	size_t N_Properties;
    300	CAM_PROPERTY_DESCRIPTION* Properties;
    301} CAM_PROPERTY_LIST_RESPONSE;
    302
    303typedef struct
    304{
    305	CAM_SHARED_MSG_HEADER Header;
    306	CAM_PROPERTY_SET PropertySet;
    307	BYTE PropertyId;
    308} CAM_PROPERTY_VALUE_REQUEST;
    309
    310typedef enum
    311{
    312	CAM_PROPERTY_MODE_Manual = 0x01,
    313	CAM_PROPERTY_MODE_Auto = 0x02,
    314} CAM_PROPERTY_MODE;
    315
    316typedef struct
    317{
    318	CAM_PROPERTY_MODE Mode;
    319	INT32 Value;
    320} CAM_PROPERTY_VALUE;
    321
    322typedef struct
    323{
    324	CAM_SHARED_MSG_HEADER Header;
    325	CAM_PROPERTY_VALUE PropertyValue;
    326} CAM_PROPERTY_VALUE_RESPONSE;
    327
    328typedef struct
    329{
    330	CAM_SHARED_MSG_HEADER Header;
    331	CAM_PROPERTY_SET PropertySet;
    332	BYTE PropertyId;
    333	CAM_PROPERTY_VALUE PropertyValue;
    334} CAM_SET_PROPERTY_VALUE_REQUEST;
    335
    336#endif /* FREERDP_CHANNEL_RDPECAM_H */