Skip to content

Commit 88bd869

Browse files
committed
Updates to v3.9.3 (FlyleafLib) / v1.5.3 (FlyleafME) / v1.2.3 (FlyleafHost.WinUI)
- Config.Decoder: Introduces AudioCodec/VideoCodec/SubtitlesCodec to allow forcing the codec - Config.Decoder: Introduces AllowDropFrames which handles decoder's skip_frame and AV_CODEC_FLAG_LOW_DELAY/AV_CODEC_FLAG2_FAST for low latency - Config.Decoder: Introduces KeyFrameValidation which ensures no artifacts on some broken formats - VideoDecoder: Fixes a possible issue with frame drops (with network streams) at decoder level - Renderer.Present: Fixes an issue with ClearScreen when forced - Renderer.PixelShader: Switching from OMSetBlendState to custom PixelShader alpha blending to avoid double blend with transparency - Player.CurTime: Improves seeking forward when it has a chance to find it in cache - FlyleafHost.Wpf: Adds full transparency support for media with alpha channel (through VideoBackground and Config.Video.BackgroundColor) - FlyleafHost.Wpf: Introduces VideoBackground for Surface's Background color (deprecates Config.Video.BackgroundColor for this purpose) - Updates Vortice / MaterialDesignThemes / WindowsAppSDK
1 parent 7ad2fd5 commit 88bd869

7 files changed

Lines changed: 31 additions & 20 deletions

File tree

FlyleafLib.Controls.WPF/FlyleafLib.Controls.WPF.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>net8.0-windows;net10.0-windows</TargetFrameworks>
55
<UseWindowsForms>true</UseWindowsForms>
66
<UseWPF>true</UseWPF>
7-
<Version>1.5.2</Version>
7+
<Version>1.5.3</Version>
88
<Authors>SuRGeoNix</Authors>
99
<Copyright>SuRGeoNix © 2025</Copyright>
1010
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
@@ -14,8 +14,7 @@
1414
<PackageTags>flyleaf flyleaflib flyleafme video audio wpf media player element control</PackageTags>
1515
<Description>FlyleafME: A WPF Media Element Control (based on FlyleafLib)</Description>
1616
<PackageReleaseNotes>
17-
- Adds .NET 10 support
18-
- Updates FlyleafLib
17+
Updates FlyleafLib / MaterialDesignThemes
1918
</PackageReleaseNotes>
2019
</PropertyGroup>
2120

FlyleafLib.Controls.WinUI/FlyleafLib.Controls.WinUI.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
<UseWinUI>true</UseWinUI>
66
<Nullable>enable</Nullable>
77
<Authors>SuRGeoNix</Authors>
8-
<Version>1.2.2</Version>
8+
<Version>1.2.3</Version>
99
<Copyright>SuRGeoNix © 2025</Copyright>
1010
<PackageProjectUrl>https://github.com/SuRGeoNix/Flyleaf</PackageProjectUrl>
1111
<PackageIcon>Flyleaf.png</PackageIcon>
1212
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
1313
<PackageTags>flyleaf flyleaflib flyleafhost video audio winui media player element control</PackageTags>
1414
<Description>FlyleafHost.WinUI: Direct3D 11 Hardware Accelerated Media Surface (based on FlyleafLib)</Description>
1515
<PackageReleaseNotes>
16-
- Adds .NET 10 support
17-
- Updates FlyleafLib
16+
Updates FlyleafLib / Vortice / WindowsAppSDK
1817
</PackageReleaseNotes>
1918
</PropertyGroup>
2019
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">

FlyleafLib/Engine/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public DecoderConfig Clone()
566566
bool _ShowCorrupted;
567567

568568
/// <summary>
569-
/// Ensures that after a key packet receives a also key frame (can create artifacts on some broken formats when disabled)
569+
/// Ensures that after a key packet receives a also key frame (can create artifacts on some broken formats when disabled and seek issues when enabled)
570570
/// </summary>
571571
public bool KeyFrameValidation { get => _KeyFrameValidation; set => SetUI(ref _KeyFrameValidation, value); }
572572
internal bool _KeyFrameValidation;

FlyleafLib/FlyleafLib.csproj

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageIconUrl />
99
<RepositoryUrl></RepositoryUrl>
1010
<Description>Media Player .NET Library for WinUI 3/WPF/WinForms (based on FFmpeg/DirectX)</Description>
11-
<Version>3.9.2</Version>
11+
<Version>3.9.3</Version>
1212
<Authors>SuRGeoNix</Authors>
1313
<Copyright>SuRGeoNix © 2025</Copyright>
1414
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
@@ -17,10 +17,16 @@
1717
<IncludeSymbols>true</IncludeSymbols>
1818
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1919
<PackageReleaseNotes>
20-
- Adds .NET 10 support
21-
- Renderer.SwapChain: Fixes an issue during initialization (could cause black screens and wrong aspect ratios during initialize/swap)
22-
- Renderer.Present: Respects Config.Video.ClearScreen and avoids clearing the screen when not set
23-
- Player: Fixes a crashing issue for Audio only
20+
- Config.Decoder: Introduces AudioCodec/VideoCodec/SubtitlesCodec to allow forcing the codec
21+
- Config.Decoder: Introduces AllowDropFrames which handles decoder's skip_frame and AV_CODEC_FLAG_LOW_DELAY/AV_CODEC_FLAG2_FAST for low latency
22+
- Config.Decoder: Introduces KeyFrameValidation which ensures no artifacts on some broken formats
23+
- VideoDecoder: Fixes a possible issue with frame drops (with network streams) at decoder level
24+
- Renderer.Present: Fixes an issue with ClearScreen when forced
25+
- Renderer.PixelShader: Switching from OMSetBlendState to custom PixelShader alpha blending to avoid double blend with new transparency support
26+
- Player.CurTime: Improves seeking forward when it has a chance to find it in cache
27+
- FlyleafHost.Wpf: Adds full transparency support for media with alpha channel (through VideoBackground and Config.Video.BackgroundColor)
28+
- FlyleafHost.Wpf: Introduces VideoBackground for Surface's Background color (deprecates Config.Video.BackgroundColor for this purpose)
29+
- Updates Vortice
2430
</PackageReleaseNotes>
2531
</PropertyGroup>
2632

FlyleafLib/MediaFramework/MediaRenderer/Renderer.PixelShader.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ internal bool ConfigPlanes(AVFrame* frame = null)
284284
285285
float4 c1 = Texture1.Sample(Sampler, float2(pos1, input.Texture.y));
286286
float4 c2 = Texture1.Sample(Sampler, float2(pos2, input.Texture.y));
287-
288287
";
289288
if (VideoStream.PixelFormat == AVPixelFormat.Yuyv422 ||
290289
VideoStream.PixelFormat == AVPixelFormat.Y210le)
@@ -451,10 +450,16 @@ internal bool ConfigPlanes(AVFrame* frame = null)
451450
for (int i = 0; i < VideoStream.PixelComps.Length; i++)
452451
offsets += pixelOffsets[(int) (VideoStream.PixelComps[i].offset / Math.Ceiling(VideoStream.PixelComp0Depth / 8.0))];
453452

453+
// TBR: [RGB0]32 has no alpha remove it
454+
if (VideoStream.PixelFormatStr[0] == '0')
455+
offsets = offsets[1..];
456+
else if (VideoStream.PixelFormatStr[^1] == '0')
457+
offsets = offsets[..^1];
458+
454459
curPSUniqueId += offsets;
455460

456461
string shader;
457-
if (VideoStream.PixelComps.Length > 3)
462+
if (VideoStream.PixelComps.Length > 3 && offsets.Length > 3)
458463
shader = @$"
459464
color = Texture1.Sample(Sampler, input.Texture).{offsets};
460465
";
@@ -734,12 +739,11 @@ internal VideoFrame FillPlanes(AVFrame* frame)
734739
bool vflip = false;
735740
for (int i = 0; i < VideoStream.PixelPlanes; i++)
736741
{
737-
if (frame->linesize[i] < 0) // Negative linesize for vertical flipping
742+
if (frame->linesize[i] < 0) // Negative linesize needs vertical flipping | [Bottom -> Top] data[i] points to last row and we need to move at first (height - 1) rows
738743
{
739744
vflip = true;
740745
subData[0].RowPitch = (uint)(-1 * frame->linesize[i]);
741-
subData[0].DataPointer = frame->data[i];
742-
subData[0].DataPointer -= (nint)((subData[0].RowPitch * (VideoStream.Height - 1))); // TBR: Heigh is wrong here (needs texture's height?)
746+
subData[0].DataPointer = frame->data[i] + (frame->linesize[i] * (frame->height - 1));
743747
}
744748
else
745749
{

FlyleafLib/MediaFramework/MediaRenderer/Renderer.VideoProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ void UpdateRotationUnSafe(uint angle, bool refresh = true)
407407
context.UpdateSubresource(vsBufferData, vsBuffer);
408408
vc?.VideoProcessorSetStreamRotation(vp, 0, true, _d3d11vpRotation);
409409

410-
UpdateAspectRatio(refresh);
410+
UpdateAspectRatioUnSafe(refresh);
411411
}
412412

413413
internal void UpdateAspectRatio(bool refresh = true)

FlyleafLib/MediaFramework/MediaStream/VideoStream.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,11 @@ public void Refresh(VideoDecoder decoder, AVFrame* frame) // TBR: Can be filled
221221
}
222222
}
223223

224-
Width = (uint)(frame->width - (cropRect.Left + cropRect.Right));
225-
Height = (uint)(frame->height - (cropRect.Top + cropRect.Bottom));
224+
if (Width == 0)
225+
{ // Those are for info only (mainly before opening the stream, otherwise we get them from renderer at player's Video.X)
226+
Width = (uint)codecCtx->width;
227+
Height = (uint)codecCtx->height;
228+
}
226229

227230
if (frame->flags.HasFlag(FrameFlags.Interlaced))
228231
FieldOrder = frame->flags.HasFlag(FrameFlags.TopFieldFirst) ? VideoFrameFormat.InterlacedTopFieldFirst : VideoFrameFormat.InterlacedBottomFieldFirst;

0 commit comments

Comments
 (0)