[Compiles faultless] Laatste commit in trein, STTS functionality werkt, kan zometeen hopelijk thuis nog meer doen

This commit is contained in:
Erik Zandvliet 2011-01-23 20:54:25 +01:00
parent bfa110452c
commit 700c0ea209
3 changed files with 29 additions and 6 deletions

View file

@ -58,7 +58,8 @@ void Box_avcC::SetReserved( ) {
} }
void Box_avcC::SetDefaults( ) { void Box_avcC::SetDefaults( ) {
SetDimensions( ); SetWidth( );
SetHeight( );
SetDepth ( ); SetDepth ( );
SetFrameCount ( ); SetFrameCount ( );
SetResolution ( ); SetResolution ( );

View file

@ -136,10 +136,15 @@ uint8_t * Interface::GetContents( ) {
} }
void Interface::UpdateContents( ) { void Interface::UpdateContents( ) {
if( !Width ) { std::cerr << "WARNING: Width not set!\n"; } if( !Width ) { fprintf(stderr,"WARNING: Width not set!\n"); }
if( !Height ) { std::cerr << "WARNING: Height not set!\n"; } if( !Height ) { fprintf(stderr,"WARNING: Height not set!\n"); }
if( !Duration ) { std::cerr << "WARNING: Duration not set!\n"; } if( !Duration ) { fprintf(stderr,"WARNING: Duration not set!\n"); }
if( !UnitsPerSecond ) { std::cerr << "WARNING: Timescale not set!\n"; } if( !UnitsPerSecond ) { fprintf(stderr,"WARNING: Timescale not set!\n"); }
if( stts.size() == 0 ) {
fprintf(stderr,"WARNING: No stts available!\n");
} else {
WriteSTTS();
}
stsd_vide->WriteContent( ); stsd_vide->WriteContent( );
stco_vide->WriteContent( ); stco_vide->WriteContent( );
stsc_vide->WriteContent( ); stsc_vide->WriteContent( );
@ -218,5 +223,19 @@ void Interface::SetStaticDefaults() {
} }
void Interface::AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta ) { void Interface::AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta ) {
stts_record temp;
temp.SampleCount = SampleCount;
temp.SampleDelta = SampleDelta;
stts.push_back(temp);
}
void Interface::EmptySTTS() {
stts.clear();
}
void Interface::WriteSTTS( ) {
for( int i = stts.size() -1; i > 0; i -- ) {
stts_vide->AddEntry(stts[i].SampleCount,stts[i].SampleDelta,i);
stts_soun->AddEntry(stts[i].SampleCount,stts[i].SampleDelta,i);
}
} }

View file

@ -13,14 +13,17 @@ class Interface {
void SetDurationTime( uint32_t NewDuration ); void SetDurationTime( uint32_t NewDuration );
void SetTimeScale( uint32_t NewUnitsPerSecond ); void SetTimeScale( uint32_t NewUnitsPerSecond );
void AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta ); void AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta );
void EmptySTTS( );
private: private:
void SetStaticDefaults(); void SetStaticDefaults();
void UpdateContents(); void UpdateContents();
void WriteSTTS( );
bool AllBoxesExist(); bool AllBoxesExist();
uint16_t Width; uint16_t Width;
uint16_t Height; uint16_t Height;
uint32_t Duration; uint32_t Duration;
uint32_t UnitsPerSecond; uint32_t UnitsPerSecond;
std::vector<stts_record> stts;
Box_ftyp * ftyp; Box_ftyp * ftyp;
Box_moov * moov; Box_moov * moov;
Box_mvhd * mvhd; Box_mvhd * mvhd;