Skip to content

Commit

Permalink
AudioDecoder: Fixes an issue with audio filters when the audio input …
Browse files Browse the repository at this point in the history
…channel is unspecified (mainly noticed with ffmpeg devices and microphones)

+Minor updates for Sample
  • Loading branch information
SuRGeoNix committed Apr 29, 2023
1 parent fb6f032 commit d7257c0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
10 changes: 6 additions & 4 deletions FlyleafLib.Controls.WPF/Themes/FlyleafBar.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:flwpf="clr-namespace:FlyleafLib.Controls.WPF">

Expand Down Expand Up @@ -70,7 +72,7 @@
</Grid.ColumnDefinitions>

<!--Current Time | Slider | Duration-->
<TextBlock Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Player.CurTime, Converter={StaticResource TicksToTime}}"/>
<TextBlock Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Player.CurTime, Converter={StaticResource TicksToTime}}" d:Text="00:00:00"/>
<Slider Grid.Column="1" IsSelectionRangeEnabled="True" SelectionStart="{Binding RelativeSource={RelativeSource Self}, Path=Value, Mode=OneWay}" Style="{DynamicResource FlyleafSlider}" Focusable="False" Margin="10,0,10,0" VerticalAlignment="Center" Value="{Binding Player.CurTime, Mode=TwoWay, Converter={StaticResource TicksToSeconds}}" Maximum="{Binding Player.Duration, Converter={StaticResource TicksToSeconds}}">
<Slider.SelectionEnd>
<MultiBinding Converter="{StaticResource SumConverter}">
Expand All @@ -79,7 +81,7 @@
</MultiBinding>
</Slider.SelectionEnd>
</Slider>
<TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Player.Duration, Converter={StaticResource TicksToTime}}"/>
<TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Player.Duration, Converter={StaticResource TicksToTime}}" d:Text="00:00:00"/>
</Grid>

<Grid Grid.Row="1" Margin="0,0,0,0">
Expand Down Expand Up @@ -199,7 +201,7 @@
</Button>

<!--Volume Slider (Decibel)-->
<Slider Grid.Column="4" Style="{DynamicResource FlyleafSlider}" Foreground="{DynamicResource SecondaryHueMidBrush}" Focusable="False" Margin="0,0,6,6" Width="100" VerticalAlignment="Bottom" Minimum="0" Maximum="{Binding Player.Config.Player.VolumeMax, Mode=OneWay}" Value="{Binding Player.Audio.Volume}"/>
<Slider Grid.Column="4" Style="{DynamicResource FlyleafSlider}" Foreground="{DynamicResource SecondaryHueMidBrush}" Focusable="False" Margin="0,0,6,6" Width="100" VerticalAlignment="Bottom" Minimum="0" Maximum="{Binding Player.Config.Player.VolumeMax, Mode=OneWay}" d:Maximum="150" d:Value="75" Value="{Binding Player.Audio.Volume}"/>

<!--Open Settings Button-->
<Button Grid.Column="5" Style="{StaticResource IconButton}" Content="{materialDesign:PackIcon Kind=SettingsOutline}" Command="{Binding OpenSettingsCmd}"/>
Expand Down
4 changes: 4 additions & 0 deletions FlyleafLib/MediaFramework/MediaStream/AudioStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public override void Refresh()
SampleFormat = (AVSampleFormat) Enum.ToObject(typeof(AVSampleFormat), AVStream->codecpar->format);
SampleFormatStr = av_get_sample_fmt_name(SampleFormat);
SampleRate = AVStream->codecpar->sample_rate;

if (AVStream->codecpar->ch_layout.order == AVChannelOrder.AV_CHANNEL_ORDER_UNSPEC)
av_channel_layout_default(&AVStream->codecpar->ch_layout, AVStream->codecpar->ch_layout.nb_channels);

ChannelLayout = AVStream->codecpar->ch_layout.u.mask;
Channels = AVStream->codecpar->ch_layout.nb_channels;
Bits = AVStream->codecpar->bits_per_coded_sample;
Expand Down
2 changes: 1 addition & 1 deletion Samples/FlyleafPlayer (WPF Control) (WPF)/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ private EngineConfig DefaultEngineConfig()
engineConfig.FFmpegHLSLiveSeek
= true;
engineConfig.UIRefresh = true;
engineConfig.FFmpegDevices = true;

#if RELEASE
engineConfig.LogOutput = "Flyleaf.FirstRun.log";
engineConfig.LogLevel = LogLevel.Debug;
engineConfig.FFmpegDevices = true;
#else
engineConfig.LogOutput = ":debug";
engineConfig.LogLevel = LogLevel.Debug;
Expand Down
5 changes: 4 additions & 1 deletion Samples/FlyleafPlayer (WPF Control) (WPF)/Dictionary.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:flyleafLib="clr-namespace:FlyleafLib;assembly=FlyleafLib">
xmlns:flyleafLib="clr-namespace:FlyleafLib;assembly=FlyleafLib"
xmlns:flwpf="clr-namespace:FlyleafLib.Controls.WPF;assembly=FlyleafLib">

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FlyleafLib.Controls.WPF;component/Resources/MaterialDesign.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FlyleafLib.Controls.WPF;component/Resources/Converters.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FlyleafLib.Controls.WPF;component/Resources/PopUpMenu.xaml"/>
</ResourceDictionary.MergedDictionaries>

<flwpf:TicksToTimeSpanConverter x:Key="TicksToTimeSpan"/>

<!--Overriding FlyleafME's Popup Menu (Using FlyleafME's Tag to pass our DataContext) -->
<ContextMenu x:Key="PopUpMenu" Style="{StaticResource FlyleafContextMenu}">
<MenuItem Header="Open File" Command="{Binding OpenFileDialog}" Icon="{materialDesign:PackIcon FolderOutline}" />
Expand Down
7 changes: 5 additions & 2 deletions Samples/FlyleafPlayer (WPF Control) (WPF)/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
mc:Ignorable="d"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"

Title="Flyleaf" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True" Background="Transparent"
Expand Down Expand Up @@ -130,7 +130,7 @@

<Grid Grid.Row="1" x:Name="PART_ContextMenuOwner" ContextMenu="{StaticResource PopUpMenu}">

<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Padding="4" Margin="10 -40 0 0" d:Text="00:00:00" FontWeight="Bold" FontSize="18" Text="{Binding Player.CurTime, Converter={StaticResource TicksToTime}}" Foreground="{DynamicResource SecondaryHueMidBrush}">
<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Padding="4" Margin="10 -40 0 0" d:Text="00:00:00.000 / 01:42:23.913" FontWeight="Bold" FontSize="18" Foreground="{DynamicResource SecondaryHueMidBrush}">
<TextBlock.Background>
<SolidColorBrush Color="{Binding Player.Config.Video.BackgroundColor}" Opacity="0.15"/>
</TextBlock.Background>
Expand All @@ -144,6 +144,9 @@
</Style.Triggers>
</Style>
</TextBlock.Style>
<Run Text="{Binding Player.CurTime, Mode=OneWay, Converter={StaticResource TicksToTimeSpan}, StringFormat={}{0:hh\\:mm\\:ss\\.fff}}"/>
<Run Text="/"/>
<Run Text="{Binding Player.Duration, Mode=OneWay, Converter={StaticResource TicksToTimeSpan}, StringFormat={}{0:hh\\:mm\\:ss\\.fff}}"/>
</TextBlock>

<TextBlock VerticalAlignment="Top" HorizontalAlignment="Right" Padding="4" Margin="0 10 10 0" FontWeight="Bold" d:Text="Volume 50%" FontSize="16" Text="{Binding Tag.Msg}" Foreground="{DynamicResource SecondaryHueMidBrush}">
Expand Down

0 comments on commit d7257c0

Please sign in to comment.