From 4b36b85e54ac49aaeff994a56cae406f506dcbf1 Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Tue, 23 Jul 2013 13:12:49 +0200 Subject: [PATCH] Fixed minor bugs in MP4, resulting in working mp4 conversion. --- lib/mp4.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mp4.cpp b/lib/mp4.cpp index 1d526f01..35604848 100644 --- a/lib/mp4.cpp +++ b/lib/mp4.cpp @@ -3969,16 +3969,16 @@ namespace MP4 { void STCO::setChunkOffset(uint32_t newChunkOffset, uint32_t no){ if (no + 1 > getEntryCount()){ - setEntryCount(no+1); for (int i = getEntryCount(); i < no; i++){ setInt32(0, 8 + i * 4);//filling undefined entries } + setEntryCount(no+1); } setInt32(newChunkOffset, 8 + no * 4); } uint32_t STCO::getChunkOffset(uint32_t no){ - if (no + 1 >= getEntryCount()){ + if (no >= getEntryCount()){ return 0; } return getInt32(8 + no * 4); @@ -4029,7 +4029,7 @@ namespace MP4 { } uint32_t STSZ::getEntrySize(uint32_t no){ - if (no + 1 >= getSampleCount()){ + if (no >= getSampleCount()){ return 0; } return getInt32(12 + no * 4);