本文整理汇总了C++中CCString::bstr方法的典型用法代码示例。如果您正苦于以下问题:C++ CCString::bstr方法的具体用法?C++ CCString::bstr怎么用?C++ CCString::bstr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCString
的用法示例。
在下文中一共展示了CCString::bstr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddMP3Filters
HRESULT AddMP3Filters(IGraphBuilder* pgb, CCString& FileName,
IBaseFilter** pSource, IBaseFilter** pSplitter,
IBaseFilter** pMP3, IBaseFilter** pOutput)
{
CCString s;
HRESULT hr = E_FAIL;
// Set the source!
s = L"Source";
if(SUCCEEDED(hr = pgb->AddSourceFilter(FileName.bstr(), s.bstr(), pSource)))
{
// Create the other filters and add them to the graph.
if(SUCCEEDED(CreateFilterAndAdd(pgb, CLSID_MPEGStreamSplitter, L"MPEG Stream Splitter", pSplitter)))
{
if(SUCCEEDED(CreateFilterAndAdd(pgb, CLSID_MP3Decoder, L"MP3 decoder", pMP3)))
{
if(SUCCEEDED(CreateFilterAndAdd(pgb, CLSID_DefaultDSoundDevice, L"Output", pOutput)))
{
hr = S_OK;
}
}
}
}
if(FAILED(hr))
{
// Release all the stuff.
SAFE_REMOVE_FILTER(pgb, *pSource);
SAFE_REMOVE_FILTER(pgb, *pSplitter);
SAFE_REMOVE_FILTER(pgb, *pMP3);
SAFE_REMOVE_FILTER(pgb, *pOutput);
}
return hr;
}
示例2: CreateFilterAndAdd
HRESULT CreateFilterAndAdd(IGraphBuilder* pgb, const GUID& clsid, PCWSTR wszName, IBaseFilter** ppOut)
{
CCString Name = wszName;
HRESULT hr = 0;
*ppOut = 0;
if(FAILED(hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void**)ppOut)))
{
return E_FAIL;
}
if(FAILED(pgb->AddFilter(*ppOut, Name.bstr())))
{
(*ppOut)->Release();
*ppOut = 0;
return E_FAIL;
}
return S_OK;
}
示例3: Open
HRESULT AudioPlayer::Open(CCString FileName, CCLog* pLog)
{
HRESULT hr;
this->Close();
if(FAILED(hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IMediaControl, (PVOID*)&this->pControl)))
{
pLog->AddEntry(L"Error working with DShow objects.");
pLog->AddEntry(hr, L"CoCreateInstance");
return E_FAIL;
}
// Now get IMediaSeeking interface - this is REQUIRED.
if(FAILED(hr = this->pControl->QueryInterface(IID_IMediaSeeking, (PVOID*)&this->pSeeking)))
{
pLog->AddEntry(L"Error working with DShow objects.");
pLog->AddEntry(hr, L"QI for IID_IMediaSeeking");
SAFE_RELEASE(this->pControl);
return E_FAIL;
}
// Now get the IBasicAudio interface - this is PREFERRED.
if(FAILED(hr = this->pControl->QueryInterface(IID_IBasicAudio, (PVOID*)&this->pAudio)))
{
pLog->AddEntry(L"DShow player does not support basic audio controls such as volume or balance.");
}
if(FAILED(this->AttemptMP3Graph(FileName, pLog)))
{
// Render the file now that we know we're good to go.
if(FAILED(hr = this->pControl->RenderFile(FileName.bstr())))
{
pLog->AddEntry(L"Error rendering the file. The file may be corrupt.");
pLog->AddEntry(hr, L"IMediaControl::RenderFile");
SAFE_RELEASE(this->pControl);
SAFE_RELEASE(this->pSeeking);
SAFE_RELEASE(this->pAudio);
return E_FAIL;
}
}
// Make sure we can use TIME_FORMAT_MEDIA_TIME for seeking... otherwise
// We won't know how to seek.
if(FAILED(hr = this->pSeeking->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME)))
{
pLog->AddEntry(L"The audio rendering software does not support seeking using time units. This is unrecoverable.");
pLog->AddEntry(hr, L"IMediaSeeking::SetTimeFormat");
SAFE_RELEASE(this->pControl);
SAFE_RELEASE(this->pSeeking);
SAFE_RELEASE(this->pAudio);
return E_FAIL;
}
// Now set up our notifications and begin our notification thread to handle them.
this->hExitEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
this->hNotificationThread = (HANDLE)_beginthread(AudioPlayer::NotificationProc, 0, this);
//this->hNotificationThread = CreateThread(NULL, 0, AudioPlayer::NotificationProc,
// this, 0, &dwId);
/*
Make sure that our old properties propogate to this file.
*/
this->SetVolume(this->dwVolume, pLog);
if(this->bPlaying == TRUE) this->Play(pLog);
// We made it this far! Hooray!
return S_OK;
}