[xiph-commits] r7334 - in trunk/oggdsf/src: lib/core/ogg/libOOOgg

illiminable at dactyl.lonelymoon.com illiminable
Sun Jul 25 11:59:17 PDT 2004


tools/OOOggValidate
Message-ID: <20040725185917.59C569AAAB at dactyl.lonelymoon.com>

Author: illiminable
Date: Sun Jul 25 11:59:17 2004
New Revision: 7334

Modified:
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggCallbackRego.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h
trunk/oggdsf/src/tools/OOOggValidate/OOOggValidate.cpp
Log:
* Bug fixes to validation tool.

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggCallbackRego.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggCallbackRego.cpp	2004-07-25 17:41:39 UTC (rev 7333)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggCallbackRego.cpp	2004-07-25 18:59:16 UTC (rev 7334)
@@ -60,6 +60,7 @@
mCB(outOggPage);
} else {
mCB(inOggPage);
+		//FIX::: Needs fixing to propagate response up.
}

}
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp	2004-07-25 17:41:39 UTC (rev 7333)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp	2004-07-25 18:59:16 UTC (rev 7334)
@@ -185,7 +185,11 @@
}

//Set the base header into the pending page
-		pendingPage->header()->setBaseHeader((unsigned char*)locBuff);
+
+		bool locRetVal = pendingPage->header()->setBaseHeader((unsigned char*)locBuff);
+		if (locRetVal == false) {
+			return PROCESS_FAILED_TO_SET_HEADER;
+		}

//NOTE ::: The page will delete the buffer when it's done. Don't delete it here

@@ -299,6 +303,8 @@
//Read data from the stream into the local buffer.
mStream.read((char*)(locBuff), locCurrPackSize);

+			//FIX::: check for stream failure.
+
debugLog<<"ProcessDataSegment : Adding packet size = "<<locCurrPackSize<<endl;

//A packet ends when a lacing value is not 255. So the check for != 255 means the isComplete property of the packet is not set unless the
@@ -360,6 +366,7 @@
eProcessResult locResult = processBaseHeader();

if (locResult != PROCESS_OK) {
+						mState = LOST_PAGE_SYNC;
//Base header process failed
return locResult;
}
@@ -376,6 +383,7 @@
eProcessResult locResult = processSegTable();

if (locResult != PROCESS_OK) {
+						mState = LOST_PAGE_SYNC;
//segment table process failed
return locResult;
}
@@ -387,9 +395,14 @@
//If all the data segment is available
if (numBytesAvail() >= pendingPage->header()->dataSize()) {
debugLog<<"ProcessBuffer : Enough to process..."<<endl;
+
+					//FIX::: Need error check.
return processDataSegment();
}
break;
+			case eState::LOST_PAGE_SYNC:
+				debugLog<<"ProcessBuffer : State = LOST_PAGE_SYNC"<<endl;
+				return PROCESS_LOST_SYNC;
default:
//Do sometyhing ??
debugLog<<"ProcessBuffer : Ogg Buffer Error"<<endl;

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h	2004-07-25 17:41:39 UTC (rev 7333)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h	2004-07-25 18:59:16 UTC (rev 7334)
@@ -53,7 +53,8 @@
EOS,
AWAITING_BASE_HEADER = 32,
AWAITING_SEG_TABLE,
-		AWAITING_DATA
+		AWAITING_DATA,
+		LOST_PAGE_SYNC = 128
};

enum eFeedResult {
@@ -66,7 +67,9 @@
PROCESS_OK,
PROCESS_UNKNOWN_INTERNAL_ERROR = 256,
PROCESS_STREAM_READ_ERROR,
-		PROCESS_DISPATCH_FAILED
+		PROCESS_DISPATCH_FAILED,
+		PROCESS_FAILED_TO_SET_HEADER,
+		PROCESS_LOST_SYNC

};
OggDataBuffer(void);

Modified: trunk/oggdsf/src/tools/OOOggValidate/OOOggValidate.cpp
===================================================================
--- trunk/oggdsf/src/tools/OOOggValidate/OOOggValidate.cpp	2004-07-25 17:41:39 UTC (rev 7333)
+++ trunk/oggdsf/src/tools/OOOggValidate/OOOggValidate.cpp	2004-07-25 18:59:16 UTC (rev 7334)
@@ -23,7 +23,8 @@
};

OggValidationState gValidationState;
-void error_write(eOggValidationErrors inErrNo, OggPage* inOggPage, OggStreamValidationState* inStreamState) {
+bool isValid = true;
+void error_write(short int inErrNo, OggPage* inOggPage, OggStreamValidationState* inStreamState) {

string locErrorString = "";
switch (inErrNo) {
@@ -47,13 +48,22 @@
case OVE_EOS_BEFORE_BOS:
locErrorString = "EOS page found before BOS page";
break;
+
+
+
+		//Process errors
+		case OggDataBuffer::PROCESS_FAILED_TO_SET_HEADER:
+			locErrorString = "Could not find ogg page.";
+			break;
default:
locErrorString = "Unnamed Error";
break;

}

-	inStreamState->mErrorCount++;
+	if (inStreamState != NULL) {
+        inStreamState->mErrorCount++;
+	}

cout << "ERROR "<<(int)inErrNo<<":  "<<locErrorString<<endl;

@@ -70,8 +80,8 @@

OggPageHeader* locHeader = inOggPage->header();

-	bool isValid = true;

+
//----------------------------------------------------------------------
//Verify structure version is 0 (RFC 3533 Sec. 6.1)
if (locHeader->StructureVersion() != 0) {
@@ -135,8 +145,8 @@

//Verify sequence No
if (locHeader->PageSequenceNo() == locStreamState->mSequenceNoUpto) {
-		error_write(OVE_SEQUENCE_NO_REPEATED, inOggPage, locStreamState);
-		isValid = false;
+		//error_write(OVE_SEQUENCE_NO_REPEATED, inOggPage, locStreamState);
+		//isValid = false;
} else if (locHeader->PageSequenceNo() < locStreamState->mSequenceNoUpto) {
error_write(OVE_SEQUENCE_NO_DECREASED, inOggPage, locStreamState);
isValid = false;
@@ -161,6 +171,10 @@
// USAGE :: OOOggValidate <OggFile>
//
//bytePos = 0;
+
+	int x;
+	cin>>x;
+
if (argc < 2) {
cout<<"Usage : OOOggValidate <filename>"<<endl;
} else {
@@ -200,10 +214,16 @@
case OVE_EOS_BEFORE_BOS:
error_write(OVE_EOS_BEFORE_BOS, NULL, NULL);
return OVE_EOS_BEFORE_BOS;
+				default:
+					error_write(locResult, NULL, NULL);
+					return locResult;

}
}

+		if (isValid) {
+			cout<<"File was valid."<<endl;
+		}
delete locBuff;
}




More information about the commits mailing list