[xiph-commits] r8306 - in trunk/oggdsf: docs
src/lib/core/directshow/dsfAnxMux
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Mon Nov 29 19:46:51 PST 2004
Author: illiminable
Date: 2004-11-29 19:46:50 -0800 (Mon, 29 Nov 2004)
New Revision: 8306
Modified:
trunk/oggdsf/docs/anx_mux.txt
trunk/oggdsf/docs/libOOOgg.txt
trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp
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
Log:
* Improved anx mux, still doesn't force a cmml codec, still some mysterious packets in there.
Modified: trunk/oggdsf/docs/anx_mux.txt
===================================================================
--- trunk/oggdsf/docs/anx_mux.txt 2004-11-29 17:37:04 UTC (rev 8305)
+++ trunk/oggdsf/docs/anx_mux.txt 2004-11-30 03:46:50 UTC (rev 8306)
@@ -0,0 +1,12 @@
+VERSION 2.0
+===========
+
+* Needs to make an annodex BOS page.
+ * Need timebase and UTC from CMML stream.
+* Needs to make an anxdata page (same serial as annodex) for each stream
+ * Need to know how many following headers.
+ * Need to know granule rate.
+ * Additional header fields - where from ?
+* Needs to ensure a CMML Stream ?
+* Needs to put an annodex BOS after the anxdata BOS's
+* Then mux pages as normal, but take the BOS flag off of the codec headers.
\ No newline at end of file
Modified: trunk/oggdsf/docs/libOOOgg.txt
===================================================================
--- trunk/oggdsf/docs/libOOOgg.txt 2004-11-29 17:37:04 UTC (rev 8305)
+++ trunk/oggdsf/docs/libOOOgg.txt 2004-11-30 03:46:50 UTC (rev 8306)
@@ -2,3 +2,7 @@
* 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.
+
+* Need a reset method to put paginator in initial state again.
+
+* Doesn't aggressively go for target size.
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp 2004-11-29 17:37:04 UTC (rev 8305)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxMuxInputPin.cpp 2004-11-30 03:46:50 UTC (rev 8306)
@@ -13,15 +13,126 @@
HRESULT AnxMuxInputPin::SetMediaType(const CMediaType* inMediaType)
{
- //This pushes an anxdata packet into the stream.
- HRESULT locHR = OggMuxInputPin::SetMediaType(inMediaType);
- if (locHR == S_OK) {
- debugLog<<"Set media type ok in base class"<<endl;
- mPaginator.acceptStampedOggPacket(AnxPacketMaker::makeAnxData_2_0(mMuxStream, &mPaginator));
+ bool locWasOK = false;
+ unsigned __int64 locGranRateNum = 0;
+ unsigned __int64 locGranRateDenom = 0;
+ unsigned long locNumHeaders = 0;
+ StreamHeaders::eCodecType locCodecID = StreamHeaders::NONE;
+
+
+ if ((inMediaType->majortype == MEDIATYPE_Video) && (inMediaType->subtype == MEDIASUBTYPE_Theora)) {
+ //Theora
+
+ sTheoraFormatBlock* locTheora = (sTheoraFormatBlock*)inMediaType->pbFormat;
+ //debugLog<<"Theo sample rate = "<<locTheora->frameRateNumerator<<" / "<<locTheora->frameRateDenominator<<endl;
+ //debugLog<<"Theo KFI = "<<locTheora->maxKeyframeInterval<<endl;
+ mMuxStream->setConversionParams(locTheora->frameRateNumerator, locTheora->frameRateDenominator, 10000000, locTheora->maxKeyframeInterval);
+ mPaginator.setNumHeaders(3);
+
+ locWasOK = true;
+ locGranRateNum = locTheora->frameRateNumerator;
+ locGranRateDenom = locTheora->frameRateDenominator;
+ locNumHeaders = 3;
+ locCodecID = StreamHeaders::THEORA;
+
+ } else if (inMediaType->majortype == MEDIATYPE_Audio) {
+ if (inMediaType->subtype == MEDIASUBTYPE_Vorbis) {
+ //Vorbis
+ sVorbisFormatBlock* locVorbis = (sVorbisFormatBlock*)inMediaType->pbFormat;
+ //debugLog<<"Vorbis sample rate = "<<locVorbis->samplesPerSec<<endl;
+ mMuxStream->setConversionParams(locVorbis->samplesPerSec, 1, 10000000);
+ mPaginator.setNumHeaders(3);
+
+ locWasOK = true;
+ locGranRateNum = locVorbis->samplesPerSec;
+ locGranRateDenom = 1;
+ locNumHeaders = 3;
+
+ locCodecID = StreamHeaders::VORBIS;
+
+
+ } else if (inMediaType->subtype == MEDIASUBTYPE_Speex) {
+ //Speex
+ sSpeexFormatBlock* locSpeex = (sSpeexFormatBlock*)inMediaType->pbFormat;
+ mMuxStream->setConversionParams(locSpeex->samplesPerSec, 1, 10000000);
+ mPaginator.setNumHeaders(2);
+
+
+ locWasOK = true;
+ locGranRateNum = locSpeex->samplesPerSec;
+ locGranRateDenom = 1;
+ locNumHeaders = 2;
+ locCodecID = StreamHeaders::SPEEX;
+ }
+
+ //TODO::: Add a num headers field to the flac format block.
+
+ //} else if (inMediaType->subtype == MEDIASUBTYPE_OggFLAC_1_0) {
+ // //We are connected to the encoder nd getting individual metadata packets.
+ // sFLACFormatBlock* locFLAC = (sFLACFormatBlock*)inMediaType->pbFormat;
+ // mMuxStream->setConversionParams(locFLAC->samplesPerSec, 1, 10000000);
+ // //debugLog<<"FLAC sample rate = "<<locFLAC->samplesPerSec<<endl;
+ // //mNeedsFLACHeaderTweak = true;
+ // mNeedsFLACHeaderCount = true;
+ //} else if (inMediaType->subtype == MEDIASUBTYPE_FLAC) {
+ // //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);
+ // //debugLog<<"FLAC sample rate = "<<locFLAC->samplesPerSec<<endl;
+ // mNeedsFLACHeaderTweak = true;
+ //}
+
+
}
+ if (locWasOK) {
+ mPaginator.acceptStampedOggPacket(AnxPacketMaker::makeAnxData_2_0(2,0, locGranRateNum, locGranRateDenom, locNumHeaders, AnxPacketMaker::makeMessageHeaders(locCodecID)));
+ return S_OK;
+ } else {
+ return S_FALSE;
+ }
- return locHR;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ////This pushes an anxdata packet into the stream.
+ //HRESULT locHR = OggMuxInputPin::SetMediaType(inMediaType);
+
+ //if (locHR == S_OK) {
+ // debugLog<<"Set media type ok in base class"<<endl;
+ // mPaginator.acceptStampedOggPacket(AnxPacketMaker::makeAnxData_2_0(mMuxStream, &mPaginator));
+ //}
+
+ //return locHR;
+
+
}
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.cpp 2004-11-29 17:37:04 UTC (rev 8305)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.cpp 2004-11-30 03:46:50 UTC (rev 8306)
@@ -9,7 +9,7 @@
{
}
-OggPage* AnxPacketMaker::makeAnnodexBOS ( unsigned long inSerialNo
+OggPage* AnxPacketMaker::makeAnnodexBOS_2_0 ( unsigned long inSerialNo
, unsigned short inVersionMajor
, unsigned short inVersionMinor
, unsigned __int64 inTimebaseNum
@@ -72,7 +72,7 @@
}
}
-StampedOggPacket* AnxPacketMaker::makeAnxData ( unsigned short inVersionMajor
+StampedOggPacket* AnxPacketMaker::makeAnxData_2_0 ( unsigned short inVersionMajor
, unsigned short inVersionMinor
, unsigned __int64 inGranuleRateNum
, unsigned __int64 inGranuleRateDenom
@@ -137,38 +137,77 @@
}
}
-StampedOggPacket* AnxPacketMaker::makeAnxData_2_0 (OggMuxStream* inMuxStream, OggPaginator* inPaginator)
-{
- return makeAnxData( 2
- , 0
- , inMuxStream->granuleNumerator()
- , inMuxStream->granuleDenominator()
- , inPaginator->numHeaders()
- , makeMessageHeaders(inMuxStream));
-}
+//StampedOggPacket* AnxPacketMaker::makeAnxData_2_0 (OggMuxStream* inMuxStream, OggPaginator* inPaginator)
+//{
+// return makeAnxData_2_0( 2
+// , 0
+// , inMuxStream->granuleNumerator()
+// , inMuxStream->granuleDenominator()
+// , inPaginator->numHeaders()
+// , makeMessageHeaders(inMuxStream));
+//}
-StreamHeaders::eCodecType AnxPacketMaker::IdentifyCodec(OggPacket* inOggPacket) {
- if (strncmp((char*)inOggPacket->packetData(), "\001vorbis", 7) == 0) {
- return StreamHeaders::VORBIS;
- } else if (strncmp((char*)inOggPacket->packetData(), "Speex ", 8) == 0) {
- return StreamHeaders::SPEEX;
- } else if ((strncmp((char*)inOggPacket->packetData(), "fLaC", 4)) == 0) {
- return StreamHeaders::FLAC;
- } else if ((strncmp((char*)inOggPacket->packetData(), "\177FLAC", 5)) == 0) {
- return StreamHeaders::OGG_FLAC_1_0;
- } else if ((strncmp((char*)inOggPacket->packetData(), "\200theora", 7)) == 0) {
- return StreamHeaders::THEORA;
- } else if ((strncmp((char*)inOggPacket->packetData(), "\001video\000\000\000", 9)) == 0) {
- return StreamHeaders::FFDSHOW_VIDEO;
- }
-
- return StreamHeaders::NONE;
-
-}
-vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream) {
+//StreamHeaders::eCodecType AnxPacketMaker::IdentifyCodec(OggPacket* inOggPacket) {
+// if (strncmp((char*)inOggPacket->packetData(), "\001vorbis", 7) == 0) {
+// return StreamHeaders::VORBIS;
+// } else if (strncmp((char*)inOggPacket->packetData(), "Speex ", 8) == 0) {
+// return StreamHeaders::SPEEX;
+// } else if ((strncmp((char*)inOggPacket->packetData(), "fLaC", 4)) == 0) {
+// return StreamHeaders::FLAC;
+// } else if ((strncmp((char*)inOggPacket->packetData(), "\177FLAC", 5)) == 0) {
+// return StreamHeaders::OGG_FLAC_1_0;
+// } else if ((strncmp((char*)inOggPacket->packetData(), "\200theora", 7)) == 0) {
+// return StreamHeaders::THEORA;
+// } else if ((strncmp((char*)inOggPacket->packetData(), "\001video\000\000\000", 9)) == 0) {
+// return StreamHeaders::FFDSHOW_VIDEO;
+// }
+//
+// return StreamHeaders::NONE;
+//
+//}
+
+
+//vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream) {
+// string locTempString = "";
+// vector<string> retVector;
+// switch(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:
+// break;
+// }
+//
+// return retVector;
+//}
+
+
+vector<string> AnxPacketMaker::makeMessageHeaders(StreamHeaders::eCodecType inCodecType) {
string locTempString = "";
vector<string> retVector;
- switch(IdentifyCodec(inMuxStream->peekFront()->getPacket(0))) {
+ switch(inCodecType) {
case StreamHeaders::VORBIS:
locTempString = "Content-type: audio/x-vorbis";
retVector.push_back(locTempString);
@@ -200,4 +239,3 @@
return retVector;
}
-
Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.h 2004-11-29 17:37:04 UTC (rev 8305)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPacketMaker.h 2004-11-30 03:46:50 UTC (rev 8306)
@@ -10,7 +10,7 @@
static const ANX_2_0_ANNODEX_BOS_SIZE = 48;
- static OggPage* makeAnnodexBOS ( unsigned long inSerialNo
+ static OggPage* makeAnnodexBOS_2_0 ( unsigned long inSerialNo
, unsigned short inVersionMajor
, unsigned short inVersionMinor
, unsigned __int64 inTimebaseNum
@@ -18,7 +18,7 @@
, const unsigned char* inUTC
);
- static StampedOggPacket* makeAnxData ( unsigned short inVersionMajor
+ static StampedOggPacket* makeAnxData_2_0 ( unsigned short inVersionMajor
, unsigned short inVersionMinor
, unsigned __int64 inGranuleRateNum
, unsigned __int64 inGranuleDenom
@@ -27,9 +27,10 @@
);
static StampedOggPacket* makeAnxData_2_0 (OggMuxStream* inMuxStream, OggPaginator* inPaginator);
- static StampedOggPacket* makeAnxData (OggMuxStream* inMuxStream, OggPaginator* inPaginator);
+ //static StampedOggPacket* makeAnxData (OggMuxStream* inMuxStream, OggPaginator* inPaginator);
- static StreamHeaders::eCodecType AnxPacketMaker::IdentifyCodec(OggPacket* inOggPacket);
- static vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream);
+ //static StreamHeaders::eCodecType AnxPacketMaker::IdentifyCodec(OggPacket* inOggPacket);
+ //static vector<string> AnxPacketMaker::makeMessageHeaders(OggMuxStream* inMuxStream);
+ static vector<string> AnxPacketMaker::makeMessageHeaders(StreamHeaders::eCodecType inCodecType);
};
Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.cpp 2004-11-29 17:37:04 UTC (rev 8305)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/AnxPageInterleaver.cpp 2004-11-30 03:46:50 UTC (rev 8306)
@@ -26,7 +26,7 @@
unsigned char* locUTC = new unsigned char[20];
memset((void*)locUTC, 0, 20);
- OggPage* locBOSPage = AnxPacketMaker::makeAnnodexBOS( mAnxSerialNo
+ OggPage* locBOSPage = AnxPacketMaker::makeAnnodexBOS_2_0( mAnxSerialNo
, 2
, 0
, 0
More information about the commits
mailing list