| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- /******************************************************************************
- |* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
- |* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- |* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
- |* PARTICULAR PURPOSE.
- |*
- |* Copyright 1995-2005 Nero AG. All Rights Reserved.
- |*-----------------------------------------------------------------------------
- |* PROJECT: Nero Plugin Manager Example
- |*
- |* FILE: WavSrcFactory.cpp
- |*
- |* PURPOSE: Implementation of the wave source factory
- ******************************************************************************/
- #include "stdafx.h"
- #include "WavSrcFactory.h"
- #include "WavSrc.h"
- EXTERN_GUID(COMPID_SrcFactory, 0x459215ca, 0x50f5, 0x42cc, 0xbf, 0x51, 0x84, 0x38, 0x11, 0x9d, 0xee, 0x6c);
- extern IAudioPluginMgr* g_pPluginMgr;
- void CWavSrcFactory::GetID(GUID *pGUID)
- {
- ASSERT(pGUID);
- if(pGUID)
- memcpy(pGUID, &COMPID_SrcFactory, sizeof(GUID));
- }
- const char* CWavSrcFactory::GetName()
- {
- return "PCM Wav file";
- }
- EAudioComponentType CWavSrcFactory::GetType()
- {
- return ACT_AudioURLSourceFactory;
- }
- bool CWavSrcFactory::Init(IAudioPluginMgr* pMgr, IStatus** ppStatus)
- {
- if(NULL != ppStatus)
- {
- *ppStatus = NULL;
- }
- if(NULL != g_pPluginMgr)
- {
- ASSERT(g_pPluginMgr == pMgr);
- }
- else
- {
- g_pPluginMgr = pMgr;
- }
- // success
- return true;
- }
- bool CWavSrcFactory::Done()
- {
- return true;
- }
- EAuxFlags CWavSrcFactory::GetAuxFlags()
- {
- return SRC_FLAGS;
- }
- EURLType CWavSrcFactory::GetSupportedURLTypes()
- {
- return URL_LocalFile;
- }
- // IExtEnum implementation
- int CWavSrcFactory::GetCount()
- {
- return 2;
- }
- // The returned value can't be stored for later use.
- // The application must copy it.
- const char* CWavSrcFactory::GetExt(int iNum)
- {
- if(0 == iNum)
- {
- return "wav";
- }
- else if(1 == iNum)
- {
- return "wave";
- }
- ASSERT(FALSE);
- return NULL;
- }
- bool CWavSrcFactory::Open(const char* szURL,
- IUnknown** ppSrc,
- EAuxFlags flagsInclude,
- EAuxFlags flagsExclude,
- IStatus** ppStatus)
- {
- if(ppStatus)
- {
- *ppStatus = NULL;
- }
- CWavSrc* pSrc = new CWavSrc(szURL, (IAudioComponent*)this, ppStatus);
- bool bOK = pSrc->IsOK();
- if(bOK)
- {
- *ppSrc = static_cast<IAggregatable*>(pSrc);
- (*ppSrc)->AddRef();
- }
- else
- {
- delete pSrc;
- *ppSrc = NULL;
- }
- return bOK;
- }
- long CWavSrcFactory::GetRefCount()
- {
- return m_lRef;
- }
- const char *CWavSrcFactory::GetVendorName()
- {
- return "Example Vendor";
- }
- bool CWavSrcFactory::CanDisplayAboutBox()
- {
- return true;
- }
- void CWavSrcFactory::DisplayAboutBox()
- {
- AfxMessageBox("Nero Example PCM WAV plugin.");
- }
|