VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
vrs_sample_apps::ImageStreamPlayer Class Reference

Image stream reader showing how to read records from a typical stream containing images. More...

Inheritance diagram for vrs_sample_apps::ImageStreamPlayer:
vrs::RecordFormatStreamPlayer vrs::StreamPlayer

Public Member Functions

bool onDataLayoutRead (const CurrentRecord &record, size_t blockIndex, DataLayout &dl) override
 
bool onImageRead (const CurrentRecord &record, size_t idx, const ContentBlock &cb) override
 
size_t getImageReadCount () const
 
- Public Member Functions inherited from vrs::RecordFormatStreamPlayer
virtual bool onAudioRead (const CurrentRecord &record, size_t blockIndex, const ContentBlock &cb)
 
virtual bool onCustomBlockRead (const CurrentRecord &rec, size_t blkIdx, const ContentBlock &cb)
 
virtual bool onUnsupportedBlock (const CurrentRecord &rec, size_t blkIdx, const ContentBlock &cb)
 
void onAttachedToFileReader (RecordFileReader &recordFileReader, StreamId streamId) override
 
bool processRecordHeader (const CurrentRecord &record, DataReference &outDataReference) override
 
void processRecord (const CurrentRecord &record, uint32_t readSize) override
 
RecordFormatReadergetLastRecordFormatReader (StreamId id, Record::Type recordType) const
 
RecordFormatReadergetCurrentRecordFormatReader () const
 
- Public Member Functions inherited from vrs::StreamPlayer
virtual bool processStateHeader (const CurrentRecord &, DataReference &)
 
virtual void processState (const CurrentRecord &, uint32_t)
 
virtual bool processConfigurationHeader (const CurrentRecord &, DataReference &)
 
virtual void processConfiguration (const CurrentRecord &, uint32_t)
 
virtual bool processDataHeader (const CurrentRecord &, DataReference &)
 
virtual void processData (const CurrentRecord &, uint32_t)
 
virtual int recordReadComplete (RecordFileReader &, const IndexRecord::RecordInfo &)
 
virtual void flush ()
 

Additional Inherited Members

- Protected Member Functions inherited from vrs::RecordFormatStreamPlayer
template<class T >
T & getExpectedLayout (DataLayout &layout, size_t blockIndex)
 
template<class T >
T & getLegacyLayout (DataLayout &layout, size_t blockIndex)
 
template<class T >
T & getCachedLayout (vector< unique_ptr< DataLayout > > &layoutCache, DataLayout &layout, size_t blockIndex)
 
- Protected Attributes inherited from vrs::RecordFormatStreamPlayer
RecordFileReaderrecordFileReader_ {}
 
map< tuple< StreamId, Record::Type, uint32_t >, RecordFormatReaderreaders_
 
map< pair< StreamId, Record::Type >, RecordFormatReader * > lastReader_
 
RecordFormatReadercurrentReader_ {}
 

Detailed Description

Image stream reader showing how to read records from a typical stream containing images.

Member Function Documentation

◆ onDataLayoutRead()

bool vrs_sample_apps::ImageStreamPlayer::onDataLayoutRead ( const CurrentRecord record,
size_t  ,
DataLayout  
)
inlineoverridevirtual

Callback for DataLayout content blocks, after it was read.

Parameters
recordMetadata associated with the record being read.
blockIndexIndex of the content block being read.
dlDataLayout read.
Returns
Return true if remaining record content blocks should be read. Return false, if the record should not be read entirely, for instance, if you only need to read some metadata stored in the first content block, but don't need to read & decode the rest of the record.

Reimplemented from vrs::RecordFormatStreamPlayer.

◆ onImageRead()

bool vrs_sample_apps::ImageStreamPlayer::onImageRead ( const CurrentRecord record,
size_t  blockIndex,
const ContentBlock cb 
)
inlineoverridevirtual

Callback for image content blocks. The ContentBlock object 'cb' describes the image content block, but the content block's data has not been read yet. Query the ContentBlock object to know the details about the image and the content block's size. Then you can allocate or reuse a buffer, and call record.reader->read() to read the content block's data in that buffer. Depending on cb.image().getImageFormat(), the content block's data will be: ImageFormat::RAW: raw pixel buffer data, in the format specified by cb.image.getPixelFormat(). ImageFormat::JPG: JPG data, as it found in a regular .jpg file. ImageFormat::PNG: PNG data, as it found in a regular .png file. ImageFormat::VIDEO: compressed data, as generated by the video codec cb.image.getCodecName(). Preferably, use a VideoRecordFormatStreamPlayer object to decode such records.

Parameters
recordMetadata associated with the record being read.
blockIndexIndex of the content block being read.
cbContentBlock describing the image data to be read.
Returns
Return true if remaining record content blocks should be read.

find more about the image format:

Reimplemented from vrs::RecordFormatStreamPlayer.


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