From 72b024cf23484d11811a6b55cc01f56d021c46cf Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Mon, 17 Jan 2011 15:34:38 +0100 Subject: [PATCH] TKHD Box Headerfile created --- MP4/box_tkhd.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ MP4/box_tkhd.h | 27 +++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 MP4/box_tkhd.cpp create mode 100644 MP4/box_tkhd.h diff --git a/MP4/box_tkhd.cpp b/MP4/box_tkhd.cpp new file mode 100644 index 00000000..7795d370 --- /dev/null +++ b/MP4/box_tkhd.cpp @@ -0,0 +1,45 @@ +#include "box_tkhd.h" + +Box_tkhd::Box_tkhd( ) { + Container = new Box( 0x6D646864 ); +} + +Box_tkhd::~Box_tkhd() { + delete Container; +} + +Box * Box_tkhd::GetBox() { + return Container; +} + +/* +void Box_mdhd::SetCreationTime( uint32_t TimeStamp ) { + uint32_t CreationTime; + if(!TimeStamp) { + CreationTime = time(NULL) + SECONDS_DIFFERENCE; + } else { + CreationTime = TimeStamp; + } + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(CreationTime),4); +} + +void Box_mdhd::SetModificationTime( uint32_t TimeStamp ) { + uint32_t ModificationTime; + if(!TimeStamp) { + ModificationTime = time(NULL) + SECONDS_DIFFERENCE; + } else { + ModificationTime = TimeStamp; + } + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(ModificationTime),8); +} + +void Box_mdhd::SetDurationTime( uint32_t TimeUnits ) { + Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(TimeUnits),16); +} + +void Box_mdhd::SetReserved() { +} + +void Box_mdhd::SetDefaults() { +} +*/ diff --git a/MP4/box_tkhd.h b/MP4/box_tkhd.h new file mode 100644 index 00000000..e326ba16 --- /dev/null +++ b/MP4/box_tkhd.h @@ -0,0 +1,27 @@ +#include "box.h" +#include + +#define SECONDS_DIFFERENCE 2082844800 + +class Box_tkhd { + public: + Box_tkhd( ); + ~Box_tkhd(); + Box * GetBox(); + void SetCreationTime( uint32_t TimeStamp = 0 ); + void SetModificationTime( uint32_t TimeStamp = 0 ); + void SetDurationTime( uint32_t TimeUnits = 0 ); + void SetWidth( uint32_t Width = 0 ); + void SetHeight( uint32_t Height = 0 ); + void SetFlags( bool Bit0 = true, bool Bit1 = true, bool Bit2 = true ); + void SetVersion( uint32_t Version = 0 ); + void SetTrackID( uint32_t TrackID = 0 ); + private: + void SetReserved(); + void SetDefaults(); + Box * Container; + + uint32_t CurrentFlags; + uint32_t CurrentVersion; +};//Box_ftyp Class +