CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
cdi_baseline_profile_api.h File Reference

This file contains declarations and definitions for the CDI AVM baseline profile API functions. More...

#include <stdbool.h>
#include "cdi_avm_api.h"

Go to the source code of this file.

Data Structures

struct  CdiAvmBaselineProfileVersion
 Structure containing the version information common to audio, video, and metadata in the baseline configuration structure. More...
 
struct  CdiAvmBaselineConfigCommon
 Structure that is common to all baseline profile versions. This allows the APIs to determine payload type and profile version. Once that has been determined, the structure can then be used by baseline version specific logic where it is cast to the appropriate type. More...
 
struct  CdiAvmVTableApi
 Type used to hold V-table of APIs that must be implemented by baseline profiles. More...
 

Macros

#define CDI_BASELINE_AVM_PAYLOAD_TYPE_ENUM_COUNT   (kCdiAvmAncillary)
 Macro used to determine number of enumerated values in CdiBaselineAvmPayloadType, without having to add a "kCdiAvmLast" enum value.
 

Typedefs

typedef struct CdiAvmBaselineConfig CdiAvmBaselineConfig
 Forward reference of structure to create pointers later.
 
typedef bool(* CdiMakeBaselineConfigurationPtr) (const CdiAvmBaselineConfigCommon *baseline_config_ptr, CdiAvmConfig *config_ptr, int *payload_unit_size_ptr)
 Prototype of function used to make a baseline configuration string from a configuration structure.
 
typedef bool(* CdiParseBaselineConfigurationPtr) (const CdiAvmConfig *config_ptr, CdiAvmBaselineConfigCommon *baseline_config_ptr)
 Prototype of function used to parse a baseline configuration string and generate a configuration structure.
 
typedef CdiReturnStatus(* CdiAvmGetBaselineUnitSizePtr) (const CdiAvmBaselineConfigCommon *baseline_config_ptr, int *payload_unit_size_ptr)
 Prototype of function used to get baseline unit size.
 
typedef const CdiEnumStringKey *(* CdiAvmKeyGetArrayPtr) (CdiAvmBaselineEnumStringKeyTypes key_type)
 Prototype of function used to get enum/string table for the specified key.
 

Enumerations

enum  CdiBaselineAvmPayloadType { kCdiAvmNotBaseline , kCdiAvmVideo , kCdiAvmAudio , kCdiAvmAncillary }
 Payload types used in CdiAvmRxData. NOTE: Any changes made here MUST also be made to "payload_type_key_array" in cdi_utility_api.c and "avm_uri_strings" in baseline_profile.c. More...
 
enum  CdiAvmBaselineEnumStringKeyTypes {
  kKeyAvmPayloadType , kKeyAvmVideoSamplingType , kKeyAvmVideoAlphaChannelType , kKeyAvmVideoBitDepthType ,
  kKeyAvmVideoColorimetryType , kKeyAvmVideoTcsType , kKeyAvmVideoRangeType , kKeyAvmAudioChannelGroupingType ,
  kKeyAvmAudioSampleRateType
}
 Enums used to indicate which key-value array a function is to access. More...
 

Functions

CDI_INTERFACE CdiReturnStatus CdiAvmRegisterBaselineProfile (CdiBaselineAvmPayloadType media_type, const char *profile_version_str, CdiAvmVTableApi *vtable_api_ptr)
 Register a baseline profile.
 
CDI_INTERFACE CdiReturnStatus CdiAvmMakeBaselineConfiguration (const CdiAvmBaselineConfig *baseline_config_ptr, CdiAvmConfig *config_ptr, int *payload_unit_size_ptr)
 
CDI_INTERFACE CdiReturnStatus CdiAvmMakeBaselineConfiguration2 (const CdiAvmBaselineConfigCommon *baseline_config_ptr, CdiAvmConfig *config_ptr, int *payload_unit_size_ptr)
 New version of the existing CdiAvmMakeBaselineConfiguration() API that supports a generic extensible baseline configuration structure. For more details see CdiAvmMakeBaselineConfiguration().
 
CDI_INTERFACE CdiReturnStatus CdiAvmParseBaselineConfiguration (const CdiAvmConfig *config_ptr, CdiAvmBaselineConfig *baseline_config_ptr)
 Converts from the AVM configuration structure to the CDI baseline configuration structure if possible. This is to be called on the receive side if the CdiAvmConfig structure is provided to the registered receive payload callback function. This function must be called whenever the config_ptr is non-NULL as the first step in determining the stream's configuration. If kCdiStatusOk is returned, then the configuration belongs to the CDI baseline profile described by the structure filled in at baseline_config_ptr. A code other than kCdiStatusOk is returned when the configuration is not recognized as a supported baseline profile. An AVM configuration not convertible to a CDI baseline configuration must be parsed by an application-specific function.
 
CDI_INTERFACE CdiReturnStatus CdiAvmParseBaselineConfiguration2 (const CdiAvmConfig *config_ptr, CdiAvmBaselineConfigCommon *baseline_config_ptr)
 
CDI_INTERFACE CdiReturnStatus CdiAvmGetBaselineUnitSize (const CdiAvmBaselineConfig *baseline_config_ptr, int *payload_unit_size_ptr)
 Gets the unit size in bits for transmission of the media as specified by the configuration structure.
 
CDI_INTERFACE CdiReturnStatus CdiAvmGetBaselineUnitSize2 (const CdiAvmBaselineConfigCommon *baseline_config_ptr, int *payload_unit_size_ptr)
 New version of the existing CdiAvmGetBaselineUnitSize() API that supports a generic extensible baseline configuration structure. For more details see CdiAvmGetBaselineUnitSize().
 
CDI_INTERFACE const char * CdiAvmKeyEnumToString (CdiAvmBaselineEnumStringKeyTypes key_type, int enum_value, const CdiAvmBaselineProfileVersion *version_ptr)
 
CDI_INTERFACE int CdiAvmKeyStringToEnum (CdiAvmBaselineEnumStringKeyTypes key_type, const char *name_str, const CdiAvmBaselineProfileVersion *version_ptr)
 
CDI_INTERFACE const CdiEnumStringKeyCdiAvmKeyGetArray (CdiAvmBaselineEnumStringKeyTypes key_type, const CdiAvmBaselineProfileVersion *version_ptr)
 
CDI_INTERFACE bool CdiAvmParseBaselineVersionString (const char *version_str, CdiAvmBaselineProfileVersion *ret_version_ptr)
 
CDI_INTERFACE CdiReturnStatus CdiAvmValidateBaselineVersionString (CdiBaselineAvmPayloadType media_type, const char *version_str, CdiAvmBaselineProfileVersion *ret_version_ptr)
 

Detailed Description

This file contains declarations and definitions for the CDI AVM baseline profile API functions.

Typedef Documentation

◆ CdiAvmGetBaselineUnitSizePtr

typedef CdiReturnStatus(* CdiAvmGetBaselineUnitSizePtr) (const CdiAvmBaselineConfigCommon *baseline_config_ptr, int *payload_unit_size_ptr)

Prototype of function used to get baseline unit size.

Parameters
baseline_config_ptrA pointer to common baseline configuration data.
payload_unit_size_ptrAddress where to write returned unit size.
Returns
Status code.

◆ CdiAvmKeyGetArrayPtr

typedef const CdiEnumStringKey *(* CdiAvmKeyGetArrayPtr) (CdiAvmBaselineEnumStringKeyTypes key_type)

Prototype of function used to get enum/string table for the specified key.

Parameters
key_typeEnumerated key type.
Returns
Pointer to enum/string keypair table. If none is found, NULL is returned.

◆ CdiMakeBaselineConfigurationPtr

typedef bool(* CdiMakeBaselineConfigurationPtr) (const CdiAvmBaselineConfigCommon *baseline_config_ptr, CdiAvmConfig *config_ptr, int *payload_unit_size_ptr)

Prototype of function used to make a baseline configuration string from a configuration structure.

Parameters
baseline_config_ptrA pointer to common baseline configuration data.
config_ptrA pointer to AVM configuration data.
payload_unit_size_ptrAddress where to write returned payload unit size.
Returns
true is returned if conversion is successful.

◆ CdiParseBaselineConfigurationPtr

typedef bool(* CdiParseBaselineConfigurationPtr) (const CdiAvmConfig *config_ptr, CdiAvmBaselineConfigCommon *baseline_config_ptr)

Prototype of function used to parse a baseline configuration string and generate a configuration structure.

Parameters
config_ptrA pointer to AVM configuration data.
baseline_config_ptrA pointer to common baseline configuration data.
Returns
true is returned if conversion is successful.

Enumeration Type Documentation

◆ CdiAvmBaselineEnumStringKeyTypes

Enums used to indicate which key-value array a function is to access.

NOTE: Update CdiAvmKeyGetArray() in baseline_profile.c whenever an entry is added to this table.

Enumerator
kKeyAvmPayloadType 

Keys that contain one set of unique data (not specific to a profile or version). See CdiAvmKeyGetArray().

Key for CdiAvmPayloadType

kKeyAvmVideoSamplingType 

Keys used by video profiles. See EnumStringKeyTypeToPayloadType().

Key for CdiAvmVideoSampling

kKeyAvmVideoAlphaChannelType 

Key for CdiAvmVideoAlphaChannel.

kKeyAvmVideoBitDepthType 

Key for CdiAvmVideoBitDepth.

kKeyAvmVideoColorimetryType 

Key for CdiAvmColorimetry.

kKeyAvmVideoTcsType 

Key for CdiAvmVideoTcs.

kKeyAvmVideoRangeType 

Key for CdiAvmVideoRange.

kKeyAvmAudioChannelGroupingType 

Key for CdiAvmAudioChannelGrouping.

kKeyAvmAudioSampleRateType 

Key for CdiAvmAudioSampleRate.

◆ CdiBaselineAvmPayloadType

Payload types used in CdiAvmRxData. NOTE: Any changes made here MUST also be made to "payload_type_key_array" in cdi_utility_api.c and "avm_uri_strings" in baseline_profile.c.

Enumerator
kCdiAvmNotBaseline 

Payload contains data for some type other than baseline profile.

kCdiAvmVideo 

Payload contains video data.

kCdiAvmAudio 

Payload contains audio data.

kCdiAvmAncillary 

Payload contains ancillary data.

Function Documentation

◆ CdiAvmGetBaselineUnitSize()

CDI_INTERFACE CdiReturnStatus CdiAvmGetBaselineUnitSize ( const CdiAvmBaselineConfig * baseline_config_ptr,
int * payload_unit_size_ptr )

Gets the unit size in bits for transmission of the media as specified by the configuration structure.

Parameters
baseline_config_ptrThe address of a configuration structure whose unit size is of interest.
payload_unit_size_ptrPointer to location where the unit bit length is to be written.
Returns
CdiReturnStatus kCdiStatusOk if the configuration structure was correct enough to determine a unit size, otherwise kCdiStatusFatal.

◆ CdiAvmKeyEnumToString()

CDI_INTERFACE const char * CdiAvmKeyEnumToString ( CdiAvmBaselineEnumStringKeyTypes key_type,
int enum_value,
const CdiAvmBaselineProfileVersion * version_ptr )

Function used to convert an enum value to a string.

Parameters
key_typeEnum which indicates which key-value array to search for enum_value.
enum_valueValue to convert to a string.
version_ptrPointer to profile version to use. If NULL, profile version 01.00 is used.
Returns
Pointer to returned string. If no match was found, NULL is returned.

◆ CdiAvmKeyGetArray()

CDI_INTERFACE const CdiEnumStringKey * CdiAvmKeyGetArray ( CdiAvmBaselineEnumStringKeyTypes key_type,
const CdiAvmBaselineProfileVersion * version_ptr )

Function used to get a pointer to a key-value array of a type specified by key_type.

Parameters
key_typeEnum from EnumStringKeyTypes which indicates which key-value array to return.
version_ptrPointer to profile version to use. If NULL, profile version 01.00 is used.
Returns
Pointer to returned string. If no match was found, NULL is returned.

◆ CdiAvmKeyStringToEnum()

CDI_INTERFACE int CdiAvmKeyStringToEnum ( CdiAvmBaselineEnumStringKeyTypes key_type,
const char * name_str,
const CdiAvmBaselineProfileVersion * version_ptr )

Function used to convert a string to a matching enum value.

Parameters
key_typeEnum which indicates which key-value array to search for name_str.
name_strPointer to string name of enumerated value.
version_ptrPointer to profile version to use. If NULL, profile version 01.00 is used.
Returns
Returned enumerated value. If no match was found, CDI_INVALID_ENUM_VALUE is returned.

◆ CdiAvmMakeBaselineConfiguration()

CDI_INTERFACE CdiReturnStatus CdiAvmMakeBaselineConfiguration ( const CdiAvmBaselineConfig * baseline_config_ptr,
CdiAvmConfig * config_ptr,
int * payload_unit_size_ptr )

Converts from the simple, constrained baseline configuration structures to the more general purpose CdiAvmConfig structure used in the AVM interface. This is useful on the transmit side for streams that comply with the baseline CDI profile for inter-vendor compatibility.

NOTE: Newly created data structures that are passed in to this function should be properly initialized before being programmed with user values. Use memset or a zero structure initializer (= {0}) to set the whole structure to zero before setting the desired members to the actual values required.

Parameters
baseline_config_ptrAddress of the source configuration structure.
config_ptrAddress of where to write the resulting AVM configuration structure.
payload_unit_size_ptrAddress of where to write the payload unit size which is used by the transmit packetizer. This value should be passed in the unit_size member of the payload_config_ptr->core_config_data structure when calling CdiAvmTxPayload().
Returns
CdiReturnStatus kCdiStatusOk if the conversion was successful, kCdiStatusFatal if config_ptr is NULL or the baseline configuration

◆ CdiAvmParseBaselineConfiguration()

CDI_INTERFACE CdiReturnStatus CdiAvmParseBaselineConfiguration ( const CdiAvmConfig * config_ptr,
CdiAvmBaselineConfig * baseline_config_ptr )

Converts from the AVM configuration structure to the CDI baseline configuration structure if possible. This is to be called on the receive side if the CdiAvmConfig structure is provided to the registered receive payload callback function. This function must be called whenever the config_ptr is non-NULL as the first step in determining the stream's configuration. If kCdiStatusOk is returned, then the configuration belongs to the CDI baseline profile described by the structure filled in at baseline_config_ptr. A code other than kCdiStatusOk is returned when the configuration is not recognized as a supported baseline profile. An AVM configuration not convertible to a CDI baseline configuration must be parsed by an application-specific function.

Parameters
config_ptrPointer to the AVM configuration structure provided to the registered receive payload callback function.
baseline_config_ptrAddress where baseline configuration structure parameters are written to when the return code is kCdiStatusOk. When the return code is kCdiStatusProfileNotSupported, then only payload_type is written. For any other return code no parameters are written.
Returns
kCdiStatusOk if conversion to CDI baseline configuration was successful; kCdiStatusFatal if a CDI baseline configuration was recognized but baseline_config_ptr is NULL; kCdiStatusNonFatal when the AVM configuration structure could not be interpreted or did not meet specifications; kCdiStatusProfileNotSupported when a CDI profile version was parsed but no corresponding baseline profile was found.

◆ CdiAvmParseBaselineConfiguration2()

CDI_INTERFACE CdiReturnStatus CdiAvmParseBaselineConfiguration2 ( const CdiAvmConfig * config_ptr,
CdiAvmBaselineConfigCommon * baseline_config_ptr )

New version of the existing CdiAvmParseBaselineConfiguration() API that supports a generic extensible baseline configuration structure. For more details see CdiAvmParseBaselineConfiguration().

◆ CdiAvmParseBaselineVersionString()

CDI_INTERFACE bool CdiAvmParseBaselineVersionString ( const char * version_str,
CdiAvmBaselineProfileVersion * ret_version_ptr )

Converts a string representing a baseline configuration structure version number in the form of "xx.yy" into a structure with major and minor members.

Parameters
version_strThe source string to convert.
ret_version_ptrThe address of the structure to write the version numbers into.
Returns
true if the conversion was successful, false if a failure was encountered.

◆ CdiAvmRegisterBaselineProfile()

CDI_INTERFACE CdiReturnStatus CdiAvmRegisterBaselineProfile ( CdiBaselineAvmPayloadType media_type,
const char * profile_version_str,
CdiAvmVTableApi * vtable_api_ptr )

Register a baseline profile.

Parameters
media_typeEnum which indicates the type of payload data (ie. video, audio or ancillary data).
profile_version_strPointer to profile version string. Must be in "xx.xx" format.
vtable_api_ptrPointer to V-table to use for required baseline profile APIs.
Returns
kCdiStatusOk if ok. kCdiStatusArraySizeExceeded if array size has been exceeded, otherwise kCdiStatusFatal.

◆ CdiAvmValidateBaselineVersionString()

CDI_INTERFACE CdiReturnStatus CdiAvmValidateBaselineVersionString ( CdiBaselineAvmPayloadType media_type,
const char * version_str,
CdiAvmBaselineProfileVersion * ret_version_ptr )

Parses a baseline configuration version number from a string of the form of "xx.yy". When the string represents a registered baseline configuration version, writes the version numbers into the provided output structure.

Parameters
media_typeEnum which indicates the type of payload data (ie. video, audio or ancillary data).
version_strThe source string to convert.
ret_version_ptrThe address of the structure to write the version numbers into.
Returns
Returns kCdiStatusOk if and only if the source string represents a known baseline configuration.