Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #526 from Sep95/CorrectVideoSize
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyVignelles authored Feb 27, 2019
2 parents fb42e9a + 353d387 commit ffd3e87
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Vlc.DotNet.Wpf/VlcVideoSourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,23 @@ private uint VideoFormat(out IntPtr userdata, IntPtr chroma, ref uint width, ref
{
var pixelFormat = IsAlphaChannelEnabled ? PixelFormats.Bgra32 : PixelFormats.Bgr32;
FourCCConverter.ToFourCC("RV32", chroma);

//Correct video width and height according to TrackInfo
var md = MediaPlayer.GetMedia();
foreach (MediaTrack track in md.Tracks)
{
if (track.Type == MediaTrackTypes.Video)
{
var trackInfo = (VideoTrack)track.TrackInfo;
width = trackInfo.Width;
height = trackInfo.Height;
if (trackInfo.SarDen != 0)
{
width = width * trackInfo.SarNum / trackInfo.SarDen;
}
break;
}
}

pitches = this.GetAlignedDimension((uint)(width * pixelFormat.BitsPerPixel) / 8, 32);
lines = this.GetAlignedDimension(height, 32);
Expand Down

0 comments on commit ffd3e87

Please sign in to comment.