Microsoft DVT-DVD filter overrides DirectShow

Anonymous
2010-04-19
2012-10-29
  • Anonymous - 2010-04-19

    Hello,

    I'm trying to install a mpeg2 DirectShow decoder on Windows7/Vista machines.
    With no user interaction (programatically via script or command line or C#)
    how do we make a different decoder to be the default on this operating
    systems.

    We have tried changing merits for all the 3rd party filters (eg. MainConcept
    filter for mpeg2) but it doesn't seem to work. The only way we got this
    working to manually hack the registry (take ownship and change permissions and
    values).


    In order to change the registry in windows 7
    (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\Preferred) we need to
    take the ownership of the registry which is a manual process. I can't find any
    programmatic ways to overcome this. Soon as DVT-DVD fiter is removed/change
    from the proffered filter role it works fine. If someone find a way to change
    it would be great,

    OR

    Some other best diplomatic solution is more than welcome :)

    Thanks in advance for your help...
    Joseph

     
  • Anonymous - 2010-04-19

     
  • BEZ

    BEZ - 2010-04-19

    Joseph

    If you know the graph you want to build I would manually build it end to end .
    This way you do not need to rely on the default filters. You can test from
    code to make sure the filters you need are there and then load the filters and
    manually plug the pins together. This is how we do it in our software and it
    works great.
    Note:
    Based on different versions of windows you may have to build different
    playback graphs as the available filters can vary from version to version. The
    way we do this is we built our own graph builder that takes a config file.
    This way we can define different graphs per supported file formant and version
    of windows.

    Hope this helps.
    zktech

     
  • Anonymous - 2010-04-19

    Hi Zktech,
    Thanks for your comments. I did installed MainConcept filter for mpeg2 and
    MediaLooks filter for .mov. Those filters are latest. As you said I did the
    same. I can manually change the filter to whatever the filter I want to, but
    by default Microsoft's DVT-DVD filter takes the ownership (that is what the
    above graph shows).

    I'm using C# wrapper for DirectShow and it does pickup DVT-DVD filter
    (Microsoft's). I'm doing playback for many formats, so how can I get rid of
    this Microsoft's DVT-DVD filter. OR how can I make the MainConcept filter as
    the default one to play.

    Thanks
    Joseph

     
  • snarfle

    snarfle - 2010-04-19

    Microsoft has had all kinds of problems with 3rd party filters installing
    themselves with higher priority than system filters. Which wouldn't be a
    problem, except some of these 3rd party filters are crap.

    In W7, ms has decided to do something about it. I believe you can control some
    of this with IAMPluginControl.

     
  • BEZ

    BEZ - 2010-04-19

    Joseph

    The simplest answer is yes you can force the filters if you hack the registry.
    But the better way is to do the graph build your self.

    You should be able to change the filter priorties but I have had issue with
    this as when Medial Player updates are pushed some times they get switch back
    to the defaults (Mostly in Vista). I would not fight the battle I would
    manully create your own graphs with the filters you need. The auto builder is
    not reliable for all formats. I have doing this for over four years now and
    have found this to be the best method for getting the filter combinations that
    I want for a given format. You could just do the manual builds on the formats
    that are causing you issue and keep using the auto build for the others. Once
    you get the hang of the manual build process you won't want to rely on the
    auto build process again.

    Regards
    zktech

     
  • Konstantin Salavatov

    do not call render and do not use intelliconnect. manually add needed
    decompressor and manually connect it. it works and tested with BDA in W7.
    by the way, why you do not like MS DV-DTV filter? In my case I found that it
    working better than Cyberlink's or any other filters I've tryed for MPEG2 and
    AVC content.

     
  • Anonymous - 2010-04-20

    Thanks for the comments. Creating my own graph sounds like a good idea, but in
    such case i need to implement graphs for all sinarios (for different type of
    files). Is there any ways I can add Microsft's DVT-DVD filter as a "not to use
    filter"?

    @Zktech, can you give me a kick start code to create my own graph, that would
    be greatful.
    @salat The problem is my application need to do the playback for mpeg file
    which are decoded as mpg2 in different settings, sometime it crashes the
    application when it autometically loads Microsoft's filter, and getting
    screeshot also fails due to that.

    I just created a sample code of the playback I'm using, it might be helpful
    for you to find pinpoint easily.

    Thanks
    Joseph

                try
                {
                    string filename = @"C:\blister\media\sample.mpg";
                    Control hWin = splitContainerMain.Panel1;
                    int hr = 0;
                    const int WMGraphNotify = 0x0400 + 13;
    
                    mGraphBuilder = (IGraphBuilder)new FilterGraph();
    
                    // QueryInterface for DirectShow interfaces
                    mMediaControl = (IMediaControl)mGraphBuilder;
                    mMediaEventEx = (IMediaEventEx)mGraphBuilder;
                    mMediaSeeking = (IMediaSeeking)mGraphBuilder;
    
                    // Have the graph signal event via window callbacks for performance
                    hr = mMediaEventEx.SetNotifyWindow(hWin.Handle, WMGraphNotify, IntPtr.Zero);
                    DsError.ThrowExceptionForHR(hr);
    
                    // create the SampleGrabber filter and config it
                    mSampGrabber = (ISampleGrabber)new SampleGrabber();
    
                    AMMediaType media = new AMMediaType();
                    media.majorType = MediaType.Video;
                    media.subType = MediaSubType.RGB24;
                    media.formatType = FormatType.VideoInfo;
    
                    // that's the call to the ISampleGrabber interface
                    mSampGrabber.SetMediaType(media);
    
                    DsUtils.FreeAMMediaType(media);
                    media = null;
    
                    // we use BufferCB (i.e. 1) because we couldn't make SampleCB work
                    //mSampGrabber.SetCallback(this, 1);
    
                    mGraphBuilder.AddFilter((IBaseFilter)mSampGrabber, "SampleGrabber");
    
                    hr = mGraphBuilder.RenderFile(filename, null);
                    DsError.ThrowExceptionForHR(hr);
    
                    mSampGrabber.SetBufferSamples(true);
    
                    // Query for video interfaces, which may not be relevant for audio files
    
                    mBasicVideo = mGraphBuilder as IBasicVideo;
    
                    int videoWidth = 0;
                    int videoHeight = 0;
                    mBasicVideo.GetVideoSize(out videoWidth, out videoHeight);
    
                    // get the stride used for calculating the screenshot
                    media = new AMMediaType();
    
                    // GetConnectedMediaType retrieve the media type for a sample
                    hr = mSampGrabber.GetConnectedMediaType(media);
    
                    if ((media.formatType != FormatType.VideoInfo) || (media.formatPtr == IntPtr.Zero))
                    {
                        throw new Exception("Format type incorrect");
                    }
    
                    // save the stride
                    VideoInfoHeader videoInfoHeader = (VideoInfoHeader)Marshal.PtrToStructure(media.formatPtr, typeof(VideoInfoHeader));
                    int VideoStride = videoWidth * (videoInfoHeader.BmiHeader.BitCount / 8);
    
                    DsUtils.FreeAMMediaType(media);
                    media = null;
    
                    mVideoWindow = mGraphBuilder as IVideoWindow;
                    hr = mVideoWindow.put_Owner(hWin.Handle);
                    DsError.ThrowExceptionForHR(hr);
    
                    hr = mVideoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
                    DsError.ThrowExceptionForHR(hr);
                    hr = mVideoWindow.SetWindowPosition(0, 0, splitContainerMain.Panel1.Width, splitContainerMain.Panel1.Height);
                    // Query for audio interfaces, which may not be relevant for video-only files
                    mBasicAudio = mGraphBuilder as IBasicAudio;
    
                    // Run the graph to play the media file
                    hr = mMediaControl.Run();
                    //m_basicAudio.put_Volume(-10000); //mute
    
                    DsError.ThrowExceptionForHR(hr);
                    labelInfo.BackColor = Color.OliveDrab;
                    labelInfo.Text = "Playing video";
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message + ex.StackTrace);
                    labelInfo.BackColor = Color.Red;
                    labelInfo.Text = ex.Message;
                }
    
     
  • Anonymous - 2010-04-20

     
  • BEZ

    BEZ - 2010-04-20

    I can look and see what code I could offer but it is all vb.net so I don't
    know if that would help you.

     
  • Konstantin Salavatov

    I think you might try to render it first and then remove DTV-DVD fiter and
    replace it.
    I still wonder why don't like it.. :)

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks