AMHP box finished, MVEX box created, both added to interface
This commit is contained in:
parent
203f4da42c
commit
1ac23854b7
7 changed files with 71 additions and 3 deletions
|
@ -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
|
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
|
||||||
OBJ = $(SRC:.cpp=.o)
|
OBJ = $(SRC:.cpp=.o)
|
||||||
OUT = Boxtest
|
OUT = Boxtest
|
||||||
INCLUDES =
|
INCLUDES =
|
||||||
|
|
|
@ -17,7 +17,7 @@ void Box_amhp::SetReserved( ) {
|
||||||
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0));
|
Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box_amhp::AddEntry( uint8_t HintTrackMode, uint8_t Settings, uint8_t TrailerDefaultSize, uint32_t Offset = 0 ) {
|
void Box_amhp::AddEntry( uint8_t HintTrackMode, uint8_t Settings, uint8_t TrailerDefaultSize, uint32_t Offset ) {
|
||||||
if(Offset >= Entries.size()) {
|
if(Offset >= Entries.size()) {
|
||||||
Entries.resize(Offset+1);
|
Entries.resize(Offset+1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,3 +23,5 @@
|
||||||
#include "box_vmhd.h"
|
#include "box_vmhd.h"
|
||||||
#include "box_mdat.h"
|
#include "box_mdat.h"
|
||||||
#include "box_rtmp.h"
|
#include "box_rtmp.h"
|
||||||
|
#include "box_amhp.h"
|
||||||
|
#include "box_mvex.h"
|
||||||
|
|
36
MP4/box_mvex.cpp
Normal file
36
MP4/box_mvex.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#include "box_mvex.h"
|
||||||
|
|
||||||
|
Box_mvex::Box_mvex( ) {
|
||||||
|
Container = new Box( 0x6D866578 );
|
||||||
|
}
|
||||||
|
|
||||||
|
Box_mvex::~Box_mvex() {
|
||||||
|
delete Container;
|
||||||
|
}
|
||||||
|
|
||||||
|
Box * Box_mvex::GetBox() {
|
||||||
|
return Container;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_mvex::AddContent( Box * newcontent, uint32_t offset ) {
|
||||||
|
if( offset >= Content.size() ) {
|
||||||
|
Content.resize(offset+1);
|
||||||
|
}
|
||||||
|
if( Content[offset] ) {
|
||||||
|
delete Content[offset];
|
||||||
|
}
|
||||||
|
Content[offset] = newcontent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_mvex::WriteContent( ) {
|
||||||
|
Container->ResetPayload( );
|
||||||
|
Box * current;
|
||||||
|
std::string serializedbox = "";
|
||||||
|
for( uint32_t i = 0; i < Content.size(); i++ ) {
|
||||||
|
current=Content[i];
|
||||||
|
if( current ) {
|
||||||
|
serializedbox.append((char*)current->GetBoxedData(),current->GetBoxedDataSize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Container->SetPayload((uint32_t)serializedbox.size(),(uint8_t*)serializedbox.c_str());
|
||||||
|
}
|
17
MP4/box_mvex.h
Normal file
17
MP4/box_mvex.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include "box.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class Box_mvex {
|
||||||
|
public:
|
||||||
|
Box_mvex();
|
||||||
|
~Box_mvex();
|
||||||
|
Box * GetBox();
|
||||||
|
void AddContent( Box * newcontent, uint32_t offset = 0 );
|
||||||
|
void WriteContent( );
|
||||||
|
private:
|
||||||
|
Box * Container;
|
||||||
|
|
||||||
|
std::vector<Box *> Content;
|
||||||
|
};//Box_ftyp Class
|
||||||
|
|
|
@ -41,12 +41,16 @@ Interface::Interface() {
|
||||||
stsd_soun = new Box_stsd();
|
stsd_soun = new Box_stsd();
|
||||||
esds_soun = new Box_esds();
|
esds_soun = new Box_esds();
|
||||||
rtmp = new Box_rtmp();
|
rtmp = new Box_rtmp();
|
||||||
|
amhp = new Box_amhp();
|
||||||
|
mvex = new Box_mvex();
|
||||||
//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( mvex ) { delete mvex; mvex = NULL; }
|
||||||
|
if( amhp ) { delete amhp; amhp = NULL; }
|
||||||
if( rtmp ) { delete rtmp; rtmp = NULL; }
|
if( rtmp ) { delete rtmp; rtmp = NULL; }
|
||||||
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; }
|
||||||
|
@ -122,6 +126,8 @@ void Interface::link( ) {
|
||||||
moov->AddContent(trak_soun->GetBox(),2);
|
moov->AddContent(trak_soun->GetBox(),2);
|
||||||
moov->AddContent(trak_vide->GetBox(),1);
|
moov->AddContent(trak_vide->GetBox(),1);
|
||||||
moov->AddContent(mvhd->GetBox());
|
moov->AddContent(mvhd->GetBox());
|
||||||
|
|
||||||
|
rtmp->AddContent(amhp->GetBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Interface::GetContentSize( ) {
|
uint32_t Interface::GetContentSize( ) {
|
||||||
|
@ -175,6 +181,9 @@ void Interface::UpdateContents( ) {
|
||||||
trak_vide->WriteContent( );
|
trak_vide->WriteContent( );
|
||||||
|
|
||||||
moov->WriteContent( );
|
moov->WriteContent( );
|
||||||
|
|
||||||
|
amhp->WriteContent( );
|
||||||
|
rtmp->WriteContent( );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Interface::AllBoxesExist() {
|
bool Interface::AllBoxesExist() {
|
||||||
|
@ -182,7 +191,7 @@ bool Interface::AllBoxesExist() {
|
||||||
minf_vide && vmhd_vide && dinf_vide && dref_vide && url_vide && stbl_vide && stts_vide && stsc_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 &&
|
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 &&
|
minf_soun && smhd_soun && dinf_soun && dref_soun && url_soun && stbl_soun && stts_soun && stsc_soun &&
|
||||||
stco_soun && stsd_soun && esds_soun );
|
stco_soun && stsd_soun && esds_soun && rtmp && amhp );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interface::SetWidth( uint16_t NewWidth ) {
|
void Interface::SetWidth( uint16_t NewWidth ) {
|
||||||
|
@ -254,6 +263,8 @@ void Interface::SetStaticDefaults() {
|
||||||
// Set Track ID's
|
// Set Track ID's
|
||||||
tkhd_vide->SetTrackID( 1 );
|
tkhd_vide->SetTrackID( 1 );
|
||||||
tkhd_soun->SetTrackID( 2 );
|
tkhd_soun->SetTrackID( 2 );
|
||||||
|
// Set amhp entry
|
||||||
|
amhp->AddEntry( 1, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interface::AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta, uint32_t Track ) {
|
void Interface::AddSTTSEntry( uint32_t SampleCount, uint32_t SampleDelta, uint32_t Track ) {
|
||||||
|
|
|
@ -68,5 +68,7 @@ class Interface {
|
||||||
Box_stsd * stsd_soun;
|
Box_stsd * stsd_soun;
|
||||||
Box_esds * esds_soun;
|
Box_esds * esds_soun;
|
||||||
Box_rtmp * rtmp;
|
Box_rtmp * rtmp;
|
||||||
|
Box_amhp * amhp;
|
||||||
|
Box_mvex * mvex;
|
||||||
};//Interface class
|
};//Interface class
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue