[xiph-commits] r16703 - trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource
cristianadam at svn.xiph.org
cristianadam at svn.xiph.org
Sun Nov 15 14:15:27 PST 2009
Author: cristianadam
Date: 2009-11-15 14:15:27 -0800 (Sun, 15 Nov 2009)
New Revision: 16703
Modified:
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource-2005.vcproj
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.h
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/stdafx.h
Log:
Refactored filter registration.
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp 2009-11-15 00:40:55 UTC (rev 16702)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp 2009-11-15 22:15:27 UTC (rev 16703)
@@ -31,33 +31,67 @@
//===========================================================================
#include "stdafx.h"
#include "NativeFLACSourceFilter.h"
+#include "NativeFLACSourcePin.h"
#include "dsfNativeFLACSource.h"
#include <sstream>
+#include "common/util.h"
CFactoryTemplate g_Templates[] =
{
{
- L"Native FLAC SourceFilter", // Name
+ NativeFLACSourceFilter::NAME, // Name
&CLSID_NativeFLACSourceFilter, // CLSID
NativeFLACSourceFilter::CreateInstance, // Method to create an instance of MyComponent
NULL, // Initialization function
- NULL // Set-up information (for filters)
+ &NativeFLACSourceFilter::m_filterReg // Set-up information (for filters)
}
-
};
// Generic way of determining the number of items in the template
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
+const wchar_t* NativeFLACSourceFilter::NAME = L"Xiph.Org Native FLAC Source";
+
+const AMOVIESETUP_MEDIATYPE NativeFLACSourceFilter::m_mediaTypes =
+{
+ &MEDIATYPE_Audio,
+ &MEDIASUBTYPE_PCM
+};
+
+const AMOVIESETUP_PIN NativeFLACSourceFilter::m_pinReg =
+{
+ L"PCM Output", //Name (obsoleted)
+ FALSE, //Renders from this pin ?? Not sure about this.
+ TRUE, //Is an output pin
+ FALSE, //Cannot have zero instances of this pin
+ FALSE, //Cannot have more than one instance of this pin
+ &CLSID_NULL, //Connects to filter (obsoleted)
+ NULL, //Connects to pin (obsoleted)
+ 1, //Only support one media type
+ &m_mediaTypes //Pointer to media type (Audio/PCM)
+};
+
+const AMOVIESETUP_FILTER NativeFLACSourceFilter::m_filterReg =
+{
+ &CLSID_NativeFLACSourceFilter, // Filter CLSID.
+ NAME, // Filter name.
+ MERIT_NORMAL, // Merit.
+ 1, // Number of pin types.
+ &m_pinReg // Pointer to pin information.
+};
+
+
#ifdef WINCE
LPAMOVIESETUP_FILTER NativeFLACSourceFilter::GetSetupData()
{
- return (LPAMOVIESETUP_FILTER)(&NativeFLACSourceFilterReg);
+ return (LPAMOVIESETUP_FILTER)(&m_filterReg);
}
#endif
CUnknown* WINAPI NativeFLACSourceFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr)
{
+ util::ConfigureLogSettings();
+
NativeFLACSourceFilter *pNewObject = new (std::nothrow) NativeFLACSourceFilter();
if (pNewObject == NULL)
{
@@ -66,8 +100,8 @@
return pNewObject;
}
-NativeFLACSourceFilter::NativeFLACSourceFilter(void) :
-CBaseFilter(NAME("NativeFLACSourceFilter"), NULL, m_pLock, CLSID_NativeFLACSourceFilter),
+NativeFLACSourceFilter::NativeFLACSourceFilter() :
+CBaseFilter(NAME, NULL, m_pLock, CLSID_NativeFLACSourceFilter),
m_numChannels(0),
m_sampleRate(0),
m_bitsPerSample(0),
@@ -253,15 +287,17 @@
//IMediaStreaming
HRESULT __stdcall NativeFLACSourceFilter::Run(REFERENCE_TIME tStart)
{
+ CAutoLock locLock(m_pLock);
LOG(logINFO) << "Run: " << ReferenceTime(tStart);
- CAutoLock locLock(m_pLock);
+
return CBaseFilter::Run(tStart);
}
HRESULT __stdcall NativeFLACSourceFilter::Pause()
{
+ CAutoLock locLock(m_pLock);
LOG(logINFO) << "Pause";
- CAutoLock locLock(m_pLock);
+
if (m_State == State_Stopped)
{
if (ThreadExists() == FALSE)
@@ -277,8 +313,9 @@
}
HRESULT __stdcall NativeFLACSourceFilter::Stop()
{
+ CAutoLock locLock(m_pLock);
LOG(logINFO) << "Stop";
- CAutoLock locLock(m_pLock);
+
CallWorker(THREAD_EXIT);
Close();
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h 2009-11-15 00:40:55 UTC (rev 16702)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h 2009-11-15 22:15:27 UTC (rev 16703)
@@ -54,6 +54,11 @@
};
static const unsigned long BUFF_SIZE = 8192;
+
+ static const wchar_t* NAME;
+ static const AMOVIESETUP_MEDIATYPE m_mediaTypes;
+ static const AMOVIESETUP_PIN m_pinReg;
+ static const AMOVIESETUP_FILTER m_filterReg;
#ifdef WINCE
// returns setup data for filter registration
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp 2009-11-15 00:40:55 UTC (rev 16702)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp 2009-11-15 22:15:27 UTC (rev 16703)
@@ -31,7 +31,7 @@
//===========================================================================
#include "stdafx.h"
#include "NativeFLACSourcePin.h"
-#include "dsfNativeFLACSource.h"
+#include "NativeFLACSourceFilter.h"
#include <sstream>
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource-2005.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource-2005.vcproj 2009-11-15 00:40:55 UTC (rev 16702)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource-2005.vcproj 2009-11-15 22:15:27 UTC (rev 16703)
@@ -762,7 +762,7 @@
AdditionalIncludeDirectories="$(BASECLASSES_WINCE);..\..\libs\libflac\include;..\..\..\..\helper;..\..\..\..\core\directshow\libDirectshowAbstracts"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;DSFNATIVEFLACSOURCE_EXPORTS;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)"
GeneratePreprocessedFile="0"
- RuntimeLibrary="2"
+ RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="4"
DebugInformationFormat="3"
@@ -783,6 +783,7 @@
OutputFile="$(OutDir)/dsfNativeFLACSource.dll"
LinkIncremental="1"
AdditionalLibraryDirectories=""
+ IgnoreDefaultLibraryNames=""
ModuleDefinitionFile="NativeFLACSource.def"
GenerateDebugInformation="true"
SubSystem="9"
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.cpp 2009-11-15 00:40:55 UTC (rev 16702)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.cpp 2009-11-15 22:15:27 UTC (rev 16703)
@@ -31,106 +31,26 @@
//===========================================================================
#include "stdafx.h"
#include <initguid.h>
-#include "NativeFLACSourceFilter.h"
#include "dsfNativeFLACSource.h"
#include "common/util.h"
+util::ComInitializer g_comInit;
+
extern "C" BOOL WINAPI DllEntryPoint(HANDLE, ULONG, LPVOID);
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- util::ConfigureLog(hModule);
- }
+ util::GetHModule() = (HMODULE)hModule;
return DllEntryPoint(hModule, dwReason, lpReserved);
}
-
-//The foLlowing two functions do the registration and deregistration of the dll and it's contained com objects.
STDAPI DllRegisterServer()
{
- HRESULT hr = AMovieDllRegisterServer2(TRUE);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
-#ifndef WINCE
- CComPtr<IFilterMapper2> filterMapper;
-
- hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&filterMapper);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = filterMapper->RegisterFilter(
- CLSID_NativeFLACSourceFilter, // Filter CLSID.
- L"Native FLAC Source Filter", // Filter name.
- NULL, // Device moniker.
- &CLSID_LegacyAmFilterCategory, // Direct Show general category
- NULL, // Instance data. ???????
- &NativeFLACSourceFilterReg // Pointer to filter information.
- );
-#else
- CComPtr<IFilterMapper> filterMapper;
-
- hr = CoCreateInstance(CLSID_FilterMapper, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper, (void **)&filterMapper);
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = filterMapper->RegisterFilter(
- CLSID_NativeFLACSourceFilter, // Filter CLSID.
- L"Native FLAC Source Filter", // Filter name.
- MERIT_NORMAL
- );
-#endif
-
- return hr;
+ return AMovieDllRegisterServer2(TRUE);
}
STDAPI DllUnregisterServer()
{
- HRESULT hr = S_OK;
-
- hr = AMovieDllRegisterServer2(FALSE);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
-#ifndef WINCE
- CComPtr<IFilterMapper2> locFilterMapper;
-
- hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
- IID_IFilterMapper2, (void **)&locFilterMapper);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = locFilterMapper->UnregisterFilter(&CLSID_LegacyAmFilterCategory,
- NULL, CLSID_NativeFLACSourceFilter);
-
-#else
- CComPtr<IFilterMapper> filterMapper;
-
- hr = CoCreateInstance(CLSID_FilterMapper, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper, (void **)&filterMapper);
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = filterMapper->UnregisterFilter(CLSID_NativeFLACSourceFilter);
-#endif
-
- return hr;
+ return AMovieDllRegisterServer2(FALSE);
}
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.h 2009-11-15 00:40:55 UTC (rev 16702)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/dsfNativeFLACSource.h 2009-11-15 22:15:27 UTC (rev 16703)
@@ -32,65 +32,6 @@
#pragma once
-#include "dsfNativeFLACSource.h"
-#include "NativeFLACSourceFilter.h"
-#include "NativeFLACSourcePin.h"
-
-
// {6DDA37BA-0553-499a-AE0D-BEBA67204548}
DEFINE_GUID(CLSID_NativeFLACSourceFilter,
0x6dda37ba, 0x553, 0x499a, 0xae, 0xd, 0xbe, 0xba, 0x67, 0x20, 0x45, 0x48);
-
-
-const REGPINTYPES FLACSourceOutputTypes =
-{
- &MEDIATYPE_Audio,
- &MEDIASUBTYPE_PCM
-};
-
-#ifndef WINCE
-
-const REGFILTERPINS FLACSourcePinReg[] =
-{
- {
- L"PCM Output", //Name (obsoleted)
- FALSE, //Renders from this pin ?? Not sure about this.
- TRUE, //Is an output pin
- FALSE, //Cannot have zero instances of this pin
- FALSE, //Cannot have more than one instance of this pin
- NULL, //Connects to filter (obsoleted)
- NULL, //Connects to pin (obsoleted)
- 1, //Only support one media type
- &FLACSourceOutputTypes //Pointer to media type (Audio/PCM)
- }
-};
-
-const REGFILTER2 NativeFLACSourceFilterReg =
-{
- 1,
- MERIT_NORMAL,
- 0,
- FLACSourcePinReg
-};
-#else
-
-const AMOVIESETUP_PIN FLACSourcePinReg = {
- L"PCM Output", //Name (obsoleted)
- FALSE, //Renders from this pin ?? Not sure about this.
- TRUE, //Is an output pin
- FALSE, //Cannot have zero instances of this pin
- FALSE, //Cannot have more than one instance of this pin
- &CLSID_NULL, //Connects to filter (obsoleted)
- NULL, //Connects to pin (obsoleted)
- 1, //Only support one media type
- &FLACSourceOutputTypes //Pointer to media type (Audio/PCM)
-};
-
-static const AMOVIESETUP_FILTER NativeFLACSourceFilterReg = {
- &CLSID_NativeFLACSourceFilter, // Filter CLSID.
- L"Native FLAC SourceFilter", // Filter name.
- MERIT_NORMAL, // Merit.
- 1, // Number of pin types.
- &FLACSourcePinReg // Pointer to pin information.
-};
-#endif
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/stdafx.h 2009-11-15 00:40:55 UTC (rev 16702)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/stdafx.h 2009-11-15 22:15:27 UTC (rev 16703)
@@ -13,7 +13,7 @@
#include <streams.h>
#include <pullpin.h>
-#ifndef _WIN32_WCE
+#ifndef WINCE
//Kernel streaming header for KSDATA_FORMAT_SUBTYPE_PCM
#include <ks.h>
#include <ksmedia.h>
More information about the commits
mailing list