本文整理汇总了C++中CComQIPtr::GetDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::GetDuration方法的具体用法?C++ CComQIPtr::GetDuration怎么用?C++ CComQIPtr::GetDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComQIPtr
的用法示例。
在下文中一共展示了CComQIPtr::GetDuration方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pos
extern "C" int WINAPI pos(HWND,HWND,char *data,char*,BOOL,BOOL)
{
CComPtr<IFilterGraph> pFG;
if(!GetFilterGraph(&pFG))
return 1;
CComQIPtr<IMediaSeeking> pMS = pFG;
REFERENCE_TIME pos, dur;
if(FAILED(pMS->GetCurrentPosition(&pos)) || FAILED(pMS->GetDuration(&dur)))
return 1;
if(dur > 10000000i64*60*60)
{
sprintf(data, _T("%02d:%02d:%02d/%02d:%02d:%02d"),
(int)(pos/10000000/60/60), (int)(pos/10000000/60)%60, (int)(pos/10000000)%60,
(int)(dur/10000000/60/60), (int)(dur/10000000/60)%60, (int)(dur/10000000)%60);
}
else
{
sprintf(data, _T("%02d:%02d/%02d:%02d"),
(int)(pos/10000000/60)%60, (int)(pos/10000000)%60,
(int)(dur/10000000/60)%60, (int)(dur/10000000)%60);
}
return 3;
}
示例2:
MEDIA_TIME FMPlayerDShow::GetDuration()
{
CComQIPtr<IMediaSeeking> iSeeking = m_FilterGraph;
MEDIA_TIME rtDur = 0;
if (iSeeking)
{
iSeeking->GetDuration(&rtDur);
}
return rtDur;
}
示例3: CompleteConnect
HRESULT CBaseMuxerInputPin::CompleteConnect(IPin* pReceivePin)
{
HRESULT hr = __super::CompleteConnect(pReceivePin);
if (FAILED(hr)) {
return hr;
}
// duration
m_rtDuration = 0;
CComQIPtr<IMediaSeeking> pMS;
if ((pMS = GetFilterFromPin(pReceivePin)) || (pMS = pReceivePin)) {
pMS->GetDuration(&m_rtDuration);
}
// properties
for (CComPtr<IPin> pPin = pReceivePin; pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin))) {
if (CComQIPtr<IDSMPropertyBag> pPB = pPin) {
ULONG cProperties = 0;
if (SUCCEEDED(pPB->CountProperties(&cProperties)) && cProperties > 0) {
for (ULONG iProperty = 0; iProperty < cProperties; iProperty++) {
PROPBAG2 PropBag;
memset(&PropBag, 0, sizeof(PropBag));
ULONG cPropertiesReturned = 0;
if (FAILED(pPB->GetPropertyInfo(iProperty, 1, &PropBag, &cPropertiesReturned))) {
continue;
}
HRESULT hr2;
CComVariant var;
if (SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr2)) && SUCCEEDED(hr2)) {
SetProperty(PropBag.pstrName, &var);
}
CoTaskMemFree(PropBag.pstrName);
}
}
}
}
(static_cast<CBaseMuxerFilter*>(m_pFilter))->AddInput();
return S_OK;
}
示例4: Show
STDMETHODIMP CLMoviePlayer::Show(ILXFrameworkFrame* frame)
{
CComPtr<ILXFrameworkApp> app;
frame->GetApp(&app);
CComPtr<ILXUIMDIFrameElement> frameelement;
frame->get_Element(&frameelement);
CComPtr<ILXUIDocument> appdocument;
app->get_Document(&appdocument);
CComPtr<ILXUIElement> mdiclient;
frameelement->getMDIClient(&mdiclient);
CComPtr<ILDOMDocument> doc;
doc.CoCreateInstance(CLSID_LDOMDocument);
VARIANT_BOOL success;
doc->load(_variant_t(L"C:\\media_layout.xml"), &success);
CComPtr<ILDOMElement> documentElement;
doc->get_documentElement(&documentElement);
CComPtr<ILDOMNode> layout;
appdocument->importNode(documentElement, VARIANT_TRUE/*deep*/, &layout);
CComQIPtr<ILMediaSeeking> seeking = m_filterGraph;
LONGLONG duration;
seeking->GetDuration(&duration);
// find the renderer filter
CComPtr<ILBasicVideo> basicVideo;
m_filterGraph->QueryFilterInterface(IID_ILBasicVideo, (IUnknown**)&basicVideo);
/*
if (basicVideo)
{
*/
CComPtr<ILDOMElement> mdichild;
appdocument->createElementNS(L"http://www.lerstad.com/2004/lxui", L"mdichild", &mdichild);
if (mdichild)
{
CComPtr<ILXUIPageElement> page;
appdocument->createElementNS(L"http://www.lerstad.com/2004/lxui", L"page", (ILDOMElement**)&page);
if (page)
{
CComPtr<ILDOMElement> e;
appdocument->createElementNS(L"http://www.lerstad.com/2004/lxui", L"content", &e);
if (e)
{
e->appendChild(layout, NULL);
#if 0
long cookie;
e->addBehavior(L"#factory#videoview", &CComVariant(GetUnknown()), &cookie);
#endif
page->appendChild(e, NULL);
}
mdichild->appendChild(page, NULL);
}
mdiclient->appendChild(mdichild, NULL);
CComPtr<ILDOMElement> durationElement;
appdocument->getElementById(L"media_duration", &durationElement);
if (durationElement)
{
WCHAR str[64];
swprintf(str, L"%g", (double)duration / LTIME_SCALE);
durationElement->put_textContent(str);
}
CComPtr<ILDOMElement> videoElement;
appdocument->getElementById(L"video", &videoElement);
if (videoElement)
{
long cookie;
videoElement->addBehavior(L"#factory#videoview", &CComVariant(GetUnknown()), &cookie);
}
}
//}
return S_OK;
}
示例5: CreateBindCtx
STDMETHODIMP CLX3DViewer::put_src(/*[in]*/ BSTR newVal)
{
HRESULT hr;
m_src = newVal;
CComPtr<IServiceProvider> sp;
hr = m_spClientSite->QueryInterface(IID_IServiceProvider, (void**)&sp);
if (SUCCEEDED(hr))
{
CComPtr<IBindHost> bindHost;
hr = sp->QueryService(SID_SBindHost, &bindHost);
if (SUCCEEDED(hr))
{
CComPtr<IMoniker> imkName;
CComPtr<IBindCtx> ctx;
hr = CreateBindCtx(0/*reserved*/, &ctx);
if (SUCCEEDED(hr))
{
hr = bindHost->CreateMoniker(m_src, NULL, &imkName, 0);
if (SUCCEEDED(hr))
{
hr = m_filterGraph.CoCreateInstance(CLSID_LFilterGraph);
if (SUCCEEDED(hr))
{
hr = m_filterGraph->AddSourceFilterForMoniker(imkName, ctx, L"", NULL);
if (SUCCEEDED(hr))
{
CComQIPtr<ILMediaSeeking> seeking = m_filterGraph;
LONGLONG duration;
seeking->GetDuration(&duration);
m_duration = duration / 100000.0;
if (m_duration > 0)
{
m_slider.Enable(TRUE);
m_slider.SetMaxPos(m_duration);
}
else
{
m_slider.Enable(FALSE);
}
// find the renderer filter
CComPtr<ILBasicVideo> basicVideo;
m_filterGraph->QueryFilterInterface(IID_ILBasicVideo, (IUnknown**)&basicVideo);
if (basicVideo)
{
m_basicVideo = basicVideo;
}
}
}
}
}
}
}
return hr;
#if 0
#if 0
m_viewpointStack.RemoveAll();
m_navigationinfoStack.RemoveAll();
#endif
if (m_scene)
{
m_scene->Release();
m_scene = NULL;
}
CComBSTR m_src = newVal;
CComQIPtr<IServiceProvider> sp = m_spClientSite;
if (sp)
{
CComPtr<IMoniker> imkName;
CComPtr<IBindHost> bindHost;
if (SUCCEEDED(sp->QueryService(SID_SBindHost, &bindHost)))
{
bindHost->CreateMoniker(m_src, NULL, &imkName, 0);
}
else
{
CreateURLMoniker(NULL, m_src, &imkName);
}
if (imkName)
{
CComPtr<IBindCtx> bctx;
if (SUCCEEDED(CreateBindCtx(0/*reserved*/, &bctx)))
{
CComPtr<IStream> stream;
imkName->BindToStorage(bctx, NULL, IID_IStream, (void**)&stream);
if (stream)
{
LPOLESTR szDisplayName;
//.........这里部分代码省略.........