Tussentijdse commit, SetTimeScale en SetDuration functies toegevoegd aan de interface, start gemaakt aan de AddSTTSEntry functie
This commit is contained in:
parent
7474b19df0
commit
bfa110452c
2 changed files with 44 additions and 6 deletions
|
@ -4,6 +4,8 @@ Interface::Interface() {
|
||||||
//Initializing local data
|
//Initializing local data
|
||||||
Width = 0;
|
Width = 0;
|
||||||
Height = 0;
|
Height = 0;
|
||||||
|
Duration = 0;
|
||||||
|
UnitsPerSecond = 0;
|
||||||
//Creating the boxes
|
//Creating the boxes
|
||||||
ftyp = new Box_ftyp();
|
ftyp = new Box_ftyp();
|
||||||
moov = new Box_moov();
|
moov = new Box_moov();
|
||||||
|
@ -136,6 +138,8 @@ uint8_t * Interface::GetContents( ) {
|
||||||
void Interface::UpdateContents( ) {
|
void Interface::UpdateContents( ) {
|
||||||
if( !Width ) { std::cerr << "WARNING: Width not set!\n"; }
|
if( !Width ) { std::cerr << "WARNING: Width not set!\n"; }
|
||||||
if( !Height ) { std::cerr << "WARNING: Height not set!\n"; }
|
if( !Height ) { std::cerr << "WARNING: Height not set!\n"; }
|
||||||
|
if( !Duration ) { std::cerr << "WARNING: Duration not set!\n"; }
|
||||||
|
if( !UnitsPerSecond ) { std::cerr << "WARNING: Timescale not set!\n"; }
|
||||||
stsd_vide->WriteContent( );
|
stsd_vide->WriteContent( );
|
||||||
stco_vide->WriteContent( );
|
stco_vide->WriteContent( );
|
||||||
stsc_vide->WriteContent( );
|
stsc_vide->WriteContent( );
|
||||||
|
@ -170,20 +174,49 @@ bool Interface::AllBoxesExist() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interface::SetWidth( uint16_t NewWidth ) {
|
void Interface::SetWidth( uint16_t NewWidth ) {
|
||||||
Width = NewWidth;
|
if( Width != NewWidth ) {
|
||||||
avcC_vide->SetWidth( Width );
|
Width = NewWidth;
|
||||||
tkhd_vide->SetWidth( Width );
|
avcC_vide->SetWidth( Width );
|
||||||
|
tkhd_vide->SetWidth( Width );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interface::SetHeight( uint16_t NewHeight ) {
|
void Interface::SetHeight( uint16_t NewHeight ) {
|
||||||
Height = NewHeight;
|
if( Height != NewHeight ) {
|
||||||
avcC_vide->SetHeight( Height );
|
Height = NewHeight;
|
||||||
tkhd_vide->SetHeight( Height );
|
avcC_vide->SetHeight( Height );
|
||||||
|
tkhd_vide->SetHeight( Height );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Interface::SetDurationTime( uint32_t NewDuration ) {
|
||||||
|
if( Duration != NewDuration ) {
|
||||||
|
Duration = NewDuration;
|
||||||
|
mvhd->SetDurationTime( Duration );
|
||||||
|
mdhd_vide->SetDurationTime( Duration );
|
||||||
|
tkhd_vide->SetDurationTime( Duration );
|
||||||
|
mdhd_soun->SetDurationTime( Duration );
|
||||||
|
tkhd_soun->SetDurationTime( Duration );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Interface::SetTimeScale( uint32_t NewUnitsPerSecond ) {
|
||||||
|
if( UnitsPerSecond != NewUnitsPerSecond ) {
|
||||||
|
UnitsPerSecond = NewUnitsPerSecond;
|
||||||
|
mvhd->SetTimeScale( UnitsPerSecond );
|
||||||
|
mdhd_vide->SetTimeScale( UnitsPerSecond );
|
||||||
|
mdhd_soun->SetTimeScale( UnitsPerSecond );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interface::SetStaticDefaults() {
|
void Interface::SetStaticDefaults() {
|
||||||
// 'vide' = 0x76696465
|
// 'vide' = 0x76696465
|
||||||
hdlr_vide->SetHandlerType( 0x76696465 );
|
hdlr_vide->SetHandlerType( 0x76696465 );
|
||||||
|
hdlr_vide->SetName( "Video Track" );
|
||||||
// 'soun' = 0x736F756E
|
// 'soun' = 0x736F756E
|
||||||
hdlr_soun->SetHandlerType( 0x736F756E );
|
hdlr_soun->SetHandlerType( 0x736F756E );
|
||||||
|
hdlr_vide->SetName( "Audio Track" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Interface::AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,17 @@ class Interface {
|
||||||
|
|
||||||
void SetWidth( uint16_t NewWidth );
|
void SetWidth( uint16_t NewWidth );
|
||||||
void SetHeight( uint16_t NewHeight );
|
void SetHeight( uint16_t NewHeight );
|
||||||
|
void SetDurationTime( uint32_t NewDuration );
|
||||||
|
void SetTimeScale( uint32_t NewUnitsPerSecond );
|
||||||
|
void AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta );
|
||||||
private:
|
private:
|
||||||
void SetStaticDefaults();
|
void SetStaticDefaults();
|
||||||
void UpdateContents();
|
void UpdateContents();
|
||||||
bool AllBoxesExist();
|
bool AllBoxesExist();
|
||||||
uint16_t Width;
|
uint16_t Width;
|
||||||
uint16_t Height;
|
uint16_t Height;
|
||||||
|
uint32_t Duration;
|
||||||
|
uint32_t UnitsPerSecond;
|
||||||
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