WavSrcFactory.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /******************************************************************************
  2. |* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3. |* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. |* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. |* PARTICULAR PURPOSE.
  6. |*
  7. |* Copyright 1995-2005 Nero AG. All Rights Reserved.
  8. |*-----------------------------------------------------------------------------
  9. |* PROJECT: Nero Plugin Manager Example
  10. |*
  11. |* FILE: WavSrcFactory.cpp
  12. |*
  13. |* PURPOSE: Implementation of the wave source factory
  14. ******************************************************************************/
  15. #include "stdafx.h"
  16. #include "WavSrcFactory.h"
  17. #include "WavSrc.h"
  18. EXTERN_GUID(COMPID_SrcFactory, 0x459215ca, 0x50f5, 0x42cc, 0xbf, 0x51, 0x84, 0x38, 0x11, 0x9d, 0xee, 0x6c);
  19. extern IAudioPluginMgr* g_pPluginMgr;
  20. void CWavSrcFactory::GetID(GUID *pGUID)
  21. {
  22. ASSERT(pGUID);
  23. if(pGUID)
  24. memcpy(pGUID, &COMPID_SrcFactory, sizeof(GUID));
  25. }
  26. const char* CWavSrcFactory::GetName()
  27. {
  28. return "PCM Wav file";
  29. }
  30. EAudioComponentType CWavSrcFactory::GetType()
  31. {
  32. return ACT_AudioURLSourceFactory;
  33. }
  34. bool CWavSrcFactory::Init(IAudioPluginMgr* pMgr, IStatus** ppStatus)
  35. {
  36. if(NULL != ppStatus)
  37. {
  38. *ppStatus = NULL;
  39. }
  40. if(NULL != g_pPluginMgr)
  41. {
  42. ASSERT(g_pPluginMgr == pMgr);
  43. }
  44. else
  45. {
  46. g_pPluginMgr = pMgr;
  47. }
  48. // success
  49. return true;
  50. }
  51. bool CWavSrcFactory::Done()
  52. {
  53. return true;
  54. }
  55. EAuxFlags CWavSrcFactory::GetAuxFlags()
  56. {
  57. return SRC_FLAGS;
  58. }
  59. EURLType CWavSrcFactory::GetSupportedURLTypes()
  60. {
  61. return URL_LocalFile;
  62. }
  63. // IExtEnum implementation
  64. int CWavSrcFactory::GetCount()
  65. {
  66. return 2;
  67. }
  68. // The returned value can't be stored for later use.
  69. // The application must copy it.
  70. const char* CWavSrcFactory::GetExt(int iNum)
  71. {
  72. if(0 == iNum)
  73. {
  74. return "wav";
  75. }
  76. else if(1 == iNum)
  77. {
  78. return "wave";
  79. }
  80. ASSERT(FALSE);
  81. return NULL;
  82. }
  83. bool CWavSrcFactory::Open(const char* szURL,
  84. IUnknown** ppSrc,
  85. EAuxFlags flagsInclude,
  86. EAuxFlags flagsExclude,
  87. IStatus** ppStatus)
  88. {
  89. if(ppStatus)
  90. {
  91. *ppStatus = NULL;
  92. }
  93. CWavSrc* pSrc = new CWavSrc(szURL, (IAudioComponent*)this, ppStatus);
  94. bool bOK = pSrc->IsOK();
  95. if(bOK)
  96. {
  97. *ppSrc = static_cast<IAggregatable*>(pSrc);
  98. (*ppSrc)->AddRef();
  99. }
  100. else
  101. {
  102. delete pSrc;
  103. *ppSrc = NULL;
  104. }
  105. return bOK;
  106. }
  107. long CWavSrcFactory::GetRefCount()
  108. {
  109. return m_lRef;
  110. }
  111. const char *CWavSrcFactory::GetVendorName()
  112. {
  113. return "Example Vendor";
  114. }
  115. bool CWavSrcFactory::CanDisplayAboutBox()
  116. {
  117. return true;
  118. }
  119. void CWavSrcFactory::DisplayAboutBox()
  120. {
  121. AfxMessageBox("Nero Example PCM WAV plugin.");
  122. }