DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Sensor Serializer

Detailed Description

Defines sensor serializer.

Data Structures

struct  dwSerializerParams
 Holds the parameters for sensor serializer creation. More...
 

Typedefs

typedef struct dwSensorSerializerObject * dwSensorSerializerHandle_t
 Handle representing a sensor serializer. More...
 
typedef struct dwSensorSerializerNewObject * dwSensorSerializerNewHandle_t
 Handle representing a sensor serializer. More...
 
typedef void(* dwSensorSerializerOnDataFunc_t) (const uint8_t *data, size_t size, void *userData)
 Callback type for getting data from sensor serializer. More...
 

Functions

DW_API_PUBLIC dwStatus dwSensorSerializer_attachTo (dwSensorSerializerHandle_t const serializer, dwSensorSerializerHandle_t const masterSerializer)
 Starts and stops serialization of a sensor with a master serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_detachFrom (dwSensorSerializerHandle_t const serializer, dwSensorSerializerHandle_t const masterSerializer)
 This method detaches the serializer previously attached with dwSensorSerializer_attachTo(). More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_initialize (dwSensorSerializerHandle_t *const serializer, dwSerializerParams const *const params, dwSensorHandle_t const sensor)
 Initializes a sensor serializer with the parameters provided. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_isAttached (bool *const isAttached, dwSensorSerializerHandle_t const serializer)
 Query method to check whether the serializer is attached to another. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_release (dwSensorSerializerHandle_t const serializer)
 Releases a sensor serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeCameraFrame (dwCameraFrameHandle_t const frame, dwSensorSerializerHandle_t const serializer)
 Pushes a camera frame to the serializer.This method must only be used if 'dwSensorSerializer_start' is not called. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeCameraFrameAsync (dwCameraFrameHandle_t const frame, dwSensorSerializerHandle_t const serializer)
 Pushes a camera frame to the serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeData (uint8_t const *const data, size_t const size, dwSensorSerializerHandle_t const serializer)
 Pushes data to the serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeDataAsync (uint8_t const *const data, size_t const size, dwSensorSerializerHandle_t const serializer)
 Pushes data to the serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_start (dwSensorSerializerHandle_t const serializer)
 Starts serialization of sensor. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializer_stop (dwSensorSerializerHandle_t const serializer)
 Starts serialization of sensor. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_initialize (dwSensorSerializerNewHandle_t *const serializer, dwCodecHeaderHandle_t const codecHeader, dwSerializerParams const *const serializerConfig, dwContextHandle_t context)
 Initializes a sensor serializer with the parameters provided. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_release (dwSensorSerializerNewHandle_t const serializer)
 Releases a sensor serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeCameraFrame (dwCameraFrameHandle_t const frame, dwSensorSerializerNewHandle_t const serializer)
 Pushes a camera frame to the serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeCameraFrameAsync (dwCameraFrameHandle_t const frame, dwSensorSerializerNewHandle_t const serializer)
 Pushes a camera frame to the serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeData (uint8_t const *const data, size_t size, dwTime_t timestamp, dwSensorSerializerNewHandle_t const serializer)
 Pushes data to the serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeDataAsync (uint8_t const *const data, size_t size, dwTime_t timestamp, dwSensorSerializerNewHandle_t const serializer)
 Pushes data to the serializer. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_start (dwSensorSerializerNewHandle_t const serializer)
 Starts serialization of sensor. More...
 
DW_API_PUBLIC dwStatus dwSensorSerializerNew_stop (dwSensorSerializerNewHandle_t const serializer)
 Starts serialization of sensor. More...
 

Data Structure Documentation

◆ dwSerializerParams

struct dwSerializerParams
Data Fields
dwSensorSerializerOnDataFunc_t onData Callback executed by the serializer on new data available.
const char8_t * parameters Array for additional parameters provided to sensor serializer creation.

The parameters argument is an array in the form of key-value pairs separated by commas, i.e., key1=value1,key2=value2,key3=value3.

Supported 'keys' are:

  • 'type' - Required. Specifies data-sink settings.
    • If the value of 'type' is 'disk', the serializer streams data to the file specified in the 'file' key. For an example, see dwSensorSerializer_initialize().
    • If the value of 'type' is 'user', the serializer uses the provided callback to stream data. When new data is available, the serializer calls the function provided in onData and puts the data in the buffer provided by userData.
  • 'file' - See description for 'type'.
  • 'file-buffer-size' - Size of output buffer to use for file operations.
  • 'format' - Required. Specifies the video format. Supported values are 'h264' and 'raw'.
  • 'bitrate' - Required if 'format' is 'h264'; optional if it is 'raw'.
  • 'framerate' - Optional.

For a code snippet, see dwSensorSerializer_initialize().

void * userData User data to be passed to the callback.

Typedef Documentation

◆ dwSensorSerializerHandle_t

typedef struct dwSensorSerializerObject* dwSensorSerializerHandle_t

Handle representing a sensor serializer.

Definition at line 70 of file SensorSerializer.h.

◆ dwSensorSerializerNewHandle_t

typedef struct dwSensorSerializerNewObject* dwSensorSerializerNewHandle_t

Handle representing a sensor serializer.

Definition at line 68 of file SensorSerializer.h.

◆ dwSensorSerializerOnDataFunc_t

typedef void(* dwSensorSerializerOnDataFunc_t) (const uint8_t *data, size_t size, void *userData)

Callback type for getting data from sensor serializer.

Parameters
[in]dataA pointer to the byte array of serialized data.
[in]sizeA pointer to the size of the byte array.

Definition at line 67 of file SensorSerializer.h.

Function Documentation

◆ dwSensorSerializer_attachTo()

DW_API_PUBLIC dwStatus dwSensorSerializer_attachTo ( dwSensorSerializerHandle_t const  serializer,
dwSensorSerializerHandle_t const  masterSerializer 
)

Starts and stops serialization of a sensor with a master serializer.

This method attaches the serializer to the same thread of the master serializer. The slave serializer handle is still used to call dwSensorSerializer_serializeDataAsync().

Note
To ensure you don't miss any data, activate serialization before calling dwSensorSerializer_startSensor().
Parameters
[in]serializerSpecifies the sensor serializer handle.
[in]masterSerializerSpecifies the sensor serializer handle that is the main thread.
Returns
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_detachFrom()

DW_API_PUBLIC dwStatus dwSensorSerializer_detachFrom ( dwSensorSerializerHandle_t const  serializer,
dwSensorSerializerHandle_t const  masterSerializer 
)

This method detaches the serializer previously attached with dwSensorSerializer_attachTo().

Due to the asyncronous nature of this call, the serializer may still be attached to the serializing thread immediately following this call. dwSensorSerializer_isAttached() must be polled for status.

Note
To ensure you don't miss any data, activate serialization before calling dwSensorSerializer_startSensor().
Parameters
[in]serializerSpecifies the sensor serializer handle.
[in]masterSerializerSpecifies the sensor serializer handle that takes ownership of the serializer.
Returns
DW_NOT_AVAILABLE - serializer is not attached to another serializer.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_initialize()

DW_API_PUBLIC dwStatus dwSensorSerializer_initialize ( dwSensorSerializerHandle_t *const  serializer,
dwSerializerParams const *const  params,
dwSensorHandle_t const  sensor 
)

Initializes a sensor serializer with the parameters provided.

Parameters
[out]serializerA pointer to the sensor serializer handle.
[in]paramsA pointer to the sensor serializer parameters.
[in]sensorSpecifies the sensor used to create the serializer. This is necessary because each sensor has its own unique serializer. For example, camera provides a serializer that can encode the data, while GPS serializes RAW data.
Returns
DW_INVALID_HANDLE - if provided inputs are invalid
DW_INVALID_ARGUMENT
DW_SUCCESS

◆ dwSensorSerializer_isAttached()

DW_API_PUBLIC dwStatus dwSensorSerializer_isAttached ( bool *const  isAttached,
dwSensorSerializerHandle_t const  serializer 
)

Query method to check whether the serializer is attached to another.

See also
dwSensorSerializer_attachTo()
Parameters
[out]isAttachedSpecifies whether the sensor serializer handle is attached to another.
[in]serializerThe sensor serializer handle.
Returns
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_release()

DW_API_PUBLIC dwStatus dwSensorSerializer_release ( dwSensorSerializerHandle_t const  serializer)

Releases a sensor serializer.

If the serializer has been attached to a master serializer via dwSensorSerializer_attachTo(), this method fails with DW_NOT_AVAILABLE. If this happens, dwSensorSerializer_detachFrom() must be called, and then this method succeeds. If the serializer is a master serializer that has other serializers attached, it releases as normal and the slave serializers are no longer be attached.

Parameters
[in]serializerThe sensor serializer handle.
Returns
DW_INVALID_HANDLE - if provided inputs are invalid.
DW_INVALID_ARGUMENT
DW_NOT_AVAILABLE - if provided serializer is attached to another. DW_SUCCESS

◆ dwSensorSerializer_serializeCameraFrame()

DW_API_PUBLIC dwStatus dwSensorSerializer_serializeCameraFrame ( dwCameraFrameHandle_t const  frame,
dwSensorSerializerHandle_t const  serializer 
)

Pushes a camera frame to the serializer.This method must only be used if 'dwSensorSerializer_start' is not called.

This pushes the serialized image directly to the sink.

Parameters
[in]frameHandle to the camera frame.
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment,
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_serializeCameraFrameAsync()

DW_API_PUBLIC dwStatus dwSensorSerializer_serializeCameraFrameAsync ( dwCameraFrameHandle_t const  frame,
dwSensorSerializerHandle_t const  serializer 
)

Pushes a camera frame to the serializer.

This method is thread-safe.

Parameters
[in]frameHandle to the camera frame.
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment,
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_serializeData()

DW_API_PUBLIC dwStatus dwSensorSerializer_serializeData ( uint8_t const *const  data,
size_t const  size,
dwSensorSerializerHandle_t const  serializer 
)

Pushes data to the serializer.

This method is thread-safe and thus can be used on the capture thread (or any other thread).

Parameters
[in]dataA pointer to the byte array of data.
[in]sizeSpecifies the size of the byte array.
[in]serializerSpecifies the handle to the sensor serializer.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_serializeDataAsync()

DW_API_PUBLIC dwStatus dwSensorSerializer_serializeDataAsync ( uint8_t const *const  data,
size_t const  size,
dwSensorSerializerHandle_t const  serializer 
)

Pushes data to the serializer.

This method is thread-safe and thus can be used on the capture thread (or any other thread). Use this method in conjunction with 'dwSensorSerializer_start'/'dwSensorSerializer_stop'.

Parameters
[in]dataA pointer to the byte array of data.
[in]sizeSpecifies the size of the byte array.
[in]serializerSpecifies the handle to the sensor serializer.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_BUFFER_FULL - serializer buffer is full, data was not pushed to serializer.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_start()

DW_API_PUBLIC dwStatus dwSensorSerializer_start ( dwSensorSerializerHandle_t const  serializer)

Starts serialization of sensor.

This method creates a new thread and begins the serialization loop.

Note
To ensure you don't miss any data, activate serialization before calling dwSensorSerializer_startSensor().
Parameters
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializer_stop()

DW_API_PUBLIC dwStatus dwSensorSerializer_stop ( dwSensorSerializerHandle_t const  serializer)

Starts serialization of sensor.

This method stops the thread and the serialization loop.

Parameters
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializerNew_initialize()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_initialize ( dwSensorSerializerNewHandle_t *const  serializer,
dwCodecHeaderHandle_t const  codecHeader,
dwSerializerParams const *const  serializerConfig,
dwContextHandle_t  context 
)

Initializes a sensor serializer with the parameters provided.

Parameters
[out]serializerA pointer to the sensor serializer handle
[in]codecHeaderA pointer to the codec header for this serializer
[in]serializerConfigSensor serializer config parameter
[in]contextThe DW context
Returns
DW_INVALID_HANDLE - if provided inputs are invalid
DW_INVALID_ARGUMENT
DW_SUCCESS

◆ dwSensorSerializerNew_release()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_release ( dwSensorSerializerNewHandle_t const  serializer)

Releases a sensor serializer.

Parameters
[in]serializerThe sensor serializer handle.
Returns
DW_INVALID_HANDLE - if provided inputs are invalid.
DW_INVALID_ARGUMENT
DW_NOT_AVAILABLE - if provided serializer is attached to another. DW_SUCCESS

◆ dwSensorSerializerNew_serializeCameraFrame()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeCameraFrame ( dwCameraFrameHandle_t const  frame,
dwSensorSerializerNewHandle_t const  serializer 
)

Pushes a camera frame to the serializer.

Parameters
[in]frameHandle to the camera frame.
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment,
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializerNew_serializeCameraFrameAsync()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeCameraFrameAsync ( dwCameraFrameHandle_t const  frame,
dwSensorSerializerNewHandle_t const  serializer 
)

Pushes a camera frame to the serializer.

This method is thread-safe.

Parameters
[in]frameHandle to the camera frame.
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment,
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializerNew_serializeData()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeData ( uint8_t const *const  data,
size_t  size,
dwTime_t  timestamp,
dwSensorSerializerNewHandle_t const  serializer 
)

Pushes data to the serializer.

Parameters
[in]dataA pointer to the byte array of data.
[in]sizeSpecifies the size of the byte array.
[in]timestampSpecifies the timestamp for the data.
[in]serializerSpecifies the handle to the sensor serializer.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializerNew_serializeDataAsync()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeDataAsync ( uint8_t const *const  data,
size_t  size,
dwTime_t  timestamp,
dwSensorSerializerNewHandle_t const  serializer 
)

Pushes data to the serializer.

This method is thread-safe and thus can be used on the capture thread (or any other thread). Use this method in conjunction with 'dwSensorSerializer_start'/'dwSensorSerializer_stop'.

Parameters
[in]dataA pointer to the byte array of data.
[in]sizeSpecifies the size of the byte array.
[in]timestampSpecifies the timestamp for the data.
[in]serializerSpecifies the handle to the sensor serializer.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_BUFFER_FULL - serializer buffer is full, data was not pushed to serializer.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializerNew_start()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_start ( dwSensorSerializerNewHandle_t const  serializer)

Starts serialization of sensor.

This method creates a new thread and begins the serialization loop.

Note
To ensure you don't miss any data, activate serialization before calling dwSensorSerializer_startSensor().
Parameters
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS

◆ dwSensorSerializerNew_stop()

DW_API_PUBLIC dwStatus dwSensorSerializerNew_stop ( dwSensorSerializerNewHandle_t const  serializer)

Starts serialization of sensor.

This method stops the thread and the serialization loop.

Parameters
[in]serializerSpecifies the sensor serializer handle.
Returns
DW_NOT_AVAILABLE - serialization is not available at this moment.
DW_INVALID_HANDLE - if given handle is not valid.
DW_SUCCESS