[xiph-commits] r8899 - in trunk/oggdsf/src/lib: core/ogg/libOOOgg
helper/libOOOggChef helper/libilliCore
ozone at motherfish-iii.xiph.org
ozone at motherfish-iii.xiph.org
Thu Feb 10 20:18:48 PST 2005
Author: ozone
Date: 2005-02-10 20:18:42 -0800 (Thu, 10 Feb 2005)
New Revision: 8899
Modified:
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp
trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp
trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h
trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h
Log:
oggdsf:
* Removed superfluous mPendingSecondaryHeaders member variable from libOOOggChef's AnnodexRecomposer class
* Tiny tiny documentation/comments updates
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp 2005-02-10 04:33:57 UTC (rev 8898)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPacket.cpp 2005-02-11 04:18:42 UTC (rev 8899)
@@ -172,6 +172,10 @@
return mPacketSize;
}
+/** Note that you should reset the checksum on the Ogg page via
+ OggPage::computeAndSetCRCChecksum() if you change the packet data, otherwise
+ you'll end up with an invalid page. (Arguably this should automatically
+ be done for you, but that's the way it is for now.) */
unsigned char* OggPacket::packetData() {
return mPacketData;
}
@@ -193,7 +197,11 @@
mPacketSize = inPacketSize;
}
-//This function accepts responsibility for the pointer it is passed, and it deletes it in the destructor.
+/** This function accepts responsibility for the pointer it is passed, and it
+ deletes it in the destructor. Note that you should reset the checksum on
+ the Ogg page via OggPage::computeAndSetCRCChecksum(), otherwise you'll end up
+ with an invalid page. (Arguably this should automatically be done for you,
+ but that's the way it is for now.) */
void OggPacket::setPacketData(unsigned char* inPacketData) {
mPacketData = inPacketData;
}
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp 2005-02-10 04:33:57 UTC (rev 8898)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp 2005-02-11 04:18:42 UTC (rev 8899)
@@ -236,6 +236,7 @@
{
mPageSequenceNo = iLE_Math::charArrToULong(inPtr);;
}
+
void OggPageHeader::setCRCChecksum(unsigned long inVal)
{
mCRCChecksum = inVal;
Modified: trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp 2005-02-10 04:33:57 UTC (rev 8898)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp 2005-02-11 04:18:42 UTC (rev 8899)
@@ -1,4 +1,4 @@
-//===========================================================================
+`//===========================================================================
//Copyright (C) 2005 Zentaro Kavanagh
//Copyright (C) 2005 Commonwealth Scientific and Industrial Research
// Organisation (CSIRO) Australia
@@ -173,7 +173,7 @@
locFile.seekg(locRequestedStartTimeOffset);
#ifdef DEBUG
- mDebugFile << "locRequestedStartTime: " << locRequestedStartTime << endl;
+ mDebugFile << "mRequestedStartTime: " << mRequestedStartTime << endl;
mDebugFile << "locRequestedStartTimeOffset: " << locRequestedStartTimeOffset << endl;
mDebugFile << "Current position: " << locFile.tellg() << endl;
#endif
@@ -182,9 +182,20 @@
// really shouldn't ...
size_t locCurrentPosition = locFile.tellg();
if (locCurrentPosition == 0) {
+#ifdef DEBUG
+ mDebugFile << "Resetting mDemuxState to SEEN_NOTHING bofore LOOK_FOR_BODY" << endl;
+#endif
mDemuxState = SEEN_NOTHING;
}
+#ifdef DEBUG
+ for (unsigned int i = 0; i < mWantedStreamSerialNumbers.size(); i++) {
+ mDebugFile << "Serialno: " << mWantedStreamSerialNumbers[i].first << endl;
+ }
+
+ mDebugFile << "mDemuxState before LOOK_FOR_BODY is " << mDemuxState << endl;
+#endif
+
mDemuxParserState = LOOK_FOR_BODY;
{
OggDataBuffer locOggBuffer;
@@ -291,7 +302,7 @@
const unsigned short CONTENT_TYPE_OFFSET = 28;
if (strncasecmp((char *) inPacket->packetData() + CONTENT_TYPE_OFFSET,
- "Content-Type: ", 14) == 0)
+ "Content-Type: ", 14) == 0)
{
const unsigned short MIME_TYPE_OFFSET = 28 + 14;
const unsigned short MAX_MIME_TYPE_LENGTH = 256;
@@ -357,10 +368,10 @@
// Add the association to our stream list
mWantedStreamSerialNumbers.push_back(locMap);
+#ifdef DEBUG
+ mDebugFile << "Added serialno " << locSerialNumber << " to mWantedStreamSerialNumbers" << endl;
+#endif
- // Add the association to the list of pending secondary headers
- mPendingSecondaryHeaders.push_back(locMap);
-
if (!wantOnlyPacketBody(mWantedMIMETypes)) {
unsigned char *locRawPageData = inOggPage->createRawPageData();
mBufferWriter(locRawPageData,
@@ -387,10 +398,10 @@
{
// Only output headers for the streams that the user wants
// in their request
- for (unsigned int i = 0; i < mPendingSecondaryHeaders.size(); i++) {
- if (mPendingSecondaryHeaders[i].first == inOggPage->header()->StreamSerialNo()) {
- if (mPendingSecondaryHeaders[i].second >= 1) {
- mPendingSecondaryHeaders[i].second--;
+ for (unsigned int i = 0; i < mWantedStreamSerialNumbers.size(); i++) {
+ if (mWantedStreamSerialNumbers[i].first == inOggPage->header()->StreamSerialNo()) {
+ if (mWantedStreamSerialNumbers[i].second >= 1) {
+ mWantedStreamSerialNumbers[i].second--;
if (wantOnlyPacketBody(mWantedMIMETypes)) {
OggPacket* locPacket = inOggPage->getPacket(0);
mBufferWriter(locPacket->packetData(),
@@ -411,8 +422,8 @@
}
bool allEmpty = true;
- for (unsigned int i = 0; i < mPendingSecondaryHeaders.size(); i++) {
- if (mPendingSecondaryHeaders[i].second != 0) {
+ for (unsigned int i = 0; i < mWantedStreamSerialNumbers.size(); i++) {
+ if (mWantedStreamSerialNumbers[i].second != 0) {
allEmpty = false;
}
}
@@ -457,39 +468,9 @@
break;
case SEEN_ANNODEX_EOS:
- {
- // Only output headers for the streams that the user wants
- // in their request
- for (unsigned int i = 0; i < mWantedStreamSerialNumbers.size(); i++) {
- if (mWantedStreamSerialNumbers[i].first == inOggPage->header()->StreamSerialNo()) {
- if (mWantedStreamSerialNumbers[i].second >= 1) {
- mWantedStreamSerialNumbers[i].second--;
- }
-#if 0
- else {
- mDemuxState = INVALID;
- }
-#endif
- }
- }
+ mDemuxState = SEEN_ALL_CODEC_HEADERS;
+ // Fallthrough!
- // Check whether we've seen all the secondary headers yet:
- // if we have, change our state to indicate that, and start
- // delivering the data to the user
-
- bool allEmpty = true;
- for (unsigned int i = 0; i < mWantedStreamSerialNumbers.size(); i++) {
- if (mWantedStreamSerialNumbers[i].second != 0) {
- allEmpty = false;
- }
- }
-
- if (allEmpty) {
- mDemuxState = SEEN_ALL_CODEC_HEADERS;
- }
- }
- break;
-
case SEEN_ALL_CODEC_HEADERS:
{
// Ignore any header packets which we may encounter
@@ -499,8 +480,14 @@
// Only output streams which the user requested
for (unsigned int i = 0; i < mWantedStreamSerialNumbers.size(); i++) {
+#ifdef DEBUG
+ mDebugFile << "Encountered page with serialno " << inOggPage->header()->StreamSerialNo() << endl;
+#endif
if ( mWantedStreamSerialNumbers[i].first
== inOggPage->header()->StreamSerialNo()) {
+#ifdef DEBUG
+ mDebugFile << "Outputting page for serialno " << mWantedStreamSerialNumbers[i].first << endl;
+#endif
if (wantOnlyPacketBody(mWantedMIMETypes)) {
for (unsigned long j = 0; j < inOggPage->numPackets(); j++) {
OggPacket* locPacket = inOggPage->getPacket(j);
@@ -530,9 +517,6 @@
assert(0);
}
- if (mDemuxState == INVALID) {
- }
-
// Tidy up
delete inOggPage;
inOggPage = NULL;
Modified: trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h 2005-02-10 04:33:57 UTC (rev 8898)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h 2005-02-11 04:18:42 UTC (rev 8899)
@@ -91,7 +91,5 @@
vector<tSerial_HeadCountPair> mWantedStreamSerialNumbers;
const vector<string>* mWantedMIMETypes;
- vector<tSerial_HeadCountPair> mPendingSecondaryHeaders;
-
LOOG_UINT64 mRequestedStartTime;
};
Modified: trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h 2005-02-10 04:33:57 UTC (rev 8898)
+++ trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h 2005-02-11 04:18:42 UTC (rev 8899)
@@ -50,7 +50,7 @@
/// Reads 8 bytes (Little Endian) and returns an int 64.
static LOOG_INT64 CharArrToInt64(const unsigned char* inCharArray);
- /// Takes an int64 and writes 8 bytes (Little Endian) into the buffer you pass.
+ /// Takes an int64 and writes 8 bytes (Little Endian) into the buffer you pass.
static void Int64ToCharArr(LOOG_INT64 inInt64, unsigned char* outCharArray);
/// Reads 2 bytes (Little Endian) and returns an unsigned short
More information about the commits
mailing list