diff --git a/MP4/Makefile b/MP4/Makefile index 2691494a..b8ed4103 100644 --- a/MP4/Makefile +++ b/MP4/Makefile @@ -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 +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 OBJ = $(SRC:.cpp=.o) OUT = Boxtest INCLUDES = diff --git a/MP4/box_includes.h b/MP4/box_includes.h index c83d6e0f..6b28de8c 100644 --- a/MP4/box_includes.h +++ b/MP4/box_includes.h @@ -21,3 +21,4 @@ #include "box_trak.h" #include "box_url.h" #include "box_vmhd.h" +#include "box_mdat.h" diff --git a/MP4/box_mdat.cpp b/MP4/box_mdat.cpp new file mode 100644 index 00000000..2a060568 --- /dev/null +++ b/MP4/box_mdat.cpp @@ -0,0 +1,17 @@ +#include "box_mdat.h" + +Box_mdat::Box_mdat( ) { + Container = new Box( 0x6D646174 ); +} + +Box_mdat::~Box_mdat() { + delete Container; +} + +Box * Box_mdat::GetBox() { + return Container; +} + +void Box_mdat::SetContent( uint8_t * NewData, uint32_t DataLength , uint32_t Offset ) { + Container->SetPayload(DataLength,NewData,Offset); +} diff --git a/MP4/box_mdat.h b/MP4/box_mdat.h new file mode 100644 index 00000000..c44f605a --- /dev/null +++ b/MP4/box_mdat.h @@ -0,0 +1,14 @@ +#include "box.h" +#include +#include + +class Box_mdat { + public: + Box_mdat(); + ~Box_mdat(); + Box * GetBox(); + void SetContent( uint8_t * NewData, uint32_t DataLength , uint32_t offset = 0 ); + private: + Box * Container; +};//Box_ftyp Class + diff --git a/MP4/interface.cpp b/MP4/interface.cpp index f0a7f18c..1d8fdd58 100644 --- a/MP4/interface.cpp +++ b/MP4/interface.cpp @@ -4,8 +4,6 @@ Interface::Interface() { //Initializing local data Width = 0; Height = 0; - Duration = 0; - UnitsPerSecond = 0; //Creating the boxes ftyp = new Box_ftyp(); moov = new Box_moov(); @@ -138,13 +136,20 @@ uint8_t * Interface::GetContents( ) { void Interface::UpdateContents( ) { if( !Width ) { fprintf(stderr,"WARNING: Width not set!\n"); } if( !Height ) { fprintf(stderr,"WARNING: Height not set!\n"); } - if( !Duration ) { fprintf(stderr,"WARNING: Duration not set!\n"); } - if( !UnitsPerSecond ) { fprintf(stderr,"WARNING: Timescale not set!\n"); } - if( stts.size() == 0 ) { - fprintf(stderr,"WARNING: No stts available!\n"); - } else { - WriteSTTS(); - } + if( !Duration.size() ) { fprintf(stderr,"WARNING: Duration not set!\n"); } + if( !UnitsPerSecond.size() ) { fprintf(stderr,"WARNING: Timescale not set!\n"); } + if( sttsvide.size() == 0 ) { + fprintf(stderr,"WARNING: No video stts available!\n"); + } else { WriteSTTS( 1 ); } + if( sttssoun.size() == 0 ) { + fprintf(stderr,"WARNING: No sound stts available!\n"); + } else { WriteSTTS( 2 ); } + if( stscvide.size() == 0 ) { + fprintf(stderr,"WARNING: No video stsc available!\n"); + } else { WriteSTSC( 1 ); } + if( stscsoun.size() == 0 ) { + fprintf(stderr,"WARNING: No sound stsc available!\n"); + } else { WriteSTSC( 2 ); } stsd_vide->WriteContent( ); stco_vide->WriteContent( ); stsc_vide->WriteContent( ); @@ -356,7 +361,7 @@ void Interface::SetOffsets( std::vector NewOffsets, uint32_t Track ) { case 2: stco_soun->SetOffsets( NewOffsets ); break; - default; + default: fprintf( stderr, "WARNING: Track %d does not exist, Offsets not written\n", Track ); break; }