RtspClientSharp
RtspClientSharp copied to clipboard
Center the video frame
So far I use the following code:
_width = width;
_height = height;
_dirtyRect = new Int32Rect(0, 0, width, height);
_transformParameters = new TransformParameters(RectangleF.Empty,
new System.Drawing.Size(_width, _height),
ScalingPolicy.RespectAspectRatio, PixelFormat.Bgra32, ScalingQuality.FastBilinear);
myWiteableBitmap = new WriteableBitmap(
width,
height,
ScreenInfo.DpiX,
ScreenInfo.DpiY,
PixelFormats.Pbgra32,
null);
RenderOptions.SetBitmapScalingMode(myWiteableBitmap, BitmapScalingMode.HighQuality);
where _width and _height are the size of the WriteableBitmap. But in case the frame size rate is different from the bitmap one the video is rendering as left aligned. How can I center it? #
Hello,
Did you resolve this issue? It seems that you need to modify some code in Invalidate method of VideoView.xaml.cs. I think that _writeableBitmap.BackBuffer should be replaced by _writeableBitmap.BackBuffer + offset, where offset could be calculated through frame width and pixel size