Exemple #1
0
 // AnyChat内核回调
 public static void VideoData_CallBack(int userId, IntPtr buf, int len, AnyChatCoreSDK.BITMAPINFOHEADER bitMap, int userValue)
 {
     if (VideoDataHandler != null)
     {
         VideoDataHandler(userId, buf, len, bitMap, userValue);
     }
 }
Exemple #2
0
        // 静态委托
        public void VideoDataCallbackDelegate(int userId, IntPtr buf, int len, AnyChatCoreSDK.BITMAPINFOHEADER bitMap, int userValue)
        {
            int          stride = bitMap.biWidth * 3;
            BitmapSource bs     = BitmapSource.Create(bitMap.biWidth, bitMap.biHeight, 96, 96, PixelFormats.Bgr24, null, buf, len, stride);
            // 将图像进行翻转
            TransformedBitmap RotateBitmap = new TransformedBitmap();

            RotateBitmap.BeginInit();
            RotateBitmap.Source    = bs;
            RotateBitmap.Transform = new RotateTransform(180);
            RotateBitmap.EndInit();
            RotateBitmap.Freeze();

            // 异步操作
            Action action = new Action(delegate()
            {
                Dispatcher.BeginInvoke(new Action(delegate()
                {
                    if (userId == g_selfUserId)
                    {
                        localVideoImage.Source = RotateBitmap;
                    }
                    else if (userId == g_otherUserId)
                    {
                        remoteVideoImage.Source = RotateBitmap;
                    }
                }), null);
            });

            action.BeginInvoke(null, null);
        }
Exemple #3
0
        // 静态委托
        public void VideoDataCallbackDelegate(int userId, IntPtr buf, int len, AnyChatCoreSDK.BITMAPINFOHEADER bitMap, int userValue)
        {
            // 由于采用自动显示(在AnyChatCoreSDK.InitSDK时设置了AnyChatCoreSDK.BRAC_FUNC_VIDEO_AUTODISP),所以屏蔽通过回调的方式显示视频,效率更高
            // 如果希望对视频进行处理,则可以设置AnyChatCoreSDK.BRAC_FUNC_VIDEO_CBDATA,去掉AnyChatCoreSDK.BRAC_FUNC_VIDEO_AUTODISP,然后开放下面的代码即可
            // 有关AnyChat自动显示和回调显示的区别可参考:http://www.anychat.cn/faq/index.php?action=artikel&cat=2&id=196&artlang=zh

/*
 *          int stride = bitMap.biWidth * 3;
 *          BitmapSource bs = BitmapSource.Create(bitMap.biWidth, bitMap.biHeight, 96, 96, PixelFormats.Bgr24, null, buf, len, stride);
 *          // 将图像进行翻转
 *          TransformedBitmap RotateBitmap = new TransformedBitmap();
 *          RotateBitmap.BeginInit();
 *          RotateBitmap.Source = bs;
 *          ScaleTransform scaleTransform = new ScaleTransform();
 *          scaleTransform.ScaleY = -1;
 *          RotateBitmap.Transform = scaleTransform;
 *          RotateBitmap.EndInit();
 *          RotateBitmap.Freeze();
 *
 *          //// 异步操作
 *          Action action = new Action(delegate()
 *          {
 *             Dispatcher.BeginInvoke(new Action(delegate()
 *             {
 *                 if (userId == g_selfUserId)
 *                     localVideoImage.Source = RotateBitmap;
 *                 else if (userId == g_otherUserId)
 *                     remoteVideoImage.Source = RotateBitmap;
 *             }), null);
 *          });
 *          action.BeginInvoke(null, null);
 */
        }
 /// <summary>
 /// 视频回调
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="buf"></param>
 /// <param name="len"></param>
 /// <param name="bitMap"></param>
 /// <param name="userValue"></param>
 private static void VideoData_CallBack(int userId, IntPtr buf, int len,
                                        AnyChatCoreSDK.BITMAPINFOHEADER bitMap, int userValue)
 {
 }