| |

VerySource

 Forgot password?
 Register
Search
View: 12|Reply: 2

How to connect SourceReader with "Moonlight-Elecard MPEG2 Demultiplexer"?

[Copy link]

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-1-25 10:40:01
| Show all posts |Read mode
How to connect SourceReader with "Moonlight-Elecard MPEG2 Demultiplexer"?
I didn't get any prompts when I connected and never returned.
How can I connect successfully?
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-5-10 10:45:01
| Show all posts
There is no problem with the connection, do not know how you connect? Send code to see.
Reply

Use magic Report

1

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

 Author| Post time: 2020-7-3 23:00:01
| Show all posts
//mpeg2dmx.ax
    WCHAR szMPegTS[]=L"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{731B8592-4001-46D4-B1A5-33EC792B4501}";
    // construct source filter
if (m_bInit)
{
CMediaType mt;
mt.majortype = MEDIATYPE_Stream;
mt.subtype = MEDIASUBTYPE_MPEG2_TRANSPORT;
mt.formattype =FORMAT_MPEGStreams;
m_pSourceStream = new CMemStream(m_pDataList);
m_pSourceStream->bStopFlag=0;
m_pSourceReader = new CMemReader(m_pSourceStream,&mt,&hr);
m_pSourceReader->AddRef();
// Add our source filter
hr = m_pGB->AddFilter(m_pSourceReader, NULL);
// find mpeg2 filter
        hr=GetFilterByMoniker(szMPegTS, (IBaseFilter **)&m_pMpeg2tsFilter);
//add mpeg2 filter
hr=m_pMpeg2tsFilter->AddRef();
hr = m_pGB->AddFilter(m_pMpeg2tsFilter, NULL);
hr=m_pMpeg2VideoFilter->AddRef();
hr = m_pGB->AddFilter(m_pMpeg2VideoFilter, NULL);
if (FAILED(hr))
{
m_bInit = false;
}
//This is where the connection fails
hr=ConnectFilters(m_pGB,m_pSourceReader,m_pMpeg2tsFilter);

The ConnectFilters function finds an INPIN and an OUTPIN in two filters and calls: hr = pGraph->Connect(pOut, pIn) to connect, and finding two PINs separately is successful.


HRESULT CFilterGraph::ConnectFilters(
    IGraphBuilder *pGraph,
    IBaseFilter *pSrc,
    IBaseFilter *pDest)
{
    if ((pGraph == NULL) || (pSrc == NULL) || (pDest == NULL))
    {
        return E_POINTER;
    }

    // Find an output pin on the first filter.
    IPin *pOut = 0;
    HRESULT hr = GetUnconnectedPin(pSrc, PINDIR_OUTPUT,&pOut);
    if (FAILED(hr))
    {
        return hr;
    }
    hr = ConnectFilters(pGraph, pOut, pDest);
    pOut->Release();
    return hr;
}

HRESULT CFilterGraph::ConnectFilters(
    IGraphBuilder *pGraph, // Filter Graph Manager.
    IPin *pOut, // Output pin on the upstream filter.
    IBaseFilter *pDest) // Downstream filter.
{
    if ((pGraph == NULL) || (pOut == NULL) || (pDest == NULL))
    {
        return E_POINTER;
    }
    // Find an input pin on the downstream filter.
    IPin *pIn = 0;
    HRESULT hr = GetUnconnectedPin(pDest, PINDIR_INPUT,&pIn);
    if (FAILED(hr))
    {
        return hr;
    }
    // Try to connect them.
    hr = pGraph->Connect(pOut, pIn); //The place where the real connection fails is here
    pIn->Release();
    return hr;
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list