AFRA box finished and added to interface

This commit is contained in:
Erik Zandvliet 2011-02-07 10:03:48 +01:00
parent 9981841406
commit 17d6a04757
5 changed files with 16 additions and 4 deletions

View file

@ -1,4 +1,4 @@
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 interface.cpp box_mdat.cpp box_rtmp.cpp box_amhp.cpp box_mvex.cpp box_trex.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 interface.cpp box_mdat.cpp box_rtmp.cpp box_amhp.cpp box_mvex.cpp box_trex.cpp box_afra.cpp
OBJ = $(SRC:.cpp=.o) OBJ = $(SRC:.cpp=.o)
OUT = Boxtest OUT = Boxtest
INCLUDES = INCLUDES =

View file

@ -30,13 +30,21 @@ void Box_afra::SetTimeScale( uint32_t Scale ) {
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Scale),5); Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Scale),5);
} }
void Box_afra::AddEntry( uint32_t Time, uint32_t SampleOffset, uint32_t Offset ) {
if(Offset >= Entries.size()) {
Entries.resize(Offset+1);
}
Entries[Offset].Time = Time;
Entries[Offset].Offset = SampleOffset;
}
void Box_afra::WriteContent( ) { void Box_afra::WriteContent( ) {
Container->ResetPayload(); Container->ResetPayload();
SetReserved( ); SetReserved( );
if(!Entries.empty()) { if(!Entries.empty()) {
for(int32_t i = Entries.size() -1; i >= 0; i--) { for(int32_t i = Entries.size() -1; i >= 0; i--) {
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Entries[i].SampleDelta),(i*12)+21); Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Entries[i].Offset),(i*12)+21);
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Entries[i].SampleCount),(i*12)+17); Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(Entries[i].Time),(i*12)+17);
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),(i*12)+13); Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0),(i*12)+13);
} }
} }

View file

@ -26,3 +26,4 @@
#include "box_amhp.h" #include "box_amhp.h"
#include "box_mvex.h" #include "box_mvex.h"
#include "box_trex.h" #include "box_trex.h"
#include "box_afra.h"

View file

@ -45,12 +45,14 @@ Interface::Interface() {
mvex = new Box_mvex(); mvex = new Box_mvex();
trex_vide = new Box_trex(); trex_vide = new Box_trex();
trex_soun = new Box_trex(); trex_soun = new Box_trex();
afra = new Box_afra();
//Set some values we already know won't change once the boxes have been created //Set some values we already know won't change once the boxes have been created
SetStaticDefaults(); SetStaticDefaults();
} }
Interface::~Interface() { Interface::~Interface() {
//Deleting the boxes if they still exist. //Deleting the boxes if they still exist.
if( afra ) { delete afra; afra = NULL; }
if( trex_vide ) { delete trex_vide; trex_vide = NULL; } if( trex_vide ) { delete trex_vide; trex_vide = NULL; }
if( trex_soun ) { delete trex_soun; trex_soun = NULL; } if( trex_soun ) { delete trex_soun; trex_soun = NULL; }
if( mvex ) { delete mvex; mvex = NULL; } if( mvex ) { delete mvex; mvex = NULL; }
@ -148,7 +150,7 @@ uint8_t * Interface::GetContents( ) {
uint32_t Ftyp_Size = ftyp->GetBox( )->GetBoxedDataSize( ); uint32_t Ftyp_Size = ftyp->GetBox( )->GetBoxedDataSize( );
uint32_t Moov_Size = moov->GetBox( )->GetBoxedDataSize( ); uint32_t Moov_Size = moov->GetBox( )->GetBoxedDataSize( );
uint32_t Rtmp_Size = rtmp->GetBox( )->GetBoxedDataSize( ); uint32_t Rtmp_Size = rtmp->GetBox( )->GetBoxedDataSize( );
memcpy(Result,ftyp->GetBox( )->GetBoxedData( ),Ftyp_Size( )); memcpy(Result,ftyp->GetBox( )->GetBoxedData( ),Ftyp_Size);
memcpy(&Result[Ftyp_Size],moov->GetBox( )->GetBoxedData( ),Moov_Size); memcpy(&Result[Ftyp_Size],moov->GetBox( )->GetBoxedData( ),Moov_Size);
memcpy(&Result[Ftyp_Size+Moov_Size],rtmp->GetBox( )->GetBoxedData( ),Rtmp_Size); memcpy(&Result[Ftyp_Size+Moov_Size],rtmp->GetBox( )->GetBoxedData( ),Rtmp_Size);
return Result; return Result;

View file

@ -72,5 +72,6 @@ class Interface {
Box_mvex * mvex; Box_mvex * mvex;
Box_trex * trex_vide; Box_trex * trex_vide;
Box_trex * trex_soun; Box_trex * trex_soun;
Box_afra * afra;
};//Interface class };//Interface class