Fixed support for MP4 files without CTTS box in a track header.
This commit is contained in:
parent
5819e9cac8
commit
5c3ff12946
4 changed files with 15 additions and 8 deletions
|
@ -1374,6 +1374,7 @@ namespace DTSC {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Meta::update(long long packTime, long long packOffset, long long packTrack, long long packDataSize, long long packBytePos, bool isKeyframe, long long packSendSize, unsigned long segment_size, const char * ivec){
|
void Meta::update(long long packTime, long long packOffset, long long packTrack, long long packDataSize, long long packBytePos, bool isKeyframe, long long packSendSize, unsigned long segment_size, const char * ivec){
|
||||||
|
DONTEVEN_MSG("Updating meta with: t=%lld, o=%lld, s=%lld, t=%lld, p=%lld", packTime, packOffset, packDataSize, packTrack, packBytePos);
|
||||||
if (!packSendSize){
|
if (!packSendSize){
|
||||||
//time and trackID are part of the 20-byte header.
|
//time and trackID are part of the 20-byte header.
|
||||||
//the container object adds 4 bytes (plus 2+namelen for each content, see below)
|
//the container object adds 4 bytes (plus 2+namelen for each content, see below)
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Mist {
|
||||||
offsetIndex = 0;
|
offsetIndex = 0;
|
||||||
offsetPos = 0;
|
offsetPos = 0;
|
||||||
sttsBox.clear();
|
sttsBox.clear();
|
||||||
|
hasCTTS = false;
|
||||||
cttsBox.clear();
|
cttsBox.clear();
|
||||||
stszBox.clear();
|
stszBox.clear();
|
||||||
stcoBox.clear();
|
stcoBox.clear();
|
||||||
|
@ -75,6 +76,7 @@ namespace Mist {
|
||||||
tmp = std::string(stblLoopPeek.asBox() ,stblLoopPeek.boxedSize());
|
tmp = std::string(stblLoopPeek.asBox() ,stblLoopPeek.boxedSize());
|
||||||
cttsBox.clear();
|
cttsBox.clear();
|
||||||
cttsBox.read(tmp);
|
cttsBox.read(tmp);
|
||||||
|
hasCTTS = true;
|
||||||
}else if (stblBoxType == "stsz"){
|
}else if (stblBoxType == "stsz"){
|
||||||
tmp = std::string(stblLoopPeek.asBox() ,stblLoopPeek.boxedSize());
|
tmp = std::string(stblLoopPeek.asBox() ,stblLoopPeek.boxedSize());
|
||||||
stszBox.clear();
|
stszBox.clear();
|
||||||
|
@ -163,6 +165,7 @@ namespace Mist {
|
||||||
offsetIndex = 0;
|
offsetIndex = 0;
|
||||||
offsetPos = 0;
|
offsetPos = 0;
|
||||||
}
|
}
|
||||||
|
if (hasCTTS){
|
||||||
MP4::CTTSEntry tmpCTTS;
|
MP4::CTTSEntry tmpCTTS;
|
||||||
while (offsetIndex < cttsBox.getEntryCount()){
|
while (offsetIndex < cttsBox.getEntryCount()){
|
||||||
tmpCTTS = cttsBox.getCTTSEntry(offsetIndex);
|
tmpCTTS = cttsBox.getCTTSEntry(offsetIndex);
|
||||||
|
@ -173,6 +176,7 @@ namespace Mist {
|
||||||
offsetPos += tmpCTTS.sampleCount;
|
offsetPos += tmpCTTS.sampleCount;
|
||||||
++offsetIndex;
|
++offsetIndex;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//next lines are common for next-getting and seeking
|
//next lines are common for next-getting and seeking
|
||||||
size = stszBox.getEntrySize(index);
|
size = stszBox.getEntrySize(index);
|
||||||
|
|
|
@ -63,6 +63,7 @@ namespace Mist {
|
||||||
MP4::STCO stcoBox;
|
MP4::STCO stcoBox;
|
||||||
MP4::STSZ stszBox;
|
MP4::STSZ stszBox;
|
||||||
MP4::STTS sttsBox;
|
MP4::STTS sttsBox;
|
||||||
|
bool hasCTTS;
|
||||||
MP4::CTTS cttsBox;
|
MP4::CTTS cttsBox;
|
||||||
MP4::STSC stscBox;
|
MP4::STSC stscBox;
|
||||||
long unsigned int timeScale;
|
long unsigned int timeScale;
|
||||||
|
|
|
@ -264,6 +264,7 @@ namespace Mist {
|
||||||
}
|
}
|
||||||
//Save the current write position
|
//Save the current write position
|
||||||
size_t curOffset = pagesByTrack[tid][curPageNum[tid]].curOffset;
|
size_t curOffset = pagesByTrack[tid][curPageNum[tid]].curOffset;
|
||||||
|
DONTEVEN_MSG("Buffering packet on page %lu for track %lu~>%lu: %d bytes @ %lu: %s", curPageNum[tid], tid, mapTid, pack.getDataLen(), curOffset);
|
||||||
//Do nothing when there is not enough free space on the page to add the packet.
|
//Do nothing when there is not enough free space on the page to add the packet.
|
||||||
if (pagesByTrack[tid][curPageNum[tid]].dataSize - curOffset < pack.getDataLen()) {
|
if (pagesByTrack[tid][curPageNum[tid]].dataSize - curOffset < pack.getDataLen()) {
|
||||||
FAIL_MSG("Trying to buffer a packet on page %lu for track %lu~>%lu, but we have a size mismatch. The packet is %d bytes long, so won't fit at offset %lu on a page of %llu bytes!", curPageNum[tid], tid, mapTid, pack.getDataLen(), curOffset, pagesByTrack[tid][curPageNum[tid]].dataSize);
|
FAIL_MSG("Trying to buffer a packet on page %lu for track %lu~>%lu, but we have a size mismatch. The packet is %d bytes long, so won't fit at offset %lu on a page of %llu bytes!", curPageNum[tid], tid, mapTid, pack.getDataLen(), curOffset, pagesByTrack[tid][curPageNum[tid]].dataSize);
|
||||||
|
|
Loading…
Add table
Reference in a new issue