Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

MS MPEG2 Demux

MS MPEG2 Demux


I'm trying to implement the MS MPEG2 Demux but it fails. Here's my code:


if (FAILED(CoInitialize(NULL))){

IGraphBuilder *pGraph = NULL;
if (FAILED(CoCreateInstance(CLSID_FilterGraph,
                    NULL, CLSCTX_INPROC_SERVER,
               (void **)&pGraph)))

IMpeg2Demultiplexer *pDemux = NULL;
if (FAILED(pGraph->QueryInterface(IID_IMpeg2Demultiplexer,
  // here it fails....

What's wrong ?!


RE: MS MPEG2 Demux

The Filter Graph Manager does not implement that interface.  You need to create an instance of the MPEG-2 demux filter, and query that for the interface instead.

RE: MS MPEG2 Demux

Oh yeah you're right. Thanks a lot!

RE: MS MPEG2 Demux

Everything works fine, but I'm still unable to connect the MPEG2 Demux filter with the rest of the graph:

pBuild->RenderStream(NULL, NULL, pCapture,
     (IBaseFilter *)pDemux, NULL);

and it fails.

Anyone has an idea why ?

RE: MS MPEG2 Demux

What is the HRESULT you're getting?

Do the media types match?  In other words, does your source filter really generate MPEG-2 media?  Are you really building a capture graph that demuxes MPEG-2?

Something else to try would be IGraphBuilder::Render() in place of ICaptureGraphBuilder2::RenderStream().

RE: MS MPEG2 Demux

Basically, I'm developped a filter that receive MPEG2 video over the internet. It works very well when using GraphEdit:

MyRecvFilter->MS MPEG2 Demux->Elecard MPEG2 Decoder->VR

I just want to code it, so here the main lines:



IGraphBuilder *pGraph = NULL;
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);

IBaseFilter *pBaseDemux = NULL;
CoCreateInstance(CLSID_MPEG2Demultiplexer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&pBaseDemux);

IMpeg2Demultiplexer *pDemux = NULL;
pBaseDemux->QueryInterface(IID_IMpeg2Demultiplexer, (void **)&pDemux);

ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE);
mt.majortype  = MEDIATYPE_Stream;
mt.formattype = FORMAT_None;
//(media types are okay)

IPin *pPinDemux = NULL;
pDemux->CreateOutputPin(&mt, L"video pin", &pPinDemux);

IMPEG2PIDMap *pPidMapDemux = NULL;
pPinDemux->QueryInterface(IID_IMPEG2PIDMap, (void **)&pPidMapDemux);

and here it fails!

When running from MSVC++, HRESULT dont have time to returns value : got a "Protection Error", telling me that a debugger is detected ?!

When launching the exec file, HRESULT returns 0x80040217, which means that The specified object was not found.

What's wrong with the code ?

Thanks for you time!


RE: MS MPEG2 Demux

This is just a guess, but I don't think you need to create the output pin on the MPEG-2 demux.  I'm thinking that GraphEdit doesn't do this.  If your source filter outputs the right MPEG-2 media type, you should be able to just tell the graph builder to render the source filter output pin.  You should not even need to create the MPEG-2 demux, it should be set up for you.

RE: MS MPEG2 Demux

unfortunately this is in french, im told you can bable fish
it, its in the area your after.

and to make things worse it delphi, easy to translate though

and it does show the graphs which you can definately follow.

Red Flag This Post

Please let us know here why the post below is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close