[xiph-commits] r8642 - in trunk/oggdsf/src:
lib/core/ogg/libOOOggSeek tools/OOOggSeekFileMaker
tools/OOOggSeekFileReader
ozone at motherfish-iii.xiph.org
ozone at motherfish-iii.xiph.org
Thu Jan 6 04:49:05 PST 2005
Author: ozone
Date: 2005-01-06 04:49:04 -0800 (Thu, 06 Jan 2005)
New Revision: 8642
Modified:
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h
trunk/oggdsf/src/tools/OOOggSeekFileMaker/OOOggSeekFileMaker.cpp
trunk/oggdsf/src/tools/OOOggSeekFileReader/OOOggSeekFileReader.cpp
Log:
oggdsf:
* Added a convenience method to AutoOggSeekTable, to serialise the seek table into a file
* Re-wrote OOOggSeekFileMaker to use above method
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp 2005-01-06 12:37:58 UTC (rev 8641)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp 2005-01-06 12:49:04 UTC (rev 8642)
@@ -246,6 +246,27 @@
}
}
+bool AutoOggSeekTable::serialiseInto(const string inSeekTableFilename)
+{
+ unsigned long locSerialisedSeekTableSize = serialisedSize();
+ unsigned char *locBuffer = new unsigned char[serialisedSize()];
+
+ if (serialiseInto(locBuffer, serialisedSize())) {
+ fstream locOutputFile;
+
+ locOutputFile.open(inSeekTableFilename.c_str(), ios_base::out | ios_base::binary);
+ locOutputFile.write((char*)locBuffer, serialisedSize());
+ locOutputFile.close();
+ } else {
+ delete [] locBuffer;
+ return false;
+ }
+
+ delete [] locBuffer;
+ return true;
+}
+
+
LOOG_INT64 AutoOggSeekTable::fileDuration()
{
return mFileDuration;
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h 2005-01-06 12:37:58 UTC (rev 8641)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h 2005-01-06 12:49:04 UTC (rev 8642)
@@ -77,6 +77,9 @@
/// Serialise the seek table into a memory buffer, which may be useful for e.g. caching.
bool serialiseInto(unsigned char* inBuff, unsigned long inBuffSize);
+ /// Serialise the seek table into a file, which may be useful for e.g. caching.
+ bool serialiseInto(const string inSeekTableFilename);
+
/// Build a seek table from a buffer previously written to with serialiseInto().
virtual bool buildTableFromBuffer(const unsigned char *inBuffer, const unsigned long inBufferSize);
Modified: trunk/oggdsf/src/tools/OOOggSeekFileMaker/OOOggSeekFileMaker.cpp
===================================================================
--- trunk/oggdsf/src/tools/OOOggSeekFileMaker/OOOggSeekFileMaker.cpp 2005-01-06 12:37:58 UTC (rev 8641)
+++ trunk/oggdsf/src/tools/OOOggSeekFileMaker/OOOggSeekFileMaker.cpp 2005-01-06 12:49:04 UTC (rev 8642)
@@ -59,17 +59,8 @@
}
locSeekTable->buildTable();
- fstream outputFile;
- outputFile.open(argv[2], ios_base::out | ios_base::binary);
+ locSeekTable->serialiseInto(argv[2]);
- unsigned char* locBuff = new unsigned char[locSeekTable->serialisedSize()];
- locSeekTable->serialiseInto(locBuff, locSeekTable->serialisedSize());
-
- outputFile.write((char*)locBuff, locSeekTable->serialisedSize());
-
- outputFile.close();
-
- delete [] locBuff;
delete locSeekTable;
}
Modified: trunk/oggdsf/src/tools/OOOggSeekFileReader/OOOggSeekFileReader.cpp
===================================================================
--- trunk/oggdsf/src/tools/OOOggSeekFileReader/OOOggSeekFileReader.cpp 2005-01-06 12:37:58 UTC (rev 8641)
+++ trunk/oggdsf/src/tools/OOOggSeekFileReader/OOOggSeekFileReader.cpp 2005-01-06 12:49:04 UTC (rev 8642)
@@ -24,32 +24,6 @@
cout << "Usage : OOOggSeekFileReader <seek_table_file>"<<endl;
} else {
-#if 0
- LOOG_INT64 timePoint;
- unsigned long bytePos;
-
- fstream seekFile;
- seekFile.open(argv[1], ios_base::in | ios_base::binary);
-
- unsigned char* buff = new unsigned char[16];
- unsigned long pointCount = 0;
- while (!seekFile.eof()) {
- //Read the time
- seekFile.read((char*)buff, 8);
- if (seekFile.gcount() == 8) {
- timePoint = iLE_Math::CharArrToInt64(buff);
-
-
- seekFile.read((char*)buff, 4);
- bytePos = iLE_Math::charArrToULong(buff);
-
- cout << "Seek point "<<pointCount<<" : Time = "<<timePoint<<", Byte Offset = "<<bytePos<<endl;
- pointCount++;
- }
- }
-
- delete [] buff;
-#else
AutoOggSeekTable *locSeekTable = new AutoOggSeekTable("foo"); // Filename doesn't matter
locSeekTable->buildTableFromFile(argv[1]);
OggSeekTable::tSeekMap locSeekMap = locSeekTable->getSeekMap();
@@ -62,8 +36,6 @@
}
delete [] locSeekTable;
-
-#endif
}
return 0;
}
More information about the commits
mailing list