通过C++读取视频图像后想要将视频图像数据实时在C#中使用,但是拷贝内存导致了帧率下降,请问什么办法能够使得C#直接读取C++分配的这块内存里的数据?
解决方案 »
- 【请教】C#中picturebox背景图片设置问题
- C#读写程序配置的技术目前有哪些?
- 未将对象引用设置到对象的实例
- C#实现时移电视(关键是P2P 流媒体 播放器)
- 什麼是同步/异步处理策略,有什麼用?(謝謝)
- 请问一个关于IrisSkin的滚动条问题
- 贡献全部身价(所有的分)或200¥请高手解决一个(图像或视频)传输问题
- 如何设置DATAGRID 的列名%……
- 微软ComboBox的一个BUG?还是我的错误?
- 请问C#中怎么才能判断输入的用户帐号是否是一个域帐号?
- Js中取RadioButtonList值的问题
- 听说httpwebreqeust也有同步异步,那么跟线程的同异步有什么区别呢?
1.c++ 自己将数据通过http请求提交到 asp.net 网站,
2.asp.net 网站部分编写一个webservice,供c++调用
最后推测是C#自动回收内存造成的。
C++函数
/// Return Type: void
///player: CFlashPlayer*
///buffer: void**
///width: int*
///height: int*
///stride: int*
///format: int*
///获取当前的图像的内存
[System.Runtime.InteropServices.DllImportAttribute("XSwfDec.dll", EntryPoint = "flashplayer_get_current_bitmap", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
public static extern void flashplayer_get_current_bitmap(ref System.IntPtr buffer, ref int width, ref int height, ref int stride, ref int format);
C#使用
#region 获得当前的内存中的位图 IntPtr bufferPtr = IntPtr.Zero;
int width =0;
int height =0;
int stride =0;
int format =0;
XSwfPlayerforWin.NativeMethods.flashplayer_get_current_bitmap(ref bufferPtr, ref width, ref height, ref stride, ref format);
XSwfPlayerforWin.NativeMethods.flashplayer_pause();
Bitmap bit = new Bitmap(width, height, stride, (System.Drawing.Imaging.PixelFormat)format, bufferPtr);
objcrop.CropImage = (Image)bit;
#endregion
c#只要传一个控件的句柄就可以了。