Fixed default values and errors

This commit is contained in:
Oswald de Bruin 2013-05-23 16:15:17 +02:00 committed by Erik Zandvliet
parent 6d6b001ec9
commit 687f477cff
2 changed files with 14 additions and 7 deletions

View file

@ -3542,8 +3542,10 @@ namespace MP4 {
return r.str(); return r.str();
} }
STTS::STTS(){ STTS::STTS(char v, uint32_t f){
memcpy(data + 4, "stts", 4); memcpy(data + 4, "stts", 4);
setVersion(v);
setFlags(f);
setEntryCount(0); setEntryCount(0);
} }
@ -3557,6 +3559,7 @@ namespace MP4 {
void STTS::setSTTSEntry(STTSEntry newSTTSEntry, uint32_t no){ void STTS::setSTTSEntry(STTSEntry newSTTSEntry, uint32_t no){
if(no + 1 > getEntryCount()){ if(no + 1 > getEntryCount()){
setEntryCount(no + 1);
for (int i = getEntryCount(); i < no; i++){ for (int i = getEntryCount(); i < no; i++){
setInt64(0, 8 + (i * 8));//filling up undefined entries of 64 bits setInt64(0, 8 + (i * 8));//filling up undefined entries of 64 bits
} }
@ -3738,8 +3741,11 @@ namespace MP4 {
return r.str(); return r.str();
} }
STSZ::STSZ(){ STSZ::STSZ(char v, uint32_t f){
memcpy(data + 4, "stsz", 4); memcpy(data + 4, "stsz", 4);
setVersion(v);
setFlags(f);
setSampleCount(0);
} }
void STSZ::setSampleSize(uint32_t newSampleSize){ void STSZ::setSampleSize(uint32_t newSampleSize){
@ -3761,6 +3767,7 @@ namespace MP4 {
void STSZ::setEntrySize(uint32_t newEntrySize, uint32_t no){ void STSZ::setEntrySize(uint32_t newEntrySize, uint32_t no){
if (no + 1 > getSampleCount()){ if (no + 1 > getSampleCount()){
setSampleCount(no + 1);
for (int i = getSampleCount(); i < no; i++){ for (int i = getSampleCount(); i < no; i++){
setInt32(0, 12 + i * 4);//filling undefined entries setInt32(0, 12 + i * 4);//filling undefined entries
} }
@ -4121,8 +4128,8 @@ namespace MP4 {
} }
} }
setBox(newContent, tempLoc); setBox(newContent, tempLoc);
if (getEntryCount() < no){ if (getEntryCount() < no+1){
setEntryCount(no); setEntryCount(no+1);
} }
} }

View file

@ -634,7 +634,7 @@ namespace MP4 {
class STTS: public fullBox{ class STTS: public fullBox{
public: public:
STTS(); STTS(char v = 1, uint32_t f = 0);
void setEntryCount(uint32_t newEntryCount); void setEntryCount(uint32_t newEntryCount);
uint32_t getEntryCount(); uint32_t getEntryCount();
void setSTTSEntry(STTSEntry newSTTSEntry, uint32_t no); void setSTTSEntry(STTSEntry newSTTSEntry, uint32_t no);
@ -685,7 +685,7 @@ namespace MP4 {
class STSZ: public fullBox{ class STSZ: public fullBox{
public: public:
STSZ(); STSZ(char v = 1, uint32_t f = 0);
void setSampleSize(uint32_t newSampleSize); void setSampleSize(uint32_t newSampleSize);
uint32_t getSampleSize(); uint32_t getSampleSize();
void setSampleCount(uint32_t newSampleCount); void setSampleCount(uint32_t newSampleCount);