Changes till now
This commit is contained in:
parent
fce97a478c
commit
c93a0bb815
8 changed files with 188 additions and 12 deletions
48
MP4/box_stsd.cpp
Normal file
48
MP4/box_stsd.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include "box_stsd.h"
|
||||
|
||||
Box_stsd::Box_stsd( ) {
|
||||
Container = new Box( 0x73747364 );
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
Box_stsd::~Box_stsd() {
|
||||
delete Container;
|
||||
}
|
||||
|
||||
Box * Box_stsd::GetBox() {
|
||||
return Container;
|
||||
}
|
||||
|
||||
void Box_stsd::AddContent( Box * newcontent, uint32_t offset ) {
|
||||
if( offset >= Content.size() ) {
|
||||
Content.resize(offset+1);
|
||||
}
|
||||
if( Content[offset] ) {
|
||||
delete Content[offset];
|
||||
}
|
||||
Content[offset] = newcontent;
|
||||
WriteContent();
|
||||
}
|
||||
|
||||
void Box_stsd::SetDefaults( ) {
|
||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8( 1 ),4);
|
||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8( 0 ),0);
|
||||
}
|
||||
|
||||
void Box_stsd::WriteContent( ) {
|
||||
Container->ResetPayload( );
|
||||
SetDefaults( );
|
||||
Box * current;
|
||||
BoxHeader currentheader;
|
||||
std::string serializedbox = "";
|
||||
for( uint32_t i = 0; i < Content.size(); i++ ) {
|
||||
current=Content[i];
|
||||
if( current ) {
|
||||
currentheader = current->GetHeader();
|
||||
serializedbox.append((char*)Box::uint32_to_uint8(currentheader.TotalSize),4);
|
||||
serializedbox.append((char*)Box::uint32_to_uint8(currentheader.BoxType),4);
|
||||
serializedbox.append((char*)current->GetPayload(),current->GetPayloadSize());
|
||||
}
|
||||
}
|
||||
Container->SetPayload((uint32_t)serializedbox.size(),(uint8_t*)serializedbox.c_str(),8);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue