LiveKit C++ Client SDK v1.9.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
livekit::DataTrackFrameEncoding Class Reference

Encoding used for frames sent on a data track. More...

#include <data_track_schema.h>

Public Types

enum  WellKnown {
  Ros1 , Cdr , Protobuf , Flatbuffer ,
  Cbor , Msgpack , Json , Other
}
 Well-known frame encodings. More...
 

Public Member Functions

 DataTrackFrameEncoding (WellKnown well_known)
 Construct a well-known encoding.
 
bool isCustom () const
 Check whether this is a custom encoding.
 
WellKnown wellKnown () const
 Get the well-known encoding.
 
const std::string & customIdentifier () const
 Get the custom identifier.
 

Static Public Member Functions

static DataTrackFrameEncoding custom (std::string identifier)
 Construct a custom, application-defined encoding.
 

Detailed Description

Encoding used for frames sent on a data track.

The serialization format of the frame bytes (for example, DataTrackFrameEncoding::Protobuf); the structure of those bytes is described by a schema (see DataTrackSchemaEncoding).

Almost all tracks use a well-known encoding, which converts implicitly:

options.frame_encoding = DataTrackFrameEncoding::Json;
@ Json
JSON, self-describing or described by a JsonSchema schema.
Definition data_track_schema.h:137

For the uncommon case of an encoding outside the well-known set, use DataTrackFrameEncoding::custom.

Member Enumeration Documentation

◆ WellKnown

Well-known frame encodings.

Enumerator
Ros1 

ROS 1, described by a Ros1Msg schema.

Cdr 

CDR, described by a Ros2Msg, Ros2Idl, or OmgIdl schema.

Protobuf 

Protocol Buffer, described by a Protobuf schema.

Flatbuffer 

FlatBuffer, described by a Flatbuffer schema.

Cbor 

CBOR, self-describing.

Msgpack 

MessagePack, self-describing.

Json 

JSON, self-describing or described by a JsonSchema schema.

Other 

Another well-known encoding not known to this client version.

Constructor & Destructor Documentation

◆ DataTrackFrameEncoding()

livekit::DataTrackFrameEncoding::DataTrackFrameEncoding ( WellKnown  well_known)
inline

Construct a well-known encoding.

The constructor is intentionally implicit for the common well-known case.

Parameters
well_knownWell-known frame encoding.

Member Function Documentation

◆ custom()

static DataTrackFrameEncoding livekit::DataTrackFrameEncoding::custom ( std::string  identifier)
inlinestatic

Construct a custom, application-defined encoding.

Prefer a well-known encoding wherever one applies. The identifier must be non-empty and no longer than 25 characters.

Parameters
identifierCustom encoding identifier.
Returns
Custom frame encoding.

◆ customIdentifier()

const std::string & livekit::DataTrackFrameEncoding::customIdentifier ( ) const
inline

Get the custom identifier.

Returns
The custom identifier. Empty when isCustom is false.

◆ isCustom()

bool livekit::DataTrackFrameEncoding::isCustom ( ) const
inline

Check whether this is a custom encoding.

Returns
true if this is a custom encoding rather than a well-known one.

◆ wellKnown()

WellKnown livekit::DataTrackFrameEncoding::wellKnown ( ) const
inline

Get the well-known encoding.

Returns
The well-known encoding. Only meaningful when isCustom is false.

The documentation for this class was generated from the following file: