Advertisement

03.30.2005 at 09:53PM PST, ID: 21370929
[x]
Attachment Details

Adding video output pin to Mpeg2 demultiplexer in C++ without it crashing on stop()

Asked by wedge9k in Microsoft Visual C++.Net

Tags: demultiplexer, mpeg2

I'm writing a PVR for windows using DirectShow and the Stream Buffer Engine but am having a problem with the MPEG-2 Demultiplexer.  The stream comming from my TVTuner device is a hardware encoded MPEG2 stream (from the Hauppauge WinTV USB2).  When I add the video output pin to the demultiplexer manually through graph edit, everything works just fine, but when I add the pin through c++ the program works untill I call the Stop() function for the graph and it crashes.  It gives me a 'division by zero' error somewhere within the microsoft code.

I'm wondering if anyone out there knows how to add the pin in C++ without it crashing when run Stop() on the graph?  Or is there a way to load the filter directly from a saved GraphEdit file? (I could just load the working filter I made manually then)

Here are the settings that I am using in my program to set up the pin in C++:

                AM_MEDIA_TYPE pMediaVideoType;
      
      MPEG2VIDEOINFO    video_info;
      interface IMPEG2StreamIdMap    *StreamIdMapVideo;

      memset(&pMediaVideoType , 0x0 , sizeof(pMediaVideoType));
      memset(&video_info , 0x0 , sizeof(MPEG2VIDEOINFO));

                //Type settings for the output stream
      pMediaVideoType.majortype = MEDIATYPE_Video;
      pMediaVideoType.subtype = MEDIASUBTYPE_MPEG2_VIDEO;
      pMediaVideoType.formattype = FORMAT_MPEG2Video ;

                //not sure exactly what I need these for
      pMediaVideoType.bFixedSizeSamples = FALSE;
      pMediaVideoType.bTemporalCompression = TRUE;
      pMediaVideoType.lSampleSize  = 0;
      pMediaVideoType.cbFormat = sizeof(MPEG2VIDEOINFO);      
           
      pMediaVideoType.pbFormat = (BYTE *)&video_info;

                //creat the pin
      hr = MPEG2_demux_interface->CreateOutputPin(&pMediaVideoType, L"Video",
                                                                                         &pMPEG2_demux_videoPin);
               
               //get an interface to the pin so that I can map it with the 0xE0 for default MPEG2 Elementary Stream
      hr  = pMPEG2_demux_videoPin->QueryInterface( IID_IMPEG2StreamIdMap,
                                                                                      (void **) &StreamIdMapVideo);
                hr = StreamIdMapVideo->MapStreamId(VideoStreamID , //0xE0
                        MPEG2_PROGRAM_ELEMENTARY_STREAM , 0,   0);
Start Free Trial
 
Keywords: Adding video output pin to Mpeg2 dem…
 
Loading Advertisement...
 
[+][-]04.16.2005 at 11:31PM PDT, ID: 13800131

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2005 at 11:32PM PDT, ID: 13800136

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2005 at 11:43PM PDT, ID: 13800152

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual C++.Net
Tags: demultiplexer, mpeg2
Sign Up Now!
Solution Provided By: cdiamond66
Participating Experts: 1
Solution Grade: B
 
 
[+][-]04.17.2005 at 11:07AM PDT, ID: 13801975

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32