RDK Documentation (Open Sourced RDK Components)
IsoBmffBuffer Class Reference

Class for ISO BMFF Buffer. More...

#include <isobmffbuffer.h>

Collaboration diagram for IsoBmffBuffer:
Collaboration graph

Public Member Functions

 IsoBmffBuffer (AampLogManager *logObj=NULL)
 IsoBmffBuffer constructor.
 
 ~IsoBmffBuffer ()
 IsoBmffBuffer destructor.
 
 IsoBmffBuffer (const IsoBmffBuffer &)=delete
 
IsoBmffBufferoperator= (const IsoBmffBuffer &)=delete
 
void setBuffer (uint8_t *buf, size_t sz)
 Set buffer. More...
 
bool parseBuffer (bool correctBoxSize=false, int newTrackId=-1)
 Parse ISOBMFF boxes from buffer. More...
 
void restampPTS (uint64_t offset, uint64_t basePts, uint8_t *segment, uint32_t bufSz)
 Restamp PTS in a buffer. More...
 
bool getFirstPTS (uint64_t &pts)
 Get first PTS of buffer. More...
 
bool getTrack_id (uint32_t &track_id)
 Get track_id from the trak box. More...
 
void PrintPTS (void)
 Print PTS of buffer. More...
 
bool getTimeScale (uint32_t &timeScale)
 Get TimeScale value of buffer. More...
 
void destroyBoxes ()
 Release ISOBMFF boxes parsed. More...
 
void printBoxes ()
 Print ISOBMFF boxes. More...
 
bool isInitSegment ()
 Check if buffer is an initialization segment. More...
 
bool parseMdatBox (uint8_t *buf, size_t &size)
 Get mdat buffer handle and size from parsed buffer. More...
 
bool getMdatBoxSize (size_t &size)
 Get mdat buffer size. More...
 
bool getEMSGData (uint8_t *&message, uint32_t &messageLen, uint8_t *&schemeIdUri, uint8_t *&value, uint64_t &presTime, uint32_t &timeScale, uint32_t &eventDuration, uint32_t &id)
 Get information from EMSG box. More...
 
bool getEMSGInfoInternal (const std::vector< Box * > *boxes, uint8_t *&message, uint32_t &messageLen, uint8_t *&schemeIdUri, uint8_t *&value, uint64_t &presTime, uint32_t &timeScale, uint32_t &eventDuration, uint32_t &id, bool &foundEmsg)
 Get emsg informations. More...
 
bool getMdatBoxCount (size_t &count)
 Check mdat buffer count in parsed buffer. More...
 
void printMdatBoxes ()
 Print ISOBMFF mdat boxes in parsed buffer. More...
 
bool getTypeOfBoxes (const char *name, std::vector< Box * > &stBoxes)
 Get list of box handle in parsed bufferr using name. More...
 
BoxgetChunkedfBox () const
 Get list of box handles in a parsed buffer. More...
 
std::vector< Box * > * getParsedBoxes ()
 Get list of box handles in a parsed buffer. More...
 
BoxgetBox (const char *name, size_t &index)
 Get box handle in parsed bufferr using name. More...
 
BoxgetBoxAtIndex (size_t index)
 Get box handle in parsed bufferr using index. More...
 
void printPTSInternal (const std::vector< Box * > *boxes)
 Print ISOBMFF box PTS. More...
 
void getSampleDuration (Box *box, uint64_t &fduration)
 Get ISOBMFF box Sample Duration. More...
 
uint64_t getSampleDurationInernal (const std::vector< Box * > *boxes)
 Get ISOBMFF box Sample Duration. More...
 
void getPts (Box *box, uint64_t &fpts)
 Get ISOBMFF box PTS. More...
 
uint64_t getPtsInternal (const std::vector< Box * > *boxes)
 Get ISOBMFF box PTS. More...
 

Private Member Functions

bool getFirstPTSInternal (const std::vector< Box * > *boxes, uint64_t &pts)
 Get first PTS of buffer. More...
 
bool getTrackIdInternal (const std::vector< Box * > *boxes, uint32_t &track_id)
 Get track id from trak box. More...
 
bool getTimeScaleInternal (const std::vector< Box * > *boxes, uint32_t &timeScale, bool &foundMdhd)
 Get TimeScale value of buffer. More...
 
void printBoxesInternal (const std::vector< Box * > *boxes)
 Print ISOBMFF boxes. More...
 
bool parseBoxInternal (const std::vector< Box * > *boxes, const char *name, uint8_t *buf, size_t &size)
 parse ISOBMFF boxes of a type in a parsed buffer More...
 
bool getBoxSizeInternal (const std::vector< Box * > *boxes, const char *name, size_t &size)
 get ISOBMFF box size of a type More...
 
bool getBoxesInternal (const std::vector< Box * > *boxes, const char *name, std::vector< Box * > *pBoxes)
 get ISOBMFF box list of a type in a parsed buffer More...
 

Private Attributes

std::vector< Box * > boxes
 
uint8_t * buffer
 
size_t bufSize
 
BoxchunkedBox
 
size_t mdatCount
 
AampLogManagermLogObj
 

yes

Class for ISO BMFF Buffer.

Definition at line 39 of file isobmffbuffer.h.

Member Function Documentation

◆ getFirstPTSInternal()

IsoBmffBuffer::getFirstPTSInternal ( const std::vector< Box * > *  boxes,
uint64_t &  pts 
)
private

Get first PTS of buffer.

Parameters
[in]boxes- ISOBMFF boxes
[out]pts- pts value
Returns
true if parse was successful. false otherwise

Definition at line 191 of file isobmffbuffer.cpp.

◆ getTrackIdInternal()

IsoBmffBuffer::getTrackIdInternal ( const std::vector< Box * > *  boxes,
uint32_t &  track_id 
)
private

Get track id from trak box.

Parameters
[in]boxes- ISOBMFF boxes
[out]track_id- track_id
Returns
true if parse was successful. false otherwise

Definition at line 218 of file isobmffbuffer.cpp.

◆ getTimeScaleInternal()

IsoBmffBuffer::getTimeScaleInternal ( const std::vector< Box * > *  boxes,
uint32_t &  timeScale,
bool &  foundMdhd 
)
private

Get TimeScale value of buffer.

Parameters
[in]boxes- ISOBMFF boxes
[out]timeScale- TimeScale value
[out]foundMdhd- flag indicates if MDHD box was seen
Returns
true if parse was successful. false otherwise

Definition at line 273 of file isobmffbuffer.cpp.

◆ printBoxesInternal()

IsoBmffBuffer::printBoxesInternal ( const std::vector< Box * > *  boxes)
private

Print ISOBMFF boxes.

Parameters
[in]boxes- ISOBMFF boxes
Returns
void

Definition at line 316 of file isobmffbuffer.cpp.

◆ parseBoxInternal()

IsoBmffBuffer::parseBoxInternal ( const std::vector< Box * > *  boxes,
const char *  name,
uint8_t *  buf,
size_t &  size 
)
private

parse ISOBMFF boxes of a type in a parsed buffer

Parameters
[in]boxes- ISOBMFF boxes
[in]name- box name to get
[out]buf- mdat buffer pointer
[out]size- size of mdat buffer
Returns
bool

Definition at line 89 of file isobmffbuffer.cpp.

◆ getBoxSizeInternal()

IsoBmffBuffer::getBoxSizeInternal ( const std::vector< Box * > *  boxes,
const char *  name,
size_t &  size 
)
private

get ISOBMFF box size of a type

Parameters
[in]boxes- ISOBMFF boxes
[in]name- box name to get
[out]size- size of mdat buffer
Returns
bool

Definition at line 117 of file isobmffbuffer.cpp.

◆ getBoxesInternal()

IsoBmffBuffer::getBoxesInternal ( const std::vector< Box * > *  boxes,
const char *  name,
std::vector< Box * > *  pBoxes 
)
private

get ISOBMFF box list of a type in a parsed buffer

Parameters
[in]boxes- ISOBMFF boxes
[in]name- box name to get
[out]pBoxes- size of mdat buffer
Returns
bool

Definition at line 417 of file isobmffbuffer.cpp.

◆ setBuffer()

void IsoBmffBuffer::setBuffer ( uint8_t *  buf,
size_t  sz 
)

Set buffer.

Parameters
[in]buf- buffer pointer
[in]sz- buffer size
Returns
void

Definition at line 47 of file isobmffbuffer.cpp.

◆ parseBuffer()

bool IsoBmffBuffer::parseBuffer ( bool  correctBoxSize = false,
int  newTrackId = -1 
)

Parse ISOBMFF boxes from buffer.

@fn parseBuffer
Parameters
[in]correctBoxSize- flag to correct the box size
[in]newTrackId- new track id to overwrite the existing track id, when value is -1, it will not override
[in]correctBoxSize- flag to indicate if box size needs to be corrected
[in]newTrackId- new track id to overwrite the existing track id, when value is -1, it will not override
Returns
true if parse was successful. false otherwise

Definition at line 59 of file isobmffbuffer.cpp.

◆ restampPTS()

IsoBmffBuffer::restampPTS ( uint64_t  offset,
uint64_t  basePts,
uint8_t *  segment,
uint32_t  bufSz 
)

Restamp PTS in a buffer.

Parameters
[in]offset- pts offset
[in]basePts- base pts
[in]segment- buffer pointer
[in]bufSz- buffer size
Returns
void

Definition at line 134 of file isobmffbuffer.cpp.

◆ getFirstPTS()

IsoBmffBuffer::getFirstPTS ( uint64_t &  pts)

Get first PTS of buffer.

Parameters
[out]pts- pts value
Returns
true if parse was successful. false otherwise

Definition at line 249 of file isobmffbuffer.cpp.

◆ getTrack_id()

IsoBmffBuffer::getTrack_id ( uint32_t &  track_id)

Get track_id from the trak box.

Parameters
[out]track_id- track-id
Returns
true if parse was successful. false otherwise

Definition at line 265 of file isobmffbuffer.cpp.

◆ PrintPTS()

IsoBmffBuffer::PrintPTS ( void  )

Print PTS of buffer.

Returns
tvoid

Definition at line 257 of file isobmffbuffer.cpp.

◆ getTimeScale()

bool IsoBmffBuffer::getTimeScale ( uint32_t &  timeScale)

Get TimeScale value of buffer.

Parameters
[out]timeScale- TimeScale value
Returns
true if parse was successful. false otherwise

Definition at line 307 of file isobmffbuffer.cpp.

◆ destroyBoxes()

void IsoBmffBuffer::destroyBoxes ( )

Release ISOBMFF boxes parsed.

Returns
void

Definition at line 177 of file isobmffbuffer.cpp.

◆ printBoxes()

IsoBmffBuffer::printBoxes ( )

Print ISOBMFF boxes.

Returns
void

Definition at line 352 of file isobmffbuffer.cpp.

◆ isInitSegment()

bool IsoBmffBuffer::isInitSegment ( )

Check if buffer is an initialization segment.

Returns
true if buffer is an initialization segment. false otherwise

Definition at line 360 of file isobmffbuffer.cpp.

◆ parseMdatBox()

IsoBmffBuffer::parseMdatBox ( uint8_t *  buf,
size_t &  size 
)

Get mdat buffer handle and size from parsed buffer.

Parameters
[out]buf- mdat buffer pointer
[out]size- size of mdat buffer
Returns
true if mdat buffer is available. false otherwise

Definition at line 79 of file isobmffbuffer.cpp.

◆ getMdatBoxSize()

IsoBmffBuffer::getMdatBoxSize ( size_t &  size)

Get mdat buffer size.

Parameters
[out]size- size of mdat buffer
Returns
true if buffer size available. false otherwise

Definition at line 109 of file isobmffbuffer.cpp.

◆ getEMSGData()

bool IsoBmffBuffer::getEMSGData ( uint8_t *&  message,
uint32_t &  messageLen,
uint8_t *&  schemeIdUri,
uint8_t *&  value,
uint64_t &  presTime,
uint32_t &  timeScale,
uint32_t &  eventDuration,
uint32_t &  id 
)

Get information from EMSG box.

Parameters
[out]message- messageData from EMSG
[out]messageLen- messageLen
[out]schemeIdUri- schemeIdUri
[out]value- value of Id3
[out]presTime- Presentation time
[out]timeScale- timeScale of ID3 metadata
[out]eventDuration- eventDuration value
[out]id- ID of metadata
Returns
true if parse was successful. false otherwise

Definition at line 408 of file isobmffbuffer.cpp.

◆ getEMSGInfoInternal()

IsoBmffBuffer::getEMSGInfoInternal ( const std::vector< Box * > *  boxes,
uint8_t *&  message,
uint32_t &  messageLen,
uint8_t *&  schemeIdUri,
uint8_t *&  value,
uint64_t &  presTime,
uint32_t &  timeScale,
uint32_t &  eventDuration,
uint32_t &  id,
bool &  foundEmsg 
)

Get emsg informations.

Parameters
[in]boxes- ISOBMFF boxes
[out]message- messageData pointer
[out]messageLen- messageLen value
[out]schemeIdUri- schemeIdUri
[out]value- value of Id3
[out]presTime- Presentation time
[out]timeScale- timeScale of ID3 metadata
[out]eventDuration- eventDuration value
[out]id- ID of metadata
[out]foundEmsg- flag indicates if EMSG box was seen
Returns
true if parse was successful. false otherwise

Definition at line 378 of file isobmffbuffer.cpp.

◆ getMdatBoxCount()

IsoBmffBuffer::getMdatBoxCount ( size_t &  count)

Check mdat buffer count in parsed buffer.

Parameters
[out]count- mdat box count
Returns
true if mdat count available. false otherwise

Definition at line 440 of file isobmffbuffer.cpp.

◆ printMdatBoxes()

IsoBmffBuffer::printMdatBoxes ( )

Print ISOBMFF mdat boxes in parsed buffer.

Returns
void

Definition at line 452 of file isobmffbuffer.cpp.

◆ getTypeOfBoxes()

IsoBmffBuffer::getTypeOfBoxes ( const char *  name,
std::vector< Box * > &  stBoxes 
)

Get list of box handle in parsed bufferr using name.

Parameters
[in]name- box name to get
[out]stBoxes- List of box handles of a type in a parsed buffer
Returns
true if Box found. false otherwise

Definition at line 463 of file isobmffbuffer.cpp.

◆ getChunkedfBox()

IsoBmffBuffer::getChunkedfBox ( ) const

Get list of box handles in a parsed buffer.

Returns
Box handle if Chunk box found in a parsed buffer. NULL otherwise

Definition at line 473 of file isobmffbuffer.cpp.

◆ getParsedBoxes()

IsoBmffBuffer::getParsedBoxes ( )

Get list of box handles in a parsed buffer.

Returns
Box handle list if Box found at index given. NULL otherwise

Definition at line 481 of file isobmffbuffer.cpp.

◆ getBox()

IsoBmffBuffer::getBox ( const char *  name,
size_t &  index 
)

Get box handle in parsed bufferr using name.

Parameters
[in]name- box name to get
[out]index- index of box in a parsed buffer
Returns
Box handle if Box found at index given. NULL otherwise

Definition at line 489 of file isobmffbuffer.cpp.

◆ getBoxAtIndex()

IsoBmffBuffer::getBoxAtIndex ( size_t  index)

Get box handle in parsed bufferr using index.

Parameters
[out]index- index of box in a parsed buffer
Returns
Box handle if Box found at index given. NULL otherwise

Definition at line 509 of file isobmffbuffer.cpp.

◆ printPTSInternal()

IsoBmffBuffer::printPTSInternal ( const std::vector< Box * > *  boxes)

Print ISOBMFF box PTS.

Parameters
[in]boxes- ISOBMFF boxes
Returns
void

Definition at line 521 of file isobmffbuffer.cpp.

◆ getSampleDuration()

IsoBmffBuffer::getSampleDuration ( Box box,
uint64_t &  fduration 
)

Get ISOBMFF box Sample Duration.

Parameters
[in]box- ISOBMFF box
[in]fduration- duration to get
Returns
void

Definition at line 584 of file isobmffbuffer.cpp.

◆ getSampleDurationInernal()

IsoBmffBuffer::getSampleDurationInernal ( const std::vector< Box * > *  boxes)

Get ISOBMFF box Sample Duration.

Parameters
[in]boxes- ISOBMFF boxes
Returns
uint64_t - duration value

Definition at line 542 of file isobmffbuffer.cpp.

◆ getPts()

IsoBmffBuffer::getPts ( Box box,
uint64_t &  fpts 
)

Get ISOBMFF box PTS.

Parameters
[in]box- ISOBMFF box
[in]fpts- PTS to get
Returns
void

Definition at line 625 of file isobmffbuffer.cpp.

◆ getPtsInternal()

IsoBmffBuffer::getPtsInternal ( const std::vector< Box * > *  boxes)

Get ISOBMFF box PTS.

Parameters
[in]boxes- ISOBMFF boxes
Returns
uint64_t - PTS value

Definition at line 595 of file isobmffbuffer.cpp.


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