Tussentijdse commit, SetWidth en SetHeight aan interface toegevoegd, default value voor hdlr_soun en hdlr_vide toegevoegd, default value voor mvhd->NextTrackID() aangepast zodat deze geldig is
This commit is contained in:
parent
c646e99270
commit
7474b19df0
7 changed files with 60 additions and 11 deletions
|
@ -18,11 +18,14 @@ void Box_avcC::SetDataReferenceIndex( uint16_t DataReferenceIndex ) {
|
||||||
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8( DataReferenceIndex ),6);
|
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8( DataReferenceIndex ),6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_avcC::SetDimensions ( uint16_t Width, uint16_t Height ) {
|
void Box_avcC::SetWidth( uint16_t Width ) {
|
||||||
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8( Height ),26);
|
|
||||||
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8( Width ),24);
|
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8( Width ),24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Box_avcC::SetHeight( uint16_t Height ) {
|
||||||
|
Container->SetPayload((uint32_t)2,Box::uint16_to_uint8( Height ),26);
|
||||||
|
}
|
||||||
|
|
||||||
void Box_avcC::SetResolution ( uint32_t Horizontal, uint32_t Vertical ) {
|
void Box_avcC::SetResolution ( uint32_t Horizontal, uint32_t Vertical ) {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8( Vertical ),32);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8( Vertical ),32);
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8( Horizontal ),28);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8( Horizontal ),28);
|
||||||
|
@ -55,6 +58,7 @@ void Box_avcC::SetReserved( ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_avcC::SetDefaults( ) {
|
void Box_avcC::SetDefaults( ) {
|
||||||
|
SetDimensions( );
|
||||||
SetDepth ( );
|
SetDepth ( );
|
||||||
SetFrameCount ( );
|
SetFrameCount ( );
|
||||||
SetResolution ( );
|
SetResolution ( );
|
||||||
|
|
|
@ -7,7 +7,8 @@ class Box_avcC {
|
||||||
~Box_avcC();
|
~Box_avcC();
|
||||||
Box * GetBox();
|
Box * GetBox();
|
||||||
void SetDataReferenceIndex( uint16_t DataReferenceIndex = 0 );
|
void SetDataReferenceIndex( uint16_t DataReferenceIndex = 0 );
|
||||||
void SetDimensions ( uint16_t Width = 0, uint16_t Height = 0);
|
void SetWidth( uint16_t Width = 0 );
|
||||||
|
void SetHeight( uint16_t Height = 0 );
|
||||||
void SetResolution ( uint32_t Horizontal = 0x00480000, uint32_t Vertical = 0x00480000 );
|
void SetResolution ( uint32_t Horizontal = 0x00480000, uint32_t Vertical = 0x00480000 );
|
||||||
void SetFrameCount ( uint16_t FrameCount = 1 );
|
void SetFrameCount ( uint16_t FrameCount = 1 );
|
||||||
void SetCompressorName ( std::string CompressorName = "");
|
void SetCompressorName ( std::string CompressorName = "");
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Box_mvhd {
|
||||||
void SetDurationTime( uint32_t TimeUnits = 0 );
|
void SetDurationTime( uint32_t TimeUnits = 0 );
|
||||||
void SetRate( uint32_t Rate = 0x00010000 );
|
void SetRate( uint32_t Rate = 0x00010000 );
|
||||||
void SetVolume( uint16_t Volume = 0x0100 );
|
void SetVolume( uint16_t Volume = 0x0100 );
|
||||||
void SetNextTrackID( uint32_t TrackID = 0 );
|
void SetNextTrackID( uint32_t TrackID = 0xFFFFFFFF );
|
||||||
private:
|
private:
|
||||||
void SetReserved();
|
void SetReserved();
|
||||||
void SetDefaults();
|
void SetDefaults();
|
||||||
|
|
|
@ -70,12 +70,14 @@ void Box_tkhd::SetTrackID( uint32_t TrackID ) {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(TrackID),12);
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(TrackID),12);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_tkhd::SetWidth( uint32_t Width ) {
|
void Box_tkhd::SetWidth( uint16_t Width ) {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Width),72);
|
uint32_t ResultWidth = ( Width << 16 );
|
||||||
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(ResultWidth),72);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_tkhd::SetHeight( uint32_t Height ) {
|
void Box_tkhd::SetHeight( uint16_t Height ) {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Height),76);
|
uint32_t ResultHeight = ( Height << 16 );
|
||||||
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(ResultHeight),76);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_tkhd::SetDefaults() {
|
void Box_tkhd::SetDefaults() {
|
||||||
|
|
|
@ -11,8 +11,8 @@ class Box_tkhd {
|
||||||
void SetCreationTime( uint32_t TimeStamp = 0 );
|
void SetCreationTime( uint32_t TimeStamp = 0 );
|
||||||
void SetModificationTime( uint32_t TimeStamp = 0 );
|
void SetModificationTime( uint32_t TimeStamp = 0 );
|
||||||
void SetDurationTime( uint32_t TimeUnits = 0 );
|
void SetDurationTime( uint32_t TimeUnits = 0 );
|
||||||
void SetWidth( uint32_t Width = 0 );
|
void SetWidth( uint16_t Width = 0 );
|
||||||
void SetHeight( uint32_t Height = 0 );
|
void SetHeight( uint16_t Height = 0 );
|
||||||
void SetFlags( bool Bit0 = true, bool Bit1 = true, bool Bit2 = true );
|
void SetFlags( bool Bit0 = true, bool Bit1 = true, bool Bit2 = true );
|
||||||
void SetVersion( uint32_t Version = 0 );
|
void SetVersion( uint32_t Version = 0 );
|
||||||
void SetTrackID( uint32_t TrackID = 0 );
|
void SetTrackID( uint32_t TrackID = 0 );
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
|
|
||||||
Interface::Interface() {
|
Interface::Interface() {
|
||||||
|
//Initializing local data
|
||||||
|
Width = 0;
|
||||||
|
Height = 0;
|
||||||
|
//Creating the boxes
|
||||||
ftyp = new Box_ftyp();
|
ftyp = new Box_ftyp();
|
||||||
moov = new Box_moov();
|
moov = new Box_moov();
|
||||||
mvhd = new Box_mvhd();
|
mvhd = new Box_mvhd();
|
||||||
|
@ -36,9 +40,12 @@ Interface::Interface() {
|
||||||
stco_soun = new Box_stco();
|
stco_soun = new Box_stco();
|
||||||
stsd_soun = new Box_stsd();
|
stsd_soun = new Box_stsd();
|
||||||
esds_soun = new Box_esds();
|
esds_soun = new Box_esds();
|
||||||
|
//Set some values we already know won't change once the boxes have been created
|
||||||
|
SetStaticDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
Interface::~Interface() {
|
Interface::~Interface() {
|
||||||
|
//Deleting the boxes if they still exist.
|
||||||
if( esds_soun ) { delete esds_soun; esds_soun = NULL; }
|
if( esds_soun ) { delete esds_soun; esds_soun = NULL; }
|
||||||
if( stsd_soun ) { delete stsd_soun; stsd_soun = NULL; }
|
if( stsd_soun ) { delete stsd_soun; stsd_soun = NULL; }
|
||||||
if( stco_soun ) { delete stco_soun; stco_soun = NULL; }
|
if( stco_soun ) { delete stco_soun; stco_soun = NULL; }
|
||||||
|
@ -126,8 +133,9 @@ uint8_t * Interface::GetContents( ) {
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Interface::UpdateContents( ) {
|
void Interface::UpdateContents( ) {
|
||||||
|
if( !Width ) { std::cerr << "WARNING: Width not set!\n"; }
|
||||||
|
if( !Height ) { std::cerr << "WARNING: Height not set!\n"; }
|
||||||
stsd_vide->WriteContent( );
|
stsd_vide->WriteContent( );
|
||||||
stco_vide->WriteContent( );
|
stco_vide->WriteContent( );
|
||||||
stsc_vide->WriteContent( );
|
stsc_vide->WriteContent( );
|
||||||
|
@ -152,3 +160,30 @@ void Interface::UpdateContents( ) {
|
||||||
|
|
||||||
moov->WriteContent( );
|
moov->WriteContent( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Interface::AllBoxesExist() {
|
||||||
|
return ( ftyp && moov && mvhd && trak_vide && tkhd_vide && mdia_vide && mdhd_vide && hdlr_vide &&
|
||||||
|
minf_vide && vmhd_vide && dinf_vide && dref_vide && url_vide && stbl_vide && stts_vide && stsc_vide &&
|
||||||
|
stco_vide && stsd_vide && avcC_vide && trak_soun && tkhd_soun && mdia_soun && mdhd_soun && hdlr_soun &&
|
||||||
|
minf_soun && smhd_soun && dinf_soun && dref_soun && url_soun && stbl_soun && stts_soun && stsc_soun &&
|
||||||
|
stco_soun && stsd_soun && esds_soun );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Interface::SetWidth( uint16_t NewWidth ) {
|
||||||
|
Width = NewWidth;
|
||||||
|
avcC_vide->SetWidth( Width );
|
||||||
|
tkhd_vide->SetWidth( Width );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Interface::SetHeight( uint16_t NewHeight ) {
|
||||||
|
Height = NewHeight;
|
||||||
|
avcC_vide->SetHeight( Height );
|
||||||
|
tkhd_vide->SetHeight( Height );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Interface::SetStaticDefaults() {
|
||||||
|
// 'vide' = 0x76696465
|
||||||
|
hdlr_vide->SetHandlerType( 0x76696465 );
|
||||||
|
// 'soun' = 0x736F756E
|
||||||
|
hdlr_soun->SetHandlerType( 0x736F756E );
|
||||||
|
}
|
||||||
|
|
|
@ -7,8 +7,15 @@ class Interface {
|
||||||
void link();
|
void link();
|
||||||
uint32_t GetContentSize();
|
uint32_t GetContentSize();
|
||||||
uint8_t * GetContents();
|
uint8_t * GetContents();
|
||||||
|
|
||||||
|
void SetWidth( uint16_t NewWidth );
|
||||||
|
void SetHeight( uint16_t NewHeight );
|
||||||
private:
|
private:
|
||||||
|
void SetStaticDefaults();
|
||||||
void UpdateContents();
|
void UpdateContents();
|
||||||
|
bool AllBoxesExist();
|
||||||
|
uint16_t Width;
|
||||||
|
uint16_t Height;
|
||||||
Box_ftyp * ftyp;
|
Box_ftyp * ftyp;
|
||||||
Box_moov * moov;
|
Box_moov * moov;
|
||||||
Box_mvhd * mvhd;
|
Box_mvhd * mvhd;
|
||||||
|
|
Loading…
Add table
Reference in a new issue