|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
35 for (
unsigned int i=boxes.size(); i>0;)
38 SAFE_DELETE(boxes[i]);
62 while (curOffset < bufSize)
64 Box *box =
Box::constructBox(buffer+curOffset, bufSize - curOffset, mLogObj, correctBoxSize, newTrackId);
65 if( ((bufSize - curOffset) < 4) || ( (bufSize - curOffset) < box->
getSize()) )
73 return !!(boxes.size());
84 #define BOX_HEADER_SIZE 8
91 for (
size_t i = 0; i < boxes->size(); i++)
93 Box *box = boxes->at(i);
95 if (IS_TYPE(box->
getType(), name))
97 size_t offset = box->
getOffset() + BOX_HEADER_SIZE;
98 size = box->
getSize() - BOX_HEADER_SIZE;
99 memcpy(buf, buffer + offset, size);
119 for (
size_t i = 0; i < boxes->size(); i++)
121 Box *box = boxes->at(i);
122 if (IS_TYPE(box->
getType(), name))
137 uint32_t curOffset = 0;
138 while (curOffset < bufSz)
140 uint8_t *buf = segment + curOffset;
141 uint32_t size = READ_U32(buf);
143 READ_U8(type, buf, 4);
146 if (IS_TYPE(type, Box::MOOF) || IS_TYPE(type, Box::TRAF))
150 else if (IS_TYPE(type, Box::TFDT))
152 uint8_t version = READ_VERSION(buf);
153 uint32_t flags = READ_FLAGS(buf);
164 uint32_t pts = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
165 pts -= (uint32_t)basePts;
166 pts += (uint32_t)offset;
179 for (
unsigned int i=boxes.size(); i>0;)
182 SAFE_DELETE(boxes[i]);
194 for (
size_t i = 0; (
false == ret) && i < boxes->size(); i++)
196 Box *box = boxes->at(i);
197 if (IS_TYPE(box->
getType(), Box::TFDT))
221 for (
size_t i = 0; (
false == ret) && i < boxes->size(); i++)
223 Box *box = boxes->at(i);
224 if (IS_TYPE(box->
getType(), Box::TRAK))
234 }
catch (std::bad_cast& bc){
276 for (
size_t i = 0; (
false == foundMdhd) && i < boxes->size(); i++)
278 Box *box = boxes->at(i);
279 if (IS_TYPE(box->
getType(), Box::MVHD))
287 else if (IS_TYPE(box->
getType(), Box::MDHD))
309 bool foundMdhd =
false;
318 for (
size_t i = 0; i < boxes->size(); i++)
320 Box *box = boxes->at(i);
322 if (IS_TYPE(box->
getType(), Box::TFDT))
324 if(
dynamic_cast<TfdtBox *
>(box)) {
325 AAMPLOG_WARN(
"****Base Media Decode Time: %lld",
dynamic_cast<TfdtBox *
>(box)->getBaseMDT());
328 else if (IS_TYPE(box->
getType(), Box::MVHD))
330 if(
dynamic_cast<MvhdBox *
>(box)) {
331 AAMPLOG_WARN(
"**** TimeScale from MVHD: %u",
dynamic_cast<MvhdBox *
>(box)->
getTimeScale());
334 else if (IS_TYPE(box->
getType(), Box::MDHD))
336 if(
dynamic_cast<MdhdBox *
>(box)) {
337 AAMPLOG_WARN(
"**** TimeScale from MDHD: %u",
dynamic_cast<MdhdBox *
>(box)->
getTimeScale());
362 bool foundFtypBox =
false;
363 for (
size_t i = 0; i < boxes.size(); i++)
365 Box *box = boxes.at(i);
366 if (IS_TYPE(box->
getType(), Box::FTYP))
378 bool 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)
381 for (
size_t i = 0; (
false == foundEmsg) && i < boxes->size(); i++)
383 Box *box = boxes->at(i);
384 if (IS_TYPE(box->
getType(), Box::EMSG))
394 id = emsgBox->
getId();
408 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)
410 bool foundEmsg =
false;
411 return getEMSGInfoInternal(&boxes, message, messageLen, schemeIdUri, value, presTime, timeScale, eventDuration,
id, foundEmsg);
419 size_t size =boxes->size();
425 for (
size_t i = 0; i < size; i++)
427 Box *box = boxes->at(i);
429 if (IS_TYPE(box->
getType(), name))
431 pBoxes->push_back(box);
434 return !!(pBoxes->size());
442 std::vector<Box*> mdatBoxes;
445 count = mdatBoxes.size();
454 std::vector<Box*> mdatBoxes;
475 return this->chunkedBox;
493 for (
size_t i = 0; i < boxes.size(); i++)
496 if (IS_TYPE(pBox->
getType(), name))
512 return boxes.at(index);
523 for (
size_t i = 0; i < boxes->size(); i++)
525 Box *box = boxes->at(i);
527 if (IS_TYPE(box->
getType(), Box::TFDT))
529 AAMPLOG_WARN(
"****Base Media Decode Time: %lld",
dynamic_cast<TfdtBox *
>(box)->getBaseMDT());
546 for (
int i = boxes->size()-1; i >= 0; i--)
548 Box *box = boxes->at(i);
549 uint64_t duration = 0;
550 if (IS_TYPE(box->
getType(), Box::TRUN))
559 if(duration)
return duration;
561 else if (IS_TYPE(box->
getType(), Box::TFHD))
570 if(duration)
return duration;
597 uint64_t retValue = 0;
598 for (
size_t i = 0; i < boxes->size(); i++)
600 Box *box = boxes->at(i);
602 if (IS_TYPE(box->
getType(), Box::TFDT))
607 AAMPLOG_WARN(
"****Base Media Decode Time: %lld", tfdtBox->
getBaseMDT());
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.
uint64_t getBaseMDT()
Get BaseMediaDecodeTime value.
uint8_t * getSchemeIdUri()
Get schemeIdUri.
std::vector< Box * > * getParsedBoxes()
Get list of box handles in a parsed buffer.
void PrintPTS(void)
Print PTS of buffer.
Class for ISO BMFF EMSG Box.
void getSampleDuration(Box *box, uint64_t &fduration)
Get ISOBMFF box Sample Duration.
uint64_t ReadUint64(uint8_t *buf)
Utility function to read 8 bytes from a buffer.
Class for ISO BMFF MDHD Box.
~IsoBmffBuffer()
IsoBmffBuffer destructor.
void printBoxesInternal(const std::vector< Box * > *boxes)
Print ISOBMFF boxes.
void printPTSInternal(const std::vector< Box * > *boxes)
Print ISOBMFF box PTS.
Box * getBoxAtIndex(size_t index)
Get box handle in parsed bufferr using index.
static Box * constructBox(uint8_t *hdr, uint32_t maxSz, AampLogManager *mLOgObj=NULL, bool correctBoxSize=false, int newTrackId=-1)
Class for ISO BMFF TFDT Box.
virtual bool hasChildren()
To check if box has any child boxes.
bool parseMdatBox(uint8_t *buf, size_t &size)
Get mdat buffer handle and size from parsed buffer.
bool getTimeScale(uint32_t &timeScale)
Get TimeScale value of buffer.
uint32_t getEventDuration()
Get eventDuration.
Box * getChunkedfBox() const
Get list of box handles in a parsed buffer.
uint32_t getMessageLen()
Get Message length.
Base Class for ISO BMFF Box.
void destroyBoxes()
Release ISOBMFF boxes parsed.
uint64_t getSampleDurationInernal(const std::vector< Box * > *boxes)
Get ISOBMFF box Sample Duration.
uint32_t getOffset() const
Get box offset.
void restampPTS(uint64_t offset, uint64_t basePts, uint8_t *segment, uint32_t bufSz)
Restamp PTS in a buffer.
uint32_t getTimeScale()
Get schemeIdUri.
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
bool getMdatBoxCount(size_t &count)
Check mdat buffer count in parsed buffer.
void setOffset(uint32_t os)
Set box's offset from the beginning of the buffer.
bool getTypeOfBoxes(const char *name, std::vector< Box * > &stBoxes)
Get list of box handle in parsed bufferr using name.
void setBuffer(uint8_t *buf, size_t sz)
Set buffer.
uint32_t getSize() const
Get box size.
void printMdatBoxes()
Print ISOBMFF mdat boxes in parsed buffer.
bool getTrack_id(uint32_t &track_id)
Get track_id from the trak box.
bool getFirstPTS(uint64_t &pts)
Get first PTS of buffer.
void getPts(Box *box, uint64_t &fpts)
Get ISOBMFF box PTS.
Class for ISO BMFF TFHD Box.
bool getTimeScaleInternal(const std::vector< Box * > *boxes, uint32_t &timeScale, bool &foundMdhd)
Get TimeScale value of buffer.
uint8_t * getMessage()
Get Message.
Private functions and types used internally by AAMP.
uint64_t getPtsInternal(const std::vector< Box * > *boxes)
Get ISOBMFF box PTS.
bool parseBuffer(bool correctBoxSize=false, int newTrackId=-1)
Parse ISOBMFF boxes from buffer.
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.
#define AAMPLOG_TRACE(FORMAT,...)
AAMP logging defines, this can be enabled through setLogLevel() as per the need.
Header file for ISO Base Media File Format Buffer.
Box * getBox(const char *name, size_t &index)
Get box handle in parsed bufferr using name.
virtual const std::vector< Box * > * getChildren()
Get children of this box.
Class for ISO BMFF MVHD Box.
bool isInitSegment()
Check if buffer is an initialization segment.
uint8_t * getValue()
Get value.
Class for ISO BMFF TRAK container.
const char * getType()
Get box type.
uint64_t getSampleDuration()
Get sampleDuration value.
void printBoxes()
Print ISOBMFF boxes.
bool getFirstPTSInternal(const std::vector< Box * > *boxes, uint64_t &pts)
Get first PTS of buffer.
bool getBoxSizeInternal(const std::vector< Box * > *boxes, const char *name, size_t &size)
get ISOBMFF box size of a type
uint32_t getTimeScale()
Get TimeScale value.
bool getMdatBoxSize(size_t &size)
Get mdat buffer size.
bool getTrackIdInternal(const std::vector< Box * > *boxes, uint32_t &track_id)
Get track id from trak box.
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
void WriteUint64(uint8_t *dst, uint64_t val)
Utility function to write 8 bytes to a buffer.
uint64_t getPresentationTime()
Get presentationTime.
uint32_t getTrack_Id()
track_id getter
Class for ISO BMFF TRUN Box.
uint32_t getTimeScale()
Get TimeScale value.
uint64_t getSampleDuration()
Get SampleDuration value.