[xiph-commits] r7725 -
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Thu Sep 9 08:30:53 PDT 2004
Author: illiminable
Date: 2004-09-09 08:30:52 -0700 (Thu, 09 Sep 2004)
New Revision: 7725
Modified:
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h
Log:
* Added a couple of helper functions...
Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp 2004-09-09 15:03:57 UTC (rev 7724)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp 2004-09-09 15:30:52 UTC (rev 7725)
@@ -145,10 +145,7 @@
((inOutputMediaType->majortype == MEDIATYPE_Video) && (inOutputMediaType->subtype == MEDIASUBTYPE_YV12) && (inOutputMediaType->formattype == FORMAT_VideoInfo)
)) {
- VIDEOINFOHEADER* locVideoHeader = (VIDEOINFOHEADER*)inOutputMediaType->Format();
- mHeight = (unsigned long)abs(locVideoHeader->bmiHeader.biHeight);
- mWidth = (unsigned long)abs(locVideoHeader->bmiHeader.biWidth);
- mFrameSize = (unsigned long)locVideoHeader->bmiHeader.biSizeImage;
+
return S_OK;
} else {
return S_FALSE;
@@ -593,7 +590,32 @@
}
+HRESULT TheoraDecodeFilter::SetMediaType(PIN_DIRECTION inDirection, const CMediaType* inMediaType) {
+ if (inDirection == PINDIR_INPUT) {
+ if (inMediaType->subtype == MEDIASUBTYPE_Theora) {
+ setTheoraFormat((sTheoraFormatBlock*)inMediaType->pbFormat);
+
+ //Set some other stuff here too...
+ mXOffset = ((sTheoraFormatBlock*)inMediaType->pbFormat)->xOffset;
+ mYOffset = ((sTheoraFormatBlock*)inMediaType->pbFormat)->yOffset;
+
+ } else {
+ //Failed... should never be here !
+ throw 0;
+ }
+ return CVideoTransformFilter::SetMediaType(PINDIR_INPUT, inMediaType);
+ } else {
+ //Output pin SetMediaType
+ VIDEOINFOHEADER* locVideoHeader = (VIDEOINFOHEADER*)inMediaType->Format();
+ mHeight = (unsigned long)abs(locVideoHeader->bmiHeader.biHeight);
+ mWidth = (unsigned long)abs(locVideoHeader->bmiHeader.biWidth);
+ mFrameSize = (unsigned long)locVideoHeader->bmiHeader.biSizeImage;
+ return CVideoTransformFilter::SetMediaType(PINDIR_OUTPUT, inMediaType);
+ }
+}
+
+
bool TheoraDecodeFilter::SetSampleParams(IMediaSample* outMediaSample, unsigned long inDataSize, REFERENCE_TIME* inStartTime, REFERENCE_TIME* inEndTime, BOOL inIsSync)
{
outMediaSample->SetTime(inStartTime, inEndTime);
@@ -605,7 +627,16 @@
return true;
}
-
+sTheoraFormatBlock* TheoraDecodeFilter::getTheoraFormatBlock()
+{
+ return mTheoraFormatInfo;
+}
+void TheoraDecodeFilter::setTheoraFormat(sTheoraFormatBlock* inFormatBlock)
+{
+ delete mTheoraFormatInfo;
+ mTheoraFormatInfo = new sTheoraFormatBlock;
+ *mTheoraFormatInfo = *inFormatBlock;
+}
//---------------------------------------
//OLD IMPLOEMENTATION....
//---------------------------------------
Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h 2004-09-09 15:03:57 UTC (rev 7724)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h 2004-09-09 15:30:52 UTC (rev 7725)
@@ -55,6 +55,12 @@
virtual HRESULT GetMediaType(int inPosition, CMediaType* outOutputMediaType);
virtual HRESULT Transform(IMediaSample* inInputSample, IMediaSample* outOutputSample);
+ //Overrides
+ virtual HRESULT TheoraDecodeFilter::SetMediaType(PIN_DIRECTION inDirection, const CMediaType* inMediaType);
+
+ //Helpers
+ sTheoraFormatBlock* getTheoraFormatBlock();
+ void setTheoraFormat(sTheoraFormatBlock* inFormatBlock);
protected:
virtual void ResetFrameCount();
void FillMediaType(CMediaType* outMediaType, unsigned long inSampleSize);
More information about the commits
mailing list