[xiph-commits] r10314 - in branches/oggdsf_new_demux/src/lib:
codecs/theora/filters/dsfTheoraDecoder
core/directshow/dsfOggDemux2 core/ogg/libOOOgg
illiminable at svn.xiph.org
illiminable at svn.xiph.org
Mon Oct 31 22:25:12 PST 2005
Author: illiminable
Date: 2005-10-31 22:24:58 -0800 (Mon, 31 Oct 2005)
New Revision: 10314
Modified:
branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h
branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h
branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp
branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h
branches/oggdsf_new_demux/src/lib/core/ogg/libOOOgg/OggPacketiser.cpp
Log:
* Fully move theora decoding to new demuxing style
* Fix a bug in the packetiser, when dispatch fails, but the packets pointer is not nulled
* Seeking working in theora again... not frame accurate yet
Modified: branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp 2005-10-29 13:14:49 UTC (rev 10313)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp 2005-11-01 06:24:58 UTC (rev 10314)
@@ -367,6 +367,8 @@
REFERENCE_TIME locEnd = 0;
inInputSample->GetTime(&locStart, &locEnd);
+ debugLog<<"Theora::Receive - Sample: Size = "<<inInputSample->GetActualDataLength()<<" Time: "<<locStart<<" - "<<locEnd<<endl;
+
//This packet is given to the decoder or buffered for later
StampedOggPacket* locPacket = new StampedOggPacket(locNewBuff, inInputSample->GetActualDataLength(), false, false, locStart, locEnd, StampedOggPacket::OGG_END_ONLY);
@@ -386,35 +388,53 @@
locStart = locGlobalStart;
+ debugLog<<"Theora::Receive - "<<locNumBufferedFrames<<" frames buffered"<<endl;
for (unsigned long i = 0; i < locNumBufferedFrames; i++) {
+ debugLog<<"Theora::Receive - Processing buffered frame "<<i<<endl;
bool locIsKeyFrame = mTheoraDecoder->isKeyFrame(mBufferedPackets[i]);
yuv_buffer* locYUV = mTheoraDecoder->decodeTheora(mBufferedPackets[i]); //This accept the packet and deletes it
locEnd = locStart + mFrameDuration;
if (locYUV != NULL) {
IMediaSample* locOutSample = NULL;
+ debugLog<<"Theora::Receive - Pre output sample initialisation"<<endl;
locHR = InitializeOutputSample(inInputSample, &locOutSample);
if (locHR != S_OK) {
//XTODO::: We need to trash our buffered packets
+ debugLog<<"Theora::Receive - Output sample initialisation failed"<<endl;
+
+ deleteBufferedPacketsAfter(i);
+
return S_FALSE;
}
+ debugLog<<"Theora::Receive - Output sample initialisation suceeded"<<endl;
//Fill the sample info
if (TheoraDecoded(locYUV, locOutSample, locIsKeyFrame, locStart, locEnd) != S_OK) {
//XTODO::: We need to trash our buffered packets
+ locOutSample->Release();
+ deleteBufferedPacketsAfter(i);
return S_FALSE;
} else {
//Deliver the sample
+ debugLog<<"Theora::Receive - Calling Deliver on outputPin"<<endl;
locHR = m_pOutput->Deliver(locOutSample);
+ locOutSample->Release();
+ debugLog<<"Theora::Receive - Post delivery"<<endl;
if (locHR != S_OK) {
//XTODO::: We need to trash our buffered packets
+ debugLog<<"Theora::Receive - Delivery failed"<<endl;
+ locOutSample->Release();
+ deleteBufferedPacketsAfter(i);
return S_FALSE;
}
+ debugLog<<"Theora::Receive - Delivery Suceeded"<<endl;
}
} else {
//XTODO::: We need to trash our buffered packets
+ deleteBufferedPacketsAfter(i);
return S_FALSE;
}
locStart = locEnd;
@@ -430,6 +450,15 @@
}
}
+
+void TheoraDecodeFilter::deleteBufferedPacketsAfter(unsigned long inPacketIndex)
+{
+ for (size_t i = inPacketIndex + 1; i < mBufferedPackets.size(); i++) {
+ delete mBufferedPackets[i];
+ }
+
+ mBufferedPackets.clear();
+}
HRESULT TheoraDecodeFilter::Transform(IMediaSample* inInputSample, IMediaSample* outOutputSample)
{
//HRESULT locHR;
@@ -574,6 +603,8 @@
//
//}
+ debugLog<<"Theora::Transform NOT IMPLEMENTED"<<endl;
+
return E_NOTIMPL;
}
Modified: branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h 2005-10-29 13:14:49 UTC (rev 10313)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h 2005-11-01 06:24:58 UTC (rev 10314)
@@ -31,6 +31,8 @@
#pragma once
+#define OGGCODECS_LOGGING
+
#include "Theoradecoderdllstuff.h"
#include "theoradecodeoutputpin.h"
#include "theoradecodeinputpin.h"
@@ -75,6 +77,8 @@
static const unsigned long THEORA_IDENT_HEADER_SIZE = 42;
virtual void ResetFrameCount();
+
+ void deleteBufferedPacketsAfter(unsigned long inPacketIndex);
void FillMediaType(CMediaType* outMediaType, unsigned long inSampleSize);
bool FillVideoInfoHeader(VIDEOINFOHEADER* inFormatBuffer);
bool SetSampleParams(IMediaSample* outMediaSample, unsigned long inDataSize, REFERENCE_TIME* inStartTime, REFERENCE_TIME* inEndTime, BOOL inIsSync);
Modified: branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h 2005-10-29 13:14:49 UTC (rev 10313)
+++ branches/oggdsf_new_demux/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h 2005-11-01 06:24:58 UTC (rev 10314)
@@ -55,7 +55,7 @@
//Quality control
virtual STDMETHODIMP Notify(IBaseFilter* inMessageSource, Quality inQuality);
- virtual HRESULT Deliver(IMediaSample* inSample) { return m_pInputPin->Receive(inSample); }
+ //virtual HRESULT Deliver(IMediaSample* inSample) { return m_pInputPin->Receive(inSample); }
//fstream debugLog;
};
Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp 2005-10-29 13:14:49 UTC (rev 10313)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.cpp 2005-11-01 06:24:58 UTC (rev 10314)
@@ -50,6 +50,7 @@
, mFilterHR(S_OK)
{
+ mPacketiserLock = new CCritSec;
//(BYTE*)inBOSPage->createRawPageData();
mPacketiser.setPacketSink(this);
@@ -61,11 +62,14 @@
//delete mBOSPage;
delete mIdentHeader;
+ delete mPacketiserLock;
+
}
bool OggDemuxPacketSourcePin::acceptOggPage(OggPage* inOggPage)
{
+ CAutoLock locPackLock(mPacketiserLock);
if (mIsStreamReady) {
mAcceptingData = true;
return mPacketiser.acceptOggPage(inOggPage);
@@ -303,8 +307,11 @@
HRESULT OggDemuxPacketSourcePin::DeliverEndFlush(void)
{
+ CAutoLock locPackLock(mPacketiserLock);
+
+ mDataQueue->EndFlush();
+
mPacketiser.reset();
- mDataQueue->EndFlush();
return S_OK;
}
Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h 2005-10-29 13:14:49 UTC (rev 10313)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourcePin.h 2005-11-01 06:24:58 UTC (rev 10314)
@@ -91,6 +91,8 @@
unsigned long getIdentSize();
unsigned long mSerialNo;
+ CCritSec* mPacketiserLock;
+
unsigned long mNumBuffers;
OggPacket* mIdentHeader;
Modified: branches/oggdsf_new_demux/src/lib/core/ogg/libOOOgg/OggPacketiser.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/ogg/libOOOgg/OggPacketiser.cpp 2005-10-29 13:14:49 UTC (rev 10313)
+++ branches/oggdsf_new_demux/src/lib/core/ogg/libOOOgg/OggPacketiser.cpp 2005-11-01 06:24:58 UTC (rev 10314)
@@ -148,6 +148,8 @@
//Deliver the packet to the packet sink...
if (dispatchStampedOggPacket(mPendingPacket) == false) {
//debugLog<<"acceptOggPage : DELIVERY FAILED !"<<endl;
+ mPacketiserState = PKRSTATE_OK;
+ mPendingPacket = NULL;
delete inOggPage;
return false;
}
@@ -165,6 +167,7 @@
//debugLog<<"acceptOggPage : INTERNAL ERROR - Header says cont but packet doesn't."<<endl;
//Header flag says continuation but first packet is not continued.
mPacketiserState = PKRSTATE_INVALID_STREAM;
+
delete inOggPage;
throw 0;
}
More information about the commits
mailing list