Skip to content

Commit 11bf639

Browse files
committed
Updating to v3.3.5
Plugins: New SubtitlesConverter plugin which supports advanced encoding detection (based on Mozilla implementation) Plugins: Adds NET Framework support BitSwarm: Fixes #87 (frame drops) by updating to v2.4.1 YT-DLP: Fixes HasAudio/HasVideo, single format and downloader's speed issues Player: Fixes AudioPlayer null reference (while sets volume/mute before initialization) Player(AVS): Fixes transition issues between AudioOnly to Video Player(AVS): Allows AudioOnly in case Video fails/not exists Subtitles: Fixes an issue that would drop next subtitles frames while pause/play or buffering Renderer: Fixes a crashing issue with x86 platforms DXCompiler: Ensures is fully optimized DXCompiler: Uses best profiles (eg. vs/ps_5_0) based on current OS DXSwapChain: Improves GPU performance by chaning SwapEffect to Discard instead of FlipSequential and BufferCount from 3 to 1 TakeSnapshot: Improves Speed and Performance
1 parent 9efda19 commit 11bf639

7 files changed

Lines changed: 41 additions & 48 deletions

File tree

FlyleafLib.Plugins.BitSwarm/BitSwarm.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,10 @@ namespace FlyleafLib.Plugins
1515
{
1616
public class BitSwarm : PluginBase, IOpen, IProvideVideo, ISuggestVideoInput
1717
{
18-
/* 1. we need an event when the decoder finishes open to restore EnableBuffering = false;
19-
* 2. we need to cancel when we close a stream (causes issues)
20-
* 3. similarly for Player.Seek Re-open!
21-
* 4. Configuration pass to main config
22-
*/
23-
// Cancel current stream to avoid errors :)
24-
//if (Torrent.data.files[fileIndex] != null && !Torrent.data.files[fileIndex].Created) Torrent.data.files[fileIndex]
25-
2618
SuRGeoNix.BitSwarmLib.BitSwarm bitSwarm;
2719

2820
TorrentOptions cfg = new TorrentOptions(); //TODO
29-
Torrent Torrent;
21+
Torrent Torrent;
3022
int fileIndex;
3123
int fileIndexNext;
3224
bool downloadNextStarted;
@@ -274,6 +266,8 @@ public TorrentOptions()
274266
MaxNewConnections = 15;
275267
BlockRequests = 4;
276268

269+
PreventTimePeriods = true;
270+
277271
//Verbosity = 2;
278272
}
279273
}

FlyleafLib.Plugins.BitSwarm/FlyleafLib.Plugins.BitSwarm.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="BitSwarm" Version="2.4.0" />
11+
<PackageReference Include="BitSwarm" Version="2.4.1" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

FlyleafLib.Plugins.SubtitlesConverter/SubtitlesConverter.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
using System.IO;
44
using System.Text;
55

6-
using FlyleafLib.MediaFramework.MediaInput;
76
using UniversalDetector;
8-
using static FlyleafLib.Utils;
7+
8+
using FlyleafLib.MediaFramework.MediaInput;
99

1010
namespace FlyleafLib.Plugins.SubtitlesConverter
1111
{
@@ -20,7 +20,6 @@ public override OpenResults OnOpenSubtitles(SubtitlesInput input)
2020
#if !NETFRAMEWORK
2121
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
2222
#endif
23-
2423
try
2524
{
2625
ICharsetDetector detector = new CharsetDetector();
@@ -114,11 +113,10 @@ public bool Convert(string fileNameIn, string fileNameOut, Encoding input, Encod
114113
sw.Flush();
115114
sr.Close();
116115
sw.Close();
117-
118116
}
119117
catch (Exception e) { Log($"Convert Error: {e.Message}"); return false; }
120118

121119
return true;
122120
}
123121
}
124-
}
122+
}

FlyleafLib/FlyleafLib.csproj

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,31 @@
88
<PackageIconUrl />
99
<RepositoryUrl></RepositoryUrl>
1010
<Description>Media Player .NET Library for WPF/WinForms (based on FFmpeg/DirectX)</Description>
11-
<Version>3.3.4</Version>
11+
<Version>3.3.5</Version>
1212
<Authors>SuRGeoNix</Authors>
1313
<Copyright>SuRGeoNix © 2021</Copyright>
1414
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
1515
<PackageProjectUrl>https://github.com/SuRGeoNix/Flyleaf</PackageProjectUrl>
1616
<PackageTags>flyleaf flyleaflib video audio media player engine framework download extract ffmpeg vortice directx</PackageTags>
1717
<IncludeSymbols>true</IncludeSymbols>
1818
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
19-
<PackageReleaseNotes>Restores backwards compatibility with Win7/8
20-
Invokes Control's UI thread to ensure Subtitles refresh
21-
Replaces depracated Youtube-DL plugin with YT-DLP
22-
Adds YT-DLP subtitles inputs support
19+
<PackageReleaseNotes>Updating to v3.3.5
2320

24-
Fixes VideoDecoder.GetFrame() to support also 4K HDR to SDR (temp fix for ffmpeg bug with HEVC)
25-
Fixes Subtitles issue with seek that it was failing at the beginning of the stream
26-
Fixes Subtitles issue with the demuxer/decoder wouldn't start properly (race condition while was Status=Ended)</PackageReleaseNotes>
27-
<AssemblyVersion>3.3.4.0</AssemblyVersion>
28-
<FileVersion>3.3.4.0</FileVersion>
21+
Plugins: New SubtitlesConverter plugin which supports advanced encoding detection (based on Mozilla implementation)
22+
Plugins: Adds NET Framework support
23+
BitSwarm: Fixes #87 (frame drops) by updating to v2.4.1
24+
YT-DLP: Fixes HasAudio/HasVideo, single format and downloader's speed issues
25+
Player: Fixes AudioPlayer null reference (while sets volume/mute before initialization)
26+
Player(AVS): Fixes transition issues between AudioOnly to Video
27+
Player(AVS): Allows AudioOnly in case Video fails/not exists
28+
Subtitles: Fixes an issue that would drop next subtitles frames while pause/play or buffering
29+
Renderer: Fixes a crashing issue with x86 platforms
30+
DXCompiler: Ensures is fully optimized
31+
DXCompiler: Uses best profiles (eg. vs/ps_5_0) based on current OS
32+
DXSwapChain: Improves GPU performance by chaning SwapEffect to Discard instead of FlipSequential and BufferCount from 3 to 1
33+
TakeSnapshot: Improves Speed and Performance</PackageReleaseNotes>
34+
<AssemblyVersion>3.3.5.0</AssemblyVersion>
35+
<FileVersion>3.3.5.0</FileVersion>
2936
</PropertyGroup>
3037

3138
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

FlyleafLib/MediaPlayer/Player.cs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ private bool MediaBuffer()
12811281
vFrame = null;
12821282
aFrame = null;
12831283
sFrame = null;
1284+
sFramePrev = null;
12841285
Subtitles.SubsText = "";
12851286

12861287
bool gotAudio = !Audio.IsOpened;
@@ -1348,8 +1349,6 @@ private bool MediaBuffer()
13481349

13491350
Log("[SCREAMER] Buffering Done");
13501351

1351-
if (sFrame == null) SubtitlesDecoder.Frames.TryDequeue(out sFrame);
1352-
13531352
if (aFrame != null && aFrame.timestamp < vFrame.timestamp)
13541353
videoStartTicks = Math.Max(aFrame.timestamp, vFrame.timestamp - Config.Audio.Latency);
13551354
else
@@ -1424,7 +1423,7 @@ private void Screamer()
14241423
if (Status != Status.Playing) break;
14251424

14261425
if (aFrame == null && !isAudioSwitch) AudioDecoder.Frames.TryDequeue(out aFrame);
1427-
if (sFrame == null && !isSubsSwitch ) SubtitlesDecoder.Frames.TryDequeue(out sFrame);
1426+
if (sFrame == null && !isSubsSwitch ) SubtitlesDecoder.Frames.TryPeek(out sFrame);
14281427

14291428
elapsedTicks = videoStartTicks + (DateTime.UtcNow.Ticks - startedAtTicks);
14301429
vDistanceMs = (int) ((vFrame.timestamp - elapsedTicks) / 10000);
@@ -1534,31 +1533,29 @@ private void Screamer()
15341533
}
15351534

15361535
if (sFramePrev != null)
1537-
if (elapsedTicks - sFramePrev.timestamp > (long)sFramePrev.duration * 10000) { Subtitles.SubsText = ""; sFramePrev = null; }
1536+
if (elapsedTicks - sFramePrev.timestamp > (long)sFramePrev.duration * 10000)
1537+
{
1538+
_Control?.BeginInvoke(new Action(() => Subtitles.SubsText = ""));
1539+
sFramePrev = null;
1540+
}
15381541

15391542
if (sFrame != null)
15401543
{
1541-
if (Math.Abs(sDistanceMs - sleepMs) < 30)
1544+
if (Math.Abs(sDistanceMs - sleepMs) < 30 || (sDistanceMs < -30 && sFrame.duration + sDistanceMs > 0))
15421545
{
15431546
string tmpSubsText = sFrame.text;
15441547
_Control?.BeginInvoke(new Action(() => Subtitles.SubsText = tmpSubsText));
1545-
sFramePrev = sFrame;
1546-
SubtitlesDecoder.Frames.TryDequeue(out sFrame);
1548+
sFramePrev = new SubtitlesFrame();
1549+
sFramePrev.timestamp = sFrame.timestamp;
1550+
sFramePrev.duration = sFrame.duration;
1551+
sFrame = null;
1552+
SubtitlesDecoder.Frames.TryDequeue(out SubtitlesFrame devnull);
15471553
}
15481554
else if (sDistanceMs < -30)
15491555
{
1550-
if (sFrame.duration + sDistanceMs > 0)
1551-
{
1552-
string tmpSubsText = sFrame.text;
1553-
_Control?.BeginInvoke(new Action(() => Subtitles.SubsText = tmpSubsText));
1554-
sFramePrev = sFrame;
1555-
SubtitlesDecoder.Frames.TryDequeue(out sFrame);
1556-
}
1557-
else
1558-
{
1559-
Log($"sDistanceMs 2 |-> {sDistanceMs}");
1560-
SubtitlesDecoder.Frames.TryDequeue(out sFrame);
1561-
}
1556+
Log($"sDistanceMs 2 |-> {sDistanceMs}");
1557+
sFrame = null;
1558+
SubtitlesDecoder.Frames.TryDequeue(out SubtitlesFrame devnull);
15621559
}
15631560
}
15641561
}

FlyleafLib/Utils.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Globalization;
55
using System.IO;
66
using System.IO.Compression;
7-
using System.Linq;
87
using System.Runtime.InteropServices;
98
using System.Runtime.Serialization;
109
using System.Text;
@@ -16,8 +15,6 @@
1615

1716
using Microsoft.Win32;
1817

19-
//using SharpDX.D3DCompiler; // Enable this if you need to re-compile shaders
20-
2118
using FFmpeg.AutoGen;
2219
using static FFmpeg.AutoGen.ffmpeg;
2320

Samples/FlyleafPlayer (WPF Control) (WPF)/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
xmlns:flwpf="clr-namespace:FlyleafLib.Controls.WPF;assembly=FlyleafLib.Controls.WPF"
1010

1111
mc:Ignorable="d"
12-
Title="Flyleaf v3.3.4" Height="450" Width="800" Background="Black" Loaded="Window_Loaded" Icon="/Flyleaf.ico">
12+
Title="Flyleaf v3.3.5" Height="450" Width="800" Background="Black" Loaded="Window_Loaded" Icon="/Flyleaf.ico">
1313
<Grid>
1414
<fl:VideoView Player="{Binding Player}">
1515
<flwpf:Flyleaf x:Name="flyleafControl"/>

0 commit comments

Comments
 (0)