[xiph-commits] r8297 - in trunk/oggdsf: docs sln/oggdsf_all
src/lib/core/annodex src/lib/core/annodex/libOOAnnodex
src/lib/core/directshow src/lib/core/directshow/dsfAnxMux
src/lib/core/directshow/dsfOggDemux
src/lib/core/directshow/dsfOggMux src/lib/core/ogg/libOOOgg
src/lib/core/ogg/libOOOggSeek src/lib/helper/libilliCore
src/tests/testLibOOOgg
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Mon Nov 29 01:52:55 PST 2004
Author: illiminable
Date: 2004-11-29 01:52:54 -0800 (Mon, 29 Nov 2004)
New Revision: 8297
Added:
trunk/oggdsf/docs/OggPaginator.txt
trunk/oggdsf/docs/anx_mux.txt
trunk/oggdsf/docs/libOOOgg.txt
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.cpp
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.h
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.cpp
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.h
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/ReadMe.txt
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.cpp
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.h
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.vcproj
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/stdafx.cpp
trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/stdafx.h
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.h
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.h
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.cpp
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.h
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.cpp
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.h
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/ReadMe.txt
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/anxmuxdllstuff.h
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.cpp
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.h
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.cpp
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h
trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.cpp
trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.h
trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.cpp
trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.h
trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.cpp
trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.h
trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.cpp
trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.h
Modified:
trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/VorbisStream.h
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.h
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.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/libOOOgg/OggMuxStream.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.h
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.h
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp
trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h
trunk/oggdsf/src/tests/testLibOOOgg/stdafx.h
trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.cpp
trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.vcproj
Log:
* Started Annodex mux.
* Added the start of a testset for libooogg
Added: trunk/oggdsf/docs/OggPaginator.txt
===================================================================
--- trunk/oggdsf/docs/OggPaginator.txt 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/docs/OggPaginator.txt 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1 @@
+* Need a reset method to put it in initial state again.
\ No newline at end of file
Added: trunk/oggdsf/docs/anx_mux.txt
===================================================================
Added: trunk/oggdsf/docs/libOOOgg.txt
===================================================================
--- trunk/oggdsf/docs/libOOOgg.txt 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/docs/libOOOgg.txt 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,4 @@
+* Need to enforce max page size restrictions more tightly, some pages go slightly over.
+
+* Need to make sure on a finish stream call to the paginator, if there is nothing buffered,
+ it adds the granule pos of the previous page as the graneul pos of the empty EOS page.
Modified: trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
===================================================================
--- trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln 2004-11-29 09:52:54 UTC (rev 8297)
@@ -1220,8 +1220,14 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testLibOOOgg", "..\..\src\tests\testLibOOOgg\testLibOOOgg.vcproj", "{6B993E86-7283-4324-B4C4-F047930FB5FF}"
ProjectSection(ProjectDependencies) = postProject
+ {223ACC19-608E-4E1B-A054-067F0CACB272} = {223ACC19-608E-4E1B-A054-067F0CACB272}
+ {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsfAnxMux", "..\..\src\lib\core\directshow\dsfAnxMux\dsfAnxMux.vcproj", "{685D495F-1620-459A-9EE3-BAD4F619B2C2}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -2469,6 +2475,22 @@
{6B993E86-7283-4324-B4C4-F047930FB5FF}.Release_SSE.Build.0 = Release|Win32
{6B993E86-7283-4324-B4C4-F047930FB5FF}.Release_SSE2.ActiveCfg = Release|Win32
{6B993E86-7283-4324-B4C4-F047930FB5FF}.Release_SSE2.Build.0 = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Debug.ActiveCfg = Debug|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Debug.Build.0 = Debug|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Debug Unicode.ActiveCfg = Debug|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Debug Unicode.Build.0 = Debug|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.MakeFile.ActiveCfg = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.MakeFile.Build.0 = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release.ActiveCfg = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release.Build.0 = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release Unicode.ActiveCfg = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release Unicode.Build.0 = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release_NoDotNET.ActiveCfg = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release_NoDotNET.Build.0 = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release_SSE.ActiveCfg = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release_SSE.Build.0 = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release_SSE2.ActiveCfg = Release|Win32
+ {685D495F-1620-459A-9EE3-BAD4F619B2C2}.Release_SSE2.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionItems) = postSolution
EndGlobalSection
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,185 @@
+#include "StdAfx.h"
+#include ".\anxpacketmaker.h"
+
+AnxPacketMaker::AnxPacketMaker(void)
+{
+}
+
+AnxPacketMaker::~AnxPacketMaker(void)
+{
+}
+
+OggPage* AnxPacketMaker::makeAnnodexBOS ( unsigned long inSerialNo
+ , unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inTimebaseNum
+ , unsigned __int64 inTimebaseDenom
+ , const char* inUTC
+
+ )
+{
+ unsigned char* locBuff = NULL;
+ StampedOggPacket* locPack = NULL;
+ OggPage* retPage = NULL;
+ unsigned char* locSegTable = NULL;
+ switch (inVersionMajor) {
+ case 2:
+ locBuff = new unsigned char[ANX_2_0_ANNODEX_BOS_SIZE];
+
+ // 0 - 7 Annodex\0
+ // 8 - 9 Version Major
+ // 10 - 11 Version Minor
+ // 12 - 19 Timebase Num
+ // 20 - 27 Timebase Denom
+ // 28 = 48 UTC
+ locBuff[0] = 'A';
+ locBuff[1] = 'n';
+ locBuff[2] = 'n';
+ locBuff[3] = 'o';
+ locBuff[4] = 'd';
+ locBuff[5] = 'e';
+ locBuff[6] = 'x';
+ locBuff[7] = 0;
+ iLE_Math::UShortToCharArr(inVersionMajor, locBuff + 8);
+ iLE_Math::UShortToCharArr(inVersionMinor, locBuff + 10);
+ iLE_Math::Int64ToCharArr(inTimebaseNum, locBuff + 12);
+ iLE_Math::Int64ToCharArr(inTimebaseDenom, locBuff + 20);
+ for (int i = 0; i < 20; i++) {
+ locBuff[28 + i] = inUTC[i];
+ }
+
+ locPack = new StampedOggPacket(locBuff, ANX_2_0_ANNODEX_BOS_SIZE, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
+
+ retPage = new OggPage;
+ retPage->header()->setHeaderFlags(2);
+ retPage->header()->setGranulePos((__int64)0);
+ retPage->header()->setNumPageSegments( 1);
+ locSegTable = new unsigned char[1];
+ locSegTable[0] = ANX_2_0_ANNODEX_BOS_SIZE;
+ retPage->header()->setSegmentTable(locSegTable, 1);
+ retPage->header()->setHeaderSize(28);
+ retPage->header()->setDataSize(ANX_2_0_ANNODEX_BOS_SIZE);
+
+ retPage->header()->setStreamSerialNo(inSerialNo);
+ retPage->addPacket(locPack);
+
+ return retPage;
+
+ default:
+ return NULL;
+
+
+ }
+}
+
+StampedOggPacket* AnxPacketMaker::makeAnxData ( unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inGranuleRateNum
+ , unsigned __int64 inGranuleRateDenom
+ , unsigned long inNumSecHeaders
+ , vector<string> inMessageHeaders
+ )
+{
+
+ StampedOggPacket* locPack = NULL;
+ OggPage* retPage = NULL;
+ unsigned char* locBuff = NULL;
+ unsigned long locUpto = 0;
+ unsigned long locPacketSize = 0;
+ switch (inVersionMajor) {
+ case 2:
+ //ASSERT(inMessageHeaders.size() > 0)
+ //THere has to be a content type field.
+
+ locPacketSize = 28; //Base header size
+ for (int i = 0; i < inMessageHeaders.size(); i++) {
+ //2 is the crlf
+ locPacketSize += inMessageHeaders[i].size() + 2;
+ }
+
+ //terminating crlf
+ locPacketSize += 2;
+
+ locBuff = new unsigned char[locPacketSize];
+
+ locBuff[0] = 'A';
+ locBuff[1] = 'n';
+ locBuff[2] = 'x';
+ locBuff[3] = 'D';
+ locBuff[4] = 'a';
+ locBuff[5] = 't';
+ locBuff[6] = 'a';
+ locBuff[7] = 0;
+
+ iLE_Math::Int64ToCharArr(inGranuleRateNum, locBuff + 8);
+ iLE_Math::Int64ToCharArr(inGranuleRateDenom, locBuff + 16);
+ iLE_Math::ULongToCharArr(inNumSecHeaders, locBuff + 24);
+ locUpto = 28;
+ for (int i = 0; i < inMessageHeaders.size(); i++) {
+ memcpy((void*)(locBuff + locUpto), (const void*)(inMessageHeaders[i].c_str()), inMessageHeaders[i].size());
+ locUpto += inMessageHeaders[i].size();
+ //TODO::: How terminated ??
+ locBuff[locUpto++] = '\r';
+ locBuff[locUpto++] = '\n';
+ }
+
+ locBuff[locUpto++] = '\r';
+ locBuff[locUpto++] = '\n';
+
+ locPack = new StampedOggPacket(locBuff, locPacketSize, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
+ retPage = new OggPage;
+
+
+
+
+ default:
+ return NULL;
+ }
+}
+
+StampedOggPacket* AnxPacketMaker::makeAnxData_2_0 (OggMuxStream* inMuxStream, OggPaginator* inPaginator)
+{
+ return makeAnxData( 2
+ , 0
+ , inMuxStream->granuleNumerator()
+ , inMuxStream->granuleDenominator()
+ , inPaginator->numHeaders()
+ , makeMessageHeaders(inMuxStream));
+}
+
+vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream) {
+ string locTempString = "";
+ vector<string> retVector;
+ switch(OggStreamFactory::IdentifyCodec(inMuxStream->peekFront()->getPacket(0))) {
+ case StreamHeaders::VORBIS:
+ locTempString = "Content-type: audio/x-vorbis";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::SPEEX:
+ locTempString = "Content-type: audio/x-speex";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::FLAC:
+ locTempString = "Content-type: audio/x-flac";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::OGG_FLAC_1_0:
+ locTempString = "Content-type: audio/x-flac_1_0";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::THEORA:
+ locTempString = "Content-type: video/x-theora";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::FFDSHOW_VIDEO:
+ locTempString = "Content-type: video/x-ogm";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::NONE:
+ default:
+ return NULL;
+ }
+
+ return retVector;
+}
+
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.h
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPacketMaker.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "libOOOgg.h"
+#include "OggStreamFactory.h"
+class AnxPacketMaker
+{
+public:
+ AnxPacketMaker(void);
+ ~AnxPacketMaker(void);
+
+ static const ANX_2_0_ANNODEX_BOS_SIZE = 48;
+
+ static OggPage* makeAnnodexBOS ( unsigned long inSerialNo
+ , unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inTimebaseNum
+ , unsigned __int64 inTimebaseDenom
+ , const char* inUTC
+ );
+
+ static StampedOggPacket* makeAnxData ( unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inGranuleRateNum
+ , unsigned __int64 inGranuleDenom
+ , unsigned long inNumSecHeaders
+ , vector<string> inMessageHeaders
+ );
+
+ static StampedOggPacket* makeAnxData_2_0 (OggMuxStream* inMuxStream, OggPaginator* inPaginator);
+ static StampedOggPacket* makeAnxData (OggMuxStream* inMuxStream, OggPaginator* inPaginator);
+
+
+ static vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream);
+
+};
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,84 @@
+#include "StdAfx.h"
+#include ".\anxpageinterleaver.h"
+
+AnxPageInterleaver::AnxPageInterleaver(unsigned long inVersionMajor, unsigned long inVersionMinor)
+ : mVersionMajor(inVersionMajor)
+ , mVersionMinor(inVersionMinor)
+ , mIsAnxSetup(false)
+{
+ //This is the Annodex Logical Stream
+ //mInputStreams.push_back(newStream());
+
+ //Just make a random serial number
+ mAnxSerialNo = 999;
+}
+
+AnxPageInterleaver::~AnxPageInterleaver(void)
+{
+
+}
+
+void AnxPageInterleaver::addAnnodex_2_0_BOS() {
+ //Find the CMML data
+ //TODO::: Need to grab the data from CMML page
+
+ unsigned char* locUTC = new unsigned char[20];
+ memset((void*)locUTC, 0, 20);
+
+ OggPage* locBOSPage = AnxPacketMaker::makeAnnodexBOS( mAnxSerialNo
+ , 2
+ , 0
+ , 0
+ , 0
+ , locUTC);
+
+
+ //Put the annodex BOS out to the file.
+ mFileWriter->acceptOggPage(locBOSPage);
+ delete locUTC;
+
+}
+
+void AnxPageInterleaver::addAllAnxData_2_0_BOS() {
+ for (int i = 1; i < mInputStreams.size(); i++) {
+ mFileWriter->acceptOggPage(mInputStreams[i]->popFront());
+ }
+
+}
+
+void AnxPageInterleaver::addAnnodexEOS() {
+ //Make the EOS page and dump it
+
+ OggPage* locEOSPage = new OggPage;
+
+ locEOSPage->header()->setStreamSerialNo(mAnxSerialNo);
+ locEOSPage->header()->setHeaderFlags(4);
+ locEOSPage->header()->setHeaderSize(27);
+
+ mFileWriter->acceptOggPage(locEOSPage);
+}
+void AnxPageInterleaver::processData()
+{
+ if ((mVersionMajor == 2) && (mVersionMinor == 0))) {
+ //IF seen all headers
+ // CREATE ANNODEX BOS
+ // CREATE ANXDATA BOS's
+ // CREATE ANNODEX EOS
+ //ELSE
+ // DO NOTHING
+ //ENDIF
+ //
+
+ if (!isAnxSetup) {
+ if (gotAllHeaders()) {
+ isAnxSetup = true;
+ addAnnodex_2_0_BOS();
+ addAllAnxData_2_0_BOS();
+ addAnnodexEOS();
+ //TODO::: Pump out these start pages.
+ }
+ } else {
+ OggPageInterleaver::processData();
+ }
+
+}
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.h
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/AnxPageInterleaver.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "OggPageInterleaver.h"
+class AnxPageInterleaver
+ : public OggPageInterleaver
+{
+public:
+ AnxPageInterleaver(unsigned long inVersionMajor, unsigned long inVersionMinor);
+ virtual ~AnxPageInterleaver(void);
+
+
+ virtual void processData();
+
+
+protected:
+ bool mIsAnxSetup;
+
+ unsigned long mVersionMajor;
+ unsigned long mVersionMinor;
+};
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/ReadMe.txt
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/ReadMe.txt 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/ReadMe.txt 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,32 @@
+========================================================================
+ DYNAMIC LINK LIBRARY : libOOAnnodex Project Overview
+========================================================================
+
+AppWizard has created this libOOAnnodex DLL for you.
+This file contains a summary of what you will find in each of the files that
+make up your libOOAnnodex application.
+
+
+libOOAnnodex.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.
+
+libOOAnnodex.cpp
+ This is the main DLL source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named libOOAnnodex.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.
+
+/////////////////////////////////////////////////////////////////////////////
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,20 @@
+// libOOAnnodex.cpp : Defines the entry point for the DLL application.
+//
+
+#include "stdafx.h"
+#include "libOOAnnodex.h"
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.h
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,11 @@
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the LIBOOANNODEX_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// LIBOOANNODEX_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef LIBOOANNODEX_EXPORTS
+#define LIBOOANNODEX_API __declspec(dllexport)
+#else
+#define LIBOOANNODEX_API __declspec(dllimport)
+#endif
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.vcproj
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.vcproj 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/libOOAnnodex.vcproj 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="libOOAnnodex"
+ ProjectGUID="{A81BF389-465C-4A66-AF3C-99C8A3A4C245}"
+ 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="..\..\ogg\libOOOgg;..\..\..\helper\libilliCore;..\..\..\core\directshow\dsfOggDemux"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBOOANNODEX_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/libOOAnnodex.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/libOOAnnodex.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/libOOAnnodex.lib"
+ 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="..\..\ogg\libOOOgg;..\..\..\helper\libilliCore;..\..\..\core\directshow\dsfOggDemux"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBOOANNODEX_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/libOOAnnodex.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/libOOAnnodex.lib"
+ 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=".\AnxPacketMaker.cpp">
+ </File>
+ <File
+ RelativePath=".\AnxPageInterleaver.cpp">
+ </File>
+ <File
+ RelativePath=".\libOOAnnodex.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=".\AnxPacketMaker.h">
+ </File>
+ <File
+ RelativePath=".\AnxPageInterleaver.h">
+ </File>
+ <File
+ RelativePath=".\libOOAnnodex.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/core/annodex/libOOAnnodex/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/stdafx.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/stdafx.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// libOOAnnodex.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
Added: trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/stdafx.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/annodex/libOOAnnodex/stdafx.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,13 @@
+// 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
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,38 @@
+#include "StdAfx.h"
+#include ".\anxmuxfilter.h"
+
+
+
+// This template lets the Object factory create us properly and work with COM infrastructure.
+CFactoryTemplate g_Templates[] =
+{
+ {
+ L"AnxMuxFilter", // Name
+ &CLSID_AnxMuxFilter, // CLSID
+ AnxMuxFilter::CreateInstance, // Method to create an instance of MyComponent
+ NULL, // Initialization function
+ NULL // Set-up information (for filters)
+ }
+
+};
+
+// Generic way of determining the number of items in the template
+int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
+
+
+
+CUnknown* WINAPI AnxMuxFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr)
+{
+ AnxDemuxSourceFilter *pNewObject = new AnxDMuxFilter();
+ if (pNewObject == NULL) {
+ *pHr = E_OUTOFMEMORY;
+ }
+ return pNewObject;
+}
+AnxMuxFilter::AnxMuxFilter(void)
+{
+}
+
+AnxMuxFilter::~AnxMuxFilter(void)
+{
+}
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "OggMuxFilter.h"
+class AnxMuxFilter
+ : public OggMuxFitler
+{
+public:
+ AnxMuxFilter(void);
+ ~AnxMuxFilter(void);
+
+ enum eAnxMuxState {
+ ANX_START_STATE = 0,
+ WRITTEN_ANNODEX_BOS = 1,
+ WRITTEN_A_CMML_ANXDATA = 2,
+ WRITTEN_A_CODEC_ANXDATA = 3,
+ WRITTEN_ANNODEX_EOS = 4,
+ PROCEED_AS_OGG = 5
+
+
+ };
+protected:
+ eAnxMuxState mAnxMuxState;
+};
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,25 @@
+#include "StdAfx.h"
+#include ".\anxmuxinputpin.h"
+
+AnxMuxInputPin::AnxMuxInputPin(void)
+{
+}
+
+AnxMuxInputPin::~AnxMuxInputPin(void)
+{
+}
+
+HRESULT AnxMuxInputPin::SetMediaType(const CMediaType* inMediaType)
+{
+ //This pushes an anxdata packet into the stream.
+ HRESULT locHR = OggMuxInputPin::SetMediaType(inMediaType);
+
+ if (locHR == S_OK) {
+
+ mPaginator.addPacketToPage(AnxPacketMaker::makeAnxData(mMuxStream));
+ }
+
+ return locHR;
+
+
+}
\ No newline at end of file
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "OggMuxInputPin.h"
+class AnxMuxInputPin
+ : public OggMuxInputPin
+{
+public:
+ AnxMuxInputPin(void);
+ ~AnxMuxInputPin(void);
+
+
+ virtual HRESULT OggMuxInputPin::SetMediaType(const CMediaType* inMediaType);
+};
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,185 @@
+#include "StdAfx.h"
+#include ".\anxpacketmaker.h"
+
+AnxPacketMaker::AnxPacketMaker(void)
+{
+}
+
+AnxPacketMaker::~AnxPacketMaker(void)
+{
+}
+
+OggPage* AnxPacketMaker::makeAnnodexBOS ( unsigned long inSerialNo
+ , unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inTimebaseNum
+ , unsigned __int64 inTimebaseDenom
+ , const char* inUTC
+
+ )
+{
+ unsigned char* locBuff = NULL;
+ StampedOggPacket* locPack = NULL;
+ OggPage* retPage = NULL;
+ unsigned char* locSegTable = NULL;
+ switch (inVersionMajor) {
+ case 2:
+ locBuff = new unsigned char[ANX_2_0_ANNODEX_BOS_SIZE];
+
+ // 0 - 7 Annodex\0
+ // 8 - 9 Version Major
+ // 10 - 11 Version Minor
+ // 12 - 19 Timebase Num
+ // 20 - 27 Timebase Denom
+ // 28 = 48 UTC
+ locBuff[0] = 'A';
+ locBuff[1] = 'n';
+ locBuff[2] = 'n';
+ locBuff[3] = 'o';
+ locBuff[4] = 'd';
+ locBuff[5] = 'e';
+ locBuff[6] = 'x';
+ locBuff[7] = 0;
+ iLE_Math::UShortToCharArr(inVersionMajor, locBuff + 8);
+ iLE_Math::UShortToCharArr(inVersionMinor, locBuff + 10);
+ iLE_Math::Int64ToCharArr(inTimebaseNum, locBuff + 12);
+ iLE_Math::Int64ToCharArr(inTimebaseDenom, locBuff + 20);
+ for (int i = 0; i < 20; i++) {
+ locBuff[28 + i] = inUTC[i];
+ }
+
+ locPack = new StampedOggPacket(locBuff, ANX_2_0_ANNODEX_BOS_SIZE, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
+
+ retPage = new OggPage;
+ retPage->header()->setHeaderFlags(2);
+ retPage->header()->setGranulePos((__int64)0);
+ retPage->header()->setNumPageSegments( 1);
+ locSegTable = new unsigned char[1];
+ locSegTable[0] = ANX_2_0_ANNODEX_BOS_SIZE;
+ retPage->header()->setSegmentTable(locSegTable, 1);
+ retPage->header()->setHeaderSize(28);
+ retPage->header()->setDataSize(ANX_2_0_ANNODEX_BOS_SIZE);
+
+ retPage->header()->setStreamSerialNo(inSerialNo);
+ retPage->addPacket(locPack);
+
+ return retPage;
+
+ default:
+ return NULL;
+
+
+ }
+}
+
+StampedOggPacket* AnxPacketMaker::makeAnxData ( unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inGranuleRateNum
+ , unsigned __int64 inGranuleRateDenom
+ , unsigned long inNumSecHeaders
+ , vector<string> inMessageHeaders
+ )
+{
+
+ StampedOggPacket* locPack = NULL;
+ OggPage* retPage = NULL;
+ unsigned char* locBuff = NULL;
+ unsigned long locUpto = 0;
+ unsigned long locPacketSize = 0;
+ switch (inVersionMajor) {
+ case 2:
+ //ASSERT(inMessageHeaders.size() > 0)
+ //THere has to be a content type field.
+
+ locPacketSize = 28; //Base header size
+ for (int i = 0; i < inMessageHeaders.size(); i++) {
+ //2 is the crlf
+ locPacketSize += inMessageHeaders[i].size() + 2;
+ }
+
+ //terminating crlf
+ locPacketSize += 2;
+
+ locBuff = new unsigned char[locPacketSize];
+
+ locBuff[0] = 'A';
+ locBuff[1] = 'n';
+ locBuff[2] = 'x';
+ locBuff[3] = 'D';
+ locBuff[4] = 'a';
+ locBuff[5] = 't';
+ locBuff[6] = 'a';
+ locBuff[7] = 0;
+
+ iLE_Math::Int64ToCharArr(inGranuleRateNum, locBuff + 8);
+ iLE_Math::Int64ToCharArr(inGranuleRateDenom, locBuff + 16);
+ iLE_Math::ULongToCharArr(inNumSecHeaders, locBuff + 24);
+ locUpto = 28;
+ for (int i = 0; i < inMessageHeaders.size(); i++) {
+ memcpy((void*)(locBuff + locUpto), (const void*)(inMessageHeaders[i].c_str()), inMessageHeaders[i].size());
+ locUpto += inMessageHeaders[i].size();
+ //TODO::: How terminated ??
+ locBuff[locUpto++] = '\r';
+ locBuff[locUpto++] = '\n';
+ }
+
+ locBuff[locUpto++] = '\r';
+ locBuff[locUpto++] = '\n';
+
+ locPack = new StampedOggPacket(locBuff, locPacketSize, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
+ retPage = new OggPage;
+
+
+
+
+ default:
+ return NULL;
+ }
+}
+
+StampedOggPacket* AnxPacketMaker::makeAnxData_2_0 (OggMuxStream* inMuxStream, OggPaginator* inPaginator)
+{
+ return makeAnxData( 2
+ , 0
+ , inMuxStream->granuleNumerator()
+ , inMuxStream->granuleDenominator()
+ , inPaginator->numHeaders()
+ , makeMessageHeaders(inMuxStream));
+}
+
+vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream) {
+ string locTempString = "";
+ vector<string> retVector;
+ switch(OggStreamFactory::IdentifyCodec(inMuxStream->peekFront()->getPacket(0))) {
+ case StreamHeaders::VORBIS:
+ locTempString = "Content-type: audio/x-vorbis";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::SPEEX:
+ locTempString = "Content-type: audio/x-speex";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::FLAC:
+ locTempString = "Content-type: audio/x-flac";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::OGG_FLAC_1_0:
+ locTempString = "Content-type: audio/x-flac_1_0";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::THEORA:
+ locTempString = "Content-type: video/x-theora";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::FFDSHOW_VIDEO:
+ locTempString = "Content-type: video/x-ogm";
+ retVector.push_back(locTempString);
+ break;
+ case StreamHeaders::NONE:
+ default:
+ return NULL;
+ }
+
+ return retVector;
+}
+
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "libOOOgg.h"
+#include "OggStreamFactory.h"
+class AnxPacketMaker
+{
+public:
+ AnxPacketMaker(void);
+ ~AnxPacketMaker(void);
+
+ static const ANX_2_0_ANNODEX_BOS_SIZE = 48;
+
+ static OggPage* makeAnnodexBOS ( unsigned long inSerialNo
+ , unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inTimebaseNum
+ , unsigned __int64 inTimebaseDenom
+ , const char* inUTC
+ );
+
+ static StampedOggPacket* makeAnxData ( unsigned short inVersionMajor
+ , unsigned short inVersionMinor
+ , unsigned __int64 inGranuleRateNum
+ , unsigned __int64 inGranuleDenom
+ , unsigned long inNumSecHeaders
+ , vector<string> inMessageHeaders
+ );
+
+ static StampedOggPacket* makeAnxData_2_0 (OggMuxStream* inMuxStream, OggPaginator* inPaginator);
+ static StampedOggPacket* makeAnxData (OggMuxStream* inMuxStream, OggPaginator* inPaginator);
+
+
+ static vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream);
+
+};
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,85 @@
+#include "StdAfx.h"
+#include ".\anxpageinterleaver.h"
+
+AnxPageInterleaver::AnxPageInterleaver(IOggCallback* inFileWriter, INotifyComplete* inNotifier, unsigned long inVersionMajor, unsigned long inVersionMinor)
+ : OggPageInterleaver(inFileWriter, inNotifier)
+ , mVersionMajor(inVersionMajor)
+ , mVersionMinor(inVersionMinor)
+ , mIsAnxSetup(false)
+{
+ //This is the Annodex Logical Stream
+ //mInputStreams.push_back(newStream());
+
+ //Just make a random serial number
+ mAnxSerialNo = 999;
+}
+
+AnxPageInterleaver::~AnxPageInterleaver(void)
+{
+
+}
+
+void AnxPageInterleaver::addAnnodex_2_0_BOS() {
+ //Find the CMML data
+ //TODO::: Need to grab the data from CMML page
+
+ unsigned char* locUTC = new unsigned char[20];
+ memset((void*)locUTC, 0, 20);
+
+ OggPage* locBOSPage = AnxPacketMaker::makeAnnodexBOS( mAnxSerialNo
+ , 2
+ , 0
+ , 0
+ , 0
+ , locUTC);
+
+
+ //Put the annodex BOS out to the file.
+ mFileWriter->acceptOggPage(locBOSPage);
+ delete locUTC;
+
+}
+
+void AnxPageInterleaver::addAllAnxData_2_0_BOS() {
+ for (int i = 1; i < mInputStreams.size(); i++) {
+ mFileWriter->acceptOggPage(mInputStreams[i]->popFront());
+ }
+
+}
+
+void AnxPageInterleaver::addAnnodexEOS() {
+ //Make the EOS page and dump it
+
+ OggPage* locEOSPage = new OggPage;
+
+ locEOSPage->header()->setStreamSerialNo(mAnxSerialNo);
+ locEOSPage->header()->setHeaderFlags(4);
+ locEOSPage->header()->setHeaderSize(27);
+
+ mFileWriter->acceptOggPage(locEOSPage);
+}
+void AnxPageInterleaver::processData()
+{
+ if ((mVersionMajor == 2) && (mVersionMinor == 0))) {
+ //IF seen all headers
+ // CREATE ANNODEX BOS
+ // CREATE ANXDATA BOS's
+ // CREATE ANNODEX EOS
+ //ELSE
+ // DO NOTHING
+ //ENDIF
+ //
+
+ if (!isAnxSetup) {
+ if (gotAllHeaders()) {
+ isAnxSetup = true;
+ addAnnodex_2_0_BOS();
+ addAllAnxData_2_0_BOS();
+ addAnnodexEOS();
+ //TODO::: Pump out these start pages.
+ }
+ } else {
+ OggPageInterleaver::processData();
+ }
+
+}
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "OggPageInterleaver.h"
+#include "AnxPacketMaker.h"
+class AnxPageInterleaver
+ : public OggPageInterleaver
+{
+public:
+ AnxPageInterleaver(IOggCallback* inFileWriter, INotifyComplete* inNotifier, unsigned long inVersionMajor, unsigned long inVersionMinor);
+ virtual ~AnxPageInterleaver(void);
+
+
+
+ virtual void processData();
+
+
+protected:
+ void addAnnodex_2_0_BOS();
+
+ bool mIsAnxSetup;
+
+ unsigned long mVersionMajor;
+ unsigned long mVersionMinor;
+
+ unsigned long mAnxSerialNo;
+};
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/ReadMe.txt
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/ReadMe.txt 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/ReadMe.txt 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,32 @@
+========================================================================
+ DYNAMIC LINK LIBRARY : dsfAnxMux Project Overview
+========================================================================
+
+AppWizard has created this dsfAnxMux DLL for you.
+This file contains a summary of what you will find in each of the files that
+make up your dsfAnxMux application.
+
+
+dsfAnxMux.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.
+
+dsfAnxMux.cpp
+ This is the main DLL source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named dsfAnxMux.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.
+
+/////////////////////////////////////////////////////////////////////////////
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/anxmuxdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/anxmuxdllstuff.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/anxmuxdllstuff.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "oggdllstuff.h"
+
+
+
+// {6C5746D3-D309-4988-8694-D435AB86460D}
+DEFINE_GUID(CLASSID_AnxMuxFilter,
+0x6c5746d3, 0xd309, 0x4988, 0x86, 0x94, 0xd4, 0x35, 0xab, 0x86, 0x46, 0xd);
+
+
+// {53696C76-6961-40b2-B136-436F6E726164}
+DEFINE_GUID(FORMAT_CMML,
+0x53696c76, 0x6961, 0x40b2, 0xb1, 0x36, 0x43, 0x6f, 0x6e, 0x72, 0x61, 0x64);
+
+
+// {5A656E74-6172-6F26-B79C-D6416E647282}
+DEFINE_GUID(MEDIASUBTYPE_CMML,
+0x5a656e74, 0x6172, 0x6f26, 0xb7, 0x9c, 0xd6, 0x41, 0x6e, 0x64, 0x72, 0x82);
+
+// {BF1121D1-8739-45e1-BCD8-90B828F643AB}
+DEFINE_GUID(CLSID_CMMLDecodeFilter,
+0xbf1121d1, 0x8739, 0x45e1, 0xbc, 0xd8, 0x90, 0xb8, 0x28, 0xf6, 0x43, 0xab);
+
+const REGFILTER2 AnxMuxSourceFilterReg = {
+ 1,
+ MERIT_NORMAL,
+ 0,
+ NULL
+
+};
+
+struct sCMMLFormatBlock {
+ __int64 granuleNumerator;
+ __int64 granuleDenominator;
+};
\ No newline at end of file
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,21 @@
+// dsfAnxMux.cpp : Defines the entry point for the DLL application.
+//
+
+#include "stdafx.h"
+#include "dsfAnxMux.h"
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,12 @@
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the DSFANXMUX_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// DSFANXMUX_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef DSFANXMUX_EXPORTS
+#define DSFANXMUX_API __declspec(dllexport)
+#else
+#define DSFANXMUX_API __declspec(dllimport)
+#endif
+
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="dsfAnxMux"
+ ProjectGUID="{685D495F-1620-459A-9EE3-BAD4F619B2C2}"
+ 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=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";..\..\ogg\libOOOgg;..\..\directshow\dsfOggMux;..\..\..\helper\libilliCore;..\..\..\core\directshow\dsfOggDemux"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSFANXMUX_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/dsfAnxMux.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/dsfAnxMux.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/dsfAnxMux.lib"
+ 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=""C:\DXSDK\Samples\C++\DirectShow\BaseClasses";..\..\ogg\libOOOgg;..\..\directshow\dsfOggMux;..\..\..\helper\libilliCore;..\..\..\core\directshow\dsfOggDemux"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSFANXMUX_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/dsfAnxMux.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/dsfAnxMux.lib"
+ 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=".\AnxMuxFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\AnxMuxInputPin.cpp">
+ </File>
+ <File
+ RelativePath=".\AnxPacketMaker.cpp">
+ </File>
+ <File
+ RelativePath=".\AnxPageInterleaver.cpp">
+ </File>
+ <File
+ RelativePath=".\dsfAnxMux.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=".\anxmuxdllstuff.h">
+ </File>
+ <File
+ RelativePath=".\AnxMuxFilter.h">
+ </File>
+ <File
+ RelativePath=".\AnxMuxInputPin.h">
+ </File>
+ <File
+ RelativePath=".\AnxPacketMaker.h">
+ </File>
+ <File
+ RelativePath=".\AnxPageInterleaver.h">
+ </File>
+ <File
+ RelativePath=".\dsfAnxMux.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/core/directshow/dsfAnxMux/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// dsfAnxMux.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
Added: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,14 @@
+// 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.h"
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/VorbisStream.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/VorbisStream.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/VorbisStream.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -34,7 +34,7 @@
#include "OggPacket.h"
#include "OggPage.h"
-
+#include "OggStream.h"
class OggStream;
class OggDemuxSourceFilter;
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -44,7 +44,7 @@
#include "StringHelper.h"
class OggMuxInputPin;
-class OggMuxFilter
+class OGG_MUX_API OggMuxFilter
: public IFileSinkFilter
, public CBaseFilter
, public IOggCallback
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -80,7 +80,7 @@
return CBaseInputPin::NonDelegatingQueryInterface(riid, ppv);
}
-
+//ANX::: Override and insert an anxdata into the stream.
HRESULT OggMuxInputPin::SetMediaType(const CMediaType* inMediaType) {
//debugLog.open("G:\\logs\\oggmuxinpin.log", ios_base::out);
//debugLog<<"Set media type..."<<endl;
@@ -113,7 +113,7 @@
//mNeedsFLACHeaderTweak = true;
mNeedsFLACHeaderCount = true;
} else if (inMediaType->subtype == MEDIASUBTYPE_FLAC) {
- //We are connected directly to the mux and are getting metadata in one block
+ //We are connected directly to the demux and are getting metadata in one block
// Need to use the header splitter class.
sFLACFormatBlock* locFLAC = (sFLACFormatBlock*)inMediaType->pbFormat;
mMuxStream->setConversionParams(locFLAC->samplesPerSec, 1, 10000000);
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -42,7 +42,7 @@
class OggMuxFilter;
-class OggMuxInputPin
+class OGG_MUX_API OggMuxInputPin
: public CBaseInputPin
, public BasicSeekPassThrough
{
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/oggmuxdllstuff.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -36,8 +36,14 @@
#include <initguid.h>
+#ifdef DSFOGGMUX_EXPORTS
+#pragma message("----> Exporting from Ogg Mux...")
+#define OGG_MUX_API __declspec(dllexport)
+#else
+#pragma message("<---- Importing from Ogg Mux...")
+#define OGG_MUX_API __declspec(dllimport)
+#endif
-
#ifdef LIBOOOGG_EXPORTS
#define LIBOOOGG_API __declspec(dllexport)
#else
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -38,7 +38,7 @@
OggDataBuffer::OggDataBuffer(void)
: mBuffer(NULL)
, mPrevGranPos(0)
- , mPendingPage(NULL)
+ , pendingPage(NULL)
, mState(AWAITING_BASE_HEADER)
, mNumBytesNeeded(OggPageHeader::OGG_BASE_HEADER_SIZE)
{
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggDataBuffer.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -81,7 +81,7 @@
(OggPageHeader::SEGMENT_WIDTH * OggPageHeader::MAX_NUM_SEGMENTS); //Segment table
//Debug only
- OggDataBuffer::OggDataBuffer(bool x);
+ //OggDataBuffer::OggDataBuffer(bool x);
void debugWrite(string inString);
//
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -49,6 +49,13 @@
//LEAK::: Need to delete the contents of the queue later.
}
+__int64 OggMuxStream::granuleNumerator() {
+ return mConvNumerator;
+}
+__int64 OggMuxStream::granuleDenominator() {
+ return mConvDenominator;
+}
+
bool OggMuxStream::acceptOggPage(OggPage* inOggPage) { //Holds page for later... still needs deleting in destructor
mIsEOS = false;
mPageQueue.push_back(inOggPage); //AOP::: Clone not required.
@@ -56,6 +63,13 @@
return true;
}
+bool OggMuxStream::pushFront(OggPage* inOggPage) {
+ mIsEOS = false;
+ mPageQueue.push_front(inOggPage);
+ mNotifier->notifyArrival();
+ return true;
+}
+
OggPage* OggMuxStream::popFront() {
OggPage* retPage = NULL;
if (!mPageQueue.empty()) {
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -49,6 +49,8 @@
//IOggCallback implementaion.
virtual bool acceptOggPage(OggPage* inOggPage);
+ virtual bool pushFront(OggPage* inOggPage);
+
virtual OggPage* popFront();
virtual OggPage* peekFront();
@@ -66,7 +68,8 @@
bool setConversionParams(__int64 inNumerator, __int64 inDenominator, __int64 inScaleFactor);
-
+ __int64 granuleNumerator();
+ __int64 granuleDenominator();
protected:
INotifyArrival* mNotifier;
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -107,14 +107,15 @@
mHeaderFlags = inBaseHeader[HEADER_FLAGS];
mGranulePos = iLE_Math::CharArrToInt64(inBaseHeader + GRANULE_POS);
mStreamSerialNo = iLE_Math::charArrToULong(inBaseHeader + SERIAL_NO);
- mCRCCheckSum = iLE_Math::charArrToULong(inBaseHeader + OGG_CHECKSUM);
+ mCRCChecksum = iLE_Math::charArrToULong(inBaseHeader + OGG_CHECKSUM);
mNumPageSegments = inBaseHeader[NUM_SEGMENTS];
mHeaderSize = OGG_BASE_HEADER_SIZE + mNumPageSegments;
mPageSize = mHeaderSize + mDataSize;
mPageState = BASE_HEAD_SET;
return true;
-
+ } else {
+ return false;
}
////Assign the structure version
@@ -151,10 +152,7 @@
//mPageState = BASE_HEAD_SET;
- return true;
- } else {
- return false;
- }
+
}
@@ -319,7 +317,13 @@
return true;
}
+//unsigned long OggPageHeader::headerCheckSum()
+//{
+//
+//
+//}
+
bool OggPageHeader::isBOS() {
return ((mHeaderFlags & eHeadFlags::BOS) != 0 );
}
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageHeader.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -62,6 +62,7 @@
static const unsigned char OGG_CAPTURE_PATTERN_SIZE = 4;
static const unsigned char OGG_BASE_HEADER_SIZE = 27;
+ static const __int64 UNKNOWN_GRANULE_POS = -1;
enum ePageState {
INVALID,
BLANK,
@@ -71,6 +72,7 @@
};
enum eHeadFlags {
+ NO_FLAGS = 0,
CONTINUATION = 1,
BOS = 2,
EOS = 4
@@ -105,13 +107,12 @@
unsigned long pageSize();
unsigned long headerSize();
unsigned long dataSize();
+ unsigned long calculateDataSize();
- unsigned long calculateDataSize();
//Bulk Mutators
bool setBaseHeader(const unsigned char* inBaseHeader);
- //bool setSegmentTable(const unsigned char* inSegTable, unsigned char inNumSegs);
-
-
+
+ //Accesors
unsigned char StructureVersion();
unsigned char HeaderFlags();
__int64 GranulePos();
@@ -121,8 +122,7 @@
unsigned char NumPageSegments();
unsigned char* SegmentTable();
-
-
+ //Mutators
void setStructureVersion(unsigned char inVal);
void setHeaderFlags(unsigned char inVal);
void setGranulePos(__int64 inPtr);
@@ -141,15 +141,15 @@
void setDataSize(unsigned long inVal);
+ //unsigned long headerCheckSum();
string toString();
protected:
-
-
-
+ //Size fields
unsigned long mPageSize;
unsigned long mHeaderSize;
unsigned long mDataSize;
+ //Header fields
unsigned char mStructureVersion;
unsigned char mHeaderFlags;
__int64 mGranulePos;
@@ -158,9 +158,10 @@
unsigned long mCRCChecksum;
unsigned char mNumPageSegments;
+ //Segment table
unsigned char* mSegmentTable;
- //OggSegmentTable* mSegmentTable;
-
+
+ //Page state
ePageState mPageState;
private:
OggPageHeader& operator=(const OggPageHeader& other); /* Don't assign me */
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -42,6 +42,7 @@
: public INotifyArrival
{
public:
+ //TODO::: Shuoldn't be called file writer... just output or something.
OggPageInterleaver(IOggCallback* inFileWriter, INotifyComplete* inNotifier);
virtual ~OggPageInterleaver(void);
@@ -58,7 +59,7 @@
protected:
vector<OggMuxStream*> mInputStreams;
- IOggCallback* mFileWriter;
+ IOggCallback* mFileWriter; //TODO::: Shuoldn't be called filewriter.
INotifyComplete* mNotifier;
//DEBUG ONLY
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -112,6 +112,7 @@
, mPendingPageHasData(false)
, mSequenceNo(0)
, mPacketCount(0)
+ , mLastGranulePos(0)
{
//debugLog.open("G:\\logs\\paginator.log", ios_base::out);
@@ -134,85 +135,40 @@
return true;
}
-bool OggPaginator::acceptStampedOggPacket(StampedOggPacket* inOggPacket) { //Keeps packet.
- //unsigned long locPotentialSize = mCurrentPageSize + inOggPacket->packetSize();
- //bool locCouldWriteNow = false;
+//Keeps packet.
+bool OggPaginator::acceptStampedOggPacket(StampedOggPacket* inOggPacket)
+{
- //if (mCurrentPageSize >= mSettings->mMinPageSize) {
- // locCouldWriteNow = true;
- //}
-
- //if (locPotentialSize > mSettings->mMaxPageSize) {
- // if (locCouldWriteNow) {
- // //CASE 1 : New page would be bigger than max but current size is greater than min
- // //
- // //Write page
- // //Start a new page
- // //Put this packet into page
- // } else {
- // //CASE 2 : New page would be bigger than max and current is smaller than min
- // //
- // //Cut to target size
- // //Write page
- // //Start new page
- // //Put remainder into page
- // }
- //} else {
- // if (locPotentialSize >= mSettings->mMinPageSize) {
- // //CASE 3 : New page is smaller than max and bigger than min, ie ready to go.
- // //
- // //Put this packet into page
- // //Write page
- // //Start new page
-
- // } else {
- // //CASE 4 : New page is smaller than both min and max... not enough data yet
- // //
- // //Put this packet into page
-
- // }
- //}
-
//debugLog<<"Accepting packet"<<endl;
addPacketToPage(inOggPacket);
return true;
}
-bool OggPaginator::finishStream() {
+bool OggPaginator::finishStream()
+{
+ //When we get a signal to finish a stream, we set the EOS Flag on the current page pending
+ // which may be empty, and then deliver it.
+
+ //This makes sure if our last page is empty and we want to send the EOS page, we stamp it with the previous granule pos
+ // since if this page has no packets it must be the same. Makes it easier to find the stream duration.
+ if (mPendingPage->numPackets() == 0) {
+ mPendingPage->header()->setGranulePos(mLastGranulePos);
+
+ }
+
mPendingPage->header()->setHeaderFlags(mPendingPage->header()->HeaderFlags() | 4);
deliverCurrentPage();
return true;
}
-bool OggPaginator::setChecksum() {
+bool OggPaginator::setChecksum()
+{
unsigned long locChecksum = 0;
unsigned long locTemp = 0;
-
- //ogg_uint32_t crc_reg=0;
- //int i;
-
- ///* safety; needed for API behavior, but not framing code */
- //og->header[22]=0;
- //og->header[23]=0;
- //og->header[24]=0;
- //og->header[25]=0;
- //
- //for(i=0;i<og->header_len;i++)
- // crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
- //for(i=0;i<og->body_len;i++)
- // crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
- //
- //og->header[22]=crc_reg&0xff;
- //og->header[23]=(crc_reg>>8)&0xff;
- //og->header[24]=(crc_reg>>16)&0xff;
- //og->header[25]=(crc_reg>>24)&0xff;
if (mPendingPage != NULL) {
-
+ //Set the checksum to NULL for the checksumming process.
mPendingPage->header()->setCRCChecksum((unsigned long)0);
-
- //To save memory allocation overhead... there is now one per class. Created in constructor, destroyed in destructor.
- //unsigned char* locBuff = new unsigned char[300]; //Deleted this function
mPendingPage->header()->rawData(mHeaderBuff, 300);
for(unsigned long i = 0; i < mPendingPage->headerSize(); i++) {
@@ -222,10 +178,8 @@
locChecksum=(locChecksum << 8) ^ crc_lookup[locTemp];
}
- //Not required, using a single buffer for the class.
- //delete[] locBuff;
- //locBuff = NULL;
+
unsigned char* locBuff = NULL;
for(unsigned long i = 0; i < mPendingPage->numPackets(); i++) {
locBuff = mPendingPage->getPacket(i)->packetData(); //View only don't delete.
@@ -244,17 +198,14 @@
bool OggPaginator::deliverCurrentPage() {
//debugLog<<"Delivering page"<<endl;
mPendingPage->header()->setSegmentTable((const unsigned char*)mSegmentTable, mSegmentTableSize);
+
mPendingPage->header()->setDataSize(mCurrentPageSize - mPendingPage->headerSize()); //This is odd
+ setChecksum();
- //mPendingPage->header()->setHeaderSize(OggPageHeader::OGG_BASE_HEADER_SIZE + mSegmentTableSize);
- //mPendingPage->header()->setNumPageSegments(mSegmentTableSize);
+ //We save this in case we need to send an empty EOS page, and we can stamp it with this value.
+ mLastGranulePos = mPendingPage->header()->GranulePos();
- //if (mPendingPage->header()->GranulePos()->value() == -1) {
- // mPendingPage->header()->setHeaderFlags(mPendingPage->header()->HeaderFlags() | 1);
- //}
- setChecksum();
-
//TODO::: Should catch and propagate return value.
mPageCallback->acceptOggPage(mPendingPage); //Gives away page.
mPendingPage = NULL;
@@ -268,18 +219,18 @@
mCurrentPageSize = OggPageHeader::OGG_BASE_HEADER_SIZE;
mPendingPageHasData = false;
mSegmentTableSize = 0;
- //mPendingPage->header()->setStructureVersion(0);
+
mPendingPage->header()->setStreamSerialNo(mSettings->mSerialNo);
- //mPendingPage->header()->setDataSize(0);
mPendingPage->header()->setPageSequenceNo(mSequenceNo);
- //mPendingPage->header()->setCRCChecksum((unsigned long)0);
+
+ //If it's the first page it gets the BOS Flag
if (mSequenceNo == 0) {
- mPendingPage->header()->setHeaderFlags(2);
+ mPendingPage->header()->setHeaderFlags(OggPageHeader::BOS);
} else {
- mPendingPage->header()->setHeaderFlags(0);
+ mPendingPage->header()->setHeaderFlags(OggPageHeader::NO_FLAGS);
}
- mPendingPage->header()->setGranulePos(-1);
+ mPendingPage->header()->setGranulePos(OggPageHeader::UNKNOWN_GRANULE_POS);
mSequenceNo++;
return true;
@@ -305,25 +256,23 @@
unsigned long locPacketStartPoint = 0;
unsigned long locConsumed = 0;
- //While there is still more packet not added to the page
+ //While there is still more packet not added to the page add as much as it will take.
while (locPacketRemaining > 0) {
//debugLog<<"Packet remaining = "<<locPacketRemaining<<endl;
+
locConsumed = addAsMuchPacketAsPossible(inOggPacket, locPacketStartPoint, locPacketRemaining);
+
//debugLog<<"Consumed = "<<locConsumed<<endl;
+
locPacketStartPoint += locConsumed;
locPacketRemaining -= locConsumed;
}
- //To ensure you get vorbis comments and codebook ending a page.
- //if ((mPacketCount == 2) && (mPendingPageHasData)) {
- // deliverCurrentPage();
- //}
//This will ensure that any header packet appears on it's own page...
//
- // An added benefit, is that comment packets appear on their own page, this makes it
- // significantly easier to add/modify comments without bumping data across a page which could
- // require changing of all the headers in all the pages.
+
+ //Every header gets it's own page.
if ((mPacketCount < mSettings->mNumHeaders) && (mPendingPageHasData)) {
//debugLog<<"Flushing a header page..."<<endl;
//debugLog<<"PacketCount = "<<mPacketCount<<endl;
@@ -335,28 +284,33 @@
}
-unsigned long OggPaginator::addAsMuchPacketAsPossible(StampedOggPacket* inOggPacket, unsigned long inStartAt, long inRemaining) {
- //Take 1 so when it adds the packet it doesn't try to consume one extra segment which doesn't exist.
-
- //The amount of space left in the page is the minimum of
- // a) The number of segments left * 255
- // b) The number of bytes less than the desired maximum page size.
-
+unsigned long OggPaginator::addAsMuchPacketAsPossible(StampedOggPacket* inOggPacket, unsigned long inStartAt, long inRemaining)
+{
//debugLog<<"Remains in packet = "<<inRemaining<<endl;
//debugLog<<"Start at = "<<inStartAt<<endl;
//debugLog<<"Segtable size = "<<mSegmentTableSize<<endl;
//debugLog<<"Max page size = "<<mSettings->mMaxPageSize<<endl;
//debugLog<<"Current page size = "<<mCurrentPageSize<<endl;
+
+ //The amount of space left in the page is the minimum of
+ // a) The (number of segments left * 255) take 1.
+ // b) The number of bytes less than the desired maximum page size.
+ //TODO::: What happens when mSegmentTableSize is 255 ?
+
+ //Take 1 so when it adds the packet it doesn't try to consume one extra segment which doesn't exist.
unsigned long locSpaceLeft = MIN(((255 - mSegmentTableSize) * 255) - 1, mSettings->mMaxPageSize - mCurrentPageSize);
//debugLog<<"Space left = "<<locSpaceLeft<<endl;
//debugLog<<"Space left = "<<locSpaceLeft<<endl;
//Round down to nearest multiple of 255
//
+
//This is important when the packet gets broken because inRemaining is gt locSpace left
// In this case where the packet gets broken the final segment on the page must be 255.
locSpaceLeft -= (locSpaceLeft % 255);
+ //ASSERT(locSpaceLeft >=0);
+
//debugLog<<"Adjust space left = "<<locSpaceLeft<<endl;
//How much we add is the minimum of
@@ -371,7 +325,7 @@
//mPending page has data is useless, it was set before this function is called... need to fix that. maybe move into add part of pack into apge
if ((!mPendingPageHasData) && (inStartAt != 0)) {
- mPendingPage->header()->setHeaderFlags(mPendingPage->header()->HeaderFlags() | 1);
+ mPendingPage->header()->setHeaderFlags(mPendingPage->header()->isContinuation());
}
if (locHowMuchToAdd > 0) {
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -46,6 +46,7 @@
: public IStampedOggPacketSink
{
public:
+ //TODO::: Have a constructor that lets you set the numheaders.
OggPaginator(void);
virtual ~OggPaginator(void);
@@ -86,6 +87,8 @@
unsigned char* mHeaderBuff;
//fstream debugLog;
+ unsigned long mLastGranulePos;
+
private:
OggPaginator& operator=(const OggPaginator& other); /* Don't assign me */
OggPaginator(const OggPaginator& other); /* Don't copy me */
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -50,7 +50,7 @@
{
mFileName = inFileName;
- mOggDemux = new OggDataBuffer(true); //Deleted in destructor.
+ mOggDemux = new OggDataBuffer(); //Deleted in destructor.
mOggDemux->registerVirtualCallback(this);
//debugLog.open("G:\\logs\\seektable.log", ios_base::out);
//debugLog<<"Constructing seek table for "<<inFileName<<endl;
Modified: trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -60,6 +60,11 @@
outCharArray[0] = (unsigned char) ((inLong << 24) >> 24);
}
+
+void iLE_Math::UShortToCharArr(unsigned short inShort, unsigned char* outCharArray) {
+ outCharArray[0] = inShort % 256;
+ outCharArray[1] = inShort / 256;
+}
unsigned short iLE_Math::charArrToUShort(const unsigned char* inCharArray) {
return (inCharArray[1] << 8) + inCharArray[0];
}
Modified: trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h
===================================================================
--- trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/lib/helper/libilliCore/iLE_Math.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -39,6 +39,8 @@
~iLE_Math(void);
static unsigned long charArrToULong(const unsigned char* inCharArray);
static void ULongToCharArr(unsigned long inLong, unsigned char* outCharArray);
+ static void UShortToCharArr(unsigned short inShort, unsigned char* outCharArray);
+
static __int64 CharArrToInt64(const unsigned char* inCharArray);
static void Int64ToCharArr(__int64 inInt64, unsigned char* outCharArray);
static unsigned short charArrToUShort(const unsigned char* inCharArray);
Added: trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.cpp
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,21 @@
+#include "StdAfx.h"
+#include ".\oggpagefilewriter.h"
+
+OggPageFileWriter::OggPageFileWriter(string inFileName)
+{
+ mFile.open(inFileName.c_str(), ios_base::out|ios_base::binary);
+}
+
+OggPageFileWriter::~OggPageFileWriter(void)
+{
+}
+
+bool OggPageFileWriter::acceptOggPage(OggPage* inOggPage) {
+
+ unsigned char* locPageBytes = inOggPage->createRawPageData();
+ mFile.write((const char*) locPageBytes, inOggPage->pageSize());
+
+ delete inOggPage;
+ delete [] locPageBytes;
+ return true;
+}
\ No newline at end of file
Added: trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.h
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/OggPageFileWriter.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,19 @@
+#pragma once
+
+//#include "dllstuff.h"
+#include "libOOOgg.h"
+#include <fstream>
+using namespace std;
+//#include "IOggCallback.h"
+class OggPageFileWriter
+ : public IOggCallback
+{
+public:
+ OggPageFileWriter(string inFileName);
+ ~OggPageFileWriter(void);
+
+ virtual bool acceptOggPage(OggPage* inOggPage);
+
+protected:
+ fstream mFile;
+};
Added: trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.cpp
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,58 @@
+#include "StdAfx.h"
+#include ".\testpatternoggpacketchecker.h"
+
+TestPatternOggPacketChecker::TestPatternOggPacketChecker(void)
+{
+}
+
+TestPatternOggPacketChecker::~TestPatternOggPacketChecker(void)
+{
+}
+
+bool TestPatternOggPacketChecker::acceptStampedOggPacket(StampedOggPacket* inPacket)
+{
+ unsigned long locPacketSize = inPacket->packetSize();
+
+ const unsigned char* locPackBuff = inPacket->packetData(); //Don't delete
+
+ bool retVal = false;
+
+ if (locPacketSize == 0) {
+ retVal = true;
+ } else if (locPacketSize < 8) {
+ for (int i = 0; i < 8; i++) {
+ if (locPackBuff[i] != i) {
+ retVal = false;
+ }
+ }
+ return true;
+ } else {
+ for (int i = 0; i < 4; i++) {
+ if (locPackBuff[i] != '[') {
+ retVal = false;
+ }
+ }
+
+ for (int i = 4; i < locPacketSize - 4; i++) {
+ if (locPackBuff[i] != ('a' + (unsigned char)(i % 26))) {
+ retVal = false;
+ }
+ }
+
+ for (int i = 1; i <=4; i++) {
+ if (locPackBuff[locPacketSize - i] != ']') {
+ retVal = false;
+ }
+ }
+ retVal = true;
+ }
+
+ cout<<"Check Packet Granule "<<inPacket->endTime()<<" Size = "<<inPacket->packetSize()<<" ";
+ if (retVal) {
+ cout<<"OK"<<endl;
+ } else {
+ cout<<"FAILED"<<endl;
+ }
+ delete inPacket;
+ return retVal;
+}
\ No newline at end of file
Added: trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.h
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketChecker.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "IStampedOggPacketSink.h"
+class TestPatternOggPacketChecker
+ : public IStampedOggPacketSink
+{
+public:
+ TestPatternOggPacketChecker(void);
+ ~TestPatternOggPacketChecker(void);
+
+ //IStampedOggPacketSink
+ virtual bool acceptStampedOggPacket(StampedOggPacket* inPacket);
+};
Added: trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.cpp
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,49 @@
+#include "StdAfx.h"
+#include ".\testpatternoggpacketgenerator.h"
+
+TestPatternOggPacketGenerator::TestPatternOggPacketGenerator(void)
+{
+}
+
+TestPatternOggPacketGenerator::~TestPatternOggPacketGenerator(void)
+{
+}
+
+StampedOggPacket* TestPatternOggPacketGenerator::generatePacket(unsigned long inPacketSize, __int64 inGranulePos)
+{
+ cout<<"Generating packet of size "<<inPacketSize<<" with gran pos "<<inGranulePos<<endl;
+ if (inPacketSize == 0) {
+
+ return new StampedOggPacket(NULL, 0, false, false, 0, inGranulePos, StampedOggPacket::OGG_END_ONLY);
+ }
+ if (inPacketSize <= 8) {
+ unsigned char* locBuff = new unsigned char[inPacketSize];
+
+ //Numbers 01234567
+ for (int i = 0; i < inPacketSize; i++) {
+ locBuff[i] = ('0' + (unsigned char)i);;
+ }
+ return new StampedOggPacket(locBuff, inPacketSize, false, false, 0, inGranulePos, StampedOggPacket::OGG_END_ONLY);
+
+ } else {
+
+ // [[[[abcdefghij...abcde...]]]]
+ unsigned char* locBuff = new unsigned char[inPacketSize];
+
+ for (int i = 0; i < 4; i++) {
+ locBuff[i] = '[';
+ }
+
+ for (int i = 4; i < inPacketSize - 4; i++) {
+ locBuff[i] = 'a' + (unsigned char)(i % 26);
+ }
+
+ for (int i = 1; i <= 4; i++) {
+ locBuff[inPacketSize - i] = ']';
+ }
+
+ return new StampedOggPacket(locBuff, inPacketSize, false, false, 0, inGranulePos, StampedOggPacket::OGG_END_ONLY);
+
+ }
+
+}
\ No newline at end of file
Added: trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.h
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPacketGenerator.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,27 @@
+#pragma once
+
+class TestPatternOggPacketGenerator
+{
+public:
+ TestPatternOggPacketGenerator(void);
+ ~TestPatternOggPacketGenerator(void);
+
+ //Test pattern will be...
+ //
+ // 50 byte packet
+
+ //Packet
+ //======
+ //All packets start with [[[[
+ //All packets end with ]]]]
+ //Will rotate through lowercase alphabetical letters.
+ //Packets shorter than 8 bytes are filled with 012345... etc.
+
+ //eg. [[[[abcdefghij...abcde...]]]]
+
+ StampedOggPacket* generatePacket(unsigned long inPacketSize, __int64 inGranulePos);
+
+protected:
+
+
+};
Added: trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.cpp
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,28 @@
+#include "StdAfx.h"
+#include ".\testpatternoggpagechecker.h"
+
+TestPatternOggPageChecker::TestPatternOggPageChecker(void)
+{
+}
+
+TestPatternOggPageChecker::~TestPatternOggPageChecker(void)
+{
+}
+
+bool TestPatternOggPageChecker::acceptOggPage(OggPage* inOggPage)
+{
+ bool locIsOK = true;
+ for (int i = 0; i < inOggPage->numPackets(); i++) {
+ locIsOK = locIsOK && (mPacketChecker.acceptStampedOggPacket( (StampedOggPacket*)(inOggPage->getStampedPacket(i)->clone()) ) );
+ }
+
+ cout<<"Check Page "<<inOggPage->header()->PageSequenceNo()<<" @ "<<inOggPage->header()->GranulePos()<<" Size = "<<inOggPage->pageSize()<<" Num Packs = "<<inOggPage->numPackets()<<" ";
+ if (locIsOK) {
+ cout<<"OK"<<endl;
+ } else {
+ cout<<"FAILED"<<endl;
+ }
+ cout<<endl;
+ delete inOggPage;
+ return (locIsOK);
+}
\ No newline at end of file
Added: trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.h
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/TestPatternOggPageChecker.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "IOggCallback.h"
+#include "TestPatternOggPacketChecker.h"
+class TestPatternOggPageChecker
+ : public IOggCallback
+{
+public:
+ TestPatternOggPageChecker(void);
+ ~TestPatternOggPageChecker(void);
+
+ virtual bool acceptOggPage(OggPage* inOggPage);
+
+protected:
+ TestPatternOggPacketChecker mPacketChecker;
+};
Modified: trunk/oggdsf/src/tests/testLibOOOgg/stdafx.h
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/stdafx.h 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/stdafx.h 2004-11-29 09:52:54 UTC (rev 8297)
@@ -8,5 +8,6 @@
#include <iostream>
#include <tchar.h>
-
+#include "dllstuff.h"
+#include "libOOOgg.h"
// TODO: reference additional headers your program requires here
Modified: trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.cpp
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.cpp 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.cpp 2004-11-29 09:52:54 UTC (rev 8297)
@@ -2,14 +2,90 @@
//
#include "stdafx.h"
-#include "libOOOgg.h"
+#include "TestPatternOggPacketGenerator.h"
+#include "TestPatternOggPageChecker.h"
+
+
#include <iostream>
using namespace std;
+bool testRandomPacketSizes(string inFileName, unsigned long inNumPackets) {
+
+ TestPatternOggPacketGenerator locPackGen;
+ TestPatternOggPageChecker locPageChecker;
+ OggPaginator locPaginator;
+
+ OggPaginatorSettings* locSettings = new OggPaginatorSettings;
+ ;
+ locSettings->mMaxPageSize = 20000;
+ locSettings->mMinPageSize = 4096;
+ locSettings->mTargetPageSize = 10000;
+ locSettings->mSerialNo = 77;
+ locSettings->mNumHeaders = 6;
+ locPaginator.setParameters(locSettings);
+
+ locPaginator.setPageCallback(&locPageChecker);
+
+ const unsigned long MAX_PACK_SIZE = 100000;
+ unsigned long locPacketSize = 0;
+ StampedOggPacket* locTestPacket;
+
+ for (int i = 0; i < inNumPackets; i++) {
+ locPacketSize = rand() % MAX_PACK_SIZE;
+ locTestPacket = locPackGen.generatePacket(locPacketSize, i);
+ locPaginator.acceptStampedOggPacket(locTestPacket);
+ }
+ locPaginator.finishStream();
+ return true;
+
+}
+
+
+bool testSmallPacketSizes(string inFileName, unsigned long inNumPackets) {
+
+ TestPatternOggPacketGenerator locPackGen;
+ TestPatternOggPageChecker locPageChecker;
+ OggPaginator locPaginator;
+
+ OggPaginatorSettings* locSettings = new OggPaginatorSettings;
+
+ locSettings->mMaxPageSize = 20000;
+ locSettings->mMinPageSize = 4096;
+ locSettings->mTargetPageSize = 8192;
+ locSettings->mSerialNo = 77;
+ locSettings->mNumHeaders = 6;
+ locPaginator.setParameters(locSettings);
+
+ locPaginator.setPageCallback(&locPageChecker);
+
+ const unsigned long MAX_PACK_SIZE = 200;
+ unsigned long locPacketSize = 0;
+ StampedOggPacket* locTestPacket;
+
+ for (int i = 0; i < inNumPackets; i++) {
+ locPacketSize = rand() % MAX_PACK_SIZE;
+ locTestPacket = locPackGen.generatePacket(locPacketSize, i);
+ locPaginator.acceptStampedOggPacket(locTestPacket);
+ }
+ locPaginator.finishStream();
+ return true;
+
+}
+
+//bool testPagination(string inFileName) {
+// TestPatternOggPacketGenerator locPackGen;
+// TestPatternOggPageChecker locPageChecker;
+// OggPaginator locPaginator;
+// locPaginator.setPageCallback(&locPageChecker);
+//
+// for (int i = 0; i <
+//
+//}
int _tmain(int argc, _TCHAR* argv[])
{
-
+ //testRandomPacketSizes("", 100);
+ testSmallPacketSizes("", 10000);
return 0;
}
Modified: trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.vcproj
===================================================================
--- trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.vcproj 2004-11-29 02:22:45 UTC (rev 8296)
+++ trunk/oggdsf/src/tests/testLibOOOgg/testLibOOOgg.vcproj 2004-11-29 09:52:54 UTC (rev 8297)
@@ -19,14 +19,16 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
+ AdditionalIncludeDirectories="..\..\lib\core\ogg\libOOOgg;..\..\lib\helper\libilliCore"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
- RuntimeLibrary="5"
+ RuntimeLibrary="3"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
+ DebugInformationFormat="4"
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -66,12 +68,14 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\lib\core\ogg\libOOOgg;..\..\lib\helper\libilliCore"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="4"
+ RuntimeLibrary="2"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
+ DebugInformationFormat="3"
+ CallingConvention="2"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
@@ -113,6 +117,9 @@
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
+ RelativePath=".\OggPageFileWriter.cpp">
+ </File>
+ <File
RelativePath=".\stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
@@ -130,14 +137,35 @@
<File
RelativePath=".\testLibOOOgg.cpp">
</File>
+ <File
+ RelativePath=".\TestPatternOggPacketChecker.cpp">
+ </File>
+ <File
+ RelativePath=".\TestPatternOggPacketGenerator.cpp">
+ </File>
+ <File
+ RelativePath=".\TestPatternOggPageChecker.cpp">
+ </File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
+ RelativePath=".\OggPageFileWriter.h">
+ </File>
+ <File
RelativePath=".\stdafx.h">
</File>
+ <File
+ RelativePath=".\TestPatternOggPacketChecker.h">
+ </File>
+ <File
+ RelativePath=".\TestPatternOggPacketGenerator.h">
+ </File>
+ <File
+ RelativePath=".\TestPatternOggPageChecker.h">
+ </File>
</Filter>
<Filter
Name="Resource Files"
More information about the commits
mailing list