23#include <freerdp/config.h>
25#if defined(CHANNEL_RDPECAM)
27#include <winpr/wtypes.h>
28#include <freerdp/channels/rdpecam.h>
30WINPR_ATTR_FORMAT_ARG(5, 6)
31static inline
void rdpecam_PrintWarning(wLog* log, const
char* file, const
char* fkt,
size_t line,
32 WINPR_FORMAT_ARG const
char* fmt, ...)
34 const DWORD level = WLOG_WARN;
38 if (WLog_IsLevelActive(log, level))
39 WLog_PrintTextMessageVA(log, level, line, file, fkt, fmt, ap);
54#define rdpecam_valid_messageId(id) \
55 rdpecam_valid_messageId_((id), WLog_Get(TAG), __FILE__, __func__, __LINE__)
56static inline bool rdpecam_valid_messageId_(UINT8
id, wLog* log,
const char* file,
const char* fkt,
61 case CAM_MSG_ID_SuccessResponse:
62 case CAM_MSG_ID_ErrorResponse:
63 case CAM_MSG_ID_SelectVersionRequest:
64 case CAM_MSG_ID_SelectVersionResponse:
65 case CAM_MSG_ID_DeviceAddedNotification:
66 case CAM_MSG_ID_DeviceRemovedNotification:
67 case CAM_MSG_ID_ActivateDeviceRequest:
68 case CAM_MSG_ID_DeactivateDeviceRequest:
69 case CAM_MSG_ID_StreamListRequest:
70 case CAM_MSG_ID_StreamListResponse:
71 case CAM_MSG_ID_MediaTypeListRequest:
72 case CAM_MSG_ID_MediaTypeListResponse:
73 case CAM_MSG_ID_CurrentMediaTypeRequest:
74 case CAM_MSG_ID_CurrentMediaTypeResponse:
75 case CAM_MSG_ID_StartStreamsRequest:
76 case CAM_MSG_ID_StopStreamsRequest:
77 case CAM_MSG_ID_SampleRequest:
78 case CAM_MSG_ID_SampleResponse:
79 case CAM_MSG_ID_SampleErrorResponse:
80 case CAM_MSG_ID_PropertyListRequest:
81 case CAM_MSG_ID_PropertyListResponse:
82 case CAM_MSG_ID_PropertyValueRequest:
83 case CAM_MSG_ID_PropertyValueResponse:
84 case CAM_MSG_ID_SetPropertyValueRequest:
87 rdpecam_PrintWarning(log, file, fkt, line,
"Invalid CAM_MSG_ID %" PRIu8,
id);
103#define rdpecam_valid_CamErrorCode(code) \
104 rdpecam_valid_CamErrorCode_((code), WLog_Get(TAG), __FILE__, __func__, __LINE__)
105static inline bool rdpecam_valid_CamErrorCode_(UINT32 code, wLog* log,
const char* file,
106 const char* fkt,
size_t line)
110 case CAM_ERROR_CODE_UnexpectedError:
111 case CAM_ERROR_CODE_InvalidMessage:
112 case CAM_ERROR_CODE_NotInitialized:
113 case CAM_ERROR_CODE_InvalidRequest:
114 case CAM_ERROR_CODE_InvalidStreamNumber:
115 case CAM_ERROR_CODE_InvalidMediaType:
116 case CAM_ERROR_CODE_OutOfMemory:
117 case CAM_ERROR_CODE_ItemNotFound:
118 case CAM_ERROR_CODE_SetNotFound:
119 case CAM_ERROR_CODE_OperationNotSupported:
122 rdpecam_PrintWarning(log, file, fkt, line,
"Invalid CAM_ERROR_CODE %" PRIu32, code);
138#define rdpecam_valid_CamStreamFrameSourceType(val) \
139 rdpecam_valid_CamStreamFrameSourceType_((val), WLog_Get(TAG), __FILE__, __func__, __LINE__)
140static inline bool rdpecam_valid_CamStreamFrameSourceType_(UINT16 val, wLog* log,
const char* file,
141 const char* fkt,
size_t line)
145 case CAM_STREAM_FRAME_SOURCE_TYPE_Color:
146 case CAM_STREAM_FRAME_SOURCE_TYPE_Infrared:
147 case CAM_STREAM_FRAME_SOURCE_TYPE_Custom:
150 rdpecam_PrintWarning(log, file, fkt, line,
151 "Invalid CAM_STREAM_FRAME_SOURCE_TYPES %" PRIu16, val);
167#define rdpecam_valid_CamStreamCategory(val) \
168 rdpecam_valid_CamStreamCategory_((val), WLog_Get(TAG), __FILE__, __func__, __LINE__)
169static inline bool rdpecam_valid_CamStreamCategory_(UINT8 val, wLog* log,
const char* file,
170 const char* fkt,
size_t line)
174 case CAM_STREAM_CATEGORY_Capture:
177 rdpecam_PrintWarning(log, file, fkt, line,
"Invalid CAM_STREAM_CATEGORY %" PRIu8, val);
193#define rdpecam_valid_CamMediaFormat(val) \
194 rdpecam_valid_CamMediaFormat_((val), WLog_Get(TAG), __FILE__, __func__, __LINE__)
195static inline bool rdpecam_valid_CamMediaFormat_(UINT8 val, wLog* log,
const char* file,
196 const char* fkt,
size_t line)
200 case CAM_MEDIA_FORMAT_INVALID:
201 case CAM_MEDIA_FORMAT_H264:
202 case CAM_MEDIA_FORMAT_MJPG:
203 case CAM_MEDIA_FORMAT_YUY2:
204 case CAM_MEDIA_FORMAT_NV12:
205 case CAM_MEDIA_FORMAT_I420:
206 case CAM_MEDIA_FORMAT_RGB24:
207 case CAM_MEDIA_FORMAT_RGB32:
210 rdpecam_PrintWarning(log, file, fkt, line,
"Invalid CAM_MEDIA_FORMAT %" PRIu8, val);
226#define rdpecam_valid_MediaTypeDescriptionFlags(val) \
227 rdpecam_valid_MediaTypeDescriptionFlags_((val), WLog_Get(TAG), __FILE__, __func__, __LINE__)
228static inline bool rdpecam_valid_MediaTypeDescriptionFlags_(UINT8 val, wLog* log,
const char* file,
229 const char* fkt,
size_t line)
233 case CAM_MEDIA_TYPE_DESCRIPTION_FLAG_DecodingRequired:
234 case CAM_MEDIA_TYPE_DESCRIPTION_FLAG_BottomUpImage:
237 rdpecam_PrintWarning(log, file, fkt, line,
238 "Invalid CAM_MEDIA_TYPE_DESCRIPTION_FLAGS %" PRIu8, val);
254#define rdpecam_valid_CamPropertyMode(val) \
255 rdpecam_valid_CamPropertyMode_((val), WLog_Get(TAG), __FILE__, __func__, __LINE__)
256static inline bool rdpecam_valid_CamPropertyMode_(UINT8 val, wLog* log,
const char* file,
257 const char* fkt,
size_t line)
261 case CAM_PROPERTY_MODE_Manual:
262 case CAM_PROPERTY_MODE_Auto:
265 rdpecam_PrintWarning(log, file, fkt, line,
"Invalid CAM_PROPERTY_MODE %" PRIu8, val);
281#define rdpecam_valid_CamPropertySet(val) \
282 rdpecam_valid_CamPropertySet_((val), WLog_Get(TAG), __FILE__, __func__, __LINE__)
283static inline bool rdpecam_valid_CamPropertySet_(UINT8 val, wLog* log,
const char* file,
284 const char* fkt,
size_t line)
288 case CAM_PROPERTY_SET_CameraControl:
289 case CAM_PROPERTY_SET_VideoProcAmp:
292 rdpecam_PrintWarning(log, file, fkt, line,
"Invalid CAM_PROPERTY_SET %" PRIu8, val);
308#define rdpecam_valid_CamPropertyCapabilities(val) \
309 rdpecam_valid_CamPropertyCapabilities_((val), WLog_Get(TAG), __FILE__, __func__, __LINE__)
310static inline bool rdpecam_valid_CamPropertyCapabilities_(UINT8 val, wLog* log,
const char* file,
311 const char* fkt,
size_t line)
315 case CAM_PROPERTY_CAPABILITY_Manual:
316 case CAM_PROPERTY_CAPABILITY_Auto:
319 rdpecam_PrintWarning(log, file, fkt, line,
"Invalid CAM_PROPERTY_CAPABILITIES %" PRIu8,