[xiph-commits] r7137 - in trunk/oggdsf/src/lib/core:

illiminable at dactyl.lonelymoon.com illiminable
Thu Jul 15 07:53:40 PDT 2004


directshow/dsfAnxDemux ogg/libOOOgg ogg/libOOOggSeek
Message-ID: <20040715145340.22B1A9AAAB at dactyl.lonelymoon.com>

Author: illiminable
Date: Thu Jul 15 07:53:40 2004
New Revision: 7137

Added:
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.h
Modified:
trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp
trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.h
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/libOOOggSeek.vcproj
Log:
* Seeking added to Annodex, crashes consistently !
* Committing before i make a mess trynig to sort out the threading bug.

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp	2004-07-15 14:53:36 UTC (rev 7137)
@@ -81,9 +81,9 @@
mFileName = inFileName;

//ANX::: Needs to override ??? Or just modify the seeker.
-	mSeekTable = new AutoOggSeekTable(StringHelper::toNarrowStr(mFileName));
+	mSeekTable = new AutoAnxSeekTable(StringHelper::toNarrowStr(mFileName));

-	//mSeekTable->buildTable();
+	mSeekTable->buildTable();

return SetUpPins();
}
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.h	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.h	2004-07-15 14:53:36 UTC (rev 7137)
@@ -35,6 +35,7 @@
#pragma once
#include "anxdllstuff.h"
#include "OggDemuxSourceFilter.h"
+#include "AutoAnxSeekTable.h"
#include "AnxStreamMapper.h"
#include "CMMLStream.h"
#include <fstream>

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp	2004-07-15 14:53:36 UTC (rev 7137)
@@ -34,7 +34,7 @@

OggDataBuffer::OggDataBuffer(void)
{
-	//debugLog.open("G:\\logs\\OggDataBuffer.log", ios_base::out);
+	debugLog.open("G:\\logs\\OggDataBuffer.log", ios_base::out);
pendingPage = NULL;
mState = AWAITING_BASE_HEADER;
mNumBytesNeeded = OggPageHeader::OGG_BASE_HEADER_SIZE;
@@ -42,7 +42,7 @@

OggDataBuffer::~OggDataBuffer(void)
{
-	//debugLog.close();
+	debugLog.close();
delete pendingPage;
}

@@ -76,7 +76,7 @@
unsigned long OggDataBuffer::numBytesAvail() {
//Returns how many bytes are available in the buffer
unsigned long locBytesAvail = mStream.tellp() - mStream.tellg();
-	//debugLog<<"Bytes avail = "<<locBytesAvail<<endl;
+	debugLog<<"Bytes avail = "<<locBytesAvail<<endl;
return locBytesAvail;
}

@@ -85,7 +85,7 @@
return mState;
}
bool OggDataBuffer::dispatch(OggPage* inOggPage) {
-	//debugLog<<"Dispatching page..."<<endl;
+	debugLog<<"Dispatching page..."<<endl;
bool locIsOK;

//Fire off the oggpage to whoever is registered to get it
@@ -120,20 +120,20 @@

bool OggDataBuffer::feed(const char* inData, unsigned long inNumBytes) {
if (inNumBytes != 0) {
-		//debugLog<<"Fed "<<inNumBytes<<" bytes..."<<endl;
+		debugLog<<"Fed "<<inNumBytes<<" bytes..."<<endl;
mStream.write(inData, inNumBytes);
//FIX ::: Need error checking.

return processBuffer();
} else {
-		//debugLog<<"Fed *zero* bytes..."<<endl;
+		debugLog<<"Fed *zero* bytes..."<<endl;
return true;
}


}
void OggDataBuffer::processBaseHeader() {
-		//debugLog<<"ProcessBaseHeader : "<<endl;
+		debugLog<<"ProcessBaseHeader : "<<endl;
//Delete the previous page
delete pendingPage;
//make a fresh one
@@ -142,72 +142,72 @@
//Make a local buffer
unsigned char* locBuff = new unsigned char[OggPageHeader::OGG_BASE_HEADER_SIZE];

-		//debugLog<<"ProcessBaseHeader : Reading from stream..."<<endl;
+		debugLog<<"ProcessBaseHeader : Reading from stream..."<<endl;
//Read from the stream buffer to it
mStream.read((char*)locBuff, OggPageHeader::OGG_BASE_HEADER_SIZE);

if(mStream.fail()) {
-			//debugLog<<"ProcessBaseHeader : Read FAILED"<<endl;
+			debugLog<<"ProcessBaseHeader : Read FAILED"<<endl;
}
//Set the base header into the pending page
pendingPage->header()->setBaseHeader((unsigned char*)locBuff);
//NOTE ::: The page will delete the buffer when it's done. Don't delete it here

-		//debugLog<<"ProcessBaseHeader : Setting state to AWAITING_SEG_TABLE"<<endl;
+		debugLog<<"ProcessBaseHeader : Setting state to AWAITING_SEG_TABLE"<<endl;
//Change the state.
mState = AWAITING_SEG_TABLE;

//Set the number of bytes we want for next time
mNumBytesNeeded = pendingPage->header()->NumPageSegments();

-		//debugLog<<"ProcessBaseHeader : Bytes needed for seg table = "<<mNumBytesNeeded<<endl;
+		debugLog<<"ProcessBaseHeader : Bytes needed for seg table = "<<mNumBytesNeeded<<endl;
}
void OggDataBuffer::processSegTable() {

-	//debugLog<<"ProcessSegTable : "<<endl;
+	debugLog<<"ProcessSegTable : "<<endl;

unsigned long locNumSegs = pendingPage->header()->NumPageSegments();

-	//debugLog<<"ProcessSegTable : Num segs = "<<locNumSegs<<endl;
+	debugLog<<"ProcessSegTable : Num segs = "<<locNumSegs<<endl;

//Make a local buffer
unsigned char* locBuff = new unsigned char[locNumSegs];

-	//debugLog<<"ProcessSegTable : Reading from buffer..."<<endl;
+	debugLog<<"ProcessSegTable : Reading from buffer..."<<endl;
//Read from the stream buffer to it
mStream.read((char*)locBuff, locNumSegs);
if(mStream.fail()) {
-		//debugLog<<"ProcessSegTable : Read FAILED"<<endl;
+		debugLog<<"ProcessSegTable : Read FAILED"<<endl;
}

//Set the data into the pending pages segtable
pendingPage->header()->setSegmentTable(locBuff);
//NOTE ::: The seg table will delete the buffer itself. Don't delete here.

-	//debugLog<<"ProcessSegTable : Transition to AWAITING_DATA"<<endl;
+	debugLog<<"ProcessSegTable : Transition to AWAITING_DATA"<<endl;
mState = AWAITING_DATA;


//Set the number of bytes we want for next time
mNumBytesNeeded = pendingPage->header()->dataSize();
-	//debugLog<<"ProcessSegTable : Num bytes needed for data = "<< mNumBytesNeeded<<endl;
+	debugLog<<"ProcessSegTable : Num bytes needed for data = "<< mNumBytesNeeded<<endl;
}

bool OggDataBuffer::processDataSegment() {

-	//debugLog<<"ProcessDataSegment : "<<endl;
+	debugLog<<"ProcessDataSegment : "<<endl;
//Make a local buffer

unsigned long locPageDataSize = pendingPage->header()->dataSize();

-	//debugLog<<"ProcessDataSegment : Page data size = "<<locPageDataSize<<endl;
+	debugLog<<"ProcessDataSegment : Page data size = "<<locPageDataSize<<endl;
unsigned char* locBuff = NULL;// = new unsigned char[locPageDataSize];
//unsigned long locPacketOffset = 0;

unsigned char* locSegTable = pendingPage->header()->SegmentTable()->segmentTable();
unsigned int locNumSegs = pendingPage->header()->SegmentTable()->numSegments();

-	//debugLog<<"ProcessDataSegment : Num segs = "<<locNumSegs<<endl;
+	debugLog<<"ProcessDataSegment : Num segs = "<<locNumSegs<<endl;
unsigned long locCurrPackSize = 0;

bool locIsLastSeg = false;
@@ -222,7 +222,7 @@
//This pointer is given to the packet... it deletes it.
locBuff = new unsigned char[locCurrPackSize];
mStream.read((char*)(locBuff), locCurrPackSize);
-			//debugLog<<"ProcessDataSegment : Adding packet size = "<<locCurrPackSize<<endl;
+			debugLog<<"ProcessDataSegment : Adding packet size = "<<locCurrPackSize<<endl;
pendingPage->addPacket( new StampedOggPacket(locBuff, locCurrPackSize, (locSegTable[i] != 255), 0, pendingPage->header()->GranulePos()->value(), StampedOggPacket::OGG_END_ONLY ) );

//locPacketOffset += locCurrPackSize;
@@ -230,11 +230,11 @@
}
}

-	//debugLog<<"ProcessDataSegment : Transition to AWAITING_BASE_HEADER"<<endl;
+	debugLog<<"ProcessDataSegment : Transition to AWAITING_BASE_HEADER"<<endl;
mState = AWAITING_BASE_HEADER;

mNumBytesNeeded = OggPageHeader::OGG_BASE_HEADER_SIZE;
-	//debugLog<<"ProcessDataSegment : num bytes needed = "<<mNumBytesNeeded<<endl;
+	debugLog<<"ProcessDataSegment : num bytes needed = "<<mNumBytesNeeded<<endl;
return dispatch(pendingPage);

}
@@ -248,40 +248,40 @@
//	int i = i;
//}

-	//debugLog<<"ClearData : Transition back to AWAITING_BASE_HEADER"<<endl;
+	debugLog<<"ClearData : Transition back to AWAITING_BASE_HEADER"<<endl;
mState = eState::AWAITING_BASE_HEADER;
mNumBytesNeeded = OggPageHeader::OGG_BASE_HEADER_SIZE;
-	//debugLog<<"ClearData : Num bytes needed = "<<mNumBytesNeeded<<endl;
+	debugLog<<"ClearData : Num bytes needed = "<<mNumBytesNeeded<<endl;
}
bool OggDataBuffer::processBuffer() {
-	//debugLog<<"ProcessBuffer :"<<endl;
+	debugLog<<"ProcessBuffer :"<<endl;
bool locErr;
while (numBytesAvail() >= mNumBytesNeeded) {
-		//debugLog<<"ProcessBuffer : Bytes Needed = "<<mNumBytesNeeded<<" --- "<<"Bytes avail = "<<numBytesAvail()<<endl;
+		debugLog<<"ProcessBuffer : Bytes Needed = "<<mNumBytesNeeded<<" --- "<<"Bytes avail = "<<numBytesAvail()<<endl;
switch (mState) {
case eState::AWAITING_BASE_HEADER:
-				//debugLog<<"ProcessBuffer : State = AWAITING_BASE_HEADER"<<endl;
+				debugLog<<"ProcessBuffer : State = AWAITING_BASE_HEADER"<<endl;
//If theres enough data to form the base header
if (numBytesAvail() >= OggPageHeader::OGG_BASE_HEADER_SIZE) {
-					//debugLog<<"ProcessBuffer : Enough to process..."<<endl;
+					debugLog<<"ProcessBuffer : Enough to process..."<<endl;
processBaseHeader();
}
break;

case eState::AWAITING_SEG_TABLE:
-				//debugLog<<"ProcessBuffer : State = AWAITING_SEG_TABLE"<<endl;
+				debugLog<<"ProcessBuffer : State = AWAITING_SEG_TABLE"<<endl;
//If there is enough data to get the segt table
if (numBytesAvail() >= pendingPage->header()->NumPageSegments()) {
-					//debugLog<<"ProcessBuffer : Enough to process..."<<endl;
+					debugLog<<"ProcessBuffer : Enough to process..."<<endl;
processSegTable();
}
break;

case eState::AWAITING_DATA:
-				//debugLog<<"ProcessBuffer : State = AWAITING_DATA"<<endl;
+				debugLog<<"ProcessBuffer : State = AWAITING_DATA"<<endl;
//If all the data segment is available
if (numBytesAvail() >= pendingPage->header()->dataSize()) {
-					//debugLog<<"ProcessBuffer : Enough to process..."<<endl;
+					debugLog<<"ProcessBuffer : Enough to process..."<<endl;
locErr = processDataSegment();
if (!locErr) {
return false;
@@ -290,7 +290,7 @@
break;
default:
//Do sometyhing ??
-				//debugLog<<"ProcessBuffer : Ogg Buffer Error"<<endl;
+				debugLog<<"ProcessBuffer : Ogg Buffer Error"<<endl;
break;
}
}

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h	2004-07-15 14:53:36 UTC (rev 7137)
@@ -36,7 +36,7 @@
#include "IOggCallback.h"

//Only needed for debugging
-//#include <fstream>
+#include <fstream>
//
using namespace std;

@@ -89,7 +89,7 @@
vector<IOggCallback*> mVirtualCallbackList;

//DEBUG
-	//fstream debugLog;
+	fstream debugLog;
//

private:

Added: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.cpp	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.cpp	2004-07-15 14:53:36 UTC (rev 7137)
@@ -0,0 +1,57 @@
+#include "StdAfx.h"
+#include ".\autoanxseektable.h"
+
+AutoAnxSeekTable::AutoAnxSeekTable(string inFileName)
+	:	AutoOggSeekTable(inFileName)
+	,	mAnxPackets(0)
+	,	mSeenAnything(false)
+	,	mAnnodexSerialNo(0)
+	,	mReadyForOgg(false)
+	,	mSkippedCMML(false)
+{
+}
+
+AutoAnxSeekTable::~AutoAnxSeekTable(void)
+{
+}
+
+//IOggCallback interface
+bool AutoAnxSeekTable::acceptOggPage(OggPage* inOggPage) {
+	if (mSeenAnything == false) {
+		if (strncmp((const char*)inOggPage->getPacket(0)->packetData(), "Annodex", 7) == 0) {
+			mAnnodexSerialNo = inOggPage->header()->StreamSerialNo();
+			mSeenAnything = true;
+			return true;
+			//Need to grab other info here.
+		} else {
+			return false;
+		}
+	}
+
+	if ((mAnnodexSerialNo == inOggPage->header()->StreamSerialNo()) && ((inOggPage->header()->HeaderFlags() & 4) != 0)) {
+		//This is the EOS o the annodex section... everything that follows is ogg like
+		mReadyForOgg = true;
+		return true;
+	}
+
+	//if (mAnnodexSerialNo == inOggPage->header()->StreamSerialNo()) {
+	//	//Ignore this stuff.
+	//	return true;
+	//} else if (strncmp((const char*)inOggPage->getPacket(0)->packetData(), "AnxData", 7) == 0) {
+	//	//Seen all the annodex stuff.
+	//	mReadyForOgg = true;
+	//	return true;
+	//}
+
+	if (mReadyForOgg) {
+		if (mSkippedCMML == false) {
+			mSkippedCMML = true;
+			return true;
+		} else {
+			return AutoOggSeekTable::acceptOggPage(inOggPage);
+		}
+	}
+
+	return true;
+
+}

Added: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.h	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoAnxSeekTable.h	2004-07-15 14:53:36 UTC (rev 7137)
@@ -0,0 +1,22 @@
+#pragma once
+#include "AutoOggSeekTable.h"
+
+class LIBOOOGGSEEK_API AutoAnxSeekTable
+	:	public AutoOggSeekTable
+{
+public:
+	AutoAnxSeekTable(string inFileName);
+	virtual ~AutoAnxSeekTable(void);
+
+	//virtual bool buildTable();
+
+	//IOggCallback interface
+	virtual bool acceptOggPage(OggPage* inOggPage);
+
+protected:
+	unsigned long mAnxPackets;
+	bool mSeenAnything;
+	unsigned long mAnnodexSerialNo;
+	bool mReadyForOgg;
+	bool mSkippedCMML;
+};

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.h	2004-07-15 14:53:36 UTC (rev 7137)
@@ -49,10 +49,10 @@
static const __int64 DS_UNITS = 10000000;
static const LINT_MAX = 4294967295;

-	bool buildTable();
+	virtual bool buildTable();

//IOggCallback interface
-	bool acceptOggPage(OggPage* inOggPage);
+	virtual bool acceptOggPage(OggPage* inOggPage);

__int64 fileDuration();


Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/libOOOggSeek.vcproj
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/libOOOggSeek.vcproj	2004-07-15 07:52:16 UTC (rev 7136)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/libOOOggSeek.vcproj	2004-07-15 14:53:36 UTC (rev 7137)
@@ -129,6 +129,9 @@
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
+				RelativePath=".\AutoAnxSeekTable.cpp">
+			</File>
+			<File
RelativePath="AutoOggSeekTable.cpp">
</File>
<File
@@ -160,6 +163,9 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc">
<File
+				RelativePath=".\AutoAnxSeekTable.h">
+			</File>
+			<File
RelativePath="AutoOggSeekTable.h">
</File>
<File



More information about the commits mailing list