Handler Reference Box Finished

This commit is contained in:
Erik Zandvliet 2011-01-13 13:38:52 +01:00
parent 32d8f8b6f5
commit 6d1ae13193
3 changed files with 24 additions and 3 deletions

View file

@ -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 =

View file

@ -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);
}

View file

@ -1,4 +1,5 @@
#include "box.h"
#include <string>
class Box_hdlr {
public:
@ -10,5 +11,6 @@ class Box_hdlr {
private:
Box * Container;
void SetReserved( );
uint32_t CurrentHandlerType;
};//Box_ftyp Class