Skip to content

Commit

Permalink
Config: Introduces Config.Decoder.ShowCorrupted to allow corrupted fr…
Browse files Browse the repository at this point in the history
…ames to be shown

FlyleafHost.Wpf: Fixes an issue with KeepRatioOnResize while exiting from fullscreen and updates the size when is changed
  • Loading branch information
SuRGeoNix committed Apr 21, 2023
1 parent d1f1681 commit 36956de
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions FlyleafLib/Controls/WPF/FlyleafHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ private static void DropChanged(DependencyObject d, DependencyPropertyChangedEve
}
private void UpdateCurRatio()
{
if (!KeepRatioOnResize)
if (!KeepRatioOnResize || IsFullScreen)
return;

curResizeRatio = Player != null && Player.Video.AspectRatio.Value > 0 ? Player.Video.AspectRatio.Value : (float)(16.0/9.0);
Expand Down Expand Up @@ -584,7 +584,10 @@ private static void OnKeepRatioOnResizeChanged(DependencyObject d, DependencyPro
return;

FlyleafHost host = d as FlyleafHost;
host.curResizeRatioIfEnabled = host.KeepRatioOnResize ? host.curResizeRatio : 0;
if (!host.KeepRatioOnResize)
host.curResizeRatioIfEnabled =0 ;
else
host.UpdateCurRatio();
}
private static void OnPlayerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Expand Down Expand Up @@ -1806,6 +1809,8 @@ public void RefreshNormalFullScreen()

if (CornerRadius != zeroCornerRadius)
((Border)Surface.Content).CornerRadius = CornerRadius;

UpdateCurRatio();
}
}
public void SetRect(Rect rect)
Expand Down
6 changes: 6 additions & 0 deletions FlyleafLib/Engine/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,12 @@ public DecoderConfig Clone()
public bool AllowProfileMismatch
{ get => _AllowProfileMismatch; set => SetUI(ref _AllowProfileMismatch, value); }
bool _AllowProfileMismatch;

/// <summary>
/// Allows corrupted frames (Parses AV_CODEC_FLAG_OUTPUT_CORRUPT to AVCodecContext)
/// </summary>
public bool ShowCorrupted { get => _ShowCorrupted; set => SetUI(ref _ShowCorrupted, value); }
bool _ShowCorrupted;
}
public class VideoConfig : NotifyPropertyChanged
{
Expand Down
3 changes: 3 additions & 0 deletions FlyleafLib/MediaFramework/MediaDecoder/DecoderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ protected string Open2(StreamBase stream, StreamBase prevStream, bool openStream

codecCtx->pkt_timebase = stream.AVStream->time_base;
codecCtx->codec_id = codec->id;

if (Config.Decoder.ShowCorrupted)
codecCtx->flags |= AV_CODEC_FLAG_OUTPUT_CORRUPT;

try { ret = Setup(codec); } catch(Exception e) { return error = $"[{Type} Setup] {e.Message}"; }
if (ret < 0)
Expand Down

0 comments on commit 36956de

Please sign in to comment.