BogdanovKirill / RtspClientSharp

Pure C# RTSP client for .NET Standard without external dependencies and with true async nature. I welcome contributions.
MIT License
708 stars 284 forks source link

Thank you !!! #5

Closed BBUBBA closed 5 years ago

BBUBBA commented 5 years ago

it's very good performance example...

thank you ^^

but... i want know something...

how can i render in winform....

i can't understand... Deep copy....

help me . T.T

have a nice day and really thank you !!

BogdanovKirill commented 5 years ago

Thank you for your feedback. I could advice you to start here: https://archive.codeplex.com/?p=razorgdipainter This is how to draw bitmaps fast in winforms/wpf

BBUBBA commented 5 years ago

Thank you Reply To me ^^

I checked Your Comment ..

But.. i Don't Know T_T

I Want Show Rtsp Frame in Winforms.

I Try this...

         var postVideoDecodingParameters = new PostVideoDecodingParameters(RectangleF.Empty,
            new Size(targetWidth, targetHeight),
            ScalingPolicy.Stretch, PixelFormat.Bgr24, ScalingQuality.Bicubic);

        IDecodedVideoFrame decodedFrame = decoder.GetDecodedFrame(bufferSegment, postVideoDecodingParameters);

        //Bitmap bmp = new Bitmap(decodedFrame.DecodedBytes.Array);

        Bitmap bmp = new Bitmap(decodedFrame.Width, decodedFrame.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

        //Create a BitmapData and Lock all pixels to be written
        System.Drawing.Imaging.BitmapData bmpData = bmp.LockBits(
                             new Rectangle(0, 0, bmp.Width, bmp.Height),
                             System.Drawing.Imaging.ImageLockMode.WriteOnly, bmp.PixelFormat);

        Marshal.Copy(decodedFrame.DecodedBytes.Array, decodedFrame.DecodedBytes.Offset,
                    bmpData.Scan0, decodedFrame.DecodedBytes.Count);

        bmp.UnlockBits(bmpData);

        bmp.Save("C:\\TEST1234.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
BogdanovKirill commented 5 years ago

Just try to use RazorPainterWFCtl and write decodedFrames to RazorBMP bitmap (see such property in RazorPainterWFCtl ) in work cycle. Then call RazorPaint method.

BBUBBA commented 5 years ago

Thank you ~!~!~!

I Try that But Not Fast..

i Just use picturebox;;

if i want use image Stretch Function.. i have to Set 32bit project...

That is Not Slow ^^;; ( 64bit Project is Very Slow..... When i try change Image... i don't know why.. but 32bit is so fast...)

Thank you ~!!!!^^

and have a nice day ^^

BogdanovKirill commented 5 years ago

I can't say where is problem here. If you care about performance, just try to use ScalingQuality.Bilinear. It's significant cheaper than Bicubic interpolation.