本帖最后由 hk92 于 2015-12-16 11:57 编辑
您好,我做了以下的测试,来利用视频数据回调函数数据,结果没有数据按照我想要的方式输入到我指定的文件当中。 - namespace ANYCHATAPI
- { public delegate void VideoDataCallback(int userId, IntPtr buf, int len, AnyChatCoreSDK.BITMAPINFOHEADER bitMap, int userValue);}
复制代码然后注册视频回调 - AnyChatCoreSDK.SetVideoDataCallBack(AnyChatCoreSDK.PixelFormat.BRAC_PIX_FMT_RGB24, video_Callback, hWnd.ToInt32());
复制代码- static AnyChatCoreSDK.VideoData_CallBack video_Callback = new AnyChatCoreSDK.VideoData_CallBack(VideoData_CallBack);
复制代码 然后是- public static VideoDataCallback Video_OnCallBack = null;
复制代码- private static void VideoData_CallBack(int userId, IntPtr buf, int len, AnyChatCoreSDK.BITMAPINFOHEADER bitMap, int userValue)
- {
-
- if (Video_OnCallBack != null)
- Video_OnCallBack(userId, buf, len, bitMap, userValue);
- // Console.WriteLine("123");
- }
复制代码 以上是 初始化AnyChat sdk 注册 callback
然后在初始化房间的时候- SystemSetting.Video_OnCallBack = new VideoDataCallback(Received_Videodata);
复制代码- private void Received_Videodata(int userId, IntPtr buf, int len, AnyChatCoreSDK.BITMAPINFOHEADER bitMap, int userValue)
- {
- string m_Command = Marshal.PtrToStringAnsi(buf);
- File.AppendAllText("D:\\a.txt", m_Command);
- }
复制代码 按照开发文档说的,在调用ret = AnyChatCoreSDK.UserCameraControl(-1, true)时就会触发回调函数,那么我测试的时候,为什么在D盘下的a.txt文档中没有数据呢?
|