WPF version for voice conferencing

Mar 10, 2012 at 8:26 PM

Good day!

Thank you for the nice product. Is there any WPF or WinForms client for voice conferencing? I've managed to compose WPF client for videoconferencing. I can publish source code if somebody is interested in.

Best Regards,

  Alexander Myltsev

Mar 13, 2012 at 3:59 PM

Hello,

I would like to see source code for WPF.

May 3, 2012 at 10:49 AM

Hi Alexander,

I am Interested in the WPF version, may you please publish it?

May 4, 2012 at 9:27 PM

Hi!

I used http://easywebcam.codeplex.com/ for webcam image capturing. I've modified WebCam.cs:webcam_ImageCaptured :

 

        void webcam_ImageCaptured(object source, WebcamEventArgs e)
        {
            var bitmapSource = Helper.LoadBitmap((System.Drawing.Bitmap)e.WebCamImage);
            _FrameImage.Source = bitmapSource;
            Helper.StartEncoding(bitmapSource);
        }

 

 

And added Helper:StarEncoding method:

#region Encoding/Decoding Methods

        public static void EncodeJpeg(BitmapSource bmp, Stream dstStream)
        {
            /*
            var encoder = new JpegBitmapEncoder();
            encoder.Frames.Add(BitmapFrame.Create(bitmap));
            encoder.QualityLevel = 100;
            encoder.Save(dstStream);
             */
            

            // Init buffer in FluxJpeg format
            int w = bmp.PixelWidth;
            int h = bmp.PixelHeight;
            //int[] p = bmp.Pixels;
            int[] p  = new int[h * w * 4];
            bmp.CopyPixels(p, w * 4, 0);
            byte[][,] pixelsForJpeg = new byte[3][,]; // RGB colors
            pixelsForJpeg[0] = new byte[w, h];
            pixelsForJpeg[1] = new byte[w, h];
            pixelsForJpeg[2] = new byte[w, h];

            // Copy WriteableBitmap data into buffer for FluxJpeg
            int i = 0;
            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    int color = p[i++];
                    pixelsForJpeg[0][x, y] = (byte)(color >> 16); // R
                    pixelsForJpeg[1][x, y] = (byte)(color >> 8);  // G
                    pixelsForJpeg[2][x, y] = (byte)(color);       // B
                }
            }
            //Encode Image as JPEG
            var jpegImage = new FluxJpeg.Core.Image(new ColorModel { colorspace = ColorSpace.RGB }, pixelsForJpeg);
            var encoder = new JpegEncoder(jpegImage, 95, dstStream);
            encoder.Encode();
        }

        public static void StartEncoding(BitmapSource source)
        {
            try
            {
                var ms = new MemoryStream();
                EncodeJpeg(source, ms);
                var buffer = ms.GetBuffer();
                Send_Bytes(buffer);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("ERROR: " + ex.Message);
            }

            /*
            try
            {
                WriteableBitmap bmp = new WriteableBitmap(rectVideo, null);
                MemoryStream ms = new MemoryStream();
                EncodeJpeg(bmp, ms);
                Send_Bytes(ms.GetBuffer());
            }
            catch (Exception) { }
             */
        }

        #endregion Encoding/Decoding Methods

FluxJpeg/Desktop is required to run this code. Other files haven't been modified.

 

Regards,

  Alex