MOOF and TRAF boxes created
This commit is contained in:
parent
2aa99228e8
commit
26fedaac9c
5 changed files with 110 additions and 0 deletions
|
@ -5,6 +5,10 @@ class Box_abst {
|
|||
Box_abst( );
|
||||
~Box_abst();
|
||||
Box * GetBox();
|
||||
|
||||
private:
|
||||
uint8_t curProfile;
|
||||
bool isLive;
|
||||
bool isUpdate;
|
||||
Box * Container;
|
||||
};//Box_ftyp Class
|
||||
|
|
36
MP4/box_moof.cpp
Normal file
36
MP4/box_moof.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include "box_moof.h"
|
||||
|
||||
Box_moof::Box_moof( ) {
|
||||
Container = new Box( 0x6D6F6F66 );
|
||||
}
|
||||
|
||||
Box_moof::~Box_moof() {
|
||||
delete Container;
|
||||
}
|
||||
|
||||
Box * Box_moof::GetBox() {
|
||||
return Container;
|
||||
}
|
||||
|
||||
void Box_moof::AddContent( Box * newcontent, uint32_t offset ) {
|
||||
if( offset >= Content.size() ) {
|
||||
Content.resize(offset+1);
|
||||
}
|
||||
if( Content[offset] ) {
|
||||
delete Content[offset];
|
||||
}
|
||||
Content[offset] = newcontent;
|
||||
}
|
||||
|
||||
void Box_moof::WriteContent( ) {
|
||||
Container->ResetPayload( );
|
||||
Box * current;
|
||||
std::string serializedbox = "";
|
||||
for( uint32_t i = 0; i < Content.size(); i++ ) {
|
||||
current=Content[i];
|
||||
if( current ) {
|
||||
serializedbox.append((char*)current->GetBoxedData(),current->GetBoxedDataSize());
|
||||
}
|
||||
}
|
||||
Container->SetPayload((uint32_t)serializedbox.size(),(uint8_t*)serializedbox.c_str());
|
||||
}
|
17
MP4/box_moof.h
Normal file
17
MP4/box_moof.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "box.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class Box_moof {
|
||||
public:
|
||||
Box_moof();
|
||||
~Box_moof();
|
||||
Box * GetBox();
|
||||
void AddContent( Box * newcontent, uint32_t offset = 0 );
|
||||
void WriteContent( );
|
||||
private:
|
||||
Box * Container;
|
||||
|
||||
std::vector<Box *> Content;
|
||||
};//Box_ftyp Class
|
||||
|
36
MP4/box_traf.cpp
Normal file
36
MP4/box_traf.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include "box_traf.h"
|
||||
|
||||
Box_traf::Box_traf( ) {
|
||||
Container = new Box( 0x74726166 );
|
||||
}
|
||||
|
||||
Box_traf::~Box_traf() {
|
||||
delete Container;
|
||||
}
|
||||
|
||||
Box * Box_traf::GetBox() {
|
||||
return Container;
|
||||
}
|
||||
|
||||
void Box_traf::AddContent( Box * newcontent, uint32_t offset ) {
|
||||
if( offset >= Content.size() ) {
|
||||
Content.resize(offset+1);
|
||||
}
|
||||
if( Content[offset] ) {
|
||||
delete Content[offset];
|
||||
}
|
||||
Content[offset] = newcontent;
|
||||
}
|
||||
|
||||
void Box_traf::WriteContent( ) {
|
||||
Container->ResetPayload( );
|
||||
Box * current;
|
||||
std::string serializedbox = "";
|
||||
for( uint32_t i = 0; i < Content.size(); i++ ) {
|
||||
current=Content[i];
|
||||
if( current ) {
|
||||
serializedbox.append((char*)current->GetBoxedData(),current->GetBoxedDataSize());
|
||||
}
|
||||
}
|
||||
Container->SetPayload((uint32_t)serializedbox.size(),(uint8_t*)serializedbox.c_str());
|
||||
}
|
17
MP4/box_traf.h
Normal file
17
MP4/box_traf.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "box.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class Box_traf {
|
||||
public:
|
||||
Box_traf();
|
||||
~Box_traf();
|
||||
Box * GetBox();
|
||||
void AddContent( Box * newcontent, uint32_t offset = 0 );
|
||||
void WriteContent( );
|
||||
private:
|
||||
Box * Container;
|
||||
|
||||
std::vector<Box *> Content;
|
||||
};//Box_ftyp Class
|
||||
|
Loading…
Add table
Reference in a new issue