All pastes #394911 Raw Edit

Unnamed

public c v1 · immutable
·published 2007-03-14 17:30 UTC
rendered paste body
HRESULT connect_vp_pin(priv_t* priv){    HRESULT hr;    IPin* pPreviewPin=NULL;    IPin* pVPOutPin=NULL;    IBaseFilter* pVPM;    IEnumFilters* pEnum;    IBaseFilter* pFilter=NULL;    IVideoWindow* pVideoWindow;    ICaptureGraphBuilder* pBuilder1;    for(;;){        /* connecting VP pin is required only for VIVO cards with VP and without Preview pins. */        hr=priv->pBuilder->vt->FindPin(priv->pBuilder,(IUnknown*)priv->pVideoFilter,PINDIR_OUTPUT,&PIN_CATEGORY_PREVIEW,NULL,FALSE,0,(IPin**)&pPreviewPin);        if (hr==S_OK)        {            pPreviewPin->vt->Release((IUnknown*)pPreviewPin);            break; // Video capture device has preview pin. No action is required        }        hr=priv->pBuilder->vt->FindPin(priv->pBuilder,(IUnknown*)priv->pVideoFilter,PINDIR_OUTPUT,&PIN_CATEGORY_VIDEOPORT,NULL,FALSE,0,(IPin**)&pVPOutPin);        if (FAILED(hr))        {            hr=S_OK; // Video capture device has no VideoPort pin. No action is required in this case            break;        }            mp_msg(MSGT_TV,MSGL_V,"Video capture device has VidePort pin and no Preview pin. Conecting VideoPort pin to Video Port Manager filter.\n");        hr = CoCreateInstance((GUID*)&CLSID_VideoPortManager, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void**)&pVPM);        if (FAILED(hr)){            showError("CoCreateInstance(CLSID_VideoPortManager) failed","connect_vp_pin",hr);            break;        }        hr=priv->pBuilder->vt->RenderStream(priv->pBuilder,NULL, NULL,pVPOutPin, NULL, NULL);        if (FAILED(hr)){            showError("RenderStream(Capture,NULL,NULL) failed","connect_vp_pin",hr);            break;        }        mp_msg(MSGT_TV,MSGL_V,"Video capture 1.\n");        priv->pGraph->vt->EnumFilters(priv->pGraph,&pEnum);        mp_msg(MSGT_TV,MSGL_V,"Video capture 2.\n");        while(pEnum->vt->Next(pEnum,1,&pFilter,NULL)==S_OK)        {        mp_msg(MSGT_TV,MSGL_V,"Video capture 3 %p.\n",pFilter);            if(SUCCEEDED(pFilter->vt->QueryInterface(pFilter,&IID_IVideoWindow,&pVideoWindow))){                pVideoWindow->vt->Release(pVideoWindow);                priv->pGraph->vt->RemoveFilter(priv->pGraph,pFilter);            }            pFilter->vt->Release(pFilter);        }        pEnum->vt->Release(pEnum);        mp_msg(MSGT_TV,MSGL_V,"Video capture 4\n",pFilter);        break;    }        if (pVPOutPin)        pVPOutPin->vt->Release((IUnknown*)pVPOutPin);        mp_msg(MSGT_TV,MSGL_V,"Video capture 5\n",pFilter);    if (pPreviewPin)        pPreviewPin->vt->Release((IUnknown*)pPreviewPin);        mp_msg(MSGT_TV,MSGL_V,"Video capture 6\n",pFilter);    return hr;}