cleaned up code

This commit is contained in:
Oswald Auguste de Bruin 2013-09-26 10:33:49 +02:00
parent 1cc1ca8707
commit 5c9574d7eb

View file

@ -21,7 +21,6 @@ namespace MP4{
header << std::string(ftypBox.asBox(),ftypBox.boxedSize()); header << std::string(ftypBox.asBox(),ftypBox.boxedSize());
uint64_t mdatSize = 0; uint64_t mdatSize = 0;
//std::vector<uint64_t> stcoOffsets;
//moov box //moov box
MP4::MOOV moovBox; MP4::MOOV moovBox;
MP4::MVHD mvhdBox; MP4::MVHD mvhdBox;
@ -189,7 +188,7 @@ namespace MP4{
sttsBox.setVersion(0); sttsBox.setVersion(0);
MP4::STTSEntry newEntry; MP4::STTSEntry newEntry;
newEntry.sampleCount = tmpParts; newEntry.sampleCount = tmpParts;
//42, because of reasons. //42, Used as magic number for timescale calculation
newEntry.sampleDelta = 42; newEntry.sampleDelta = 42;
sttsBox.setSTTSEntry(newEntry, 0); sttsBox.setSTTSEntry(newEntry, 0);
stblBox.setContent(sttsBox,1); stblBox.setContent(sttsBox,1);
@ -253,13 +252,6 @@ namespace MP4{
} }
//calculating the offset where the STCO box will be in the main MOOV box //calculating the offset where the STCO box will be in the main MOOV box
//needed for probable optimise //needed for probable optimise
/*stcoOffsets.push_back(
moovBox.payloadSize() +
trakBox.boxedSize() +
mdiaBox.boxedSize() +
minfBox.boxedSize() +
stblBox.boxedSize()
);*/
mdatSize = totalByteOffset; mdatSize = totalByteOffset;
stblBox.setContent(stcoBox,4 + offset); stblBox.setContent(stcoBox,4 + offset);
minfBox.setContent(stblBox,2); minfBox.setContent(stblBox,2);
@ -272,7 +264,6 @@ namespace MP4{
//initial offset length ftyp, length moov + 8 //initial offset length ftyp, length moov + 8
unsigned long long int byteOffset = ftypBox.boxedSize() + moovBox.boxedSize() + 8; unsigned long long int byteOffset = ftypBox.boxedSize() + moovBox.boxedSize() + 8;
//update all STCO //update all STCO
//std::map <int, MP4::STCO&> STCOFix;
//for tracks //for tracks
for (unsigned int i = 1; i < moovBox.getContentCount(); i++){ for (unsigned int i = 1; i < moovBox.getContentCount(); i++){
//10 lines to get the STCO box. //10 lines to get the STCO box.
@ -302,7 +293,6 @@ namespace MP4{
} }
for (int j = 0; j < checkStblBox.getContentCount(); j++){ for (int j = 0; j < checkStblBox.getContentCount(); j++){
if (checkStblBox.getContent(j).isType("stco")){ if (checkStblBox.getContent(j).isType("stco")){
//STCOFix.insert( std::pair<int, MP4::STCO&>(((MP4::TKHD&)(checkTrakBox.getContent(0))).getTrackID(),(MP4::STCO&)(checkStblBox.getContent(j))));
checkStcoBox = ((MP4::STCO&)checkStblBox.getContent(j)); checkStcoBox = ((MP4::STCO&)checkStblBox.getContent(j));
break; break;
} }
@ -328,11 +318,6 @@ namespace MP4{
//while there are requested packets in the trackBuffer:... //while there are requested packets in the trackBuffer:...
while (!trackBuffer[keyParts[curKey].trackID].empty()){ while (!trackBuffer[keyParts[curKey].trackID].empty()){
//output requested packages //output requested packages
//std::deque<long long unsigned int> parsedParts;
//JSON::decodeVector(keyParts[curKey].parts, parsedParts);
//if(parsedParts[curPart] != trackBuffer[keyParts[curKey].trackID].front()["data"].asString().size()){
//std::cerr << "Size discrepancy in buffer packet. Size: " << trackBuffer[keyParts[curKey].trackID].front()["data"].asString().size() << " Expected:" << parsedParts[curPart] << std::endl;
//}
stringBuffer += trackBuffer[keyParts[curKey].trackID].front()["data"].asString(); stringBuffer += trackBuffer[keyParts[curKey].trackID].front()["data"].asString();
trackBuffer[keyParts[curKey].trackID].pop_front(); trackBuffer[keyParts[curKey].trackID].pop_front();
curPart++; curPart++;
@ -344,11 +329,6 @@ namespace MP4{
//after that, try to put out the JSON data directly //after that, try to put out the JSON data directly
if(keyParts[curKey].trackID == mediaPart["trackid"].asInt()){ if(keyParts[curKey].trackID == mediaPart["trackid"].asInt()){
//output JSON packet //output JSON packet
//std::deque<long long int> parsedParts;
//JSON::decodeVector(keyParts[curKey].parts, parsedParts);
//if(parsedParts[curPart] != mediaPart["data"].asStringRef().size()){
//std::cerr << "Size discrepancy in JSON packet. Size: " << mediaPart["data"].asStringRef().size() << " Expected:" << parsedParts[curPart] << std::endl;
//}
stringBuffer += mediaPart["data"].asStringRef(); stringBuffer += mediaPart["data"].asStringRef();
curPart++; curPart++;
if(curPart >= keyParts[curKey].partsize){ if(curPart >= keyParts[curKey].partsize){