diff --git a/MP4/Makefile b/MP4/Makefile index 59b77e7b..bf582c10 100644 --- a/MP4/Makefile +++ b/MP4/Makefile @@ -1,4 +1,4 @@ -SRC = box.cpp box_ftyp.cpp box_h264.cpp box_stbl.cpp box_stco.cpp box_stsc.cpp box_stsd.cpp box_stts.cpp box_url.cpp box_dref.cpp box_dinf.cpp box_minf.cpp box_vmhd.cpp main.cpp +SRC = box.cpp box_ftyp.cpp box_h264.cpp box_stbl.cpp box_stco.cpp box_stsc.cpp box_stsd.cpp box_stts.cpp box_url.cpp box_dref.cpp box_dinf.cpp box_minf.cpp box_vmhd.cpp box_hdlr.cpp main.cpp OBJ = $(SRC:.cpp=.o) OUT = Boxtest INCLUDES = diff --git a/MP4/box_hdlr.cpp b/MP4/box_hdlr.cpp index 94efb540..41b70604 100644 --- a/MP4/box_hdlr.cpp +++ b/MP4/box_hdlr.cpp @@ -2,7 +2,7 @@ Box_hdlr::Box_hdlr( ) { Container = new Box( 0x68646C72 ); - SetDefaults(); + CurrentHandlerType = 0; SetReserved(); } @@ -15,6 +15,25 @@ Box * Box_hdlr::GetBox() { } void Box_hdlr::SetReserved( ) { - Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(1)); + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),20); + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),16); + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),12); + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),4); + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0)); } +void Box_hdlr::SetHandlerType( uint32_t HandlerType ) { + if( HandlerType != 0 ) { + CurrentHandlerType = HandlerType; + } + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(CurrentHandlerType),8); +} + +void Box_hdlr::SetName ( std::string Name ) { + char * tmp = new char[Name.size()+1]; + strcpy(tmp,Name.c_str()); + Container->ResetPayload(); + SetReserved(); + SetHandlerType(0); + Container->SetPayload((uint32_t)strlen(tmp)+1,(uint8_t*)tmp,24); +} diff --git a/MP4/box_hdlr.h b/MP4/box_hdlr.h index 6c446e96..45fd2e0d 100644 --- a/MP4/box_hdlr.h +++ b/MP4/box_hdlr.h @@ -1,4 +1,5 @@ #include "box.h" +#include class Box_hdlr { public: @@ -10,5 +11,6 @@ class Box_hdlr { private: Box * Container; void SetReserved( ); + uint32_t CurrentHandlerType; };//Box_ftyp Class