开发者

Stack Overflow on Marshal.PtrToStructure reading wmv files

I'm using a frame grabber class in order to capture and process each frame in a video. The class can be found here: http://www.codeproject.com/KB/graphics/FrameGrabber.aspx

I'm having issues with running it, however. When loading the file, it attempts to marshal a video format pointer into a VideoInfoHeader (I'm using DirectShow.Net). The code that does this is as follows:

videoInfo = (VideoInfoHeader)Marshal.PtrToStructure(mediaType.formatPtr, typeof(VideoInfoHeader));

When I run this it immediately crashes out of the debugging environment, probably with a stack overflow. When stepping through I can see that the formatPtr always equals 93, though I do no开发者_运维百科t know what to make of this as I am fairly new to marshalling.

I have checked that the video runs fine in Windows Media Player.

This is essential in finding the dimensions of the video and also the size of the header, which needs to be skipped before the frames can be read.

I am running Windows 7 x64.

Any help on this would be much appreciated, I must've tried fifteen different frame grabbing techniques.


Maybe your mediaType structure goes corrupt, do you check what it contains before call? Where it filled?

Also I recommend to run your app under WinDbg. You can find what exact happens there.

If you are new with it try to read Tess Ferrandez's Blog. There are also a lot of information about debugging with WinDbg around, just search.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜