|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
25 #ifndef __ISOBMFFBOX_H__
26 #define __ISOBMFFBOX_H__
34 #define READ_U32(buf) \
35 (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; buf+=4;
37 #define WRITE_U64(buf, val) \
38 buf[0]= val>>56; buf[1]= val>>48; buf[2]= val>>40; buf[3]= val>>32; buf[4]= val>>24; buf[5]= val>>16; buf[6]= val>>8; buf[7]= val;
40 #define WRITE_U32(buf, val) \
41 buf[0]= val>>24; buf[1]= val>>16; buf[2]= val>>8; buf[3]= val;
43 #define READ_U8(dst, src, sz) \
44 memcpy(dst, src, sz); src+=sz;
46 #define READ_VERSION(buf) \
49 #define READ_FLAGS(buf) \
50 (buf[0] << 16) | (buf[1] << 8) | buf[2]; buf+=3;
74 uint32_t
ReadCStringLen(
const uint8_t* buffer, uint32_t bufferLen);
76 #define READ_BMDT64(buf) \
77 ReadUint64(buf); buf+=8;
79 #define READ_64(buf) \
80 ReadUint64(buf); buf+=8;
82 #define IS_TYPE(value, type) \
83 (value[0]==type[0] && value[1]==type[1] && value[2]==type[2] && value[3]==type[3])
99 static constexpr
const char *FTYP =
"ftyp";
100 static constexpr
const char *MOOV =
"moov";
101 static constexpr
const char *MVHD =
"mvhd";
102 static constexpr
const char *TRAK =
"trak";
103 static constexpr
const char *MDIA =
"mdia";
104 static constexpr
const char *MDHD =
"mdhd";
105 static constexpr
const char *EMSG =
"emsg";
107 static constexpr
const char *MOOF =
"moof";
108 static constexpr
const char *TFHD =
"tfhd";
109 static constexpr
const char *TRAF =
"traf";
110 static constexpr
const char *TFDT =
"tfdt";
111 static constexpr
const char *TRUN =
"trun";
112 static constexpr
const char *MDAT =
"mdat";
113 static constexpr
const char *TKHD =
"tkhd";
115 static constexpr
const char *STYP =
"styp";
116 static constexpr
const char *SIDX =
"sidx";
117 static constexpr
const char *PRFT =
"prft";
125 Box(uint32_t sz,
const char btype[4]);
206 std::vector<Box*> children;
310 FullBox(uint32_t sz,
const char btype[4], uint8_t ver, uint32_t f);
330 MvhdBox(uint32_t sz, uint32_t tScale);
381 MdhdBox(uint32_t sz, uint32_t tScale);
433 TfdtBox(uint32_t sz, uint64_t mdt);
476 uint32_t eventDuration;
478 uint32_t presentationTimeDelta;
479 uint64_t presentationTime;
480 uint8_t* schemeIdUri;
483 uint8_t* messageData;
495 EmsgBox(uint32_t sz, uint32_t tScale, uint32_t evtDur, uint32_t _id);
507 EmsgBox(
FullBox &fbox, uint32_t tScale, uint32_t evtDur, uint32_t _id, uint64_t presTime, uint32_t presTimeDelta);
560 void setId(uint32_t _id);
620 void setValue(uint8_t* schemeIdValue);
636 void setMessage(uint8_t* message, uint32_t len);
674 Entry() : sample_duration(0), sample_size(0), sample_flags(0), sample_composition_time_offset(0) {}
675 uint32_t sample_duration;
676 uint32_t sample_size;
677 uint32_t sample_flags;
678 uint32_t sample_composition_time_offset;
686 TrunBox(uint32_t sz, uint64_t sampleDuration);
737 TfhdBox(uint32_t sz, uint64_t sample_duration);
792 PrftBox(uint32_t sz, uint32_t trackId, uint64_t ntpTs, uint64_t mediaTime);
802 PrftBox(
FullBox &fbox, uint32_t trackId, uint64_t ntpTs, uint64_t mediaTime);
void setTimeScale(uint32_t tScale)
Set TimeScale value.
void addChildren(Box *box)
Add a box as a child box.
void setBaseMDT(uint64_t mdt)
Set BaseMediaDecodeTime value.
uint64_t getBaseMDT()
Get BaseMediaDecodeTime value.
void setId(uint32_t _id)
Set id.
static GenericContainerBox * constructContainer(uint32_t sz, const char btype[4], uint8_t *ptr, int newTrackId=-1)
void setNtpTs(uint64_t ntpTs)
Set NTP Ts value.
uint8_t * getSchemeIdUri()
Get schemeIdUri.
uint32_t getPresentationTimeDelta()
Get presentationTimeDelta.
static MdhdBox * constructMdhdBox(uint32_t sz, uint8_t *ptr)
Static function to construct a MdhdBox object.
Class for ISO BMFF EMSG Box.
Box(uint32_t sz, const char btype[4])
Box constructor.
TrunBox(uint32_t sz, uint64_t sampleDuration)
TrunBox constructor.
Class for ISO BMFF MDHD Box.
FullBox(uint32_t sz, const char btype[4], uint8_t ver, uint32_t f)
FullBox constructor.
PrftBox(uint32_t sz, uint32_t trackId, uint64_t ntpTs, uint64_t mediaTime)
PrftBox constructor.
const char * getBoxType() const
Get box type.
static TrakBox * constructTrakBox(uint32_t sz, uint8_t *ptr, int newTrackId=-1)
virtual ~Box()
Box destructor.
EmsgBox(uint32_t sz, uint32_t tScale, uint32_t evtDur, uint32_t _id)
EmsgBox constructor.
static Box * constructBox(uint8_t *hdr, uint32_t maxSz, AampLogManager *mLOgObj=NULL, bool correctBoxSize=false, int newTrackId=-1)
void setTimeScale(uint32_t tScale)
Set TimeScale value.
Class for ISO BMFF TFDT Box.
virtual bool hasChildren()
To check if box has any child boxes.
static PrftBox * constructPrftBox(uint32_t sz, uint8_t *ptr)
Static function to construct a PrftBox object.
uint32_t getEventDuration()
Get eventDuration.
MvhdBox(uint32_t sz, uint32_t tScale)
MvhdBox constructor.
uint32_t getMessageLen()
Get Message length.
void setEventDuration(uint32_t evtDur)
Set eventDuration value.
uint32_t ReadCStringLen(const uint8_t *buffer, uint32_t bufferLen)
Read a string from buffer and return it.
Base Class for ISO BMFF Box.
uint64_t ReadUint64(uint8_t *buf)
Utility function to read 8 bytes from a buffer.
TfhdBox(uint32_t sz, uint64_t sample_duration)
TfhdBox constructor.
uint32_t getOffset() const
Get box offset.
Class for ISO BMFF Box container Eg: MOOV, MOOF, TRAK, MDIA.
static TrunBox * constructTrunBox(uint32_t sz, uint8_t *ptr)
Static function to construct a TrunBox object.
uint32_t getTimeScale()
Get schemeIdUri.
uint64_t getNtpTs()
Get ntp Timestamp value.
void setOffset(uint32_t os)
Set box's offset from the beginning of the buffer.
void setPresentationTimeDelta(uint32_t presTimeDelta)
Set presentationTimeDelta.
void setPresentationTime(uint64_t presTime)
Set presentationTime.
bool hasChildren() override
To check if box has any child boxes.
uint32_t getSize() const
Get box size.
TrakBox(uint32_t sz)
Trak constructor.
void setSampleDuration(uint64_t sample_duration)
Set Sample Duration value.
virtual ~GenericContainerBox()
GenericContainerBox destructor.
Class for ISO BMFF TFHD Box.
void WriteUint64(uint8_t *dst, uint64_t val)
Utility function to write 8 bytes to a buffer.
uint8_t * getMessage()
Get Message.
GenericContainerBox(uint32_t sz, const char btype[4])
GenericContainerBox constructor.
static MvhdBox * constructMvhdBox(uint32_t sz, uint8_t *ptr)
Static function to construct a MvhdBox object.
TfdtBox(uint32_t sz, uint64_t mdt)
TfdtBox constructor.
const std::vector< Box * > * getChildren() override
Get children of this box.
void setMediaTime(uint64_t mediaTime)
Set Sample Duration value.
void setValue(uint8_t *schemeIdValue)
Set value.
static TfhdBox * constructTfhdBox(uint32_t sz, uint8_t *ptr)
Static function to construct a TfdtBox object.
virtual const std::vector< Box * > * getChildren()
Get children of this box.
Class for ISO BMFF MVHD Box.
uint64_t getMediaTime()
Get SampleDuration value.
uint8_t * getValue()
Get value.
uint32_t getTrackId()
Get Track id value.
void setSampleDuration(uint64_t sampleDuration)
Set SampleDuration value.
Class for ISO BMFF TRAK container.
const char * getType()
Get box type.
void setSchemeIdUri(uint8_t *schemeIdURI)
Set schemeIdUri.
Class for single ISO BMFF Box Eg: FTYP, MDHD, MVHD, TFDT.
uint64_t getSampleDuration()
Get sampleDuration value.
void setTrackId(uint32_t trackId)
Set Track Id value.
void setTimeScale(uint32_t tScale)
Set TimeScale value.
EmsgBox & operator=(const EmsgBox &)=delete
EmsgBox =operator overloading.
Class for ISO BMFF TFHD Box.
static EmsgBox * constructEmsgBox(uint32_t sz, uint8_t *ptr)
Static function to construct a EmsgBox object.
uint32_t getTimeScale()
Get TimeScale value.
MdhdBox(uint32_t sz, uint32_t tScale)
MdhdBox constructor.
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.
static TfdtBox * constructTfdtBox(uint32_t sz, uint8_t *ptr)
Static function to construct a TfdtBox object.
void setMessage(uint8_t *message, uint32_t len)
Set Message.