cscg24-guacamole

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

rdpecam.h (9311B)


      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_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H
     21#define FREERDP_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H
     22
     23#include <freerdp/channels/rdpecam.h>
     24#include <freerdp/channels/wtsvc.h>
     25
     26typedef struct camera_device_server_context CameraDeviceServerContext;
     27
     28typedef UINT (*psCameraDeviceServerOpen)(CameraDeviceServerContext* context);
     29typedef UINT (*psCameraDeviceServerClose)(CameraDeviceServerContext* context);
     30
     31typedef BOOL (*psCameraDeviceServerChannelIdAssigned)(CameraDeviceServerContext* context,
     32                                                      UINT32 channelId);
     33
     34typedef UINT (*psCameraDeviceServerInitialize)(CameraDeviceServerContext* context,
     35                                               BOOL externalThread);
     36typedef UINT (*psCameraDeviceServerPoll)(CameraDeviceServerContext* context);
     37typedef BOOL (*psCameraDeviceServerChannelHandle)(CameraDeviceServerContext* context,
     38                                                  HANDLE* handle);
     39
     40typedef UINT (*psCameraDeviceServerSuccessResponse)(CameraDeviceServerContext* context,
     41                                                    const CAM_SUCCESS_RESPONSE* successResponse);
     42typedef UINT (*psCameraDeviceServerErrorResponse)(CameraDeviceServerContext* context,
     43                                                  const CAM_ERROR_RESPONSE* errorResponse);
     44
     45typedef UINT (*psCameraDeviceServerActivateDeviceRequest)(
     46    CameraDeviceServerContext* context, const CAM_ACTIVATE_DEVICE_REQUEST* activateDeviceRequest);
     47typedef UINT (*psCameraDeviceServerDeactivateDeviceRequest)(
     48    CameraDeviceServerContext* context,
     49    const CAM_DEACTIVATE_DEVICE_REQUEST* deactivateDeviceRequest);
     50
     51typedef UINT (*psCameraDeviceServerStreamListRequest)(
     52    CameraDeviceServerContext* context, const CAM_STREAM_LIST_REQUEST* streamListRequest);
     53typedef UINT (*psCameraDeviceServerStreamListResponse)(
     54    CameraDeviceServerContext* context, const CAM_STREAM_LIST_RESPONSE* streamListResponse);
     55
     56typedef UINT (*psCameraDeviceServerMediaTypeListRequest)(
     57    CameraDeviceServerContext* context, const CAM_MEDIA_TYPE_LIST_REQUEST* mediaTypeListRequest);
     58typedef UINT (*psCameraDeviceServerMediaTypeListResponse)(
     59    CameraDeviceServerContext* context, const CAM_MEDIA_TYPE_LIST_RESPONSE* mediaTypeListResponse);
     60
     61typedef UINT (*psCameraDeviceServerCurrentMediaTypeRequest)(
     62    CameraDeviceServerContext* context,
     63    const CAM_CURRENT_MEDIA_TYPE_REQUEST* currentMediaTypeRequest);
     64typedef UINT (*psCameraDeviceServerCurrentMediaTypeResponse)(
     65    CameraDeviceServerContext* context,
     66    const CAM_CURRENT_MEDIA_TYPE_RESPONSE* currentMediaTypeResponse);
     67
     68typedef UINT (*psCameraDeviceServerStartStreamsRequest)(
     69    CameraDeviceServerContext* context, const CAM_START_STREAMS_REQUEST* startStreamsRequest);
     70typedef UINT (*psCameraDeviceServerStopStreamsRequest)(
     71    CameraDeviceServerContext* context, const CAM_STOP_STREAMS_REQUEST* stopStreamsRequest);
     72
     73typedef UINT (*psCameraDeviceServerSampleRequest)(CameraDeviceServerContext* context,
     74                                                  const CAM_SAMPLE_REQUEST* sampleRequest);
     75typedef UINT (*psCameraDeviceServerSampleResponse)(CameraDeviceServerContext* context,
     76                                                   const CAM_SAMPLE_RESPONSE* sampleResponse);
     77typedef UINT (*psCameraDeviceServerSampleErrorResponse)(
     78    CameraDeviceServerContext* context, const CAM_SAMPLE_ERROR_RESPONSE* sampleErrorResponse);
     79
     80typedef UINT (*psCameraDeviceServerPropertyListRequest)(
     81    CameraDeviceServerContext* context, const CAM_PROPERTY_LIST_REQUEST* propertyListRequest);
     82typedef UINT (*psCameraDeviceServerPropertyListResponse)(
     83    CameraDeviceServerContext* context, const CAM_PROPERTY_LIST_RESPONSE* propertyListResponse);
     84
     85typedef UINT (*psCameraDeviceServerPropertyValueRequest)(
     86    CameraDeviceServerContext* context, const CAM_PROPERTY_VALUE_REQUEST* propertyValueRequest);
     87typedef UINT (*psCameraDeviceServerPropertyValueResponse)(
     88    CameraDeviceServerContext* context, const CAM_PROPERTY_VALUE_RESPONSE* propertyValueResponse);
     89
     90typedef UINT (*psCameraDeviceServerSetPropertyValueRequest)(
     91    CameraDeviceServerContext* context,
     92    const CAM_SET_PROPERTY_VALUE_REQUEST* setPropertyValueRequest);
     93
     94struct camera_device_server_context
     95{
     96	HANDLE vcm;
     97
     98	/* Server self-defined pointer. */
     99	void* userdata;
    100
    101	/**
    102	 * Name of the virtual channel. Pointer owned by the CameraDeviceServerContext,
    103	 * meaning camera_device_server_context_free() takes care of freeing the pointer.
    104	 *
    105	 * Server implementations should sanitize the virtual channel name for invalid
    106	 * names, like names for other known channels
    107	 * ("ECHO", "AUDIO_PLAYBACK_DVC", etc.)
    108	 */
    109	char* virtualChannelName;
    110
    111	/**
    112	 * Protocol version to be used. Every sent server to client PDU has the
    113	 * version value in the Header set to the following value.
    114	 */
    115	BYTE protocolVersion;
    116
    117	/*** APIs called by the server. ***/
    118
    119	/**
    120	 * Optional: Set thread handling.
    121	 * When externalThread=TRUE, the application is responsible to call
    122	 * Poll() periodically to process channel events.
    123	 *
    124	 * Defaults to externalThread=FALSE
    125	 */
    126	psCameraDeviceServerInitialize Initialize;
    127
    128	/**
    129	 * Open the camera device channel.
    130	 */
    131	psCameraDeviceServerOpen Open;
    132
    133	/**
    134	 * Close the camera device channel.
    135	 */
    136	psCameraDeviceServerClose Close;
    137
    138	/**
    139	 * Poll
    140	 * When externalThread=TRUE, call Poll() periodically from your main loop.
    141	 * If externalThread=FALSE do not call.
    142	 */
    143	psCameraDeviceServerPoll Poll;
    144
    145	/**
    146	 * Retrieve the channel handle for use in conjunction with Poll().
    147	 * If externalThread=FALSE do not call.
    148	 */
    149	psCameraDeviceServerChannelHandle ChannelHandle;
    150
    151	/**
    152	 * For the following server to client PDUs,
    153	 * the message header does not have to be set.
    154	 */
    155
    156	/**
    157	 * Send a Activate Device Request PDU.
    158	 */
    159	psCameraDeviceServerActivateDeviceRequest ActivateDeviceRequest;
    160
    161	/**
    162	 * Send a Deactivate Device Request PDU.
    163	 */
    164	psCameraDeviceServerDeactivateDeviceRequest DeactivateDeviceRequest;
    165
    166	/**
    167	 * Send a Stream List Request PDU.
    168	 */
    169	psCameraDeviceServerStreamListRequest StreamListRequest;
    170
    171	/**
    172	 * Send a Media Type List Request PDU.
    173	 */
    174	psCameraDeviceServerMediaTypeListRequest MediaTypeListRequest;
    175
    176	/**
    177	 * Send a Current Media Type Request PDU.
    178	 */
    179	psCameraDeviceServerCurrentMediaTypeRequest CurrentMediaTypeRequest;
    180
    181	/**
    182	 * Send a Start Streams Request PDU.
    183	 */
    184	psCameraDeviceServerStartStreamsRequest StartStreamsRequest;
    185
    186	/**
    187	 * Send a Stop Streams Request PDU.
    188	 */
    189	psCameraDeviceServerStopStreamsRequest StopStreamsRequest;
    190
    191	/**
    192	 * Send a Sample Request PDU.
    193	 */
    194	psCameraDeviceServerSampleRequest SampleRequest;
    195
    196	/**
    197	 * Send a Property List Request PDU.
    198	 */
    199	psCameraDeviceServerPropertyListRequest PropertyListRequest;
    200
    201	/**
    202	 * Send a Property Value Request PDU.
    203	 */
    204	psCameraDeviceServerPropertyValueRequest PropertyValueRequest;
    205
    206	/**
    207	 * Send a Set Property Value Request PDU.
    208	 */
    209	psCameraDeviceServerSetPropertyValueRequest SetPropertyValueRequest;
    210
    211	/*** Callbacks registered by the server. ***/
    212
    213	/**
    214	 * Callback, when the channel got its id assigned.
    215	 */
    216	psCameraDeviceServerChannelIdAssigned ChannelIdAssigned;
    217
    218	/**
    219	 * Callback for the Success Response PDU.
    220	 */
    221	psCameraDeviceServerSuccessResponse SuccessResponse;
    222
    223	/**
    224	 * Callback for the Error Response PDU.
    225	 */
    226	psCameraDeviceServerErrorResponse ErrorResponse;
    227
    228	/**
    229	 * Callback for the Stream List Response PDU.
    230	 */
    231	psCameraDeviceServerStreamListResponse StreamListResponse;
    232
    233	/**
    234	 * Callback for the Media Type List Response PDU.
    235	 */
    236	psCameraDeviceServerMediaTypeListResponse MediaTypeListResponse;
    237
    238	/**
    239	 * Callback for the Current Media Type Response PDU.
    240	 */
    241	psCameraDeviceServerCurrentMediaTypeResponse CurrentMediaTypeResponse;
    242
    243	/**
    244	 * Callback for the Sample Response PDU.
    245	 */
    246	psCameraDeviceServerSampleResponse SampleResponse;
    247
    248	/**
    249	 * Callback for the Sample Error Response PDU.
    250	 */
    251	psCameraDeviceServerSampleErrorResponse SampleErrorResponse;
    252
    253	/**
    254	 * Callback for the Property List Response PDU.
    255	 */
    256	psCameraDeviceServerPropertyListResponse PropertyListResponse;
    257
    258	/**
    259	 * Callback for the Property Value Response PDU.
    260	 */
    261	psCameraDeviceServerPropertyValueResponse PropertyValueResponse;
    262
    263	rdpContext* rdpcontext;
    264};
    265
    266#ifdef __cplusplus
    267extern "C"
    268{
    269#endif
    270
    271	FREERDP_API CameraDeviceServerContext* camera_device_server_context_new(HANDLE vcm);
    272	FREERDP_API void camera_device_server_context_free(CameraDeviceServerContext* context);
    273
    274#ifdef __cplusplus
    275}
    276#endif
    277
    278#endif /* FREERDP_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H */