Esempio n. 1
0
void FMPlayerDShow::Clear()
{
	if (m_MediaControl != NULL)
		m_MediaControl->Stop(); 

	m_MediaControl.Release();
	m_MediaEvent.Release();
	m_FilterGraph.Release();

	DisconnectPins(m_xVid); 
	DisconnectPins(m_AviSplitter); 

	m_xVid.Release();
	m_FileSource.Release();
	m_AviSplitter.Release(); 

	m_MSAud.Release();
	m_AC3Filter.Release(); 
	m_DSoundFilter.Release();


	m_GraphBuilt = FALSE;
	m_VideoType = 0; 
	m_FourCC = ""; 
	m_StreamFormat = "";

	m_VideoRenderer.Release(); 

}
Esempio n. 2
0
void ezQtNodeScene::NodeEventsHandler(const ezDocumentNodeManagerEvent& e)
{
  switch (e.m_EventType)
  {
    case ezDocumentNodeManagerEvent::Type::NodeMoved:
    {
      ezVec2 vPos = m_pManager->GetNodePos(e.m_pObject);
      ezQtNode* pNode = m_Nodes[e.m_pObject];
      pNode->setPos(vPos.x, vPos.y);
    }
    break;
    case ezDocumentNodeManagerEvent::Type::AfterPinsConnected:
    {
      ConnectPins(e.m_pConnection);
    }
    break;
    case ezDocumentNodeManagerEvent::Type::BeforePinsDisonnected:
    {
      DisconnectPins(e.m_pConnection);
    }
    break;
    case ezDocumentNodeManagerEvent::Type::BeforePinsChanged:
    {
    }
    break;
    case ezDocumentNodeManagerEvent::Type::AfterPinsChanged:
    {
    }
    break;
      // case ezDocumentNodeManagerEvent::Type::BeforeNodeAdded:
      //  {
      //  }
      //  break;
    case ezDocumentNodeManagerEvent::Type::AfterNodeAdded:
    {
      CreateNode(e.m_pObject);
    }
    break;
    case ezDocumentNodeManagerEvent::Type::BeforeNodeRemoved:
    {
      DeleteNode(e.m_pObject);
    }
    break;
      // case ezDocumentNodeManagerEvent::Type::AfterNodeRemoved:
      //  {
      //  }
      //  break;

    default:
      break;
  }
}
Esempio n. 3
0
void ezQtNodeScene::Clear()
{
  while (!m_ConnectionsSourceTarget.IsEmpty())
  {
    DisconnectPins(m_ConnectionsSourceTarget.GetIterator().Key());
  }

  m_ConnectionsSourceTarget.Clear();

  while (!m_Nodes.IsEmpty())
  {
    DeleteNode(m_Nodes.GetIterator().Key());
  }
}
Esempio n. 4
0
/******************************Public*Routine******************************\
* DestroyGraph
*
* Stops the graph, destroys and removes all the filters (VMR9 is removed last)
*
\**************************************************************************/
HRESULT CVMR9Subgraph::DestroyGraph()
{
    HRESULT hr = S_OK;
    OAFilterState state;

    if( !m_pGraph )
    {
        return E_POINTER;
    }

    FILTER_INFO fi;
    CComPtr<IMediaControl> pMc;
    CComPtr<IEnumFilters> pEnum;
    CComPtr<IBaseFilter> pFilter;
    CComPtr<IBaseFilter> pVMR = NULL;

    // 1. stop the graph
    hr = m_pGraph->QueryInterface( IID_IMediaControl, (void**)&(pMc.p) );
    if( FAILED(hr))
    {
        return hr;
    }

    do
    {
        hr = pMc->GetState(100, &state);
    } while( S_OK == hr && State_Stopped != state );

    hr = m_pGraph->EnumFilters( &(pEnum.p) );
    if( FAILED(hr))
    {
        return hr;
    }

    // tear off
    hr = pEnum->Next(1, &(pFilter.p), NULL);
    while( S_OK == hr && pFilter )
    {
        hr = DisconnectPins( pFilter );
        pFilter = NULL;
        hr = pEnum->Next(1, &(pFilter.p), NULL);
    }
    pFilter = NULL;

    // remove filters
    hr = pEnum->Reset();
    hr = pEnum->Next(1, &(pFilter.p), NULL);
    while( S_OK == hr && pFilter )
    {
        hr = pFilter->QueryFilterInfo( &fi);
        if( fi.pGraph)
            fi.pGraph->Release();

        if( 0 == wcscmp( fi.achName, L"VMR9"))
        {
            pVMR = pFilter;
        }
        hr = m_pGraph->RemoveFilter( pFilter);
        pFilter = NULL;

        hr = pEnum->Reset();
        hr = pEnum->Next(1, &pFilter, NULL);
    }

    pFilter = NULL;
    pEnum = NULL;
    pVMR = NULL;

    return S_OK;
}
Esempio n. 5
0
HRESULT FMPlayerDShow::InitFilters(const tchar* pFileName)
{
	USES_CONVERSION; 
	HRESULT hr = S_OK; 
	m_FrameRate = 25.0;

	if (m_VideoType == VIDEO_TYPE_MPG)
	{
		hr = m_xVid.CoCreateInstance(CLSID_CMpegVideoCodec, NULL, CLSCTX_INPROC);
		_DBGLogResult(hr, "mpg codec"); 
		m_FourCC = "mpeg1";
		//we use IMediaDet for MPEG and we determine the AVI frame rate from the AVI header.
		CComPtr<IMediaDet> iMediaDet;
		if (SUCCEEDED(iMediaDet.CoCreateInstance(CLSID_MediaDet, NULL, CLSCTX_INPROC)))
			if (SUCCEEDED(iMediaDet->put_Filename(T2OLE(pFileName))))
				iMediaDet->get_FrameRate(&m_FrameRate);
	}
	else
	{
		FString sFourCC; 
		if (GetAVIInfo(pFileName))
		{
			_DBGAlert("%s: 4CC = %s\n", pFileName, sFourCC); 
			if (m_FourCC == "x264" || m_FourCC == "h264")
			{
				hr = DSHelpCreateInstance(T2OLE(g_AppSettings.AppDir("x264.ax")), IID_ICoreAVC, NULL, IID_IBaseFilter, (void**)&m_xVid); 
				_DBGLogResult(hr, "x264.ax"); 
			}
			else
			{
				if (m_FourCC == "divx" && m_StreamFormat == "divx")
				{
					hr = DSHelpCreateInstance(T2OLE(g_AppSettings.AppDir("divxdec.ax")), IID_IDivX4, NULL, IID_IBaseFilter, (void**)&m_xVid);
					_DBGLogResult(hr, "divxdec.ax"); 	
				}
				else
				{
					hr = DSHelpCreateInstance(T2OLE(g_AppSettings.AppDir("xvid.ax")), IID_IXvidDecoder, NULL, IID_IBaseFilter, (void**)&m_xVid); 
					_DBGLogResult(hr, "xvid.ax"); 
				}
			}
		}
	}

	hr = DSHelpCreateInstance(T2OLE(g_AppSettings.AppDir("ac3filter.ax")), IID_IAC3Decoder, NULL, IID_IBaseFilter, (void**)&m_AC3Filter);
	_DBGLogResult(hr, "ac3filter.ax"); 	


	//	hr = DSHelpCreateInstance(T2OLE(g_AppSettings.AppDir("msadds32.ax")), IID_IMSAudio, NULL, IID_IBaseFilter, (void**)&m_MSAud);
	//	_DBGLogResult(hr, "msadds32.ax"); 

	hr = m_DSoundFilter.CoCreateInstance(CLSID_DSoundRender, NULL, CLSCTX_INPROC); 
	_DBGLogResult(hr, "dsoundrender"); 

	if (m_VideoType == VIDEO_TYPE_MPG)
	{
		hr = m_AviSplitter.CoCreateInstance(CLSID_MPEG1Splitter, NULL, CLSCTX_INPROC); 
		_DBGLogResult(hr, "mpg splitter"); 
	}
	else
	{
		hr = m_AviSplitter.CoCreateInstance(CLSID_AviSplitter, NULL, CLSCTX_INPROC); 
		_DBGLogResult(hr, "avisplitter"); 
	}




	//Create video renderer
	if (m_VideoRenderer == NULL)
	{
		///hr = DSHelpCreateInstance(L"quartz.dll", CLSID_VideoRendererDefault, NULL, IID_IBaseFilter, (void**)&m_VideoRenderer);
		hr = m_VideoRenderer.CoCreateInstance(CLSID_VideoRendererDefault, NULL, CLSCTX_INPROC); 
		_DBGLogResult(hr, "video renderer"); 
	}
	else
	{
		DisconnectPins(m_VideoRenderer); 
	}

	if (SUCCEEDED(hr))
	{
		CComQIPtr<IGraphBuilder> pGraphBuilder = m_FilterGraph; 

		hr |= pGraphBuilder->AddFilter(m_xVid, L"Video Decoder");
		hr |= pGraphBuilder->AddFilter(m_DSoundFilter, L"DSound Output");
		hr |= pGraphBuilder->AddFilter(m_AC3Filter, L"AC3 Audio Decoder"); 
		hr |= pGraphBuilder->AddFilter(m_AviSplitter, L"Avi Splitter");
		hr |= pGraphBuilder->AddFilter(m_VideoRenderer, L"Video Renderer"); 

		if (FAILED(hr))
		{
			_DBGAlertM("**Warning prebuilding graph: %s\n", GetErrorDescription(hr));
		}
	}
	return hr; 
}