[Stable] Interface contains an UpdateContents() function, which updates all the contents of the boxes

This commit is contained in:
Erik Zandvliet 2011-01-23 15:52:20 +01:00
parent 1d56214cd1
commit 1c69d2dbc8
22 changed files with 40 additions and 23 deletions

View file

@ -18,7 +18,6 @@ void Box_dinf::AddContent( Box * newcontent ) {
Content = NULL;
}
Content = newcontent;
WriteContent();
}
void Box_dinf::WriteContent( ) {

View file

@ -8,10 +8,10 @@ class Box_dinf {
~Box_dinf();
Box * GetBox();
void AddContent( Box * newcontent );
void WriteContent( );
private:
Box * Container;
void WriteContent( );
Box * Content;
};//Box_ftyp Class

View file

@ -21,7 +21,6 @@ void Box_dref::AddContent( Box * newcontent, uint32_t offset ) {
delete Content[offset];
}
Content[offset] = newcontent;
WriteContent();
}
void Box_dref::WriteContent( ) {

View file

@ -8,11 +8,11 @@ class Box_dref {
~Box_dref();
Box * GetBox();
void AddContent( Box * newcontent, uint32_t offset = 0 );
void WriteContent( );
private:
Box * Container;
void SetReserved( );
void WriteContent( );
std::vector<Box *> Content;
};//Box_ftyp Class

View file

@ -20,7 +20,6 @@ void Box_mdia::AddContent( Box * newcontent, uint32_t offset ) {
delete Content[offset];
}
Content[offset] = newcontent;
WriteContent();
}
void Box_mdia::WriteContent( ) {

View file

@ -8,10 +8,10 @@ class Box_mdia {
~Box_mdia();
Box * GetBox();
void AddContent( Box * newcontent, uint32_t offset = 0 );
void WriteContent( );
private:
Box * Container;
void WriteContent( );
std::vector<Box *> Content;
};//Box_ftyp Class

View file

@ -20,7 +20,6 @@ void Box_minf::AddContent( Box * newcontent, uint32_t offset ) {
delete Content[offset];
}
Content[offset] = newcontent;
WriteContent();
}
void Box_minf::WriteContent( ) {

View file

@ -8,10 +8,10 @@ class Box_minf {
~Box_minf();
Box * GetBox();
void AddContent( Box * newcontent, uint32_t offset = 0 );
void WriteContent( );
private:
Box * Container;
void WriteContent( );
std::vector<Box *> Content;
};//Box_ftyp Class

View file

@ -20,7 +20,6 @@ void Box_moov::AddContent( Box * newcontent, uint32_t offset ) {
delete Content[offset];
}
Content[offset] = newcontent;
WriteContent();
}
void Box_moov::WriteContent( ) {

View file

@ -8,10 +8,10 @@ class Box_moov {
~Box_moov();
Box * GetBox();
void AddContent( Box * newcontent, uint32_t offset = 0 );
void WriteContent( );
private:
Box * Container;
void WriteContent( );
std::vector<Box *> Content;
};//Box_ftyp Class

View file

@ -20,7 +20,6 @@ void Box_stbl::AddContent( Box * newcontent, uint32_t offset ) {
delete Content[offset];
}
Content[offset] = newcontent;
WriteContent();
}
void Box_stbl::WriteContent( ) {

View file

@ -8,10 +8,10 @@ class Box_stbl {
~Box_stbl();
Box * GetBox();
void AddContent( Box * newcontent, uint32_t offset = 0 );
void WriteContent( );
private:
Box * Container;
void WriteContent( );
std::vector<Box *> Content;
};//Box_ftyp Class

View file

@ -25,7 +25,7 @@ void Box_stco::AddOffset( uint32_t DataOffset, uint32_t Offset ) {
}
void Box_stco::WriteOffsets( ) {
void Box_stco::WriteContent( ) {
Container->ResetPayload();
SetReserved( );
if(!Offsets.empty()) {

View file

@ -8,10 +8,10 @@ class Box_stco {
~Box_stco();
Box * GetBox();
void AddOffset( uint32_t DataOffset, uint32_t Offset = 0 );
void WriteContent( );
private:
Box * Container;
void WriteOffsets( );
void SetReserved( );
std::vector<uint32_t> Offsets;
};//Box_ftyp Class

View file

@ -24,11 +24,10 @@ void Box_stsc::AddEntry( uint32_t FirstChunk, uint32_t SamplesPerChunk, uint32_t
Entries[Offset].FirstChunk = FirstChunk;
Entries[Offset].SamplesPerChunk = SamplesPerChunk;
Entries[Offset].SampleDescIndex = SampleDescIndex;
WriteEntries( );
}
void Box_stsc::WriteEntries( ) {
void Box_stsc::WriteContent( ) {
Container->ResetPayload();
SetReserved( );
if(!Entries.empty()) {

View file

@ -15,10 +15,10 @@ class Box_stsc {
Box * GetBox();
void SetReserved( );
void AddEntry( uint32_t FirstChunk = 0, uint32_t SamplesPerChunk = 0, uint32_t SampleDescIndex = 0, uint32_t Offset = 0 );
void WriteContent( );
private:
Box * Container;
void WriteEntries( );
std::vector<stsc_record> Entries;
};//Box_ftyp Class

View file

@ -10,7 +10,6 @@ Box_stsd::~Box_stsd() {
}
Box * Box_stsd::GetBox() {
WriteContent();
return Container;
}

View file

@ -8,11 +8,11 @@ class Box_stsd {
~Box_stsd();
Box * GetBox();
void AddContent( Box * newcontent, uint32_t offset = 0 );
void WriteContent();
private:
Box * Container;
void SetReserved();
void WriteContent();
std::vector<Box *> Content;
};//Box_ftyp Class

View file

@ -23,11 +23,10 @@ void Box_stts::AddEntry( uint32_t SampleCount, uint32_t SampleDelta, uint32_t Of
}
Entries[Offset].SampleCount = SampleCount;
Entries[Offset].SampleDelta = SampleDelta;
WriteEntries( );
}
void Box_stts::WriteEntries( ) {
void Box_stts::WriteContent( ) {
Container->ResetPayload();
SetReserved( );
if(!Entries.empty()) {

View file

@ -14,10 +14,10 @@ class Box_stts {
Box * GetBox();
void SetReserved( );
void AddEntry( uint32_t SampleCount, uint32_t SampleDelta, uint32_t Offset = 0 );
void WriteContent( );
private:
Box * Container;
void WriteEntries( );
std::vector<stts_record> Entries;
};//Box_ftyp Class

View file

@ -20,7 +20,6 @@ void Box_trak::AddContent( Box * newcontent, uint32_t offset ) {
delete Content[offset];
}
Content[offset] = newcontent;
WriteContent();
}
void Box_trak::WriteContent( ) {

View file

@ -125,3 +125,30 @@ uint8_t * Interface::GetContents( ) {
memcpy(&Result[ftyp->GetBox( )->GetBoxedDataSize( )],moov->GetBox( )->GetBoxedData( ),moov->GetBox( )->GetBoxedDataSize( ));
return Result;
}
void Interface::UpdateContents( ) {
stsd_vide->WriteContent( );
stco_vide->WriteContent( );
stsc_vide->WriteContent( );
stts_vide->WriteContent( );
stbl_vide->WriteContent( );
dref_vide->WriteContent( );
dinf_vide->WriteContent( );
minf_vide->WriteContent( );
mdia_vide->WriteContent( );
stsd_soun->WriteContent( );
stco_soun->WriteContent( );
stsc_soun->WriteContent( );
stts_soun->WriteContent( );
stbl_soun->WriteContent( );
dref_soun->WriteContent( );
dinf_soun->WriteContent( );
minf_soun->WriteContent( );
mdia_soun->WriteContent( );
trak_vide->WriteContent( );
moov->WriteContent( );
}