[STABLE] all boxes compile, hint media header box added
This commit is contained in:
parent
9729daa93d
commit
755fcd00c6
6 changed files with 73 additions and 14 deletions
|
@ -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 box_hdlr.cpp box_trak.cpp box_moov.cpp box_mdia.cpp box_mdhd.cpp main.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
|
||||||
OBJ = $(SRC:.cpp=.o)
|
OBJ = $(SRC:.cpp=.o)
|
||||||
OUT = Boxtest
|
OUT = Boxtest
|
||||||
INCLUDES =
|
INCLUDES =
|
||||||
|
|
42
MP4/box_hmhd.cpp
Normal file
42
MP4/box_hmhd.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#include "box_hmhd.h"
|
||||||
|
|
||||||
|
Box_hmhd::Box_hmhd( ) {
|
||||||
|
Container = new Box( 0x686D6864 );
|
||||||
|
SetDefaults();
|
||||||
|
SetReserved();
|
||||||
|
}
|
||||||
|
|
||||||
|
Box_hmhd::~Box_hmhd() {
|
||||||
|
delete Container;
|
||||||
|
}
|
||||||
|
|
||||||
|
Box * Box_hmhd::GetBox() {
|
||||||
|
return Container;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_hmhd::SetMaxPDUSize( uint16_t Size ) {
|
||||||
|
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8(Size),4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_hmhd::SetAvgPDUSize( uint16_t Size ) {
|
||||||
|
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8(Size),6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_hmhd::SetMaxBitRate( uint32_t Rate ) {
|
||||||
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Rate),8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_hmhd::SetAvgBitRate( uint32_t Rate ) {
|
||||||
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Rate),12);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_hmhd::SetReserved( ) {
|
||||||
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),16);
|
||||||
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0));
|
||||||
|
}
|
||||||
|
void Box_hmhd::SetDefaults( ) {
|
||||||
|
SetAvgBitRate( );
|
||||||
|
SetMaxBitRate( );
|
||||||
|
SetAvgPDUSize( );
|
||||||
|
SetMaxPDUSize( );
|
||||||
|
}
|
17
MP4/box_hmhd.h
Normal file
17
MP4/box_hmhd.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include "box.h"
|
||||||
|
|
||||||
|
class Box_hmhd {
|
||||||
|
public:
|
||||||
|
Box_hmhd( );
|
||||||
|
~Box_hmhd();
|
||||||
|
Box * GetBox();
|
||||||
|
void SetMaxPDUSize( uint16_t Size = 0 );
|
||||||
|
void SetAvgPDUSize( uint16_t Size = 0 );
|
||||||
|
void SetMaxBitRate( uint32_t Rate = 0 );
|
||||||
|
void SetAvgBitRate( uint32_t Rate = 0 );
|
||||||
|
private:
|
||||||
|
Box * Container;
|
||||||
|
void SetReserved( );
|
||||||
|
void SetDefaults( );
|
||||||
|
};//Box_ftyp Class
|
||||||
|
|
|
@ -47,7 +47,7 @@ void Box_mvhd::SetRate( uint32_t Rate ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_mvhd::SetVolume( uint16_t Volume ) {
|
void Box_mvhd::SetVolume( uint16_t Volume ) {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(Rate),24);
|
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(Volume),24);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_mvhd::SetNextTrackID( uint32_t TrackID ) {
|
void Box_mvhd::SetNextTrackID( uint32_t TrackID ) {
|
||||||
|
|
|
@ -39,15 +39,15 @@ void Box_tkhd::SetDurationTime( uint32_t TimeUnits ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_tkhd::SetReserved() {
|
void Box_tkhd::SetReserved() {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0x40000000),68);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0x40000000),68);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),64);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),64);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),60);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),60);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),56);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),56);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0x10000),52);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0x10000),52);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),48);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),48);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),44);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),44);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),40);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),40);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0x10000),36);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0x10000),36);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),34);
|
Container->SetPayload((uint32_t)4,Box::uint16_to_uint8(0),34);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),28);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),28);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),24);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),24);
|
||||||
|
@ -75,7 +75,7 @@ void Box_tkhd::SetWidth( uint32_t Width ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_tkhd::SetHeight( uint32_t Height ) {
|
void Box_tkhd::SetHeight( uint32_t Height ) {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Width),76);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Height),76);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_tkhd::SetDefaults() {
|
void Box_tkhd::SetDefaults() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "box_h264.h"
|
#include "box_avcC.h"
|
||||||
#include "box_stsd.h"
|
#include "box_stsd.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
Box_h264 * Testing = new Box_h264();
|
Box_avcC * Testing = new Box_avcC();
|
||||||
Testing->SetCompressorName( "Test123" );
|
Testing->SetCompressorName( "Test123" );
|
||||||
std::cout << "H264::Size: " << Testing->GetBox()->GetHeader().TotalSize << "\n";
|
std::cout << "H264::Size: " << Testing->GetBox()->GetHeader().TotalSize << "\n";
|
||||||
Box_stsd * Testsample = new Box_stsd();
|
Box_stsd * Testsample = new Box_stsd();
|
||||||
|
|
Loading…
Add table
Reference in a new issue