[xiph-commits] r10248 - in branches/oggdsf_new_demux: sln/oggdsf_all src/lib/core/directshow/dsfOggDemux2

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sat Oct 22 08:32:41 PDT 2005


Author: illiminable
Date: 2005-10-22 08:32:26 -0700 (Sat, 22 Oct 2005)
New Revision: 10248

Added:
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h
Modified:
   branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj
Log:
* Add a new codec naive stream mapper
* Add some media type negotiation to output pin
* Add new GUIDS for format block and media type

Modified: branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln
===================================================================
--- branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/sln/oggdsf_all/oggdsf_all.sln	2005-10-22 15:32:26 UTC (rev 10248)
@@ -1199,6 +1199,7 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsfOggDemux2", "..\..\src\lib\core\directshow\dsfOggDemux2\dsfOggDemux2.vcproj", "{304B710A-7355-471C-A4A8-9E8F6D640E6D}"
 	ProjectSection(ProjectDependencies) = postProject
+		{223ACC19-608E-4E1B-A054-067F0CACB272} = {223ACC19-608E-4E1B-A054-067F0CACB272}
 		{EA7091BB-9906-41DF-9738-F4858A136086} = {EA7091BB-9906-41DF-9738-F4858A136086}
 	EndProjectSection
 EndProject

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.cpp	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.cpp	2005-10-22 15:32:26 UTC (rev 10248)
@@ -156,7 +156,11 @@
 	return E_NOTIMPL;
 
 }
-
+HRESULT OggDemuxPageSourceFilter::SetUpPins()
+{
+	//TODO:::
+	return S_OK;
+}
 int OggDemuxPageSourceFilter::GetPinCount() 
 {
 	//TODO::: Implement

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.h	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourceFilter.h	2005-10-22 15:32:26 UTC (rev 10248)
@@ -90,5 +90,6 @@
 	virtual STDMETHODIMP GetPreroll(LONGLONG *pllPreroll);
 	virtual STDMETHODIMP IsUsingTimeFormat(const GUID *pFormat);
 
-
+protected:
+	virtual HRESULT SetUpPins();
 };

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.cpp	2005-10-22 15:32:26 UTC (rev 10248)
@@ -31,10 +31,85 @@
 #include "StdAfx.h"
 #include ".\oggdemuxpagesourcepin.h"
 
-OggDemuxPageSourcePin::OggDemuxPageSourcePin(void)
+OggDemuxPageSourcePin::	OggDemuxPageSourcePin(		TCHAR* inObjectName
+												,	OggDemuxPageSourceFilter* inParentFilter
+												,	CCritSec* inFilterLock
+												,	OggPage* inBOSPage)
+	:	CBaseOutputPin(			NAME("Ogg Demux Output Pin")
+							,	inParentFilter
+							,	inFilterLock
+							,	&mFilterHR
+							,	L"Ogg Stream" )
+	,	mBOSPage(inBOSPage)
 {
+
+	mBOSAsFormatBlock = (BYTE*)inBOSPage->createRawPageData();
+	
 }
 
 OggDemuxPageSourcePin::~OggDemuxPageSourcePin(void)
 {
+	delete[] mBOSAsFormatBlock;
+	delete mBOSPage;
 }
+
+BYTE* OggDemuxPageSourcePin::getBOSAsFormatBlock()
+{
+	return mBOSAsFormatBlock;
+}
+HRESULT OggDemuxPageSourcePin::GetMediaType(int inPosition, CMediaType* outMediaType) 
+{
+	//Put it in from the info we got in the constructor.
+	if (inPosition == 0) {
+		AM_MEDIA_TYPE locAMMediaType;
+		locAMMediaType.majortype = MEDIATYPE_OggPageStream;
+
+		locAMMediaType.subtype = MEDIASUBTYPE_None;
+		locAMMediaType.formattype = FORMAT_OggBOSPage;
+		locAMMediaType.cbFormat = mBOSPage->pageSize();
+		locAMMediaType.pbFormat = getBOSAsFormatBlock();
+		locAMMediaType.pUnk = NULL;
+	
+			
+	
+		CMediaType locMediaType(locAMMediaType);		
+		*outMediaType = locMediaType;
+		return S_OK;
+	} else {
+		return VFW_S_NO_MORE_ITEMS;
+	}
+}
+HRESULT OggDemuxPageSourcePin::CheckMediaType(const CMediaType* inMediaType) {
+	if (		(inMediaType->majortype == MEDIATYPE_OggPageStream) 
+			&&	(inMediaType->subtype == MEDIASUBTYPE_None)
+			&&	(inMediaType->formattype == FORMAT_OggBOSPage)) {
+			//&&	(inMediaType->cbFormat == mBOSPage->pageSize()) {
+
+		return S_OK;
+	} else {
+		return E_FAIL;
+	}
+}
+HRESULT OggDemuxPageSourcePin::DecideBufferSize(IMemAllocator* inoutAllocator, ALLOCATOR_PROPERTIES* inoutInputRequest) 
+{
+	HRESULT locHR = S_OK;
+
+	ALLOCATOR_PROPERTIES locReqAlloc;
+	ALLOCATOR_PROPERTIES locActualAlloc;
+
+	locReqAlloc.cbAlign = 1;
+	locReqAlloc.cbBuffer = 65536; //BUFFER_SIZE;
+	locReqAlloc.cbPrefix = 0;
+	locReqAlloc.cBuffers = NUM_PAGE_BUFFERS; //NUM_BUFFERS;
+
+	locHR = inoutAllocator->SetProperties(&locReqAlloc, &locActualAlloc);
+
+	if (locHR != S_OK) {
+		return locHR;
+	}
+	
+	locHR = inoutAllocator->Commit();
+
+	return locHR;
+
+}

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPageSourcePin.h	2005-10-22 15:32:26 UTC (rev 10248)
@@ -30,9 +30,34 @@
 //===========================================================================
 #pragma once
 
+#include <libOOOgg/OggPage.h>
 class OggDemuxPageSourcePin
+	:	public CBaseOutputPin
 {
 public:
-	OggDemuxPageSourcePin(void);
+	//OggDemuxPageSourcePin(void);
+	OggDemuxPageSourcePin(	TCHAR* inObjectName, 
+							OggDemuxPageSourceFilter* inParentFilter,
+							CCritSec* inFilterLock,
+							OggPage* inBOSPage);
+							//StreamHeaders* inHeaderSource, 
+							//CMediaType* inMediaType,
+							//wstring inPinName,
+							//bool inAllowSeek,
+							//unsigned long inNumBuffers,
+							//unsigned long inBufferSize);
 	~OggDemuxPageSourcePin(void);
+
+	static const unsigned long NUM_PAGE_BUFFERS = 100;
+	//CBasePin virtuals
+	virtual HRESULT GetMediaType(int inPosition, CMediaType* outMediaType);
+	virtual HRESULT CheckMediaType(const CMediaType* inMediaType);
+	virtual HRESULT DecideBufferSize(IMemAllocator* inoutAllocator, ALLOCATOR_PROPERTIES* inoutInputRequest);
+protected:
+	//What is this actually for ?
+	HRESULT mFilterHR;
+
+	BYTE* getBOSAsFormatBlock();
+	BYTE* mBOSAsFormatBlock;
+	OggPage* mBOSPage;
 };

Added: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.cpp	2005-10-22 15:32:26 UTC (rev 10248)
@@ -0,0 +1,46 @@
+#include "StdAfx.h"
+#include ".\oggstreammapper.h"
+
+OggStreamMapper::OggStreamMapper(OggDemuxPageSourceFilter* inParentFilter, CCritSec* inParentFilterLock)
+	:	mStreamState(eStreamState::STRMAP_READY)
+	,	mParentFilter(inParentFilter)
+	,	mParentFilterLock(inParentFilterLock)
+{
+}
+
+OggStreamMapper::~OggStreamMapper(void)
+{
+}
+
+bool OggStreamMapper::acceptOggPage(OggPage* inOggPage)
+{
+
+	switch (mStreamState) {
+		case STRMAP_READY:
+			//WARNING::: Partial fall through
+			if (inOggPage->header()->isBOS()) {
+				mStreamState = STRMAP_PARSING_BOS_PAGES;
+			} else {
+				mStreamState = STRMAP_ERROR;
+				delete inOggPage;
+				return false;
+			}
+			//Partial fall through
+		case STRMAP_PARSING_BOS_PAGES:
+			return addNewPin(inOggPage);
+		case STRMAP_PARSING_HEADERS:
+		case STRMAP_DATA:
+		case STRMAP_FINISHED:
+		case STRMAP_ERROR:
+			break;
+	}
+	
+
+}
+
+bool OggStreamMapper::addNewPin(OggPage* inOggPage)
+{
+	OggDemuxPageSourcePin* locNewPin = new OggDemuxPageSourcePin(NAME("OggPageSourcePin"), mParentFilter, mParentFilterLock, inOggPage);
+	mPins.push_back(locNewPin);
+	return true;
+}
\ No newline at end of file

Added: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggStreamMapper.h	2005-10-22 15:32:26 UTC (rev 10248)
@@ -0,0 +1,40 @@
+#pragma once
+
+//#include "OggDemuxPageSourcePin.h"
+//#include "OggDemuxPageSourceFilter.h"
+
+#include <libOOOgg/IOggCallback.h>
+#include <vector>
+using namespace std;
+
+
+class OggStreamMapper
+	:	public IOggCallback
+{
+public:
+
+	enum eStreamState {
+		STRMAP_READY,
+		STRMAP_PARSING_BOS_PAGES,
+		STRMAP_PARSING_HEADERS,
+		STRMAP_DATA,
+		STRMAP_FINISHED,
+		STRMAP_ERROR
+
+	};
+	OggStreamMapper(OggDemuxPageSourceFilter* inParentFilter, CCritSec* inParentFilterLock);
+	virtual ~OggStreamMapper(void);
+
+	//IOggCallback Interface
+	virtual bool acceptOggPage(OggPage* inOggPage);
+
+	eStreamState streamState();
+
+protected:
+	eStreamState mStreamState;
+	vector<OggDemuxPageSourcePin*> mPins;
+	OggDemuxPageSourceFilter* mParentFilter;
+	CCritSec* mParentFilterLock;
+
+	bool addNewPin(OggPage* inOggPage);
+};

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/ds_guids.h	2005-10-22 15:32:26 UTC (rev 10248)
@@ -17,6 +17,15 @@
 DEFINE_GUID(CLSID_OggDemuxPageSourceFilter, 
 0xc9361f5a, 0x3282, 0x4944, 0x98, 0x99, 0x6d, 0x99, 0xcd, 0xc5, 0x37, 0xb);
 
+
+// {60891713-C24F-4767-B6C9-6CA05B3338FC}
+DEFINE_GUID(MEDIATYPE_OggPageStream, 
+0x60891713, 0xc24f, 0x4767, 0xb6, 0xc9, 0x6c, 0xa0, 0x5b, 0x33, 0x38, 0xfc);
+
+// {95388704-162C-42a9-8149-C3577C12AAF9}
+DEFINE_GUID(FORMAT_OggBOSPage, 
+0x95388704, 0x162c, 0x42a9, 0x81, 0x49, 0xc3, 0x57, 0x7c, 0x12, 0xaa, 0xf9);
+
 //// {3913F0AB-E7ED-41c4-979B-1D1FDD983C07}
 //DEFINE_GUID(MEDIASUBTYPE_FLAC, 
 //0x3913f0ab, 0xe7ed, 0x41c4, 0x97, 0x9b, 0x1d, 0x1f, 0xdd, 0x98, 0x3c, 0x7);

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj	2005-10-22 13:38:30 UTC (rev 10247)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/dsfOggDemux2.vcproj	2005-10-22 15:32:26 UTC (rev 10248)
@@ -135,6 +135,9 @@
 				RelativePath=".\oggdllstuff.cpp">
 			</File>
 			<File
+				RelativePath=".\OggStreamMapper.cpp">
+			</File>
+			<File
 				RelativePath=".\RegWrap.cpp">
 			</File>
 			<File
@@ -173,6 +176,9 @@
 				RelativePath=".\oggdllstuff.h">
 			</File>
 			<File
+				RelativePath=".\OggStreamMapper.h">
+			</File>
+			<File
 				RelativePath=".\RegWrap.h">
 			</File>
 			<File



More information about the commits mailing list