Defines sensor serializer.
Defines sensor serializer base types.
Data Structures | |
struct | dwSerializerStats |
Holds the available statistics for a serializer. More... | |
struct | dwSerializerParams |
Holds the parameters for sensor serializer creation. More... | |
Typedefs | |
typedef struct dwSensorSerializerNewObject * | dwSensorSerializerNewHandle_t |
Handle representing a sensor serializer. More... | |
typedef enum dwSerializerStatTimeDifference | dwSerializerStatTimeDifference |
Defines the various delta used in statistics. More... | |
typedef struct dwSerializerStats | dwSerializerStats |
Holds the available statistics for a serializer. More... | |
typedef void(* | dwSensorSerializerOnDataFunc_t) (const uint8_t *data, size_t size, void *userData) |
Callback type for getting data from sensor serializer. More... | |
typedef struct dwSensorSerializerObject * | dwSensorSerializerHandle_t |
Handle representing a sensor serializer. More... | |
typedef struct dwSerializerParams | dwSerializerParams |
Holds the parameters for sensor serializer creation. More... | |
Enumerations | |
enum | dwSerializerStatTimeDifference { DW_SERIALIZER_STAT_DISK_WRITE_TIME = 0, DW_SERIALIZER_STAT_ENCODE_TIME = 1, DW_SERIALIZER_STAT_STAGE1_TIME = 2, DW_SERIALIZER_STAT_STAGE2_TIME = 3, DW_SERIALIZER_STAT_STAGE3_TIME = 4, DW_SERIALIZER_STAT_COUNT = 5 } |
Defines the various delta used in statistics. More... | |
Functions | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_initialize (dwSensorSerializerNewHandle_t *const serializer, dwCodecHeaderHandle_t const codecHeader, dwSerializerParams const *const serializerConfig, dwContextHandle_t const context) |
Create and initialize a sensor serializer based on the driveworks context parameter, CodecHeader parameter and dwSerializerParams parameter. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_release (dwSensorSerializerNewHandle_t const serializer) |
Release the sensor serializer. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_serializeData (uint8_t const *const data, size_t const size, dwTime_t const timestamp, dwSensorSerializerNewHandle_t const serializer) |
Serialize the data synchronously. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_serializeDataAsync (uint8_t const *const data, size_t const size, dwTime_t const timestamp, dwSensorSerializerNewHandle_t const serializer) |
Serialize the data asynchronously. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_serializeCameraFrame (dwCameraFrameHandle_t const frame, dwSensorSerializerNewHandle_t const serializer) |
Serialize the camera frame synchronously. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_serializeCameraFrameAsync (dwCameraFrameHandle_t const frame, dwSensorSerializerNewHandle_t const serializer) |
Serialize the camera frame asynchronously. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_start (dwSensorSerializerNewHandle_t const serializer) |
Create and launch a worker thread to do serialization task. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_stop (dwSensorSerializerNewHandle_t const serializer) |
Stop the internal worker thread. More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializerNew_appendAllocationAttributes (dwImageProperties *const imgProps, dwSensorSerializerNewHandle_t const serializer) |
The internal encoder's allocation attributes are appended to the image properties imgProps of the allocated images. 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_release (dwSensorSerializerHandle_t const serializer) |
Releases a sensor serializer. More... | |
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_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_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_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 | 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_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_getStats (dwSerializerStats *const outStats, dwSensorSerializerHandle_t const serializer) |
Gets serializer statistics (if available). More... | |
DW_API_PUBLIC dwStatus | dwSensorSerializer_appendAllocationAttributes (dwImageProperties *const imgProps, dwSensorSerializerHandle_t const serializer) |
Append the allocation attribute such that images allocated by the application and given to the serializer This API is used to append the underlying driver's allocation attributes to the image properties. More... | |
typedef struct dwSensorSerializerObject* dwSensorSerializerHandle_t |
Handle representing a sensor serializer.
Definition at line 86 of file SensorSerializerTypes.h.
typedef struct dwSensorSerializerNewObject* dwSensorSerializerNewHandle_t |
Handle representing a sensor serializer.
Definition at line 50 of file SensorSerializer.h.
Callback type for getting data from sensor serializer.
[in] | data | A pointer to the byte array of serialized data. |
[in] | size | A pointer to the size of the byte array. |
[in] | userData | User Data |
Definition at line 83 of file SensorSerializerTypes.h.
typedef struct dwSerializerParams dwSerializerParams |
Holds the parameters for sensor serializer creation.
typedef struct dwSerializerStats dwSerializerStats |
Holds the available statistics for a serializer.
Defines the various delta used in statistics.
Defines the various delta used in statistics.
Definition at line 37 of file SensorSerializerTypes.h.
DW_API_PUBLIC dwStatus dwSensorSerializer_appendAllocationAttributes | ( | dwImageProperties *const | imgProps, |
dwSensorSerializerHandle_t const | serializer | ||
) |
Append the allocation attribute such that images allocated by the application and given to the serializer This API is used to append the underlying driver's allocation attributes to the image properties.
[in,out] | imgProps | Image properties |
[in] | serializer | Handle to the serializer |
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().
[in] | serializer | Specifies the sensor serializer handle. |
[in] | masterSerializer | Specifies the sensor serializer handle that is the main thread. |
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.
[in] | serializer | Specifies the sensor serializer handle. |
[in] | masterSerializer | Specifies the sensor serializer handle that takes ownership of the serializer. |
DW_API_PUBLIC dwStatus dwSensorSerializer_getStats | ( | dwSerializerStats *const | outStats, |
dwSensorSerializerHandle_t const | serializer | ||
) |
Gets serializer statistics (if available).
[out] | outStats | A pointer to a structure containing the statistics. |
[in] | serializer | Handle to the serializer |
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.
[out] | serializer | A pointer to the sensor serializer handle. |
[in] | params | A pointer to the sensor serializer parameters. |
[in] | sensor | Specifies 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. |
DW_API_PUBLIC dwStatus dwSensorSerializer_isAttached | ( | bool *const | isAttached, |
dwSensorSerializerHandle_t const | serializer | ||
) |
Query method to check whether the serializer is attached to another.
[out] | isAttached | Specifies whether the sensor serializer handle is attached to another. |
[in] | serializer | The sensor serializer handle. |
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.
[in] | serializer | The sensor serializer handle. |
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.
[in] | frame | Handle to the camera frame. |
[in] | serializer | Specifies the sensor serializer handle. |
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.
[in] | frame | Handle to the camera frame. |
[in] | serializer | Specifies the sensor serializer handle. |
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).
[in] | data | A pointer to the byte array of data. |
[in] | size | Specifies the size of the byte array. |
[in] | serializer | Specifies the handle to the sensor serializer. |
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'.
[in] | data | A pointer to the byte array of data. |
[in] | size | Specifies the size of the byte array. |
[in] | serializer | Specifies the handle to the sensor serializer. |
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.
[in] | serializer | Specifies the sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializer_stop | ( | dwSensorSerializerHandle_t const | serializer | ) |
Starts serialization of sensor.
This method stops the thread and the serialization loop.
[in] | serializer | Specifies the sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_appendAllocationAttributes | ( | dwImageProperties *const | imgProps, |
dwSensorSerializerNewHandle_t const | serializer | ||
) |
The internal encoder's allocation attributes are appended to the image properties imgProps
of the allocated images.
These images can be set as the image pool for camera frames. By doing so, the camera frames fed to the serializer can be properly encoded by the internal encoder, utilizing the allocated images with the appropriate attributes.
[in,out] | imgProps | Image properties to have allocation attributes appended from the serializer(internal encoder). |
[in] | serializer | Sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_initialize | ( | dwSensorSerializerNewHandle_t *const | serializer, |
dwCodecHeaderHandle_t const | codecHeader, | ||
dwSerializerParams const *const | serializerConfig, | ||
dwContextHandle_t const | context | ||
) |
Create and initialize a sensor serializer based on the driveworks context parameter, CodecHeader parameter and dwSerializerParams parameter.
[out] | serializer | A pointer to the created sensor serializer handle. |
[in] | codecHeader | CodecHeader handle. It determines the media type and codec type of the Serializer. |
[in] | serializerConfig | A Parameter to Configure the Serializer, such as work mode, file path to save the serialized data. Refer to comments of dwSerializerParams to see more details. |
[in] | context | The DW context |
context
. DW_API_PUBLIC dwStatus dwSensorSerializerNew_release | ( | dwSensorSerializerNewHandle_t const | serializer | ) |
Release the sensor serializer.
Stop the worker thread if the serializer works in async-mode. All packets cached in the serializer will be processed. The output stream is flushed and closed. Destroy the underlying Sensor Serializer object.
[in] | serializer | sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeCameraFrame | ( | dwCameraFrameHandle_t const | frame, |
dwSensorSerializerNewHandle_t const | serializer | ||
) |
Serialize the camera frame synchronously.
Once this API returns successfully, the camera frame is serialized into an output stream. After serialization, the serialized data is flushed to storage, guaranteeing that it is written and saved.
[in] | frame | The camera frame data to be serialized. |
[in] | serializer | Sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeCameraFrameAsync | ( | dwCameraFrameHandle_t const | frame, |
dwSensorSerializerNewHandle_t const | serializer | ||
) |
Serialize the camera frame asynchronously.
Once this API returns successfully, the camera frame packet is added to an internal buffer or queue. An internal worker thread periodically serializes the packets from this buffer or queue. Finally, the serialized data is flushed into storage, ensuring it is written and saved. No additional action or option is required for this particular camera frame packet.
[in] | frame | The camera frame data to be serialized. |
[in] | serializer | Sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeData | ( | uint8_t const *const | data, |
size_t const | size, | ||
dwTime_t const | timestamp, | ||
dwSensorSerializerNewHandle_t const | serializer | ||
) |
Serialize the data synchronously.
Once this API returns successfully, the data is serialized into an output stream. After serialization, the serialized data is flushed to storage, guaranteeing that it is written and saved.
[in] | data | First byte of the data packet to be serialized. |
[in] | size | Total count of bytes of the data packet to be serialized. |
[in] | timestamp | The timestamp of the data packet to be serialized, will be recorded into the serialized data. |
[in] | serializer | Sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_serializeDataAsync | ( | uint8_t const *const | data, |
size_t const | size, | ||
dwTime_t const | timestamp, | ||
dwSensorSerializerNewHandle_t const | serializer | ||
) |
Serialize the data asynchronously.
Once this API returns successfully, the data packet is added to an internal buffer or queue. An internal worker thread periodically serializes the packets from this buffer or queue. Finally, the serialized data is flushed into storage, ensuring it is written and saved. No additional action or option is required for this particular data packet.
[in] | data | First byte of the data packet to be serialized. |
[in] | size | Total count of bytes of the data packet to be serialized. |
[in] | timestamp | The timestamp of the data packet to be serialized, will be recorded into the serialized data. |
[in] | serializer | Sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_start | ( | dwSensorSerializerNewHandle_t const | serializer | ) |
Create and launch a worker thread to do serialization task.
This action is applicable only when the Serializer is operating in async-mode.
[in] | serializer | Sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializerNew_stop | ( | dwSensorSerializerNewHandle_t const | serializer | ) |
Stop the internal worker thread.
all packets cached in the serializer are processed before the dedicated thread is halted. This action is applicable only when the Serializer is operating in async-mode.
[in] | serializer | Sensor serializer handle. |