Skip to content

Commit 8afdc75

Browse files
committed
Enable VLC adjust filter and use SetAdjustFloat directly
Use SSEVPMI.MediaEngine.SetAdjustFloat for video adjustments (saturation, hue, brightness, contrast, gamma) and remove the local SetImageOption helper. Also enable the VLC "video-filter=adjust" option for GIF and Video views so the adjustments take effect. These changes ensure image/video adjustment values are applied via the media engine and the adjust filter is active at playback.
1 parent d6a2701 commit 8afdc75

3 files changed

Lines changed: 7 additions & 16 deletions

File tree

src/Shared/Engine/Sucrose.Shared.Engine.VlcPlayer/Helper/Properties.cs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static async void ExecuteScript(string Script)
113113
// Map -100..100 to VLC range 0.0..3.0 (default 1.0)
114114
float Saturation = MapWithPivot(InputValue, -100f, 100f, 0f, 0f, 3f, 1f);
115115

116-
SetImageOption(VideoAdjustOption.Saturation, Saturation);
116+
SSEVPMI.MediaEngine.SetAdjustFloat(VideoAdjustOption.Saturation, Saturation);
117117
}
118118
break;
119119
case "hue":
@@ -123,7 +123,7 @@ public static async void ExecuteScript(string Script)
123123
// Map -100..100 to VLC range -180..180 (default 0)
124124
float hue = MapWithPivot(InputValue, -100f, 100f, 0f, -180f, 180f, 0f);
125125

126-
SetImageOption(VideoAdjustOption.Hue, hue);
126+
SSEVPMI.MediaEngine.SetAdjustFloat(VideoAdjustOption.Hue, hue);
127127
}
128128
break;
129129
case "brightness":
@@ -133,7 +133,7 @@ public static async void ExecuteScript(string Script)
133133
// Map -100..100 to VLC range 0.0..2.0 (default 1.0)
134134
float Brightness = MapWithPivot(InputValue, -100f, 100f, 0f, 0f, 2f, 1f);
135135

136-
SetImageOption(VideoAdjustOption.Brightness, Brightness);
136+
SSEVPMI.MediaEngine.SetAdjustFloat(VideoAdjustOption.Brightness, Brightness);
137137
}
138138
break;
139139
case "contrast":
@@ -143,7 +143,7 @@ public static async void ExecuteScript(string Script)
143143
// Map -100..100 to VLC range 0.0..2.0 (default 1.0)
144144
float Contrast = MapWithPivot(InputValue, -100f, 100f, 0f, 0f, 2f, 1f);
145145

146-
SetImageOption(VideoAdjustOption.Contrast, Contrast);
146+
SSEVPMI.MediaEngine.SetAdjustFloat(VideoAdjustOption.Contrast, Contrast);
147147
}
148148
break;
149149
// This filter is not working?
@@ -154,7 +154,7 @@ public static async void ExecuteScript(string Script)
154154
// Map -100..100 to VLC range 0.01..10.0 (default 1.0)
155155
float Gamma = MapWithPivot(InputValue, -100f, 100f, 0f, 0.01f, 10f, 1f);
156156

157-
SetImageOption(VideoAdjustOption.Gamma, Gamma);
157+
SSEVPMI.MediaEngine.SetAdjustFloat(VideoAdjustOption.Gamma, Gamma);
158158
}
159159
break;
160160
case "speed":
@@ -182,17 +182,6 @@ public static async void ExecuteScript(string Script)
182182
}
183183
}
184184

185-
private static void SetImageOption(VideoAdjustOption Option, float Value)
186-
{
187-
// Crash with post-processing with disabled.
188-
if (!SSEVPMI.MediaEngine.EnableHardwareDecoding)
189-
{
190-
return;
191-
}
192-
193-
SSEVPMI.MediaEngine.SetAdjustFloat(Option, Value);
194-
}
195-
196185
private static float MapWithPivot(float Value, float SourceMin, float SourceMax, float SourcePivot, float TargetMin, float TargetMax, float TargetPivot)
197186
{
198187
// Clamp so we don't extrapolate

src/Shared/Engine/Sucrose.Shared.Engine.VlcPlayer/View/Gif.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public Gif()
4444
"no-stats",
4545
"no-drop-late-frames",
4646
"no-snapshot-preview",
47+
"video-filter=adjust",
4748
"no-sub-autodetect-file",
4849
"no-metadata-network-access",
4950
SMME.StayAwake ? "disable-screensaver" : "no-disable-screensaver"

src/Shared/Engine/Sucrose.Shared.Engine.VlcPlayer/View/Video.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public Video()
4444
"no-stats",
4545
"no-drop-late-frames",
4646
"no-snapshot-preview",
47+
"video-filter=adjust",
4748
"no-sub-autodetect-file",
4849
"no-metadata-network-access",
4950
SMME.StayAwake ? "disable-screensaver" : "no-disable-screensaver"

0 commit comments

Comments
 (0)