[xiph-commits] r8016 - in trunk/oggdsf/src/lib/core:
directshow/dsfOggMux ogg/libOOOgg ogg/libOOOggSeek
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Fri Oct 15 09:46:03 PDT 2004
Author: illiminable
Date: 2004-10-15 09:46:02 -0700 (Fri, 15 Oct 2004)
New Revision: 8016
Modified:
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.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/OggPaginator.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.cpp
trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.h
trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
Log:
* Added an explicit way to mark the number of headers for the paginator... it was putting some vorbis/theora packets which had 0 granule pos (dunno why this happens... since i thought if there's audio, granule pos must be non-zero) before headers.
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.cpp 2004-10-15 16:46:02 UTC (rev 8016)
@@ -36,6 +36,7 @@
, mParentFilter(inParentFilter)
, mMuxStream(inMuxStream)
, mNeedsFLACHeaderTweak(false)
+ , mNeedsFLACHeaderCount(false)
{
OggPaginatorSettings* locSettings = new OggPaginatorSettings;
@@ -79,23 +80,26 @@
sTheoraFormatBlock* locTheora = (sTheoraFormatBlock*)inMediaType->pbFormat;
debugLog<<"Theo sample rate = "<<locTheora->frameRateNumerator<<" / "<<locTheora->frameRateDenominator<<endl;
mMuxStream->setConversionParams(locTheora->frameRateNumerator, locTheora->frameRateDenominator, 10000000, locTheora->maxKeyframeInterval);
-
+ mPaginator.setNumHeaders(3);
} 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);
} else if (inMediaType->subtype == MEDIASUBTYPE_Speex) {
//Speex
sSpeexFormatBlock* locSpeex = (sSpeexFormatBlock*)inMediaType->pbFormat;
mMuxStream->setConversionParams(locSpeex->samplesPerSec, 1, 10000000);
+ mPaginator.setNumHeaders(2);
} 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);
//mNeedsFLACHeaderTweak = true;
+ mNeedsFLACHeaderCount = true;
} else if (inMediaType->subtype == MEDIASUBTYPE_FLAC) {
//We are connected directly to the mux and are getting metadata in one block
// Need to use the header splitter class.
@@ -178,6 +182,11 @@
memcpy((void*)locBuff, (const void*)locSampleBuff, inSample->GetActualDataLength());
StampedOggPacket* locPacket = new StampedOggPacket(locBuff, inSample->GetActualDataLength(), false, false, locStart, locEnd, StampedOggPacket::OGG_END_ONLY);
+ if (mNeedsFLACHeaderCount) {
+ mNeedsFLACHeaderCount = false;
+ //This is to set the number of headers on the paginator for OggFLAC_1_0
+ mPaginator.setNumHeaders( locPacket->packetData()[8] );
+ }
if ((mNeedsFLACHeaderTweak)) {
//The first packet in FLAC has all the metadata in one block...
// It needs to be broken up for correct muxing....
@@ -212,6 +221,12 @@
for (int i = 0; i < locFLACSplitter->numHeaders(); i++) {
debugLog<<"Giving pager, packet "<<i<<endl;
debugLog<<locFLACSplitter->getHeader(i)->toPackDumpString()<<endl; //This is a leak !!
+ if (i==0) {
+ //Set the number of headers in the paginator for FLAC classic.
+ StampedOggPacket* locHeadPack = locFLACSplitter->getHeader(i);
+ mPaginator.setNumHeaders(locHeadPack->packetData()[8]);
+ delete locHeadPack;
+ }
mPaginator.acceptStampedOggPacket(locFLACSplitter->getHeader(i));
debugLog<<"After paginator feed..."<<endl;
}
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxInputPin.h 2004-10-15 16:46:02 UTC (rev 8016)
@@ -80,6 +80,7 @@
OggMuxFilter* mParentFilter;
bool mNeedsFLACHeaderTweak;
+ bool mNeedsFLACHeaderCount;
OggPaginator mPaginator;
OggMuxStream* mMuxStream;
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.cpp 2004-10-15 16:46:02 UTC (rev 8016)
@@ -40,6 +40,7 @@
, mConvDenominator(1)
, mConvScaleFactor(1)
, mConvTheoraLogKeyFrameInterval(0)
+
{
}
@@ -149,4 +150,5 @@
}
void OggMuxStream::setIsActive(bool inIsActive) {
mIsActive = inIsActive;
-}
\ No newline at end of file
+}
+
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggMuxStream.h 2004-10-15 16:46:02 UTC (rev 8016)
@@ -63,6 +63,9 @@
virtual bool setConversionParams(__int64 inNumerator, __int64 inDenominator, __int64 inScaleFactor, __int64 inTheoraLogKFI);
bool setConversionParams(__int64 inNumerator, __int64 inDenominator, __int64 inScaleFactor);
+
+
+
protected:
INotifyArrival* mNotifier;
@@ -76,5 +79,6 @@
__int64 mConvDenominator;
__int64 mConvScaleFactor;
__int64 mConvTheoraLogKeyFrameInterval;
+
deque<OggPage*> mPageQueue;
};
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.cpp 2004-10-15 16:46:02 UTC (rev 8016)
@@ -311,16 +311,15 @@
// deliverCurrentPage();
//}
- //This will ensure that any packet that has a 0 time stamp appears on it's own page...
- // For codecs with fixed number of headers, it's easy to put several of these packets on a page
- // But it's more difficult to do it generically for variable numbers of headers.
- // Just ensuring that any packet with 0 gran pos (which is usually only headers, or possibly
- // the first packet in a non-continuous codec) has it's own page is the simplest solution
+ //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.
- if ((inOggPacket->endTime() == 0) && (mPendingPageHasData)) {
- debugLog<<"Flushing a 0 gran pos page..."<<endl;
+ if ((mPacketCount < mSettings->mNumHeaders) && (mPendingPageHasData)) {
+ debugLog<<"Flushing a header page..."<<endl;
+ debugLog<<"PacketCount = "<<mPacketCount<<endl;
+ debugLog<<"Num Headers = "<<mSettings->mNumHeaders<<endl;
deliverCurrentPage();
}
mPacketCount++;
@@ -506,4 +505,13 @@
bool OggPaginator::setPageCallback(IOggCallback* inPageCallback) {
mPageCallback = inPageCallback;
return true;
-}
\ No newline at end of file
+}
+
+void OggPaginator::setNumHeaders(unsigned long inNumHeaders) {
+ mSettings->mNumHeaders = inNumHeaders;
+}
+unsigned long OggPaginator::numHeaders() {
+ return mSettings->mNumHeaders;
+
+}
+
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginator.h 2004-10-15 16:46:02 UTC (rev 8016)
@@ -50,12 +50,16 @@
~OggPaginator(void);
bool setParameters(OggPaginatorSettings* inSettings);
+
bool acceptStampedOggPacket(StampedOggPacket* inOggPacket);
bool setPageCallback(IOggCallback* inPageCallback);
bool finishStream();
+ void setNumHeaders(unsigned long inNumHeaders);
+ unsigned long numHeaders();
+
protected:
bool deliverCurrentPage();
bool setChecksum();
@@ -67,6 +71,7 @@
//bool addPartOfPacketToPage(StampedOggPacket* inOggPacket, unsigned long inStartFrom);
unsigned long mPacketCount;
+ unsigned long mNumHeaders;
unsigned long mCurrentPageSize;
unsigned char mSegmentTable[255];
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.cpp 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.cpp 2004-10-15 16:46:02 UTC (rev 8016)
@@ -33,6 +33,11 @@
#include "oggpaginatorsettings.h"
OggPaginatorSettings::OggPaginatorSettings(void)
+ : mSerialNo(0)
+ , mMaxPageSize(8192)
+ , mTargetPageSize(4096)
+ , mMinPageSize(4096)
+ , mNumHeaders(0)
{
}
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.h
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.h 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPaginatorSettings.h 2004-10-15 16:46:02 UTC (rev 8016)
@@ -41,5 +41,6 @@
unsigned long mMaxPageSize;
unsigned long mTargetPageSize;
unsigned long mMinPageSize;
+ unsigned long mNumHeaders;
};
Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp 2004-10-15 14:35:15 UTC (rev 8015)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp 2004-10-15 16:46:02 UTC (rev 8016)
@@ -65,7 +65,7 @@
}
bool AutoOggSeekTable::acceptOggPage(OggPage* inOggPage) {
- mPacketCount += inOggPage->numPackets();
+
//TODO ::: Some of this could be shared from other places.
if (!mFoundStreamInfo) {
@@ -163,10 +163,16 @@
}
}
+ if (mSerialNoToTrack == inOggPage->header()->StreamSerialNo()) {
+ mPacketCount += inOggPage->numPackets();
+ }
+
if ((mFoundStreamInfo) && (mSerialNoToTrack == inOggPage->header()->StreamSerialNo()) && (inOggPage->header()->GranulePos() != -1)) {
//if ((mPacketCount > 3) && (mLastIsSeekable == true)) {
debugLog<<"Stream headers complete..."<<endl;
+ debugLog<<"Num Headers = "<<mNumHeaders<<endl;
+ debugLog<<"Packet COunt = "<<mPacketCount<<endl;
if ((mPacketCount > mNumHeaders) && ((inOggPage->header()->HeaderFlags() & 1) != 1)) {
debugLog<<"Adding seek point Time = "<<mLastSeekTime<<" -- File pos = "<<mFilePos<<endl;
addSeekPoint(mLastSeekTime, mFilePos);
More information about the commits
mailing list