From dab1ec345d12730e199a4226c4224b49b44645bc Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Wed, 16 Feb 2011 15:02:56 +0100 Subject: [PATCH] [Stable] Interface::GenerateLiveBootstrap( ) --- MP4/box_abst.cpp | 4 ++-- MP4/box_abst.h | 2 +- MP4/interface.cpp | 34 ++++++++++++++++++++++++++++++++++ MP4/interface.h | 2 ++ 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/MP4/box_abst.cpp b/MP4/box_abst.cpp index da9a8606..dbfd6526 100644 --- a/MP4/box_abst.cpp +++ b/MP4/box_abst.cpp @@ -40,7 +40,7 @@ void Box_abst::SetSMPTE( uint32_t Smpte ) { curSMPTE = Smpte; } -void Box_abst::SetMovieIdentfier( std::string Identifier ) { +void Box_abst::SetMovieIdentifier( std::string Identifier ) { curMovieIdentifier = Identifier; } @@ -94,7 +94,7 @@ void Box_abst::SetDefaults( ) { SetTimeScale( ); SetMediaTime( ); SetSMPTE( ); - SetMovieIdentfier( ); + SetMovieIdentifier( ); SetDRM( ); SetMetaData( ); } diff --git a/MP4/box_abst.h b/MP4/box_abst.h index f2cea66d..4f4b379c 100644 --- a/MP4/box_abst.h +++ b/MP4/box_abst.h @@ -22,7 +22,7 @@ class Box_abst { void SetTimeScale( uint32_t Scale = 1000 ); void SetMediaTime( uint32_t Time = 0 ); void SetSMPTE( uint32_t Smpte = 0 ); - void SetMovieIdentfier( std::string Identifier = "" ); + void SetMovieIdentifier( std::string Identifier = "" ); void SetDRM( std::string Drm = "" ); void SetMetaData( std::string MetaData = "" ); void AddServerEntry( std::string Url = "", uint32_t Offset = 0 ); diff --git a/MP4/interface.cpp b/MP4/interface.cpp index 0013d9c0..3f64bd48 100644 --- a/MP4/interface.cpp +++ b/MP4/interface.cpp @@ -450,3 +450,37 @@ void Interface::SetOffsets( std::vector NewOffsets, uint32_t Track ) { break; } } + +std::string Interface::GenerateLiveBootstrap( uint32_t CurMediaTime ) { + //SetUpAFRT + afrt->SetUpdate(false); + afrt->SetTimeScale( 1000 ); + afrt->AddQualityEntry( "" ); + afrt->AddFragmentRunEntry( 1, 0, 0, 2 ); + afrt->WriteContent( ); + + //SetUpASRT + asrt->SetUpdate(false); + asrt->AddQualityEntry( "" ); + asrt->AddSegmentRunEntry( 1, 0 ); + asrt->WriteContent( ); + + //SetUpABST + abst->SetBootstrapVersion( 1 ); + abst->SetProfile( 0 ); + abst->SetLive( true ); + abst->SetUpdate( false ); + abst->SetTimeScale( 1000 ); + abst->SetMediaTime( CurMediaTime ); + abst->SetSMPTE( 0 ); + abst->SetMovieIdentifier( "" ); + abst->SetDRM( "" ); + abst->SetMetaData( "" ); + abst->AddServerEntry( "" ); + abst->AddQualityEntry( "" ); + abst->WriteContent( ); + + std::string Result; + Result.append( (char*)abst->GetBox( )->GetBoxedData( ), (int)abst->GetBox( )->GetBoxedDataSize( ) ); + return Result; +} diff --git a/MP4/interface.h b/MP4/interface.h index ca15c4d3..d4edec0b 100644 --- a/MP4/interface.h +++ b/MP4/interface.h @@ -18,6 +18,8 @@ class Interface { void EmptySTSC( uint32_t Track ); void SetOffsets( std::vector NewOffsets, uint32_t Track ); void SetData( uint8_t * Data, uint32_t DataSize ); + + std::string GenerateLiveBootstrap( uint32_t CurMediaTime ); private: void SetStaticDefaults(); void UpdateContents();