[xiph-commits] r9106 - in trunk/oggdsf/src: lib/codecs/cmml/dsfCMMLRawSource lib/codecs/cmml/libCMMLTags lib/codecs/theora/filters/dsfTheoraEncoder lib/core/directshow/dsfAnxMux lib/core/directshow/dsfOggMux lib/helper/libOOOggChef tools/CMMLDump

ozone at motherfish-iii.xiph.org ozone at motherfish-iii.xiph.org
Sun Apr 3 06:58:53 PDT 2005


Author: ozone
Date: 2005-04-03 06:58:44 -0700 (Sun, 03 Apr 2005)
New Revision: 9106

Modified:
   trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourcePin.cpp
   trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLTag.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h
   trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp
   trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp
   trunk/oggdsf/src/tools/CMMLDump/CMMLDump.cpp
   trunk/oggdsf/src/tools/CMMLDump/CMMLDump.vcproj
Log:
oggcodecs:
 * Default to muxing Annodex v3 files, not v2, which will be deprecated soon (huzzah)
 * While I have your attention, credit for the fix in changeset:9105 should go to illi, not me


Modified: trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourcePin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourcePin.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourcePin.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -1,6 +1,8 @@
 #include "stdafx.h"
 #include ".\cmmlrawsourcepin.h"
 
+#define OGGCODECS_LOGGING
+
 CMMLRawSourcePin::CMMLRawSourcePin(CMMLRawSourceFilter* inParentFilter, CCritSec* inFilterLock)
 	:	CBaseOutputPin(NAME("CMML Raw Source Pin"), inParentFilter, inFilterLock, &mFilterHR, L"CMML Source")
 	,	mDataQueue(NULL)
@@ -83,6 +85,9 @@
 	//NOTE::: May have missed some fields ????
 	//NOTE::: May want to check for null pointers
 	//outMediaType->SetFormat(mMediaType->Format(), mMediaType->FormatLength());
+
+	debugLog << "CMMLRawSourcePin::GetMediaType called" << endl;
+	
 	if (inPosition == 0) {
 		CMediaType locMediaType;
 
@@ -103,8 +108,10 @@
 }
 HRESULT CMMLRawSourcePin::CheckMediaType(const CMediaType* inMediaType) {
 	if ((inMediaType->majortype == MEDIATYPE_Text) && (inMediaType->subtype == MEDIASUBTYPE_CMML) && (inMediaType->formattype == FORMAT_CMML)) {
+		debugLog << "CheckMediaType returned S_OK" << endl;
 		return S_OK;
 	} else {
+		debugLog << "CheckMediaType returned E_FAIL" << endl;
 		return E_FAIL;
 	}
 }
@@ -158,6 +165,7 @@
 
 	wstring locStr = inTag->toString();
 
+	debugLog << "ANX_VERSION_MAJOR == " << ANX_VERSION_MAJOR << ", " << ANX_VERSION_MINOR << endl;
 	
 	//TODO::: For now, this narrowfies the string... to ascii, instead of sending
 	// 2 byte chars.
@@ -174,6 +182,9 @@
 		if ((ANX_VERSION_MAJOR == 2) && (ANX_VERSION_MINOR == 0)) {
 			locStart = locStartStamp.toHunNanos() / 10000;
 		} else if ((ANX_VERSION_MAJOR == 3) && (ANX_VERSION_MINOR == 0)) {
+#ifdef OGGCODECS_LOGGING
+			debugLog << "mLastTime pre-locStart: " << mLastTime << endl;
+#endif
 			locStart = (mLastTime << 32) + ((locStartStamp.toHunNanos() - mLastTime) / 10000);
 			
 		} else {
@@ -189,6 +200,9 @@
 		if ((ANX_VERSION_MAJOR == 2) && (ANX_VERSION_MINOR == 0)) {
 			locStop = locEndStamp.toHunNanos() / 10000;
 		} else if ((ANX_VERSION_MAJOR == 3) && (ANX_VERSION_MINOR == 0)) {
+#ifdef OGGCODECS_LOGGING
+			debugLog << "mLastTime pre-locStop: " << mLastTime << endl;
+#endif
 			locStop = (mLastTime << 32) + ((locEndStamp.toHunNanos() - mLastTime) / 10000);
 		} else {
 			//If you are here you set the constants in the header file wrong
@@ -196,6 +210,9 @@
 		}
 
 		mLastTime = locStartStamp.toHunNanos() / 10000;
+#ifdef OGGCODECS_LOGGING
+		debugLog << "mLastTime after setup: " << mLastTime << endl;
+#endif
 		//locStop = StringHelper::stringToNum(StringHelper::toNarrowStr(locClip->start())) * 1000ULL;
 		
 

Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLTag.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLTag.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -93,11 +93,13 @@
 {
 	wstring retStr = inString;
 	//Do the ampersand first !!
+#if 0
 	retStr = replaceAll(retStr, L'&', L"&amp;");
 	retStr = replaceAll(retStr, L'<', L"&lt;");
 	retStr = replaceAll(retStr, L'>', L"&gt;");
 	retStr = replaceAll(retStr, L'"', L"&quot;");
 	retStr = replaceAll(retStr, L'\'', L"&apos;");
+#endif
 
 	return retStr;
 

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -1345,7 +1345,7 @@
 	mTheoraInfo.aspect_denominator=0;
 	
 	mTheoraInfo.colorspace=OC_CS_UNSPECIFIED;		//YV12
-	mTheoraInfo.target_bitrate=400000; //mVideoFormat->dwBitRate;
+	mTheoraInfo.target_bitrate=200000; //mVideoFormat->dwBitRate;
 
 	//Hard code for now
 	mTheoraInfo.quality=30; //video_q;

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxFilter.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -70,7 +70,7 @@
 } 
 AnxMuxFilter::AnxMuxFilter(void)
 	:	OggMuxFilter(CLSID_AnxMuxFilter)
-	,	mAnxVersionMajor(2)
+	,	mAnxVersionMajor(3)
 	,	mAnxVersionMinor(0)
 {
 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -31,6 +31,8 @@
 #include "stdafx.h"
 #include "oggmuxinputpin.h"
 
+#define OGGCODECS_LOGGING
+
 OggMuxInputPin::OggMuxInputPin(OggMuxFilter* inParentFilter, CCritSec* inFilterLock, HRESULT* inHR, OggMuxStream* inMuxStream)
 	:	CBaseInputPin(NAME("OggMuxInputPin"), inParentFilter, inFilterLock, inHR, L"Ogg Packet In")
 	,	mParentFilter(inParentFilter)
@@ -58,6 +60,12 @@
 	//debugLog.open(x.c_str(), ios_base::out);
 	//locSettings->mSerialNo = 13130;
 	
+#ifdef OGGCODECS_LOGGING
+	debugLog.open("G:\\logs\\oggmuxinputpin.log", ios_base::out);
+#endif
+
+	debugLog << "OggMuxInputPin constructed" << endl;
+
 	mPaginator.setParameters(locSettings);
 	mPaginator.setPageCallback(mMuxStream);
 
@@ -66,7 +74,7 @@
 
 OggMuxInputPin::~OggMuxInputPin(void)
 {
-	//debugLog.close();
+	debugLog.close();
 }
 
 STDMETHODIMP OggMuxInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
@@ -84,6 +92,9 @@
 HRESULT OggMuxInputPin::SetMediaType(const CMediaType* inMediaType) {
 	//debugLog.open("G:\\logs\\oggmuxinpin.log", ios_base::out);
 	//debugLog<<"Set media type..."<<endl;
+	
+	debugLog << "OggMuxInputPin::SetMediaType called" << endl;
+
 	if ((inMediaType->majortype == MEDIATYPE_Video) && (inMediaType->subtype == MEDIASUBTYPE_Theora)) {
 		//Theora
 		
@@ -127,6 +138,7 @@
 		
 	} else if (inMediaType->majortype == MEDIATYPE_Text) {
 		if (inMediaType->subtype == MEDIASUBTYPE_CMML) {
+			debugLog << "OggMuxInputPin::SetMediaType got to CMML" << endl;
 			sCMMLFormatBlock* locCMML = (sCMMLFormatBlock*)inMediaType->pbFormat;
 			mMuxStream->setConversionParams(locCMML->granuleNumerator,locCMML->granuleDenominator, 10000000);
 			mMuxStream->setNumHeaders(1);

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h	2005-04-03 13:58:44 UTC (rev 9106)
@@ -86,5 +86,5 @@
 	
 	OggPaginator mPaginator;
 	OggMuxStream* mMuxStream;
-	//fstream debugLog;
+	fstream debugLog;
 };

Modified: trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/AnnodexRecomposer.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -35,6 +35,7 @@
 #include "stdafx.h"
 
 #include <libOOOggChef/AnnodexRecomposer.h>
+#include <libOOOggChef/CMMLRecomposer.h>
 #include <libOOOggChef/utils.h>
 
 #include <libOOOgg/libOOOgg.h>
@@ -50,7 +51,7 @@
 using namespace std;
 
 
-#undef DEBUG
+#define DEBUG
 
 /** You may optionally ask
 	AnnodexRecomposer to use a cached representation of the seek table (which is
@@ -96,6 +97,20 @@
 
 	static const size_t BUFF_SIZE = 8192;
 
+	// Optimisation: If the client only wants CMML, and a file with .cmml
+	// exists, recompose from that instead of the original .anx file, which
+	// will be orders of magnitudes faster!
+	string locCMMLFilename = mFilename + ".cmml";
+	if (wantOnlyCMML(mWantedMIMETypes) && fileExists(locCMMLFilename)) {
+#ifdef DEBUG
+		mDebugFile << "Client wants CMML: " + locCMMLFilename + " exists" << endl;
+#endif
+		CMMLRecomposer *locCMMLRecomposer = new CMMLRecomposer(locCMMLFilename,
+			mBufferWriter, mBufferWriterUserData);
+		return locCMMLRecomposer->recomposeStreamFrom(inStartingTimeOffset,
+			inWantedMIMETypes);
+	}
+
 	// Turn the starting time offset into DirectSeconds
 	mRequestedStartTime = (LOOG_UINT64) inStartingTimeOffset * 10000000;
 

Modified: trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp
===================================================================
--- trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/lib/helper/libOOOggChef/CMMLRecomposer.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -52,7 +52,7 @@
 
 using namespace std;
 
-#undef DEBUG
+#define DEBUG
 
 CMMLRecomposer::CMMLRecomposer(string inFilename, BufferWriter inBufferWriter, void* inBufferWriterUserData)
 	:	mCMMLFilename(inFilename)

Modified: trunk/oggdsf/src/tools/CMMLDump/CMMLDump.cpp
===================================================================
--- trunk/oggdsf/src/tools/CMMLDump/CMMLDump.cpp	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/tools/CMMLDump/CMMLDump.cpp	2005-04-03 13:58:44 UTC (rev 9106)
@@ -120,7 +120,7 @@
 
 					// Get the packet's time in seconds
 					LOOG_INT64 locPacketGranulePos = inOggPage->header()->GranulePos();
-					float locPacketStartTimeInSeconds = (float) locPacketGranulePos/ (float) 1000;
+					float locPacketStartTimeInSeconds = (float) locPacketGranulePos / (float) 1000;
 
 					// Let's make the CMML parsing library decide whether it's a <head>
 					// or <clip> tag -- after all, that's what it's there for :)
@@ -157,9 +157,6 @@
 						wcout << locPacketDataWString << endl;
 					}
 
-					if (locDidParseClip) {
-						cout << locPacketStartTimeInSeconds << " seconds:" << endl;
-					}
 					wcout << locCMMLTag->toString() << endl;
 
 					delete locCMMLTag;
@@ -198,6 +195,10 @@
 
 	fstream locInputFile;
 
+	// Output XML preabmel
+	cout << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" << endl;
+	cout << "<!DOCTYPE cmml SYSTEM \"cmml.dtd\">" << endl;
+
 	// Let's go!
 
 	const unsigned short BUFF_SIZE = 8092;

Modified: trunk/oggdsf/src/tools/CMMLDump/CMMLDump.vcproj
===================================================================
--- trunk/oggdsf/src/tools/CMMLDump/CMMLDump.vcproj	2005-04-03 13:56:34 UTC (rev 9105)
+++ trunk/oggdsf/src/tools/CMMLDump/CMMLDump.vcproj	2005-04-03 13:58:44 UTC (rev 9106)
@@ -70,7 +70,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="..\..\lib\core\ogg;.;..\..\lib\helper;..\..\lib\codecs\cmml"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				RuntimeLibrary="0"
+				RuntimeLibrary="2"
 				UsePrecompiledHeader="3"
 				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"



More information about the commits mailing list