MP4 lib added default values

This commit is contained in:
Oswald Auguste de Bruin 2013-07-02 14:37:16 +02:00 committed by Erik Zandvliet
parent c8782b4d24
commit 7f47a746fb
2 changed files with 21 additions and 19 deletions

View file

@ -2583,6 +2583,10 @@ namespace MP4 {
//Note: next 4 headers inherit from fullBox, start at byte 4. //Note: next 4 headers inherit from fullBox, start at byte 4.
VMHD::VMHD(){ VMHD::VMHD(){
memcpy(data + 4, "vmhd", 4); memcpy(data + 4, "vmhd", 4);
setGraphicsMode(0);
setOpColor(0,0);
setOpColor(0,1);
setOpColor(0,2);
} }
void VMHD::setGraphicsMode(uint16_t newGraphicsMode){ void VMHD::setGraphicsMode(uint16_t newGraphicsMode){
@ -2624,6 +2628,7 @@ namespace MP4 {
SMHD::SMHD(){ SMHD::SMHD(){
memcpy(data + 4, "smhd", 4); memcpy(data + 4, "smhd", 4);
setBalance(0);
} }
void SMHD::setBalance(int16_t newBalance){ void SMHD::setBalance(int16_t newBalance){
@ -3766,7 +3771,6 @@ namespace MP4 {
return getInt32(4); return getInt32(4);
} }
void STSZ::setSampleCount(uint32_t newSampleCount){ void STSZ::setSampleCount(uint32_t newSampleCount){
setInt32(newSampleCount, 8); setInt32(newSampleCount, 8);
} }
@ -3824,6 +3828,10 @@ namespace MP4 {
CLAP::CLAP(){ CLAP::CLAP(){
memcpy(data + 4, "clap", 4); memcpy(data + 4, "clap", 4);
setHorizOffN(0);
setHorizOffD(0);
setVertOffN(0);
setVertOffD(0);
} }
void CLAP::setCleanApertureWidthN(uint32_t newVal){ void CLAP::setCleanApertureWidthN(uint32_t newVal){
@ -4002,16 +4010,16 @@ namespace MP4 {
getInt16(74); getInt16(74);
} }
void VisualSampleEntry::setCLAP(Box& clap){
setBox(clap,78);
}
Box & VisualSampleEntry::getCLAP(){ Box & VisualSampleEntry::getCLAP(){
static Box ret = Box((char*)"\000\000\000\010erro", false); static Box ret = Box((char*)"\000\000\000\010erro", false);
if(payloadSize() <84){//if the EntryBox is not big enough to hold a CLAP/PASP if(payloadSize() <84){//if the EntryBox is not big enough to hold a CLAP/PASP
return ret; return ret;
} }
if (getBox(76).isType("clap")){ return getBox(78);
return getBox(76);
}else{
return ret;
}
} }
Box & VisualSampleEntry::getPASP(){ Box & VisualSampleEntry::getPASP(){
@ -4019,19 +4027,12 @@ namespace MP4 {
if(payloadSize() <84){//if the EntryBox is not big enough to hold a CLAP/PASP if(payloadSize() <84){//if the EntryBox is not big enough to hold a CLAP/PASP
return ret; return ret;
} }
if (getBox(76).isType("pasp")){ if (payloadSize() < 78 + getBoxLen(78) + 8){
return getBox(76);
}else{
if (payloadSize() < 76 + getBoxLen(76) + 8){
return ret; return ret;
}else{ }else{
if (getBox(76+getBoxLen(76)).isType("pasp")){ return getBox(78+getBoxLen(78));
return getBox(76+getBoxLen(76));
}else{
return ret;
}
}
} }
} }
std::string VisualSampleEntry::toPrettyVisualString(uint32_t indent, std::string name){ std::string VisualSampleEntry::toPrettyVisualString(uint32_t indent, std::string name){
@ -4045,10 +4046,10 @@ namespace MP4 {
r << std::string(indent + 1, ' ') << "FrameCount: " << getFrameCount() << std::endl; r << std::string(indent + 1, ' ') << "FrameCount: " << getFrameCount() << std::endl;
r << std::string(indent + 1, ' ') << "CompressorName: " << getCompressorName() << std::endl; r << std::string(indent + 1, ' ') << "CompressorName: " << getCompressorName() << std::endl;
r << std::string(indent + 1, ' ') << "Depth: " << getDepth() << std::endl; r << std::string(indent + 1, ' ') << "Depth: " << getDepth() << std::endl;
if (getCLAP().isType("clap")){ if (!getCLAP().isType("erro")){
r << getCLAP().toPrettyString(indent+1); r << getCLAP().toPrettyString(indent+1);
} }
if (getPASP().isType("pasp")){ if (!getPASP().isType("erro")){
r << getPASP().toPrettyString(indent+1); r << getPASP().toPrettyString(indent+1);
} }
return r.str(); return r.str();

View file

@ -755,6 +755,7 @@ namespace MP4 {
void setDepth(uint16_t newDepth); void setDepth(uint16_t newDepth);
uint16_t getDepth(); uint16_t getDepth();
Box & getCLAP(); Box & getCLAP();
void setCLAP(Box& clap);
Box & getPASP(); Box & getPASP();
std::string toPrettyVisualString(uint32_t index = 0, std::string = ""); std::string toPrettyVisualString(uint32_t index = 0, std::string = "");
}; };