diff --git a/MP4/box_avcC.cpp b/MP4/box_avcC.cpp index 354312c7..596d3077 100644 --- a/MP4/box_avcC.cpp +++ b/MP4/box_avcC.cpp @@ -58,7 +58,8 @@ void Box_avcC::SetReserved( ) { } void Box_avcC::SetDefaults( ) { - SetDimensions( ); + SetWidth( ); + SetHeight( ); SetDepth ( ); SetFrameCount ( ); SetResolution ( ); diff --git a/MP4/interface.cpp b/MP4/interface.cpp index ea40e1c3..7fd024cc 100644 --- a/MP4/interface.cpp +++ b/MP4/interface.cpp @@ -136,10 +136,15 @@ uint8_t * Interface::GetContents( ) { } void Interface::UpdateContents( ) { - if( !Width ) { std::cerr << "WARNING: Width not set!\n"; } - if( !Height ) { std::cerr << "WARNING: Height not set!\n"; } - if( !Duration ) { std::cerr << "WARNING: Duration not set!\n"; } - if( !UnitsPerSecond ) { std::cerr << "WARNING: Timescale not set!\n"; } + if( !Width ) { fprintf(stderr,"WARNING: Width not set!\n"); } + if( !Height ) { fprintf(stderr,"WARNING: Height not set!\n"); } + if( !Duration ) { fprintf(stderr,"WARNING: Duration 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( ); stco_vide->WriteContent( ); stsc_vide->WriteContent( ); @@ -218,5 +223,19 @@ void Interface::SetStaticDefaults() { } 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); + } } diff --git a/MP4/interface.h b/MP4/interface.h index d32d9f04..5d339fba 100644 --- a/MP4/interface.h +++ b/MP4/interface.h @@ -13,14 +13,17 @@ class Interface { void SetDurationTime( uint32_t NewDuration ); void SetTimeScale( uint32_t NewUnitsPerSecond ); void AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta ); + void EmptySTTS( ); private: void SetStaticDefaults(); void UpdateContents(); + void WriteSTTS( ); bool AllBoxesExist(); uint16_t Width; uint16_t Height; uint32_t Duration; uint32_t UnitsPerSecond; + std::vector stts; Box_ftyp * ftyp; Box_moov * moov; Box_mvhd * mvhd;