Adding stco and mdat functionality
This commit is contained in:
		
							parent
							
								
									2c177c4689
								
							
						
					
					
						commit
						4742862b08
					
				
					 6 changed files with 26 additions and 2 deletions
				
			
		|  | @ -6,7 +6,7 @@ class Box_avcC { | ||||||
|     Box_avcC( ); |     Box_avcC( ); | ||||||
|     ~Box_avcC(); |     ~Box_avcC(); | ||||||
|     Box * GetBox(); |     Box * GetBox(); | ||||||
|     void SetDataReferenceIndex( uint16_t DataReferenceIndex = 0 ); |     void SetDataReferenceIndex( uint16_t DataReferenceIndex = 1 ); | ||||||
|     void SetWidth( uint16_t Width = 0 ); |     void SetWidth( uint16_t Width = 0 ); | ||||||
|     void SetHeight( uint16_t Height = 0 ); |     void SetHeight( uint16_t Height = 0 ); | ||||||
|     void SetResolution ( uint32_t Horizontal = 0x00480000, uint32_t Vertical = 0x00480000 ); |     void SetResolution ( uint32_t Horizontal = 0x00480000, uint32_t Vertical = 0x00480000 ); | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ class Box_esds { | ||||||
|     Box_esds( ); |     Box_esds( ); | ||||||
|     ~Box_esds(); |     ~Box_esds(); | ||||||
|     Box * GetBox(); |     Box * GetBox(); | ||||||
|     void SetDataReferenceIndex( uint16_t DataReferenceIndex = 0); |     void SetDataReferenceIndex( uint16_t DataReferenceIndex = 1); | ||||||
|     void SetChannelCount( uint16_t Count = 2 ); |     void SetChannelCount( uint16_t Count = 2 ); | ||||||
|     void SetSampleSize( uint16_t Size = 16 ); |     void SetSampleSize( uint16_t Size = 16 ); | ||||||
|   private: |   private: | ||||||
|  |  | ||||||
|  | @ -35,3 +35,7 @@ void Box_stco::WriteContent( ) { | ||||||
|   } |   } | ||||||
|   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Offsets.size()),4); |   Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Offsets.size()),4); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void Box_stco::SetOffsets( std::vector<uint32_t> NewOffsets ) { | ||||||
|  |   Offsets = NewOffsets; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ class Box_stco { | ||||||
|     ~Box_stco(); |     ~Box_stco(); | ||||||
|     Box * GetBox(); |     Box * GetBox(); | ||||||
|     void AddOffset( uint32_t DataOffset, uint32_t Offset = 0 ); |     void AddOffset( uint32_t DataOffset, uint32_t Offset = 0 ); | ||||||
|  |     void SetOffsets( std::vector<uint32_t> NewOffsets ); | ||||||
|     void WriteContent( ); |     void WriteContent( ); | ||||||
|   private: |   private: | ||||||
|     Box * Container; |     Box * Container; | ||||||
|  |  | ||||||
|  | @ -244,6 +244,9 @@ void Interface::SetStaticDefaults() { | ||||||
| //  'soun' = 0x736F756E
 | //  'soun' = 0x736F756E
 | ||||||
|   hdlr_soun->SetHandlerType( 0x736F756E ); |   hdlr_soun->SetHandlerType( 0x736F756E ); | ||||||
|   hdlr_vide->SetName( "Audio Track" ); |   hdlr_vide->SetName( "Audio Track" ); | ||||||
|  | //  Set Track ID's
 | ||||||
|  |   tkhd_vide->SetTrackID( 1 ); | ||||||
|  |   tkhd_soun->SetTrackID( 2 ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Interface::AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta, uint32_t Track ) { | void Interface::AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta, uint32_t Track ) { | ||||||
|  | @ -344,3 +347,17 @@ void Interface::WriteSTSC( uint32_t Track ) { | ||||||
|       break; |       break; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void Interface::SetOffsets( std::vector<uint32_t> NewOffsets, uint32_t Track ) { | ||||||
|  |   switch( Track ) { | ||||||
|  |     case 1: | ||||||
|  |       stco_vide->SetOffsets( NewOffsets ); | ||||||
|  |       break; | ||||||
|  |     case 2: | ||||||
|  |       stco_soun->SetOffsets( NewOffsets ); | ||||||
|  |       break; | ||||||
|  |     default; | ||||||
|  |       fprintf( stderr, "WARNING: Track %d does not exist, Offsets not written\n", Track ); | ||||||
|  |       break; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -16,6 +16,8 @@ class Interface { | ||||||
|     void EmptySTTS( uint32_t Track ); |     void EmptySTTS( uint32_t Track ); | ||||||
|     void AddSTSCEntry( uint32_t FirstChunk, uint32_t SamplesPerChunk, uint32_t Track ); |     void AddSTSCEntry( uint32_t FirstChunk, uint32_t SamplesPerChunk, uint32_t Track ); | ||||||
|     void EmptySTSC( uint32_t Track ); |     void EmptySTSC( uint32_t Track ); | ||||||
|  |     void SetOffsets( std::vector<uint32_t> NewOffsets, uint32_t Track ); | ||||||
|  |     void SetData( uint8_t * Data, uint32_t DataSize ); | ||||||
|   private: |   private: | ||||||
|     void SetStaticDefaults(); |     void SetStaticDefaults(); | ||||||
|     void UpdateContents(); |     void UpdateContents(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Erik Zandvliet
						Erik Zandvliet