Commit a3df567a authored by Ramesh Nallur's avatar Ramesh Nallur

Removed a test code element

parent a08cd05e
......@@ -554,85 +554,85 @@ void MP4File::OptimizeForTimeSeek( const char* srcFileName, const char *indexFil
SetPosition(pMdat->GetStart());
log.verbose1f(": Mdat Start:%llu Size:%llu NewFilePos:%llu index:%d\n",
log.verbose1f(": Mdat Start:%llu Size:%llu NewFilePos:%llu index:%d\n",
pMdat->GetStart(), pMdat->GetSize(), GetPosition(), index );
m_file->read((void *)buffer, pMdat->GetSize()+8, nin, 0);
log.verbose1f(": Mdat Start:%llu Size:%llu NewFilePos:%llu\n",
log.verbose1f(": Mdat Start:%llu Size:%llu NewFilePos:%llu\n",
pMdat->GetStart(), pMdat->GetSize(), GetPosition() );
m_file = dst;
log.verbose1f(": Mdat Start:%llu Size:%llu NewFilePos:%llu\n",
pMdat->GetStart(), pMdat->GetSize(), GetPosition() );
m_file->write((void *)buffer, pMdat->GetSize()+8, nin, 0);
free(buffer);
for (int32_t j = 0; true ; j++)
{
ostringstream oss;
oss << "moof[" << index << "].traf[" << j << "]" ;
MP4Atom *pTrafAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTrafAtom == NULL)
break;
oss.str("");
oss.clear();
m_file->write((void *)buffer, pMdat->GetSize()+8, nin, 0);
free(buffer);
for (int32_t j = 0; true ; j++)
{
ostringstream oss;
oss << "moof[" << index << "].traf[" << j << "]" ;
MP4Atom *pTrafAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTrafAtom == NULL)
break;
oss.str("");
oss.clear();
#if 1
oss << "moof[" << index << "].traf[" << j << "].tfhd.baseDataOffset" ;
oss << "moof[" << index << "].traf[" << j << "].tfhd.baseDataOffset" ;
uint64_t value = GetIntegerProperty(oss.str().c_str());
log.verbose3f(": %s is %lld Setting to: %lld\n", oss.str().c_str(), value, pMoof->GetStart());
uint64_t value = GetIntegerProperty(oss.str().c_str());
log.verbose3f(": %s is %lld Setting to: %lld\n", oss.str().c_str(), value, pMoof->GetStart());
SetIntegerProperty(oss.str().c_str(), pMoof->GetStart());
SetIntegerProperty(oss.str().c_str(), pMoof->GetStart());
oss.str("");
oss.clear();
oss.str("");
oss.clear();
// Locate the baseDataOffsetPosition
// Locate the baseDataOffsetPosition
oss << "moof[" << index << "].traf[" << j << "].tfhd" ;
oss << "moof[" << index << "].traf[" << j << "].tfhd" ;
MP4Atom *pTfhdAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTfhdAtom == NULL) {
log.errorf("Tfhd not found!!\n");
ASSERT(false);
}
MP4Atom *pTfhdAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTfhdAtom == NULL) {
log.errorf("Tfhd not found!!\n");
ASSERT(false);
}
uint64_t baseDataOffSetLocation = 0;
uint64_t baseDataOffSetLocation = 0;
if (pTfhdAtom->GetFlags() & 0x000001) {// basedataoffset present
baseDataOffSetLocation = pTfhdAtom->GetStart() + 16;
}
if (pTfhdAtom->GetFlags() & 0x000001) {// basedataoffset present
baseDataOffSetLocation = pTfhdAtom->GetStart() + 16;
}
indexStringStream << j << "," << baseDataOffSetLocation << ",";
indexStringStream << j << "," << baseDataOffSetLocation << ",";
log.verbose3f("BaseDataOffset: %s is %d \n", oss.str().c_str(), baseDataOffSetLocation);
log.verbose3f("BaseDataOffset: %s is %d \n", oss.str().c_str(), baseDataOffSetLocation);
#else // We tried to remove the offset completely from the trun so that we dont have to muck with it. But for some reason QuickTime does not like this file
MP4Property* pProperty = NULL;
uint32_t index;
oss << "moof[" << index << "].traf[" << j << "].tfhd" ;
MP4Atom *pTfhdAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTfhdAtom != NULL) {
log.verbose3f(": %s Removing Base offset \n", oss.str().c_str());
((MP4TfhdAtom *)pTfhdAtom)->RemoveBaseOffsetProperty();
}
oss.str("");
oss.clear();
pProperty = NULL;
oss << "moof[" << index << "].traf[" << j << "].trun" ;
MP4Atom *pTrunAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTrunAtom != NULL) {
log.verbose3f(": %s Removing Data offset \n", oss.str().c_str());
((MP4TrunAtom *)pTrunAtom)->RemovedataOffsetProperty();
}
MP4Property* pProperty = NULL;
uint32_t index;
oss << "moof[" << index << "].traf[" << j << "].tfhd" ;
MP4Atom *pTfhdAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTfhdAtom != NULL) {
log.verbose3f(": %s Removing Base offset \n", oss.str().c_str());
((MP4TfhdAtom *)pTfhdAtom)->RemoveBaseOffsetProperty();
}
oss.str("");
oss.clear();
pProperty = NULL;
oss << "moof[" << index << "].traf[" << j << "].trun" ;
MP4Atom *pTrunAtom = m_pRootAtom->FindAtom(oss.str().c_str());
if (pTrunAtom != NULL) {
log.verbose3f(": %s Removing Data offset \n", oss.str().c_str());
((MP4TrunAtom *)pTrunAtom)->RemovedataOffsetProperty();
}
#endif
}
}
// remember the pos and update the moof to disk since it changed
uint64_t savePos = GetPosition();
......@@ -644,28 +644,15 @@ void MP4File::OptimizeForTimeSeek( const char* srcFileName, const char *indexFil
SetPosition(savePos);
log.verbose3f("Updating Moof After FilePos:%lld\n", savePos);
index++;
index++;
log.verbose3f("Updating Index: %s\n", indexStringStream.str().c_str() );
// Update the index file
File::Size nout;
indexStringStream << "\n";
indx->write(indexStringStream.str().c_str(), strlen(indexStringStream.str().c_str()), nout, 0);
log.verbose3f("Updating Index: %s\n", indexStringStream.str().c_str() );
// Update the index file
File::Size nout;
indexStringStream << "\n";
indx->write(indexStringStream.str().c_str(), strlen(indexStringStream.str().c_str()), nout, 0);
#if 0
if (index == 38)
{
log.verbose1f(": Mdat Start:%llu Size:%llu NewFilePos:%llu\n",
pMdat->GetStart(), pMdat->GetSize(), GetPosition() );
continue;
}
#else
// if (index == 38)
break;
#endif
}
}
catch (...) {
// cleanup and rethrow. Without this, we'd leak memory and an open file handle(s).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment