I am using a code which captures a frame from a video which I found in CodeProject
我正在使用一个代码来捕获我在CodeProject中找到的视频中的帧
The code runs great on 32bit, the problem starts when I try to run on 64bit systems.
代码在32位上运行良好,当我尝试在64位系统上运行时问题就出现了。
The exception thrown is "AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted"
引发的异常是“AccessViolationException:尝试读取或写入受保护的内存。这通常表示其他内存已损坏”
I debugged in 32bit and in 64bit platforms and found where the problem is-
我在32位和64位平台上调试,发现问题出在哪里 -
mediaType = new AMMediaType();
mediaDet.get_StreamMediaType(mediaType);
videoInfo = (VideoInfoHeader)Marshal.PtrToStructure(mediaType.formatPtr, typeof(VideoInfoHeader));
After the second line I looked at mediaType contents and it is completely different in 64bit over 32, which causes the next line to throw the exception(mediaType.formatPtr has different value)
在第二行之后我查看了mediaType内容,它在64位超过32时完全不同,这导致下一行抛出异常(mediaType.formatPtr具有不同的值)
I assume the problem is with the type "IntPtr" which size is different on the 2 platforms(4 vs 8 bytes) the thing is that I don't know how to overcome this problem.
我假设问题是“IntPtr”类型,在2个平台上大小不同(4对8字节),我不知道如何克服这个问题。
Any kind of help would be good, thanks in advance, Liran.
任何形式的帮助都会很好,谢谢提前,Liran。
1 个解决方案
#1
1
found the solution - the problem lies within the DirectShow DLL, FrameGrabber referenced an old version of the dll, I downloaded and replaced the reference with their latest DLL and problem solved.
发现解决方案 - 问题在于DirectShow DLL,FrameGrabber引用了旧版本的dll,我下载并用最新的DLL替换了引用并解决了问题。
Thanks for your post, Liran.
感谢您的帖子,Liran。
#1
1
found the solution - the problem lies within the DirectShow DLL, FrameGrabber referenced an old version of the dll, I downloaded and replaced the reference with their latest DLL and problem solved.
发现解决方案 - 问题在于DirectShow DLL,FrameGrabber引用了旧版本的dll,我下载并用最新的DLL替换了引用并解决了问题。
Thanks for your post, Liran.
感谢您的帖子,Liran。