Custom DirectShow source filter crashing WPF app?? RRS feed

  • Question

  • I wrote a custom file source filter for my app, it works perfectly fine in graph edit & windows media player but when I try to play my file in wpf app using mediaelement - the app crashes. I've tried playing other video formats in same mediaelement tag and they work perfectly fine. Any idea whats causing the problem?
    Monday, June 25, 2007 9:01 AM


All replies

  • There really shouldn't be a specific reason it doesn't work in WPF and it could be just about "anything" causing it to crash.  The great thing about Visual Studio is you can debug both projects at the same time, just make sure your filter and WPF application are in the same solution.  Start up your WPF app with some breakpoints in the filter code and start steppin.


    Good luck,



    Monday, June 25, 2007 4:44 PM
  • The problem has something to do with my source filter. It works perfectly fine on WMP, but in WPF app as soon as I hit the play button the whole app crashes. I tried debugging it but the exception is being raised in the nvidia driver (nvd3dum.dll) - "Unhandled exception at 0x051c6c96 in WPFVideo.exe: 0xC0000005: Access violation reading location 0x00000000."


    My filter actually is the "ball filter" from directshow samples and its working fine in WMP & graph edit. Right now I can't think of any reason why it should cause a driver crash. Any MS guys reading this?

    Monday, June 25, 2007 6:11 PM
  • I think the canned response around these parts is "try upgrading you video card drivers".


    I don't remember the source of the ball filter that well, but maybe try playing with different color spaces (in MediaType).  I'm stabbing in the dark, but maybe the new EVR + nvd3dum.dll doesn't like the pixel format.

    Monday, June 25, 2007 7:44 PM
  • I just tried EVR & my filter in Graph edit and it works perfectly fine! but still doesn't work in WPF app


    I'm using following media type, MajorType: Video, SubType: RGB32. Not sure if its a driver error, because its working fine outside wpf environment.


    Are there any requirements for source filters for wpf? With my current filter i've only implemented CSource & IFileSourceFilter...didn't implement any seeking, quality and/or other interfaces. 


    Tuesday, June 26, 2007 1:13 AM
  • There shouldn't be any extra requirements for source filters in WPF.  Any source filter (with the IFileSourceFilter) I made had no problem being loaded.  Anything that could play in WMP never gave me any grief in WPF.


    I made a WPF work-around to get reference to the MediaElement's graph.  Part of the code is a generic source filter.  Maybe you can play around with it and see if some of the code will work for you.  The stock code I made loads a web-cam into WPF.  But you can create any graph you like.  Heres a link: http://jmorrill.hjtcentral.com/Home/tabid/428/EntryID/15/Default.aspx


    I would also try testing on another machine with a different video card.  That might be the quickest test.



    Tuesday, June 26, 2007 5:39 AM
  • I just ran into an another issue - I can't debug the filter???


    I tried adding filter & wpf app in same solution, tried to attach VS with running app, tried running filter, tried running wpf app. My filter gets loaded but none of the breakpoints get called, I confirmed that by putting a MessageBox() call in methods, the message boxes are working so the new problem is the breakpoints not being called. I have set DirectX mode to debug...any clue whats wrong?

    Wednesday, June 27, 2007 1:22 AM
  • Tuesday, July 3, 2007 8:54 PM