CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
cdi_utility_api.h
Go to the documentation of this file.
1// -------------------------------------------------------------------------------------------
2// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3// This file is part of the AWS CDI-SDK, licensed under the BSD 2-Clause "Simplified" License.
4// License details at: https://github.com/aws/aws-cdi-sdk/blob/mainline/LICENSE
5// -------------------------------------------------------------------------------------------
6
7#ifndef CDI_UTILITY_API_H__
8#define CDI_UTILITY_API_H__
9
19#include <stdbool.h>
20#include <stdint.h>
21
22//*********************************************************************************************************************
23//***************************************** START OF DEFINITIONS AND TYPES ********************************************
24//*********************************************************************************************************************
25
27#if defined(_WIN32) && defined(__cplusplus)
28#define CDI_INTERFACE extern "C" __declspec (dllexport)
29#elif defined(_WIN32)
30#define CDI_INTERFACE __declspec (dllexport)
31#elif defined(__cplusplus)
32#define CDI_INTERFACE extern "C"
33#else
34#define CDI_INTERFACE
35#endif
36
38#define CDI_INVALID_ENUM_VALUE (-1)
39
42
46typedef struct {
48 const char* name_str;
50
66
75
76//*********************************************************************************************************************
77//******************************************* START OF PUBLIC FUNCTIONS ***********************************************
78//*********************************************************************************************************************
79
88
97CDI_INTERFACE const char* CdiUtilityEnumValueToString(const CdiEnumStringKey* key_array, int enum_value);
98
107CDI_INTERFACE int CdiUtilityStringToEnumValue(const CdiEnumStringKey* key_array, const char* name_str);
108
117CDI_INTERFACE const char* CdiUtilityKeyEnumToString(CdiEnumStringKeyType key_type, int enum_value);
118
127CDI_INTERFACE int CdiUtilityKeyStringToEnum(CdiEnumStringKeyType key_type, const char* name_str);
128
137CDI_INTERFACE uint32_t CdiUtilityPtpToRtp(const CdiPtpTimestamp* ptp_timestamp_ptr, uint32_t sample_rate);
138
147
155static inline const char* CdiUtilityBoolToString(bool b)
156{
157 return b ? "true" : "false";
158}
159
160#endif // CDI_UTILITY_API_H__
static const char * CdiUtilityBoolToString(bool b)
Definition cdi_utility_api.h:155
CdiConnectionProtocolType
This enumeration is used in the CdiConnectionState structure to indicate what connection layer is bei...
Definition cdi_utility_api.h:71
@ kProtocolTypeRaw
Raw connection.
Definition cdi_utility_api.h:72
@ kProtocolTypeAvm
Audio, Video and Metadata (AVM) connection.
Definition cdi_utility_api.h:73
#define CDI_INTERFACE
Specify C linkage when compiling as C++ and define API interface export for Windows.
Definition cdi_utility_api.h:34
CDI_INTERFACE const char * CdiUtilityKeyEnumToString(CdiEnumStringKeyType key_type, int enum_value)
Definition cdi_utility_api.c:156
CDI_INTERFACE const char * CdiUtilityEnumValueToString(const CdiEnumStringKey *key_array, int enum_value)
Definition cdi_utility_api.c:120
CDI_INTERFACE const CdiEnumStringKey * CdiUtilityKeyGetArray(CdiEnumStringKeyType key_type)
Definition cdi_utility_api.c:104
CdiEnumStringKeyType
Enums used to indicate which key-value array a function is to access.
Definition cdi_utility_api.h:56
@ kKeyLogLevel
Key for CdiLogLevel.
Definition cdi_utility_api.h:62
@ kKeyAdapterType
Key for CdiAdapterTypeSelection.
Definition cdi_utility_api.h:57
@ kKeyConnectionProtocolType
Key for CdiConnectionProtocolType.
Definition cdi_utility_api.h:59
@ kKeyLogMethod
Key for CdiLogMethod.
Definition cdi_utility_api.h:60
@ kKeyConnectionStatus
Key for CdiConnectionStatus.
Definition cdi_utility_api.h:63
@ kKeyBufferType
Key for CdiBufferType.
Definition cdi_utility_api.h:58
@ kKeyLogComponent
Key for CdiLogComponent.
Definition cdi_utility_api.h:61
@ kKeyTestUnit
Key for CdiTestUnitName.
Definition cdi_utility_api.h:64
CDI_INTERFACE int CdiUtilityKeyStringToEnum(CdiEnumStringKeyType key_type, const char *name_str)
Definition cdi_utility_api.c:162
CDI_INTERFACE uint64_t CdiUtilityPtpTimestampToMicroseconds(const CdiPtpTimestamp *timestamp_ptr)
Definition cdi_utility_api.c:180
CDI_INTERFACE int CdiUtilityStringToEnumValue(const CdiEnumStringKey *key_array, const char *name_str)
Definition cdi_utility_api.c:138
CDI_INTERFACE uint32_t CdiUtilityPtpToRtp(const CdiPtpTimestamp *ptp_timestamp_ptr, uint32_t sample_rate)
Function used to convert a PTP timestamp into an RTP timestamp.
Definition cdi_utility_api.c:168
Type used for holding arrays of enums and related string representations.
Definition cdi_utility_api.h:46
const char * name_str
Corresponding string representation.
Definition cdi_utility_api.h:48
int enum_value
Enumerated value.
Definition cdi_utility_api.h:47
A structure for holding a PTP timestamp defined in seconds and nanoseconds. This PTP time as defined ...
Definition cdi_core_api.h:331