ABST box update
This commit is contained in:
		
							parent
							
								
									1ae7093b51
								
							
						
					
					
						commit
						8abe080cdc
					
				
					 2 changed files with 64 additions and 0 deletions
				
			
		|  | @ -12,6 +12,10 @@ Box * Box_abst::GetBox() { | |||
|   return Container; | ||||
| } | ||||
| 
 | ||||
| void Box_abst::SetBootstrapVersion( uint32_t Version ) { | ||||
|   curBootstrapInfoVersion = Version; | ||||
| } | ||||
| 
 | ||||
| void Box_abst::SetProfile( uint8_t Profile ) { | ||||
|   curProfile = Profile; | ||||
| } | ||||
|  | @ -81,3 +85,59 @@ void Box_abst::AddFragmentRunTable( Box * newFragment, uint32_t Offset ) { | |||
|   } | ||||
|   FragmentRunTables[Offset] = newFragment; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void Box_abst::SetDefaults( ) { | ||||
|   SetProfile( ); | ||||
|   SetLive( ); | ||||
|   SetUpdate( ); | ||||
|   SetTimeScale( ); | ||||
|   SetMediaTime( ); | ||||
|   SetSMPTE( ); | ||||
|   SetMovieIdentfier( ); | ||||
|   SetDRM( ); | ||||
|   SetMetaData( ); | ||||
| } | ||||
| 
 | ||||
| void SetReserved( ) { | ||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0)); | ||||
| } | ||||
| 
 | ||||
| void Box_abst::WriteContent( ) { | ||||
|   Container->ResetPayload( ); | ||||
|   SetReserved( ); | ||||
|   Box * current; | ||||
|   std::string serializedSegments = ""; | ||||
|   int SegmentAmount = 0; | ||||
|   for( uint32_t i = 0; i < SegmentRunTables.size(); i++ ) { | ||||
|     current=SegmentRunTables[i]; | ||||
|     if( current ) { | ||||
|       SegmentAmount ++; | ||||
|       serializedSegments.append((char*)current->GetBoxedata(),current->GetBoxedDataSize()); | ||||
|     } | ||||
|   } | ||||
|   std::string serializedFragments = ""; | ||||
|   int FragmentAmount = 0; | ||||
|   for( uint32_t i = 0; i < FragmentRunTables.size(); i++ ) { | ||||
|     current=FragmentRunTables[i]; | ||||
|     if( current ) { | ||||
|       FragmentAmount ++; | ||||
|       serializedFragments.append((char*)current->GetBoxedata(),current->GetBoxedDataSize()); | ||||
|     } | ||||
|   } | ||||
|   //NO_OFFSET
 | ||||
|   uint8_t * temp = new uint8_t[1]; | ||||
|   temp[0] = 0 & ( curProfile << 6 ) & ( (uint8_t)isLive << 7 ) & ( (uint8_t)isUpdate << 7 ); | ||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(curBootstrapInfoVersion),4); | ||||
|   Container->SetPayload((uint32_t)1,temp,8); | ||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(curTimeScale),9); | ||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),13); | ||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(curMediaTime),17); | ||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),21); | ||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(curSMPTE),25); | ||||
|   Container->SetPayload((uint32_t)curMovieIdentifier.size(),(uint8_t*)curMovieIdentifier.c_str(),29); | ||||
|    | ||||
|   //CalcOffsets
 | ||||
|   Container->SetPayload((uint32_t)serializedSegments.size(),(uint8_t*)serializedSegments.c_str()); | ||||
|   Container->SetPayload((uint32_t)serializedFragments.size(),(uint8_t*)serializedFragments.c_str()); | ||||
| } | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ class Box_abst { | |||
|     Box_abst( ); | ||||
|     ~Box_abst(); | ||||
|     Box * GetBox(); | ||||
|     void SetBootstrapVersion( uint32_t Version = 1 ); | ||||
|     void SetProfile( uint8_t Profile = 0 ); | ||||
|     void SetLive( bool Live = true ); | ||||
|     void SetUpdate( bool Update = false ); | ||||
|  | @ -29,6 +30,9 @@ class Box_abst { | |||
|     void AddSegmentRunTable( Box * newSegment, uint32_t Offset = 0 ); | ||||
|     void AddFragmentRunTable( Box * newFragment, uint32_t Offset = 0 ); | ||||
|   private: | ||||
|     void SetDefaults( ); | ||||
|     void SetReserved( ); | ||||
|     uint32_t curBootstrapInfoVersion; | ||||
|     uint8_t curProfile; | ||||
|     bool isLive; | ||||
|     bool isUpdate; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Erik Zandvliet
						Erik Zandvliet