[xiph-commits] r8591 - in trunk/oggdsf: sln/oggdsf_all src/lib/helper src/lib/helper/libOOOggChef src/tools/mod_oggchef

ozone at motherfish-iii.xiph.org ozone at motherfish-iii.xiph.org
Mon Jan 3 01:20:14 PST 2005


Author: ozone
Date: 2005-01-03 01:20:13 -0800 (Mon, 03 Jan 2005)
New Revision: 8591

Added:
   trunk/oggdsf/src/lib/helper/libOOOggChef/
   trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp
   trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h
   trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.cpp
   trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.h
   trunk/oggdsf/src/lib/helper/libOOOggChef/ReadMe.txt
   trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.cpp
   trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.h
   trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj
   trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.cpp
   trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.h
Modified:
   trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
   trunk/oggdsf/src/tools/mod_oggchef/README.txt
   trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.cpp
   trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.vcproj
Log:
oggdsf:
 * Updated mod_oggchef README.txt
 * Split core mod_oggchef functionality into a separate libOOOggChef library
 * Broke timed URI seeking in mod_oggchef (will fix this back up soon)
 * Added logical bitstream extraction to mod_oggchef


Modified: trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
===================================================================
--- trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln	2005-01-03 09:20:13 UTC (rev 8591)
@@ -1113,6 +1113,7 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_oggchef", "..\..\src\tools\mod_oggchef\mod_oggchef.vcproj", "{F8FDD992-E21A-483F-BBE7-305D10163DE4}"
 	ProjectSection(ProjectDependencies) = postProject
 		{223ACC19-608E-4E1B-A054-067F0CACB272} = {223ACC19-608E-4E1B-A054-067F0CACB272}
+		{3D55194E-6732-4A74-A947-EDFF585A0F19} = {3D55194E-6732-4A74-A947-EDFF585A0F19}
 		{9A14F6AC-BC6E-401A-A300-07369BD6C5FE} = {9A14F6AC-BC6E-401A-A300-07369BD6C5FE}
 		{2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
 	EndProjectSection
@@ -1121,6 +1122,13 @@
 	ProjectSection(ProjectDependencies) = postProject
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOOOggChef", "..\..\src\lib\helper\libOOOggChef\libOOOggChef.vcproj", "{3D55194E-6732-4A74-A947-EDFF585A0F19}"
+	ProjectSection(ProjectDependencies) = postProject
+		{223ACC19-608E-4E1B-A054-067F0CACB272} = {223ACC19-608E-4E1B-A054-067F0CACB272}
+		{9A14F6AC-BC6E-401A-A300-07369BD6C5FE} = {9A14F6AC-BC6E-401A-A300-07369BD6C5FE}
+		{2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
+	EndProjectSection
+EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libTemporalURI", "..\..\src\lib\helper\libTemporalURI\libTemporalURI.vcproj", "{37CA269C-45DF-4DF7-9C12-3FE3B651D6FC}"
 	ProjectSection(ProjectDependencies) = postProject
 		{2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
@@ -2460,6 +2468,26 @@
 		{A7E7277C-1F4A-4F43-97F7-ABD1C61FD6EB}.Release_SSE.Build.0 = Release|.NET
 		{A7E7277C-1F4A-4F43-97F7-ABD1C61FD6EB}.Release_SSE2.ActiveCfg = Release|.NET
 		{A7E7277C-1F4A-4F43-97F7-ABD1C61FD6EB}.Release_SSE2.Build.0 = Release|.NET
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Debug.ActiveCfg = Debug|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Debug.Build.0 = Debug|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Debug Unicode.ActiveCfg = Debug|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Debug Unicode.Build.0 = Debug|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Debug__cdecl.ActiveCfg = Debug|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Debug__cdecl.Build.0 = Debug|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.MakeFile.ActiveCfg = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.MakeFile.Build.0 = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release.ActiveCfg = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release.Build.0 = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release Unicode.ActiveCfg = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release Unicode.Build.0 = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release__cdecl.ActiveCfg = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release__cdecl.Build.0 = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release_NoDotNET.ActiveCfg = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release_NoDotNET.Build.0 = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release_SSE.ActiveCfg = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release_SSE.Build.0 = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release_SSE2.ActiveCfg = Release|Win32
+		{3D55194E-6732-4A74-A947-EDFF585A0F19}.Release_SSE2.Build.0 = Release|Win32
 		{37CA269C-45DF-4DF7-9C12-3FE3B651D6FC}.Debug.ActiveCfg = Debug|Win32
 		{37CA269C-45DF-4DF7-9C12-3FE3B651D6FC}.Debug.Build.0 = Debug|Win32
 		{37CA269C-45DF-4DF7-9C12-3FE3B651D6FC}.Debug Unicode.ActiveCfg = Debug|Win32

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,269 @@
+#include "stdafx.h"
+
+#include <libOOOggChef/AnnodexRecomposer.h>
+
+#include <libOOOgg/libOOOgg.h>
+#include <libOOOggSeek/AutoAnxSeekTable.h>
+
+#include <fstream>
+#include <string>
+#include <vector>
+
+using namespace std;
+
+
+#define DEBUG
+
+
+AnnodexRecomposer::AnnodexRecomposer(string inFilename, BufferWriter inBufferWriter, void* inBufferWriterUserData)
+	:	mFilename(inFilename)
+	,	mDemuxState(SEEN_NOTHING)
+	,	mStartOfBodyOffset(0)
+	,	mRequestedTime(0)
+	,	mBufferWriter(inBufferWriter)
+	,	mBufferWriterUserData(inBufferWriterUserData)
+{
+}
+
+AnnodexRecomposer::~AnnodexRecomposer(void)
+{
+}
+
+
+void AnnodexRecomposer::recomposeStreamFrom(double inStartingTimeOffset,
+	const vector<const string>* inWantedMIMETypes)
+{
+	mWantedMIMETypes = inWantedMIMETypes;
+
+	fstream mFile;
+	mFile.open(mFilename.c_str(), ios_base::in | ios_base::binary);
+
+	static const size_t BUFF_SIZE = 8192;
+
+	// Build a seek table from the file, so we can find out the end location of
+	// the stream headers, and the byte position of the user's requested start
+	// time
+	AutoAnxSeekTable *locSeekTable = new AutoAnxSeekTable(mFilename);
+	locSeekTable->buildTable();
+	
+	// Seek to the user's requested start time
+	mStartOfBodyOffset = locSeekTable->getStartPos(0).second;
+	
+	mRequestedTime = (LOOG_UINT64) inStartingTimeOffset * 10000000;
+	//mRequestedTimeOffset = locSeekTable->getStartPos(locStartTime).second;
+
+	// TODO: Grab the headers from the stream (ack'ing preferred MIME type)
+	// TODO: Grab data from the stream at offset (ack'ing preferred MIME type)
+
+	OggDataBuffer locOggBuffer;
+	locOggBuffer.registerVirtualCallback(this);
+
+	char *locBuffer = new char[BUFF_SIZE];
+	for (;;)
+	{
+		mFile.read(locBuffer, BUFF_SIZE);
+		unsigned long locBytesRead = mFile.gcount();
+		if (locBytesRead <= 0) {
+			break;
+		}
+		locOggBuffer.feed((unsigned char *) locBuffer, locBytesRead);
+	}
+
+	// Tidy up
+	mFile.close();
+}
+
+bool isAnnodexBOSPage (OggPage *inOggPage)
+{
+	return (
+			inOggPage->numPackets() == 1
+		&&	inOggPage->header()->isBOS()
+		&&	strncmp((char*)inOggPage->getPacket(0)->packetData(),
+		            "Annodex\0", 8) == 0
+		   );
+}
+
+bool isAnxDataPage (OggPage *inOggPage)
+{
+	return (
+			inOggPage->numPackets() == 1
+		&&	inOggPage->header()->isBOS()
+		&&	strncmp((char*)inOggPage->getPacket(0)->packetData(),
+		            "AnxData\0", 8) == 0
+		   );
+}
+
+bool isAnnodexEOSPage (OggPage *inOggPage, unsigned long locAnnodexSerialNumber)
+{
+	return (
+			inOggPage->header()->isEOS()
+		&&	inOggPage->header()->StreamSerialNo() == locAnnodexSerialNumber
+		   );
+}
+
+unsigned long secondaryHeaders(OggPacket* inPacket)
+{
+	const unsigned short NUM_SEC_HEADERS_OFFSET = 24;
+
+	return iLE_Math::charArrToULong(inPacket->packetData() +
+									NUM_SEC_HEADERS_OFFSET);
+
+}
+
+string mimeType(OggPacket* inPacket)
+{
+	const unsigned short CONTENT_TYPE_OFFSET = 28;
+
+	if (_strnicmp((char *) inPacket->packetData() + CONTENT_TYPE_OFFSET,
+		          "Content-Type: ", 14) == 0)
+	{
+		const unsigned short MIME_TYPE_OFFSET = 28 + 14;
+		const unsigned short MAX_MIME_TYPE_LENGTH = 256;
+		char *locMimeType = new char[MAX_MIME_TYPE_LENGTH];
+		sscanf((char *) inPacket->packetData() + MIME_TYPE_OFFSET, "%s\r\n", locMimeType);
+		return locMimeType;
+	} else {
+		return NULL;
+	}
+}
+
+bool wantOnlyPacketBody(const vector<const string>* inWantedMIMETypes)
+{
+	// TODO: This should check for packet bodies generally, not text/x-cmml
+
+	return (	inWantedMIMETypes->size() == 1
+			&&	inWantedMIMETypes->at(0) == "text/x-cmml");
+}
+
+bool AnnodexRecomposer::acceptOggPage(OggPage* inOggPage)
+{
+	switch (mDemuxState) {
+
+		case SEEN_NOTHING:
+			if (isAnnodexBOSPage(inOggPage)) {
+				mDemuxState = SEEN_ANNODEX_BOS;
+
+				// Remember the Annodex stream's serial number, so we can output it later
+				mAnnodexSerialNumber = inOggPage->header()->StreamSerialNo();
+				mWantedStreamSerialNumbers.push_back(make_pair<unsigned long, unsigned long>(mAnnodexSerialNumber, 0));
+
+				if (!wantOnlyPacketBody(mWantedMIMETypes)) {
+					// Send out the page
+					mBufferWriter(inOggPage->createRawPageData(),
+						inOggPage->pageSize(), mBufferWriterUserData);
+				}
+			} else {
+				// The Annodex BOS page should always be the very first page of
+				// the stream, so if we don't see it, the stream's invalid
+				mDemuxState = INVALID;
+			}
+			break;
+
+		case SEEN_ANNODEX_BOS:
+			if (isAnxDataPage(inOggPage)) {
+				unsigned long locSerialNumber = inOggPage->header()->StreamSerialNo();
+				string locMimeType = mimeType(inOggPage->getPacket(0));
+
+				for (unsigned int i = 0; i < mWantedMIMETypes->size(); i++) {
+					if (	mWantedMIMETypes->at(i) == locMimeType
+						||	mWantedMIMETypes->at(i) == "*/*" /* accept all */) {
+						// Create an association of serial no and num headers
+						tSerial_HeadCountPair locMap;
+						locMap.first = locSerialNumber;
+						locMap.second = secondaryHeaders(inOggPage->getPacket(0));
+
+						// Add the association to our stream list
+						mWantedStreamSerialNumbers.push_back(locMap);
+
+						if (!wantOnlyPacketBody(mWantedMIMETypes)) {
+							mBufferWriter(inOggPage->createRawPageData(),
+								inOggPage->pageSize(), mBufferWriterUserData);
+						}
+
+						break;
+					}
+				}
+			} else if (isAnnodexEOSPage(inOggPage, mAnnodexSerialNumber)) {
+				mDemuxState = SEEN_ANNODEX_EOS;
+				if (!wantOnlyPacketBody(mWantedMIMETypes)) {
+					mBufferWriter(inOggPage->createRawPageData(),
+						inOggPage->pageSize(), mBufferWriterUserData);
+				}
+			} else {
+				// We didn't spot either an AnxData page or the Annodex EOS: WTF?
+				mDemuxState = INVALID;
+			}
+			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 (wantOnlyPacketBody(mWantedMIMETypes)) {
+								OggPacket* locPacket = inOggPage->getPacket(0);
+								mBufferWriter(locPacket->packetData(),
+									locPacket->packetSize(), mBufferWriterUserData);
+							} else {
+								mBufferWriter(inOggPage->createRawPageData(),
+									inOggPage->pageSize(), mBufferWriterUserData);
+							}
+						} else {
+							mDemuxState = INVALID;
+						}
+					}
+				}
+
+				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:
+			{
+				// Only output streams which the user requested
+				for (unsigned int i = 0; i < mWantedStreamSerialNumbers.size(); i++) {
+					if (	mWantedStreamSerialNumbers[i].first
+						==	inOggPage->header()->StreamSerialNo()) {
+						if (wantOnlyPacketBody(mWantedMIMETypes)) {
+							for (unsigned long j = 0; j < inOggPage->numPackets(); j++) {
+								OggPacket* locPacket = inOggPage->getPacket(j);
+								if (locPacket->packetSize() > 0) {
+									mBufferWriter(locPacket->packetData(),
+										locPacket->packetSize(), mBufferWriterUserData);
+								}
+							}
+						} else {
+							mBufferWriter(inOggPage->createRawPageData(),
+								inOggPage->pageSize(), mBufferWriterUserData);
+						}
+					}
+				}
+			}
+			break;
+		case INVALID:
+			break;
+		default:
+			break;
+	}
+
+	if (mDemuxState == INVALID) {
+	}
+
+	// Tidy up
+	delete inOggPage;
+	inOggPage = NULL;
+
+	return true;
+}
+


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,58 @@
+#pragma once
+
+
+#include "IRecomposer.h"
+
+#include <libOOOgg/libOOOgg.h>
+#include <libOOOggChef/libOOOggChef.h>
+
+#include <string>
+#include <vector>
+
+using namespace std;
+
+class LIBOOOGGCHEF_API AnnodexRecomposer : public IRecomposer, public IOggCallback
+{
+public:
+	typedef bool (*BufferWriter) (unsigned char *buffer, unsigned long bufferSize, void *userData);
+
+	AnnodexRecomposer(void);
+	AnnodexRecomposer(string inFilename, BufferWriter inBufferWriter, void* inBufferWriterUserData);
+	~AnnodexRecomposer(void);
+
+	void recomposeStreamFrom(double inStartingTimeOffset, const vector<const string>* inWantedMIMETypes);
+	bool acceptOggPage(OggPage* inOggPage);
+
+    AnnodexRecomposer(const AnnodexRecomposer&);  // Don't copy me
+    AnnodexRecomposer &operator=(const AnnodexRecomposer&);  // Don't assign men
+
+protected:
+
+	typedef pair<unsigned long, unsigned long> tSerial_HeadCountPair;
+
+	enum eDemuxState {
+		SEEN_NOTHING,
+		SEEN_ANNODEX_BOS,
+		SEEN_ANNODEX_EOS,
+		SEEN_ALL_CODEC_HEADERS,
+		INVALID = 100,
+	};
+
+	void sendPage(OggPage* inOggPage);
+
+	BufferWriter mBufferWriter;
+	void* mBufferWriterUserData;
+
+	string mFilename;
+	fstream mFile;
+
+	unsigned long mStartOfBodyOffset; // Deprecate?
+	unsigned long mRequestedTimeOffset; // Deprecate
+	unsigned long mAnnodexSerialNumber;
+
+	LOOG_INT64 mRequestedTime;
+
+	eDemuxState mDemuxState;
+	vector<tSerial_HeadCountPair> mWantedStreamSerialNumbers;
+	const vector<const string>* mWantedMIMETypes;
+};


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.cpp	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.cpp	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,13 @@
+#include "stdafx.h"
+
+#include <libOOOggChef/IRecomposer.h>
+
+
+IRecomposer::IRecomposer(void)
+{
+}
+
+IRecomposer::~IRecomposer(void)
+{
+}
+


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.h	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.h	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <libOOOggChef/libOOOggChef.h>
+
+#include <string>
+#include <vector>
+
+using namespace std;
+
+class LIBOOOGGCHEF_API IRecomposer
+{
+public:
+	IRecomposer(void);
+	virtual ~IRecomposer(void);
+
+	virtual void recomposeStreamFrom(double inStartingTimeOffset, const vector<const string>* inWantedMIMETypes) = 0;
+
+};


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/IRecomposer.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/ReadMe.txt
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/ReadMe.txt	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/ReadMe.txt	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,53 @@
+========================================================================
+    WIN32 APPLICATION : libOOOggChef Project Overview
+========================================================================
+
+AppWizard has created this libOOOggChef application for you.  
+This file contains a summary of what you will find in each of the files that
+make up your libOOOggChef application.
+
+
+libOOOggChef.vcproj
+    This is the main project file for VC++ projects generated using an Application Wizard. 
+    It contains information about the version of Visual C++ that generated the file, and 
+    information about the platforms, configurations, and project features selected with the
+    Application Wizard.
+
+libOOOggChef.cpp
+    This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+AppWizard has created the following resources:
+
+libOOOggChef.rc
+    This is a listing of all of the Microsoft Windows resources that the
+    program uses.  It includes the icons, bitmaps, and cursors that are stored
+    in the RES subdirectory.  This file can be directly edited in Microsoft
+    Visual C++.
+
+Resource.h
+    This is the standard header file, which defines new resource IDs.
+    Microsoft Visual C++ reads and updates this file.
+libOOOggChef.ico
+    This is an icon file, which is used as the application's icon (32x32).
+    This icon is included by the main resource file libOOOggChef.rc.
+
+small.ico
+    This is an icon file, which contains a smaller version (16x16)
+    of the application's icon. This icon is included by the main resource
+    file libOOOggChef.rc.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named libOOOggChef.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/ReadMe.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.cpp	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.cpp	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,54 @@
+//===========================================================================
+//Copyright (C) 2005 Zentaro Kavanagh
+//Copyright (C) 2005 Commonwealth Scientific and Industrial Research
+//                   Organisation (CSIRO) Australia
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+//  notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+//  notice, this list of conditions and the following disclaimer in the
+//  documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors 
+//  may be used to endorse or promote products derived from this software 
+//  without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
+
+// libOOOggChef.cpp : Defines the entry point for the DLL application.
+//
+
+#include "stdafx.h"
+
+BOOL APIENTRY DllMain( HANDLE, 
+                       DWORD  ul_reason_for_call, 
+                       LPVOID
+					 )
+{
+	switch (ul_reason_for_call)
+	{
+	case DLL_PROCESS_ATTACH:
+	case DLL_THREAD_ATTACH:
+	case DLL_THREAD_DETACH:
+	case DLL_PROCESS_DETACH:
+		break;
+	}
+    return TRUE;
+}
+


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.h	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.h	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,12 @@
+#pragma once
+
+
+#ifdef WIN32
+# ifdef LIBOOOGGCHEF_EXPORTS
+#  define LIBOOOGGCHEF_API __declspec(dllexport)
+# else
+#  define LIBOOOGGCHEF_API __declspec(dllimport)
+# endif
+#else  /* assume POSIX */
+# define LIBOOOGGCHEF_API
+#endif


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/libOOOggChef.vcproj	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="libOOOggChef"
+	ProjectGUID="{3D55194E-6732-4A74-A947-EDFF585A0F19}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="2"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\core\ogg;.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBOOOGGCHEF_EXPORTS"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="3"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CallingConvention="2"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libOOOggChef.dll"
+				LinkIncremental="2"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/libOOOggChef.pdb"
+				SubSystem="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="2"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\core\ogg;.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBOOOGGCHEF_EXPORTS"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="3"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CallingConvention="2"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libOOOggChef.dll"
+				LinkIncremental="1"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath=".\AnnodexRecomposer.cpp">
+			</File>
+			<File
+				RelativePath=".\IRecomposer.cpp">
+			</File>
+			<File
+				RelativePath=".\libOOOggChef.cpp">
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\AnnodexRecomposer.h">
+			</File>
+			<File
+				RelativePath=".\IRecomposer.h">
+			</File>
+			<File
+				RelativePath=".\libOOOggChef.h">
+			</File>
+			<File
+				RelativePath=".\stdafx.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt">
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.cpp	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.cpp	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// libOOOggChef.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.h	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.h	2005-01-03 09:20:13 UTC (rev 8591)
@@ -0,0 +1,15 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+
+#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h>
+
+// TODO: reference additional headers your program requires here
+#include <libOOOgg/libOOOgg.h>
+#include <libOOOggSeek/libOOOggSeek.h>


Property changes on: trunk/oggdsf/src/lib/helper/libOOOggChef/stdafx.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/oggdsf/src/tools/mod_oggchef/README.txt
===================================================================
--- trunk/oggdsf/src/tools/mod_oggchef/README.txt	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/tools/mod_oggchef/README.txt	2005-01-03 09:20:13 UTC (rev 8591)
@@ -1,11 +1,51 @@
-mod_timeslice
-=============
+mod_oggchef
+===========
 
-mod_timeslice is an Apache 2 module which enables server-side seeking into
-media files via timed URIs.  Currently, if a media player client wishes to
-start playback of a multimedia file from an HTTP server at 15 seconds
-(i.e. seek to 15 seconds), it has two choices.  It can:
+mod_oggchef is an Apache 2 module which enables the web server to
+dynamically recompose media, according to the client's wishes.  It can:
 
+* Serve out only certain tracks (logical bitstreams) from the host's Ogg
+  file, by using the HTTP "Accept:" header field.  For example, an HTTP
+  request with the header "Accept: video/x-theora" can be used to serve
+  out only the video track, with no audio track.
+
+* Serve out the media with a specific time interval via timed URIs.  For
+  example, a web client can request playback of the media beginning at 30
+  minutes into a movie.
+
+
+Extracting Tracks
+-----------------
+
+Track extraction is performed via the HTTP "Accept:" header.  mod_oggchef
+maintains a map of MIME types to logical bitstream formats, as follows:
+
+* application/x-annodex: Annodex-encapsulated file (i.e. serve out the
+  entire media file)
+* application/ogg & application/x-ogg: Ogg-encapsulated file (i.e. serve
+  out the entire media file).  Note that if the host file is an Annodex
+  file, the Annodex headers will be stripped off, so a standard Ogg file
+  is delivered.
+* audio/x-speex: the Speex audio codec encapsulated inside an Ogg
+  stream.
+* audio/x-vorbis: the Vorbis audio codec encapsulated inside an Ogg
+  stream.
+* text/x-cmml: CMML metadata.
+* video/x-theora: the Theora video codec encapsulated inside an Ogg
+  stream.
+
+
+Timed URIs (server-side seeking)
+--------------------------------
+
+NOTE: This is currently broken, so currently, requested timed URIs won't
+work (it'll just be served out from the starting time, always).  I'll fix
+it up over the next day or two.
+
+Currently, if a media player client wishes to start playback of
+a multimedia file from an HTTP server at 15 seconds (i.e. seek to 15
+seconds), it has two choices.  It can:
+
     1.  Download the media file from the beginning, and simply wait until
 	15 seconds of data have been received.  This is what many media
 	players do.
@@ -17,7 +57,7 @@
 	client generally has to perform a bisection search (such as
 	a binary search) over the network.
 
-With mod_timeslice, the client can ask the web server to play back
+With mod_oggchef, the client can ask the web server to play back
 a resource at a particular time point by using a timed URI.  As an
 example, to play back the media file http://example.com/foo.anx starting
 at 15 seconds, the client simply appends the timed URI query '?t=15', e.g.
@@ -29,16 +69,16 @@
 different time scheme formats, see
 <http://www.annodex.net/specifications.html>.
 
-Note that mod_timeslice is effectively a re-implementation of the timed
+Note that mod_oggchef is effectively a re-implementation of the timed
 URI capability of mod_annodex <http://www.annodex.net/installation.html>.
 mod_annodex is far more powerful, being able to dynamically generate
 Annodex media from CMML files, and serve out only the CMML portion of
 Annodex media.  These features will be added in the future, though
-possibly not to mod_timeslice itself.
+possibly not to mod_oggchef itself.
 
 
-What Works
-----------
+Restrictions
+------------
 
 * Currently, only Annodex media files are supported.  Support for Ogg
   files will be forthcoming.
@@ -68,7 +108,7 @@
 
 Windows:
 
-* Windows developers can simply open up the mod_timeslice.vcproj Visual
+* Windows developers can simply open up the mod_oggchef.vcproj Visual
   Studio project file and build that.  Note that the project file is
   pre-configured to use the standard Apache 2 installation path of
   C:\Program Files\Apache Group\Apache2, and of course requires the Apache
@@ -91,14 +131,14 @@
 * Add the "application/x-annodex" MIME type to your Apache's mime.types
   file, for file extensions anx, axa and axv.
 
-* Edit your httpd.conf file to enable mod_timeslice by inserting the
+* Edit your httpd.conf file to enable mod_oggchef by inserting the
   following line:
 
-  LoadModule timeslice_module /path/to/mod_timeslice.so
+  LoadModule oggchef_module /path/to/mod_oggchef.so
 
 Windows:
 
-* Copy mod_timeslice.so (and mod_timeslice.pdb, if you want to use the
+* Copy mod_oggchef.so (and mod_oggchef.pdb, if you want to use the
   Visual Studio Debugger with Apache) to Apache's module directory,
   usually at C:\Program Files\Apache Group\Apache2\modules.
 

Modified: trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.cpp
===================================================================
--- trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.cpp	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.cpp	2005-01-03 09:20:13 UTC (rev 8591)
@@ -51,19 +51,22 @@
 #include <libOOOgg/libOOOgg.h>
 #include <libOOOgg/dllstuff.h>
 #include <libOOOggSeek/AutoAnxSeekTable.h>
+#include <libOOOggSeek/AutoOggSeekTable.h>
+#include <libOOOggChef/AnnodexRecomposer.h>
+#include <libOOOggChef/IRecomposer.h>
 
+
+#include <algorithm>
 #include <iostream>
 #include <fstream>
+#include <list>
+#include <string>
 
+#define DEBUG
 
 
-/* Note: This file's pretty ugly at the moment, it's basically a merge of the
-   mod_annodex_ap20 source code and AnxCutter.  Don't worry, it will be tidied
-   up :)
- */
+#if 0
 
-#define DEBUG
-
 #define ANX_MIME_TYPE "application/x-annodex"
 #define CMML_MIME_TYPE "text/x-cmml"
 
@@ -301,50 +304,158 @@
   ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
                 "Served request");
 }
+#endif
 
+bool isAnnodexFile (string locFilename)
+{
+	string locExtension = locFilename.substr(locFilename.length() - 4);
 
+	return (locExtension == ".anx" || locExtension == ".axv" || locExtension == ".axa");
+}
+
+bool isOggFile (string locFilename)
+{
+	string locExtension = locFilename.substr(locFilename.length() - 4);
+
+	return (locExtension == ".ogg" || locExtension == ".ogm");
+}
+
+typedef pair<float, char *> tQualityPair;
+
+bool qualityPairComparator (const tQualityPair &p1, const tQualityPair &p2)
+{
+	return (p2.first < p1.first);
+}
+
+const vector<const string> *preferredOutputMIMETypes(request_rec *inRequest)
+{
+
+	// If the user requested the application/ mime type (i.e. the entire
+	// encapsulated file), then just return everything
+	string locFilename = inRequest->filename;
+	if (	(		isAnnodexFile(locFilename)
+				&&	get_accept_quality(inRequest, "application/x-annodex") == 1.0
+			)
+		||	(		isOggFile(locFilename)
+				&& (	get_accept_quality(inRequest, "application/ogg")   == 1.0
+					||	get_accept_quality(inRequest, "application/x-ogg") == 1.0)
+			)
+		)
+	{
+		vector<const string>* locAcceptAllMimeTypes = new vector<const string>;
+		locAcceptAllMimeTypes->push_back("*/*");
+		return const_cast<const vector<const string>*> (locAcceptAllMimeTypes);
+	}
+
+	vector<tQualityPair> locQualityList;
+	
+	// TODO: We hardcode the types in here for the moment: we should really
+	// iterate over the list of Accept: types.  Note that this is in order
+	// of priority!
+
+#define MIME_QUALITY_PAIR(s) ( make_pair<float, char *>(get_accept_quality(inRequest, s), s) )
+	locQualityList.push_back( MIME_QUALITY_PAIR("application/x-annodex") );
+	locQualityList.push_back( MIME_QUALITY_PAIR("application/ogg") );
+	locQualityList.push_back( MIME_QUALITY_PAIR("application/x-ogg") );
+	locQualityList.push_back( MIME_QUALITY_PAIR("audio/x-speex") );
+	locQualityList.push_back( MIME_QUALITY_PAIR("audio/x-vorbis") );
+	locQualityList.push_back( MIME_QUALITY_PAIR("text/x-cmml") );
+	locQualityList.push_back( MIME_QUALITY_PAIR("video/x-theora") );
+#undef MIME_QUALITY_PAIR
+
+	// TODO: Implement wanted MIME types given the above list and qualities
+
+	// Sort the list in order of Accept: quality (so 1.0 is first, 0.0 is last)
+	sort(locQualityList.begin(), locQualityList.end(), qualityPairComparator);
+
+	// Since we have a quality rating now, output only the first (preferred)
+	// MIME type that we want
+	vector<const string>* locMIMETypes = new vector<const string>;
+	tQualityPair locElement = locQualityList[0];
+	const string locMIMEType = locElement.second;
+	locMIMETypes->push_back(locMIMEType);
+
+	return const_cast<const vector<const string>*> (locMIMETypes);
+}
+
+bool httpDataSender (unsigned char *inBuffer, unsigned long inBufferLength, void *inUserData)
+{
+	request_rec *locRequest = (request_rec *) inUserData;
+
+	ap_rwrite(inBuffer, inBufferLength, locRequest);
+
+	return true;
+}
+
 extern "C" {
 
-/* The annodex content handler */
-static int AP_MODULE_ENTRY_POINT annodex_handler(request_rec *r)
+static int AP_MODULE_ENTRY_POINT oggchef_handler(request_rec *inRequest)
 {
-  apr_uri_t * uri;
-  char * filename;
-  apr_table_t * cgi_table;
+	apr_uri_t *locURI = &(inRequest->parsed_uri);
 
-	   ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
-                  "Got here 2");
+	// Grab the local filename (which is determined by the requested URL)
+	string locFilename = inRequest->filename;
 
-  uri = &(r->parsed_uri);
+	// Make a name=value table of the CGI query parameters
+	apr_table_t* locCGITable = make_cgi_table (inRequest, locURI->query);
 
-  /* usually filename is request filename */
-  filename = r->filename;
+	// Find out what time we're meant to start serving stuff out at
+	const char* locRequestedStartTimeAsCString =
+		(const char *) apr_table_get (locCGITable, "t");
+	double locRequestedStartTime =
+		anx_parse_time(locRequestedStartTimeAsCString);
 
-	   ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
-                  "filename is %s", filename);
+	// What's the output MIME type requested?
+	const vector<const string>* locOutputMIMETypes = preferredOutputMIMETypes(inRequest);
 
-  cgi_table = make_cgi_table (r, uri->query);
+#ifdef DEBUG
+	for (unsigned int i = 0; i < locOutputMIMETypes->size(); i++) {
+		string locMIMEType = locOutputMIMETypes->at(i);
+		ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, inRequest,
+			"Wanted MIMEs %d: %s", i, locMIMEType.c_str());
+	}
+#endif
 
-  ma_anxenc (r, r->filename, ANX_MIME_TYPE, cgi_table);
+	// Poor man's factory: create a new class to dynamically generate the Ogg
+	// file according to the user's wishes
+	IRecomposer *locRecomposer = NULL;
+	if (isAnnodexFile(locFilename)) {
+		locRecomposer = new AnnodexRecomposer(locFilename, httpDataSender, inRequest);
+	} else if (isOggFile(locFilename)) {
+		//locRecomposer = new OggRecomposer(locOutputMIMETypes);
+	} else {
+		// We should never get here
+		ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, inRequest,
+					  "Couldn't identify filename %s", locFilename.c_str());
+	}
 
-  return OK;
+	locRecomposer->recomposeStreamFrom(locRequestedStartTime, locOutputMIMETypes);
+
+	// Clean up
+	delete locOutputMIMETypes;
+	delete locRecomposer;
+
+	return OK;
 }
 
-static void AP_MODULE_ENTRY_POINT annodex_register_hooks(apr_pool_t *p)
+
+static void AP_MODULE_ENTRY_POINT oggchef_register_hooks(apr_pool_t *)
 {
-    ap_hook_handler(AP_HOOK_HANDLER_FUNCTION(annodex_handler),
-		            NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_handler(AP_HOOK_HANDLER_FUNCTION(oggchef_handler),
+		            NULL,
+					NULL,
+					APR_HOOK_MIDDLE);
 }
 
 /* Dispatch list for API hooks */
-module AP_MODULE_DECLARE_DATA timeslice_module = {
+module AP_MODULE_DECLARE_DATA oggchef_module = {
     STANDARD20_MODULE_STUFF, 
     NULL,                  /* create per-dir    config structures */
     NULL,                  /* merge  per-dir    config structures */
     NULL,                  /* create per-server config structures */
     NULL,                  /* merge  per-server config structures */
     NULL,                  /* table of config file commands       */
-    AP_REGISTER_HOOK_FUNCTION(annodex_register_hooks)  /* register hooks */
+    AP_REGISTER_HOOK_FUNCTION(oggchef_register_hooks)  /* register hooks */
 };
 
 } /* extern "C" */

Modified: trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.vcproj
===================================================================
--- trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.vcproj	2005-01-03 06:36:22 UTC (rev 8590)
+++ trunk/oggdsf/src/tools/mod_oggchef/mod_oggchef.vcproj	2005-01-03 09:20:13 UTC (rev 8591)
@@ -175,6 +175,9 @@
 		</Configuration>
 	</Configurations>
 	<References>
+		<ProjectReference
+			ReferencedProjectIdentifier="{3D55194E-6732-4A74-A947-EDFF585A0F19}"
+			Name="libOOOggChef"/>
 	</References>
 	<Files>
 		<Filter



More information about the commits mailing list