Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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.

alarco (Programmer) (OP)
9 Aug 04 14:30
Hi

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,
                IID_IGraphBuilder,
               (void **)&pGraph)))
{
...
}

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

What's wrong ?!

Thanks!
Helpful Member!  teriviret (Programmer)
10 Aug 04 1:28
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.
alarco (Programmer) (OP)
10 Aug 04 9:29
Oh yeah you're right. Thanks a lot!
alarco (Programmer) (OP)
10 Aug 04 14:32
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 ?

teriviret (Programmer)
10 Aug 04 21:28
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().
alarco (Programmer) (OP)
11 Aug 04 13:50
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:

---

CoInitiliaze(NULL);

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);

AM_MEDIA_TYPE mt;
ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE);
mt.majortype  = MEDIATYPE_Stream;
mt.subtype    = MEDIASUBTYPE_MPEG2_PROGRAM
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!

---
teriviret (Programmer)
11 Aug 04 22:26
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.
markymsofth (Programmer)
16 Sep 04 18:47
http://paul.glagla.free.fr/d4.htm

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.

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