TREX box completed and added to interface
This commit is contained in:
		
							parent
							
								
									1ac23854b7
								
							
						
					
					
						commit
						b85be8b76c
					
				
					 7 changed files with 70 additions and 2 deletions
				
			
		| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
SRC = box_avcC.cpp box.cpp box_dinf.cpp box_dref.cpp box_esds.cpp box_ftyp.cpp box_hdlr.cpp box_hmhd.cpp box_mdhd.cpp box_mdia.cpp box_minf.cpp box_moov.cpp box_mvhd.cpp box_nmhd.cpp box_smhd.cpp box_stbl.cpp box_stco.cpp box_stsc.cpp box_stsd.cpp box_stts.cpp box_tkhd.cpp box_trak.cpp box_url.cpp box_vmhd.cpp main.cpp interface.cpp box_mdat.cpp box_rtmp.cpp box_amhp.cpp box_mvex.cpp
 | 
					SRC = box_avcC.cpp box.cpp box_dinf.cpp box_dref.cpp box_esds.cpp box_ftyp.cpp box_hdlr.cpp box_hmhd.cpp box_mdhd.cpp box_mdia.cpp box_minf.cpp box_moov.cpp box_mvhd.cpp box_nmhd.cpp box_smhd.cpp box_stbl.cpp box_stco.cpp box_stsc.cpp box_stsd.cpp box_stts.cpp box_tkhd.cpp box_trak.cpp box_url.cpp box_vmhd.cpp main.cpp interface.cpp box_mdat.cpp box_rtmp.cpp box_amhp.cpp box_mvex.cpp box_trex.cpp
 | 
				
			||||||
OBJ = $(SRC:.cpp=.o)
 | 
					OBJ = $(SRC:.cpp=.o)
 | 
				
			||||||
OUT = Boxtest
 | 
					OUT = Boxtest
 | 
				
			||||||
INCLUDES = 
 | 
					INCLUDES = 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Box_ftyp::Box_ftyp( ) {
 | 
					Box_ftyp::Box_ftyp( ) {
 | 
				
			||||||
  Container = new Box( 0x66747970 );
 | 
					  Container = new Box( 0x66747970 );
 | 
				
			||||||
 | 
					  SetDefaults( );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Box_ftyp::~Box_ftyp() {
 | 
					Box_ftyp::~Box_ftyp() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,3 +25,4 @@
 | 
				
			||||||
#include "box_rtmp.h"
 | 
					#include "box_rtmp.h"
 | 
				
			||||||
#include "box_amhp.h"
 | 
					#include "box_amhp.h"
 | 
				
			||||||
#include "box_mvex.h"
 | 
					#include "box_mvex.h"
 | 
				
			||||||
 | 
					#include "box_trex.h"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										44
									
								
								MP4/box_trex.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								MP4/box_trex.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,44 @@
 | 
				
			||||||
 | 
					#include "box_trex.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Box_trex::Box_trex( ) {
 | 
				
			||||||
 | 
					  Container = new Box( 0x74726578 );
 | 
				
			||||||
 | 
					  SetReserved( );
 | 
				
			||||||
 | 
					  SetDefaults( );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Box_trex::~Box_trex() {
 | 
				
			||||||
 | 
					  delete Container;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Box * Box_trex::GetBox() {
 | 
				
			||||||
 | 
					  return Container;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Box_trex::SetDefaults( ) {
 | 
				
			||||||
 | 
					  SetTrackID( );
 | 
				
			||||||
 | 
					  SetSampleDescriptionIndex( );
 | 
				
			||||||
 | 
					  SetSampleDuration( );
 | 
				
			||||||
 | 
					  SetSampleSize( );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Box_trex::SetReserved( ) {
 | 
				
			||||||
 | 
					  Container->SetPayload((uint32_t)2,Box::uint16_to_uint8(1),22);
 | 
				
			||||||
 | 
					  Container->SetPayload((uint32_t)2,Box::uint16_to_uint8(0),20);
 | 
				
			||||||
 | 
					  Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Box_trex::SetTrackID( uint32_t Id ) {
 | 
				
			||||||
 | 
					  Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Id),4);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Box_trex::SetSampleDescriptionIndex( uint32_t Index ) {
 | 
				
			||||||
 | 
					  Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Index),8);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Box_trex::SetSampleDuration( uint32_t Duration ) {
 | 
				
			||||||
 | 
					  Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Duration),12);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Box_trex::SetSampleSize( uint32_t Size ) {
 | 
				
			||||||
 | 
					  Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Size),16);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										16
									
								
								MP4/box_trex.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								MP4/box_trex.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					#include "box.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Box_trex {
 | 
				
			||||||
 | 
					  public:
 | 
				
			||||||
 | 
					    Box_trex( );
 | 
				
			||||||
 | 
					    ~Box_trex();
 | 
				
			||||||
 | 
					    Box * GetBox();
 | 
				
			||||||
 | 
					    void SetTrackID( uint32_t Id = 0 );
 | 
				
			||||||
 | 
					    void SetSampleDescriptionIndex( uint32_t Index = 0 );
 | 
				
			||||||
 | 
					    void SetSampleDuration( uint32_t Duration = 0 );
 | 
				
			||||||
 | 
					    void SetSampleSize( uint32_t Size = 0 );
 | 
				
			||||||
 | 
					  private:
 | 
				
			||||||
 | 
					    void SetReserved( );
 | 
				
			||||||
 | 
					    void SetDefaults( );
 | 
				
			||||||
 | 
					    Box * Container;
 | 
				
			||||||
 | 
					};//Box_ftyp Class
 | 
				
			||||||
| 
						 | 
					@ -43,12 +43,16 @@ Interface::Interface() {
 | 
				
			||||||
  rtmp = new Box_rtmp();
 | 
					  rtmp = new Box_rtmp();
 | 
				
			||||||
  amhp = new Box_amhp();
 | 
					  amhp = new Box_amhp();
 | 
				
			||||||
  mvex = new Box_mvex();
 | 
					  mvex = new Box_mvex();
 | 
				
			||||||
 | 
					  trex_vide = new Box_trex();
 | 
				
			||||||
 | 
					  trex_soun = new Box_trex();
 | 
				
			||||||
  //Set some values we already know won't change once the boxes have been created
 | 
					  //Set some values we already know won't change once the boxes have been created
 | 
				
			||||||
  SetStaticDefaults();
 | 
					  SetStaticDefaults();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Interface::~Interface() {
 | 
					Interface::~Interface() {
 | 
				
			||||||
  //Deleting the boxes if they still exist.
 | 
					  //Deleting the boxes if they still exist.
 | 
				
			||||||
 | 
					  if( trex_vide ) { delete trex_vide; trex_vide = NULL; }
 | 
				
			||||||
 | 
					  if( trex_soun ) { delete trex_soun; trex_soun = NULL; }
 | 
				
			||||||
  if( mvex ) { delete mvex; mvex = NULL; }
 | 
					  if( mvex ) { delete mvex; mvex = NULL; }
 | 
				
			||||||
  if( amhp ) { delete amhp; amhp = NULL; }
 | 
					  if( amhp ) { delete amhp; amhp = NULL; }
 | 
				
			||||||
  if( rtmp ) { delete rtmp; rtmp = NULL; }
 | 
					  if( rtmp ) { delete rtmp; rtmp = NULL; }
 | 
				
			||||||
| 
						 | 
					@ -191,7 +195,7 @@ bool Interface::AllBoxesExist() {
 | 
				
			||||||
  minf_vide && vmhd_vide && dinf_vide && dref_vide && url_vide && stbl_vide && stts_vide && stsc_vide &&
 | 
					  minf_vide && vmhd_vide && dinf_vide && dref_vide && url_vide && stbl_vide && stts_vide && stsc_vide &&
 | 
				
			||||||
  stco_vide && stsd_vide && avcC_vide && trak_soun && tkhd_soun && mdia_soun && mdhd_soun && hdlr_soun &&
 | 
					  stco_vide && stsd_vide && avcC_vide && trak_soun && tkhd_soun && mdia_soun && mdhd_soun && hdlr_soun &&
 | 
				
			||||||
  minf_soun && smhd_soun && dinf_soun && dref_soun && url_soun && stbl_soun && stts_soun && stsc_soun &&
 | 
					  minf_soun && smhd_soun && dinf_soun && dref_soun && url_soun && stbl_soun && stts_soun && stsc_soun &&
 | 
				
			||||||
  stco_soun && stsd_soun && esds_soun && rtmp && amhp );
 | 
					  stco_soun && stsd_soun && esds_soun && rtmp && amhp && mvex && trex_vide && trex_soun );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Interface::SetWidth( uint16_t NewWidth ) {
 | 
					void Interface::SetWidth( uint16_t NewWidth ) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,5 +70,7 @@ class Interface {
 | 
				
			||||||
    Box_rtmp * rtmp;
 | 
					    Box_rtmp * rtmp;
 | 
				
			||||||
    Box_amhp * amhp;
 | 
					    Box_amhp * amhp;
 | 
				
			||||||
    Box_mvex * mvex;
 | 
					    Box_mvex * mvex;
 | 
				
			||||||
 | 
					    Box_trex * trex_vide;
 | 
				
			||||||
 | 
					    Box_trex * trex_soun;
 | 
				
			||||||
};//Interface class
 | 
					};//Interface class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue