Skip to content

Commit

Permalink
Updating to 3.4.7 / 1.1.20
Browse files Browse the repository at this point in the history
-= Enriches FlyleafLib with Logging =-

* Adds Log Support for both FlyleafLib and FFmpeg (with separate log levels for each)
* Organizes the previously Master and renaming it to Engine
* Allows runtime/dynamic changes to log configuration
* Collects all the Global configuration to one place and allows Load/Save
* Controls.WPF: Renames Buffering Tab to Player and adds the new Logging settings
* Controls.WPF: Adds Read Timeout to Player Settings
* AudioOnly: Prevents the initialization of VideoDecoder and Renderer
* Adds a read timeout even on the demuxer (Player.VideoDemuxer.TimedOut)

[Breaking/Important Changes]
* New way to initialize FlyleafLib with Engine.Start
* Master has been renamed to Engine
* Master.RegisterFFmpeg and Master.RegisterPlugins have been removed
* Master.GPUAdapters transferred to Engine.Video.GPUAdapters
* Master.AudioMaster.Devices transferred to Engine.Audio.Devices
* Master configuration properties transferred to Engine.Config

[Start Engine Example]

Engine.Start(new EngineConfig()
{
 UIRefresh           = true,  // Required for Activity, BufferedDuration and Stats in combination with Config.Player.Stats = true
 UIRefreshInterval   = 250,  // How often to update the UI
 UICurTimePerSecond  = false, // Whether to update CurTime only when it's second changed or by UIRefreshInterval
 HighPerformaceTimers= false, // Forces TimeBeginPeriod(1) always active

 //LogOutput           = ":debug",
 //LogOutput           = ":console",
 LogOutput           = "C:\\logs\\file.log",

 LogLevel            = LogLevel.Debug,
 FFmpegLogLevel      = FFmpegLogLevel.Warning,

 PluginsPath         = "C:\\SomePath\\Plugins",
 FFmpegPath          = "C:\\SomePath\\FFmpeg",
});

* FFmpegPath and PluginsPath support both relative and absolute paths and can specify the ":" prefix for any folder below the current

[Solution Notes]
* FFmpeg libraries for x86 platforms have been removed from the solution
* FFmpeg libraries have been transferred to FFmpeg/ folder
* All the global classes have been transferred to Engine/
  • Loading branch information
SuRGeoNix committed Jan 18, 2022
1 parent d2c1e72 commit 70ccd88
Show file tree
Hide file tree
Showing 74 changed files with 1,275 additions and 760 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 7 additions & 5 deletions FlyleafLib.Controls.WPF/Flyleaf.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public Player Player

public Config Config => Player?.Config;

public AudioMaster AudioMaster => Master.AudioMaster;
public AudioEngine AudioEngine => Engine.Audio;
public EngineConfig ConfigEngine => Engine.Config;

public SerializableDictionary<string, SerializableDictionary<string, string>>
PluginsConfig => Config?.Plugins;
Expand Down Expand Up @@ -168,8 +169,6 @@ internal Settings

static Flyleaf()
{
Master.UIRefresh = true; // Allow UI Refresh for Activity Mode, Buffered Duration on Pause & Stats

Player.SwapCompleted += (o, e) =>
{
var flyleaf1 = (Flyleaf)e.Player1.Tag;
Expand Down Expand Up @@ -197,6 +196,9 @@ public Flyleaf()
if (isDesignMode) return;

DataContext = this;

// Ensure that the engine has been started
Engine.Config.UIRefresh = true; // Allow UI Refresh for Activity Mode, Buffered Duration on Pause & Stats
}
public override void OnApplyTemplate()
{
Expand Down Expand Up @@ -382,12 +384,12 @@ private void InitializePlayer(Player oldPlayer = null)

if (oldPlayer != null)
{
Log($"Assigning {Player.PlayerId} | {(oldPlayer != null ? $"Old {oldPlayer.PlayerId}" : "")}");
//Log($"Assigning {Player.PlayerId} | {(oldPlayer != null ? $"Old {oldPlayer.PlayerId}" : "")}");
return;
}

UniqueId = Player.PlayerId;
Log($"Assigning {Player.PlayerId} | {(oldPlayer != null ? $"Old {oldPlayer.PlayerId}" : "")}");
//Log($"Assigning {Player.PlayerId} | {(oldPlayer != null ? $"Old {oldPlayer.PlayerId}" : "")}");

Unloaded += (o, e) => { Dispose(); };
Player.Control.MouseClick += (o, e) => { if (e.Button == System.Windows.Forms.MouseButtons.Right & popUpMenu != null) popUpMenu.IsOpen = true; };
Expand Down
7 changes: 4 additions & 3 deletions FlyleafLib.Controls.WPF/FlyleafLib.Controls.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0-windows;net5.0-windows;net472</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<Version>1.1.19</Version>
<Version>1.1.20</Version>
<Authors>SuRGeoNix</Authors>
<Copyright>SuRGeoNix © 2022</Copyright>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
Expand All @@ -14,8 +14,9 @@
<PackageTags>flyleaf flyleaflib video audio media player element control</PackageTags>
<Description>WPF Media Player Control/Element (based on FlyleafLib)</Description>
<PackageReleaseNotes>
* Updates Settings with Filters/Deinterlace and Speed x8
* Updates FlyleafLib and MaterialDesign
* Renames Buffering Tab to Player and adds the new Logging settings
* Adds Read Timeout to Player Settings
* Updates FlyleafLib
</PackageReleaseNotes>
</PropertyGroup>

Expand Down
123 changes: 77 additions & 46 deletions FlyleafLib.Controls.WPF/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

<ObjectDataProvider x:Key="LogLevelEnum" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="fl:LogLevel"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

<ObjectDataProvider x:Key="FFmpegLogLevelEnum" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="fl:FFmpegLogLevel"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

</ResourceDictionary>
</UserControl.Resources>

Expand Down Expand Up @@ -164,12 +176,71 @@
</StackPanel>
</materialDesign:DialogHost.DialogContent>

<dragablz:TabablzControl Width="525" Height="390" x:Name="tabRoot" FixedHeaderCount="10" Style="{StaticResource mdTabControl}" ItemContainerStyle="{StaticResource NormalTabItemStyle}">
<dragablz:TabablzControl Width="504" Height="390" x:Name="tabRoot" FixedHeaderCount="10" Style="{StaticResource mdTabControl}" ItemContainerStyle="{StaticResource NormalTabItemStyle}">
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="TextElement.Foreground" Value="{DynamicResource MaterialDesignBody}"/>
</Style>
</TabControl.Resources>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal" Background="{DynamicResource MaterialDesignPaper}">
<materialDesign:PackIcon Kind="PlayBoxMultipleOutline" Margin="0 6 4 6"/>
<TextBlock Text="Player" VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueMidBrush}" Padding="0 0 8 0"/>
</StackPanel>
</TabItem.Header>
<Grid>
<Grid Margin="20" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>

<TextBlock Grid.Row="0" Text="Read Timeout (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Demuxer.ReadTimeout, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="1" Text="Buffer Duration Min. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Player.MinBufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="2" Text="Buffer Duration Max. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Demuxer.BufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="3" Text="Audio Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxAudioFrames, UpdateSourceTrigger=Explicit}"/>

<TextBlock Grid.Row="4" Text="Video Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxVideoFrames, UpdateSourceTrigger=Explicit}"/>

<Separator Grid.Row="5" Grid.ColumnSpan="3"/>

<TextBlock Grid.Row="6" Text="Log File" VerticalAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" Width="260" TextAlignment="Left" Style="{StaticResource FLTextbox}" Text="{Binding ConfigEngine.LogOutput, UpdateSourceTrigger=Explicit}"/>

<TextBlock Grid.Row="7" Text="Log Level" VerticalAlignment="Center"/>
<ComboBox Grid.Row="7" Grid.Column="1" ItemsSource="{Binding Source={StaticResource LogLevelEnum}}" SelectedItem="{Binding ConfigEngine.LogLevel}"/>

<TextBlock Grid.Row="8" Text="Log Level (FFmpeg)" VerticalAlignment="Center"/>
<ComboBox Grid.Row="8" Grid.Column="1" ItemsSource="{Binding Source={StaticResource FFmpegLogLevelEnum}}" SelectedItem="{Binding ConfigEngine.FFmpegLogLevel}"/>
</Grid>
<StackPanel Margin="0, 0, 0, 10" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Button Style="{StaticResource SaveButton}"/>
<Button Content="Apply" FontWeight="ExtraBold" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="apply"/>
<Button Margin="10 0" Content="Cancel" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="cancel" />
</StackPanel>
</Grid>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal" Background="{DynamicResource MaterialDesignPaper}">
Expand Down Expand Up @@ -198,7 +269,7 @@
<TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource FLTextboxN}" Text="{Binding Config.Audio.Delay, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="2" Text="Device" VerticalAlignment="Center"/>
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" x:Name="cmbAudioDevice" Tag="_save" ItemsSource="{Binding AudioMaster.Devices}" SelectedItem="{Binding Player.Audio.Device, UpdateSourceTrigger=Explicit}" />
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" x:Name="cmbAudioDevice" Tag="_save" ItemsSource="{Binding AudioEngine.Devices}" SelectedItem="{Binding Player.Audio.Device, UpdateSourceTrigger=Explicit}" />
</Grid>
<StackPanel Margin="0, 0, 0, 10" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Button Style="{StaticResource SaveButton}"/>
Expand Down Expand Up @@ -313,7 +384,7 @@

<TextBlock Grid.Row="2" Text="Deinterlace" VerticalAlignment="Center"/>
<ToggleButton Grid.Row="2" Grid.Column="1" Tag="_save" IsChecked="{Binding Config.Video.Deinterlace, UpdateSourceTrigger=Explicit}" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignSwitchDarkToggleButton}"/>

<TextBlock Grid.Row="3" Text="V. Sync" VerticalAlignment="Center"/>
<ToggleButton Grid.Row="3" Grid.Column="1" Tag="_save" IsChecked="{Binding Config.Video.VSync, UpdateSourceTrigger=Explicit}" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignSwitchDarkToggleButton}"/>

Expand All @@ -334,7 +405,7 @@

<TextBlock Grid.Row="9" Text="HDR to SDR Tone" VerticalAlignment="Center"/>
<TextBox Grid.Row="9" Grid.Column="1" Style="{StaticResource FLTextbox}" Text="{Binding Config.Video.HDRtoSDRTone, UpdateSourceTrigger=LostFocus}"/>

<StackPanel Orientation="Vertical" Grid.Row="10" Grid.ColumnSpan="3" Margin="0 10 0 0">
<ItemsControl ItemsSource="{Binding Config.Video.Filters.Values}">
<ItemsControl.ItemTemplate>
Expand All @@ -357,46 +428,6 @@
</StackPanel>
</Grid>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal" Background="{DynamicResource MaterialDesignPaper}">
<materialDesign:PackIcon Kind="ProgressDownload" Margin="4 6 4 6"/>
<TextBlock Text="Buffering" VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueMidBrush}" Padding="0 0 8 0"/>
</StackPanel>
</TabItem.Header>
<Grid>
<Grid Margin="20" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>

<TextBlock Grid.Row="0" Text="Buffer Duration Min. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Player.MinBufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="1" Text="Buffer Duration Max. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Demuxer.BufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="2" Text="Audio Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxAudioFrames, UpdateSourceTrigger=Explicit}"/>

<TextBlock Grid.Row="3" Text="Video Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxVideoFrames, UpdateSourceTrigger=Explicit}"/>
</Grid>
<StackPanel Margin="0, 0, 0, 10" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Button Style="{StaticResource SaveButton}"/>
<Button Content="Apply" FontWeight="ExtraBold" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="apply"/>
<Button Margin="10 0" Content="Cancel" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="cancel" />
</StackPanel>
</Grid>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal" Background="{DynamicResource MaterialDesignPaper}">
Expand Down Expand Up @@ -504,7 +535,7 @@
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal" Background="{DynamicResource MaterialDesignPaper}">
<materialDesign:PackIcon Kind="PluginOutline" Margin="4 6 4 6"/>
<materialDesign:PackIcon Kind="PluginOutline" Margin="0 6 4 6"/>
<TextBlock Text="Plugins" VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueMidBrush}" Padding="0 0 4 0"/>
</StackPanel>
</TabItem.Header>
Expand Down Expand Up @@ -534,7 +565,7 @@
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="{Binding Key, Mode=OneWay}" VerticalAlignment="Center" Width="150"/>
<TextBox Text="{Binding Value, Mode=OneWay}" VerticalAlignment="Center" Width="320" LostFocus="PluginValueChanged"/>
<TextBox Text="{Binding Value, Mode=OneWay}" VerticalAlignment="Center" Width="310" LostFocus="PluginValueChanged"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
Expand Down
Loading

0 comments on commit 70ccd88

Please sign in to comment.