Bijna klaar!
This commit is contained in:
		
							parent
							
								
									5ca7a72b86
								
							
						
					
					
						commit
						a3fd7a5a43
					
				
					 84 changed files with 879 additions and 969 deletions
				
			
		
							
								
								
									
										51
									
								
								util/MP4/box_trak.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								util/MP4/box_trak.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| #include "box.cpp" | ||||
| #include <vector> | ||||
| #include <string> | ||||
| 
 | ||||
| class Box_trak { | ||||
|   public: | ||||
|     Box_trak(); | ||||
|     ~Box_trak(); | ||||
|     Box * GetBox(); | ||||
|     void AddContent( Box * newcontent, uint32_t offset = 0 ); | ||||
|     void WriteContent( ); | ||||
|   private: | ||||
|     Box * Container; | ||||
|      | ||||
|     std::vector<Box *> Content; | ||||
| };//Box_ftyp Class
 | ||||
| 
 | ||||
| Box_trak::Box_trak( ) { | ||||
|   Container = new Box( 0x7472616B ); | ||||
| } | ||||
| 
 | ||||
| Box_trak::~Box_trak() { | ||||
|   delete Container; | ||||
| } | ||||
| 
 | ||||
| Box * Box_trak::GetBox() { | ||||
|   return Container; | ||||
| } | ||||
| 
 | ||||
| void Box_trak::AddContent( Box * newcontent, uint32_t offset ) { | ||||
|   if( offset >= Content.size() ) { | ||||
|     Content.resize(offset+1); | ||||
|   } | ||||
|   if( Content[offset] ) { | ||||
|     delete Content[offset]; | ||||
|   } | ||||
|   Content[offset] = newcontent; | ||||
| } | ||||
| 
 | ||||
| void Box_trak::WriteContent( ) { | ||||
|   Container->ResetPayload( ); | ||||
|   Box * current; | ||||
|   std::string serializedbox = ""; | ||||
|   for( uint32_t i = 0; i < Content.size(); i++ ) { | ||||
|     current=Content[i]; | ||||
|     if( current ) { | ||||
|       serializedbox.append((char*)current->GetBoxedData(),current->GetBoxedDataSize()); | ||||
|     } | ||||
|   } | ||||
|   Container->SetPayload((uint32_t)serializedbox.size(),(uint8_t*)serializedbox.c_str()); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma