Fixed minor bugs in MP4, resulting in working mp4 conversion.

This commit is contained in:
Erik Zandvliet 2013-07-23 13:12:49 +02:00
parent 84b3d612ca
commit 4b36b85e54

View file

@ -3969,16 +3969,16 @@ namespace MP4 {
void STCO::setChunkOffset(uint32_t newChunkOffset, uint32_t no){ void STCO::setChunkOffset(uint32_t newChunkOffset, 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++){
setInt32(0, 8 + i * 4);//filling undefined entries setInt32(0, 8 + i * 4);//filling undefined entries
} }
setEntryCount(no+1);
} }
setInt32(newChunkOffset, 8 + no * 4); setInt32(newChunkOffset, 8 + no * 4);
} }
uint32_t STCO::getChunkOffset(uint32_t no){ uint32_t STCO::getChunkOffset(uint32_t no){
if (no + 1 >= getEntryCount()){ if (no >= getEntryCount()){
return 0; return 0;
} }
return getInt32(8 + no * 4); return getInt32(8 + no * 4);
@ -4029,7 +4029,7 @@ namespace MP4 {
} }
uint32_t STSZ::getEntrySize(uint32_t no){ uint32_t STSZ::getEntrySize(uint32_t no){
if (no + 1 >= getSampleCount()){ if (no >= getSampleCount()){
return 0; return 0;
} }
return getInt32(12 + no * 4); return getInt32(12 + no * 4);