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

Commit

Permalink
Adapted VideoFormat() callback
Browse files Browse the repository at this point in the history
Correct video width and height according to TrackInfo
  • Loading branch information
Sep95 authored Feb 23, 2019
1 parent fb42e9a commit c382d37
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Vlc.DotNet.Wpf/VlcVideoSourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@ 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 = track.TrackInfo as VideoTrack;
width = trackInfo.Width;
height = trackInfo.Height;
break;
}
}

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

0 comments on commit c382d37

Please sign in to comment.