MDAT box added, functionality to set it's contents added
This commit is contained in:
parent
4742862b08
commit
88d0f63379
5 changed files with 48 additions and 11 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
|
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
|
||||||
OBJ = $(SRC:.cpp=.o)
|
OBJ = $(SRC:.cpp=.o)
|
||||||
OUT = Boxtest
|
OUT = Boxtest
|
||||||
INCLUDES =
|
INCLUDES =
|
||||||
|
|
|
@ -21,3 +21,4 @@
|
||||||
#include "box_trak.h"
|
#include "box_trak.h"
|
||||||
#include "box_url.h"
|
#include "box_url.h"
|
||||||
#include "box_vmhd.h"
|
#include "box_vmhd.h"
|
||||||
|
#include "box_mdat.h"
|
||||||
|
|
17
MP4/box_mdat.cpp
Normal file
17
MP4/box_mdat.cpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include "box_mdat.h"
|
||||||
|
|
||||||
|
Box_mdat::Box_mdat( ) {
|
||||||
|
Container = new Box( 0x6D646174 );
|
||||||
|
}
|
||||||
|
|
||||||
|
Box_mdat::~Box_mdat() {
|
||||||
|
delete Container;
|
||||||
|
}
|
||||||
|
|
||||||
|
Box * Box_mdat::GetBox() {
|
||||||
|
return Container;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Box_mdat::SetContent( uint8_t * NewData, uint32_t DataLength , uint32_t Offset ) {
|
||||||
|
Container->SetPayload(DataLength,NewData,Offset);
|
||||||
|
}
|
14
MP4/box_mdat.h
Normal file
14
MP4/box_mdat.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include "box.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class Box_mdat {
|
||||||
|
public:
|
||||||
|
Box_mdat();
|
||||||
|
~Box_mdat();
|
||||||
|
Box * GetBox();
|
||||||
|
void SetContent( uint8_t * NewData, uint32_t DataLength , uint32_t offset = 0 );
|
||||||
|
private:
|
||||||
|
Box * Container;
|
||||||
|
};//Box_ftyp Class
|
||||||
|
|
|
@ -4,8 +4,6 @@ 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();
|
||||||
|
@ -138,13 +136,20 @@ uint8_t * Interface::GetContents( ) {
|
||||||
void Interface::UpdateContents( ) {
|
void Interface::UpdateContents( ) {
|
||||||
if( !Width ) { fprintf(stderr,"WARNING: Width not set!\n"); }
|
if( !Width ) { fprintf(stderr,"WARNING: Width not set!\n"); }
|
||||||
if( !Height ) { fprintf(stderr,"WARNING: Height not set!\n"); }
|
if( !Height ) { fprintf(stderr,"WARNING: Height not set!\n"); }
|
||||||
if( !Duration ) { fprintf(stderr,"WARNING: Duration not set!\n"); }
|
if( !Duration.size() ) { fprintf(stderr,"WARNING: Duration not set!\n"); }
|
||||||
if( !UnitsPerSecond ) { fprintf(stderr,"WARNING: Timescale not set!\n"); }
|
if( !UnitsPerSecond.size() ) { fprintf(stderr,"WARNING: Timescale not set!\n"); }
|
||||||
if( stts.size() == 0 ) {
|
if( sttsvide.size() == 0 ) {
|
||||||
fprintf(stderr,"WARNING: No stts available!\n");
|
fprintf(stderr,"WARNING: No video stts available!\n");
|
||||||
} else {
|
} else { WriteSTTS( 1 ); }
|
||||||
WriteSTTS();
|
if( sttssoun.size() == 0 ) {
|
||||||
}
|
fprintf(stderr,"WARNING: No sound stts available!\n");
|
||||||
|
} else { WriteSTTS( 2 ); }
|
||||||
|
if( stscvide.size() == 0 ) {
|
||||||
|
fprintf(stderr,"WARNING: No video stsc available!\n");
|
||||||
|
} else { WriteSTSC( 1 ); }
|
||||||
|
if( stscsoun.size() == 0 ) {
|
||||||
|
fprintf(stderr,"WARNING: No sound stsc available!\n");
|
||||||
|
} else { WriteSTSC( 2 ); }
|
||||||
stsd_vide->WriteContent( );
|
stsd_vide->WriteContent( );
|
||||||
stco_vide->WriteContent( );
|
stco_vide->WriteContent( );
|
||||||
stsc_vide->WriteContent( );
|
stsc_vide->WriteContent( );
|
||||||
|
@ -356,7 +361,7 @@ void Interface::SetOffsets( std::vector<uint32_t> NewOffsets, uint32_t Track ) {
|
||||||
case 2:
|
case 2:
|
||||||
stco_soun->SetOffsets( NewOffsets );
|
stco_soun->SetOffsets( NewOffsets );
|
||||||
break;
|
break;
|
||||||
default;
|
default:
|
||||||
fprintf( stderr, "WARNING: Track %d does not exist, Offsets not written\n", Track );
|
fprintf( stderr, "WARNING: Track %d does not exist, Offsets not written\n", Track );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue