TKHD Box Headerfile created

This commit is contained in:
Erik Zandvliet 2011-01-17 15:34:38 +01:00
parent 1413e40dd3
commit 72b024cf23
2 changed files with 72 additions and 0 deletions

45
MP4/box_tkhd.cpp Normal file
View file

@ -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() {
}
*/

27
MP4/box_tkhd.h Normal file
View file

@ -0,0 +1,27 @@
#include "box.h"
#include <ctime>
#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