[Windows] Remove redundant DirectSound error codes
[xbmc.git] / xbmc / video / PlayerController.cpp
blobace0f0a6374e5cc282708b974f4636c747c20730
1 /*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "PlayerController.h"
11 #include "ServiceBroker.h"
12 #include "application/ApplicationComponents.h"
13 #include "application/ApplicationPlayer.h"
14 #include "cores/IPlayer.h"
15 #include "dialogs/GUIDialogKaiToast.h"
16 #include "dialogs/GUIDialogSelect.h"
17 #include "dialogs/GUIDialogSlider.h"
18 #include "guilib/GUIComponent.h"
19 #include "guilib/GUISliderControl.h"
20 #include "guilib/GUIWindowManager.h"
21 #include "guilib/LocalizeStrings.h"
22 #include "input/actions/Action.h"
23 #include "input/actions/ActionIDs.h"
24 #include "settings/AdvancedSettings.h"
25 #include "settings/DisplaySettings.h"
26 #include "settings/MediaSettings.h"
27 #include "settings/Settings.h"
28 #include "settings/SettingsComponent.h"
29 #include "settings/SubtitlesSettings.h"
30 #include "utils/LangCodeExpander.h"
31 #include "utils/StringUtils.h"
32 #include "utils/Variant.h"
33 #include "video/dialogs/GUIDialogAudioSettings.h"
34 #include "video/guilib/VideoStreamSelectHelper.h"
36 using namespace KODI;
37 using namespace UTILS;
39 CPlayerController::CPlayerController()
41 MOVING_SPEED::EventCfg eventCfg{100.0f, 300.0f, 200};
42 m_movingSpeed.AddEventConfig(ACTION_SUBTITLE_VSHIFT_UP, eventCfg);
43 m_movingSpeed.AddEventConfig(ACTION_SUBTITLE_VSHIFT_DOWN, eventCfg);
46 CPlayerController::~CPlayerController() = default;
48 CPlayerController& CPlayerController::GetInstance()
50 static CPlayerController instance;
51 return instance;
54 bool CPlayerController::OnAction(const CAction &action)
56 const unsigned int MsgTime = 300;
57 const unsigned int DisplTime = 2000;
59 auto& components = CServiceBroker::GetAppComponents();
60 const auto appPlayer = components.GetComponent<CApplicationPlayer>();
62 if (appPlayer->IsPlayingVideo())
64 switch (action.GetID())
66 case ACTION_SHOW_SUBTITLES:
68 if (appPlayer->GetSubtitleCount() == 0)
70 CGUIDialogKaiToast::QueueNotification(
71 CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), g_localizeStrings.Get(10005),
72 DisplTime, false, MsgTime);
73 return true;
76 bool subsOn = !appPlayer->GetSubtitleVisible();
77 appPlayer->SetSubtitleVisible(subsOn);
78 std::string sub;
79 if (subsOn)
81 std::string lang;
82 SubtitleStreamInfo info;
83 appPlayer->GetSubtitleStreamInfo(CURRENT_STREAM, info);
84 if (!g_LangCodeExpander.Lookup(info.language, lang))
85 lang = g_localizeStrings.Get(13205); // Unknown
87 if (info.name.length() == 0)
88 sub = lang;
89 else
90 sub = StringUtils::Format("{} - {}", lang, info.name);
92 else
93 sub = g_localizeStrings.Get(1223);
94 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info,
95 g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime);
96 return true;
99 case ACTION_NEXT_SUBTITLE:
100 case ACTION_CYCLE_SUBTITLE:
102 if (appPlayer->GetSubtitleCount() == 0)
103 return true;
105 int currentSub = appPlayer->GetSubtitle();
106 bool currentSubVisible = true;
108 if (appPlayer->GetSubtitleVisible())
110 if (++currentSub >= appPlayer->GetSubtitleCount())
112 currentSub = 0;
113 if (action.GetID() == ACTION_NEXT_SUBTITLE)
115 appPlayer->SetSubtitleVisible(false);
116 currentSubVisible = false;
119 appPlayer->SetSubtitle(currentSub);
121 else if (action.GetID() == ACTION_NEXT_SUBTITLE)
123 appPlayer->SetSubtitleVisible(true);
126 std::string sub, lang;
127 if (currentSubVisible)
129 SubtitleStreamInfo info;
130 appPlayer->GetSubtitleStreamInfo(currentSub, info);
131 if (!g_LangCodeExpander.Lookup(info.language, lang))
132 lang = g_localizeStrings.Get(13205); // Unknown
134 if (info.name.length() == 0)
135 sub = lang;
136 else
137 sub = StringUtils::Format("{} - {}", lang, info.name);
139 else
140 sub = g_localizeStrings.Get(1223);
141 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime);
142 return true;
145 case ACTION_DIALOG_SELECT_SUBTITLE:
147 VIDEO::GUILIB::OpenDialogSelectSubtitleStream();
148 return true;
151 case ACTION_SUBTITLE_DELAY_MIN:
153 float videoSubsDelayRange = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange;
154 CVideoSettings vs = appPlayer->GetVideoSettings();
155 vs.m_SubtitleDelay -= 0.1f;
156 if (vs.m_SubtitleDelay < -videoSubsDelayRange)
157 vs.m_SubtitleDelay = -videoSubsDelayRange;
158 appPlayer->SetSubTitleDelay(vs.m_SubtitleDelay);
160 ShowSlider(action.GetID(), 22006, appPlayer->GetVideoSettings().m_SubtitleDelay,
161 -videoSubsDelayRange, 0.1f, videoSubsDelayRange);
162 return true;
165 case ACTION_SUBTITLE_DELAY_PLUS:
167 float videoSubsDelayRange = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange;
168 CVideoSettings vs = appPlayer->GetVideoSettings();
169 vs.m_SubtitleDelay += 0.1f;
170 if (vs.m_SubtitleDelay > videoSubsDelayRange)
171 vs.m_SubtitleDelay = videoSubsDelayRange;
172 appPlayer->SetSubTitleDelay(vs.m_SubtitleDelay);
174 ShowSlider(action.GetID(), 22006, appPlayer->GetVideoSettings().m_SubtitleDelay,
175 -videoSubsDelayRange, 0.1f, videoSubsDelayRange);
176 return true;
179 case ACTION_SUBTITLE_DELAY:
181 float videoSubsDelayRange = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange;
182 ShowSlider(action.GetID(), 22006, appPlayer->GetVideoSettings().m_SubtitleDelay,
183 -videoSubsDelayRange, 0.1f, videoSubsDelayRange, true);
184 return true;
187 case ACTION_AUDIO_DELAY:
189 float videoAudioDelayRange = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoAudioDelayRange;
190 ShowSlider(action.GetID(), 297, appPlayer->GetVideoSettings().m_AudioDelay,
191 -videoAudioDelayRange, AUDIO_DELAY_STEP, videoAudioDelayRange, true);
192 return true;
195 case ACTION_AUDIO_DELAY_MIN:
197 float videoAudioDelayRange = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoAudioDelayRange;
198 CVideoSettings vs = appPlayer->GetVideoSettings();
199 vs.m_AudioDelay -= AUDIO_DELAY_STEP;
200 if (vs.m_AudioDelay < -videoAudioDelayRange)
201 vs.m_AudioDelay = -videoAudioDelayRange;
202 appPlayer->SetAVDelay(vs.m_AudioDelay);
204 ShowSlider(action.GetID(), 297, appPlayer->GetVideoSettings().m_AudioDelay,
205 -videoAudioDelayRange, AUDIO_DELAY_STEP, videoAudioDelayRange);
206 return true;
209 case ACTION_AUDIO_DELAY_PLUS:
211 float videoAudioDelayRange = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoAudioDelayRange;
212 CVideoSettings vs = appPlayer->GetVideoSettings();
213 vs.m_AudioDelay += AUDIO_DELAY_STEP;
214 if (vs.m_AudioDelay > videoAudioDelayRange)
215 vs.m_AudioDelay = videoAudioDelayRange;
216 appPlayer->SetAVDelay(vs.m_AudioDelay);
218 ShowSlider(action.GetID(), 297, appPlayer->GetVideoSettings().m_AudioDelay,
219 -videoAudioDelayRange, AUDIO_DELAY_STEP, videoAudioDelayRange);
220 return true;
223 case ACTION_AUDIO_NEXT_LANGUAGE:
225 if (appPlayer->GetAudioStreamCount() == 1)
226 return true;
228 int currentAudio = appPlayer->GetAudioStream();
229 int audioStreamCount = appPlayer->GetAudioStreamCount();
231 if (++currentAudio >= audioStreamCount)
232 currentAudio = 0;
233 appPlayer->SetAudioStream(currentAudio); // Set the audio stream to the one selected
235 std::string lan;
236 AudioStreamInfo info;
237 appPlayer->GetAudioStreamInfo(currentAudio, info);
238 if (!g_LangCodeExpander.Lookup(info.language, lan))
239 lan = g_localizeStrings.Get(13205); // Unknown
241 std::string textInfo = lan;
242 if (!info.name.empty())
243 textInfo += " - " + info.name;
244 if (!info.codecDesc.empty())
245 textInfo += " (" + info.codecDesc + ")";
247 std::string caption = g_localizeStrings.Get(460);
248 caption += StringUtils::Format(" ({}/{})", currentAudio + 1, audioStreamCount);
249 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, caption, textInfo,
250 DisplTime, false, MsgTime);
251 return true;
254 case ACTION_DIALOG_SELECT_AUDIO:
256 VIDEO::GUILIB::OpenDialogSelectAudioStream();
257 return true;
260 case ACTION_VIDEO_NEXT_STREAM:
262 if (appPlayer->GetVideoStreamCount() == 1)
263 return true;
265 int currentVideo = appPlayer->GetVideoStream();
266 int videoStreamCount = appPlayer->GetVideoStreamCount();
268 if (++currentVideo >= videoStreamCount)
269 currentVideo = 0;
270 appPlayer->SetVideoStream(currentVideo);
271 VideoStreamInfo info;
272 appPlayer->GetVideoStreamInfo(currentVideo, info);
273 std::string caption = g_localizeStrings.Get(38031);
274 caption += StringUtils::Format(" ({}/{})", currentVideo + 1, videoStreamCount);
275 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, caption, info.name, DisplTime, false, MsgTime);
276 return true;
279 case ACTION_DIALOG_SELECT_VIDEO:
281 VIDEO::GUILIB::OpenDialogSelectVideoStream();
282 return true;
285 case ACTION_ZOOM_IN:
287 CVideoSettings vs = appPlayer->GetVideoSettings();
288 vs.m_CustomZoomAmount += 0.01f;
289 if (vs.m_CustomZoomAmount > 2.f)
290 vs.m_CustomZoomAmount = 2.f;
291 vs.m_ViewMode = ViewModeCustom;
292 appPlayer->SetRenderViewMode(ViewModeCustom, vs.m_CustomZoomAmount, vs.m_CustomPixelRatio,
293 vs.m_CustomVerticalShift, vs.m_CustomNonLinStretch);
294 ShowSlider(action.GetID(), 216, vs.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f);
295 return true;
298 case ACTION_ZOOM_OUT:
300 CVideoSettings vs = appPlayer->GetVideoSettings();
301 vs.m_CustomZoomAmount -= 0.01f;
302 if (vs.m_CustomZoomAmount < 0.5f)
303 vs.m_CustomZoomAmount = 0.5f;
304 vs.m_ViewMode = ViewModeCustom;
305 appPlayer->SetRenderViewMode(ViewModeCustom, vs.m_CustomZoomAmount, vs.m_CustomPixelRatio,
306 vs.m_CustomVerticalShift, vs.m_CustomNonLinStretch);
307 ShowSlider(action.GetID(), 216, vs.m_CustomZoomAmount, 0.5f, 0.1f, 2.0f);
308 return true;
311 case ACTION_INCREASE_PAR:
313 CVideoSettings vs = appPlayer->GetVideoSettings();
314 vs.m_CustomPixelRatio += 0.01f;
315 if (vs.m_CustomPixelRatio > 2.f)
316 vs.m_CustomPixelRatio = 2.f;
317 vs.m_ViewMode = ViewModeCustom;
318 appPlayer->SetRenderViewMode(ViewModeCustom, vs.m_CustomZoomAmount, vs.m_CustomPixelRatio,
319 vs.m_CustomVerticalShift, vs.m_CustomNonLinStretch);
320 ShowSlider(action.GetID(), 217, vs.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f);
321 return true;
324 case ACTION_DECREASE_PAR:
326 CVideoSettings vs = appPlayer->GetVideoSettings();
327 vs.m_CustomPixelRatio -= 0.01f;
328 if (vs.m_CustomPixelRatio < 0.5f)
329 vs.m_CustomPixelRatio = 0.5f;
330 vs.m_ViewMode = ViewModeCustom;
331 appPlayer->SetRenderViewMode(ViewModeCustom, vs.m_CustomZoomAmount, vs.m_CustomPixelRatio,
332 vs.m_CustomVerticalShift, vs.m_CustomNonLinStretch);
333 ShowSlider(action.GetID(), 217, vs.m_CustomPixelRatio, 0.5f, 0.1f, 2.0f);
334 return true;
337 case ACTION_VSHIFT_UP:
339 CVideoSettings vs = appPlayer->GetVideoSettings();
340 vs.m_CustomVerticalShift -= 0.01f;
341 if (vs.m_CustomVerticalShift < -2.0f)
342 vs.m_CustomVerticalShift = -2.0f;
343 vs.m_ViewMode = ViewModeCustom;
344 appPlayer->SetRenderViewMode(ViewModeCustom, vs.m_CustomZoomAmount, vs.m_CustomPixelRatio,
345 vs.m_CustomVerticalShift, vs.m_CustomNonLinStretch);
346 ShowSlider(action.GetID(), 225, vs.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f);
347 return true;
350 case ACTION_VSHIFT_DOWN:
352 CVideoSettings vs = appPlayer->GetVideoSettings();
353 vs.m_CustomVerticalShift += 0.01f;
354 if (vs.m_CustomVerticalShift > 2.0f)
355 vs.m_CustomVerticalShift = 2.0f;
356 vs.m_ViewMode = ViewModeCustom;
357 appPlayer->SetRenderViewMode(ViewModeCustom, vs.m_CustomZoomAmount, vs.m_CustomPixelRatio,
358 vs.m_CustomVerticalShift, vs.m_CustomNonLinStretch);
359 ShowSlider(action.GetID(), 225, vs.m_CustomVerticalShift, -2.0f, 0.1f, 2.0f);
360 return true;
363 case ACTION_SUBTITLE_VSHIFT_UP:
365 const auto settings{CServiceBroker::GetSettingsComponent()->GetSubtitlesSettings()};
366 SUBTITLES::Align subAlign{settings->GetAlignment()};
367 if (subAlign != SUBTITLES::Align::BOTTOM_OUTSIDE && subAlign != SUBTITLES::Align::MANUAL)
368 return true;
370 RESOLUTION_INFO resInfo = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo();
371 CVideoSettings vs = appPlayer->GetVideoSettings();
373 int maxPos = resInfo.Overscan.bottom;
374 if (subAlign == SUBTITLES::Align::BOTTOM_OUTSIDE)
376 maxPos =
377 resInfo.Overscan.bottom + static_cast<int>(static_cast<float>(resInfo.iHeight) / 100 *
378 settings->GetVerticalMarginPerc());
381 vs.m_subtitleVerticalPosition -=
382 static_cast<int>(m_movingSpeed.GetUpdatedDistance(ACTION_SUBTITLE_VSHIFT_UP));
383 if (vs.m_subtitleVerticalPosition < resInfo.Overscan.top)
384 vs.m_subtitleVerticalPosition = resInfo.Overscan.top;
385 appPlayer->SetSubtitleVerticalPosition(vs.m_subtitleVerticalPosition,
386 action.GetText() == "save");
388 ShowSlider(action.GetID(), 277, static_cast<float>(vs.m_subtitleVerticalPosition),
389 static_cast<float>(resInfo.Overscan.top), 1.0f, static_cast<float>(maxPos));
390 return true;
393 case ACTION_SUBTITLE_VSHIFT_DOWN:
395 const auto settings{CServiceBroker::GetSettingsComponent()->GetSubtitlesSettings()};
396 SUBTITLES::Align subAlign{settings->GetAlignment()};
397 if (subAlign != SUBTITLES::Align::BOTTOM_OUTSIDE && subAlign != SUBTITLES::Align::MANUAL)
398 return true;
400 RESOLUTION_INFO resInfo = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo();
401 CVideoSettings vs = appPlayer->GetVideoSettings();
403 int maxPos = resInfo.Overscan.bottom;
404 if (subAlign == SUBTITLES::Align::BOTTOM_OUTSIDE)
406 // In this case the position not includes the vertical margin,
407 // so to be able to move the text to the bottom of the screen
408 // we must extend the maximum position with the vertical margin.
409 // Note that the text may go also slightly off-screen, this is
410 // caused by Libass see "displacement compensation" on OverlayRenderer
411 maxPos =
412 resInfo.Overscan.bottom + static_cast<int>(static_cast<float>(resInfo.iHeight) / 100 *
413 settings->GetVerticalMarginPerc());
416 vs.m_subtitleVerticalPosition +=
417 static_cast<int>(m_movingSpeed.GetUpdatedDistance(ACTION_SUBTITLE_VSHIFT_DOWN));
418 if (vs.m_subtitleVerticalPosition > maxPos)
419 vs.m_subtitleVerticalPosition = maxPos;
420 appPlayer->SetSubtitleVerticalPosition(vs.m_subtitleVerticalPosition,
421 action.GetText() == "save");
423 ShowSlider(action.GetID(), 277, static_cast<float>(vs.m_subtitleVerticalPosition),
424 static_cast<float>(resInfo.Overscan.top), 1.0f, static_cast<float>(maxPos));
425 return true;
428 case ACTION_SUBTITLE_ALIGN:
430 const auto settings{CServiceBroker::GetSettingsComponent()->GetSubtitlesSettings()};
431 SUBTITLES::Align align{settings->GetAlignment()};
433 align = static_cast<SUBTITLES::Align>(static_cast<int>(align) + 1);
435 if (align != SUBTITLES::Align::MANUAL && align != SUBTITLES::Align::BOTTOM_INSIDE &&
436 align != SUBTITLES::Align::BOTTOM_OUTSIDE && align != SUBTITLES::Align::TOP_INSIDE &&
437 align != SUBTITLES::Align::TOP_OUTSIDE)
439 align = SUBTITLES::Align::MANUAL;
442 settings->SetAlignment(align);
443 CGUIDialogKaiToast::QueueNotification(
444 CGUIDialogKaiToast::Info, g_localizeStrings.Get(21460),
445 g_localizeStrings.Get(21461 + static_cast<int>(align)), TOAST_DISPLAY_TIME, false);
446 return true;
449 case ACTION_VOLAMP_UP:
450 case ACTION_VOLAMP_DOWN:
452 // Don't allow change with passthrough audio
453 if (appPlayer->IsPassthrough())
455 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning,
456 g_localizeStrings.Get(660),
457 g_localizeStrings.Get(29802),
458 TOAST_DISPLAY_TIME, false);
459 return false;
462 float sliderMax = VOLUME_DRC_MAXIMUM / 100.0f;
463 float sliderMin = VOLUME_DRC_MINIMUM / 100.0f;
465 CVideoSettings vs = appPlayer->GetVideoSettings();
466 if (action.GetID() == ACTION_VOLAMP_UP)
467 vs.m_VolumeAmplification += 1.0f;
468 else
469 vs.m_VolumeAmplification -= 1.0f;
471 vs.m_VolumeAmplification =
472 std::max(std::min(vs.m_VolumeAmplification, sliderMax), sliderMin);
474 appPlayer->SetDynamicRangeCompression((long)(vs.m_VolumeAmplification * 100));
476 ShowSlider(action.GetID(), 660, vs.m_VolumeAmplification, sliderMin, 1.0f, sliderMax);
477 return true;
480 case ACTION_VOLAMP:
482 float sliderMax = VOLUME_DRC_MAXIMUM / 100.0f;
483 float sliderMin = VOLUME_DRC_MINIMUM / 100.0f;
484 ShowSlider(action.GetID(), 660, appPlayer->GetVideoSettings().m_VolumeAmplification,
485 sliderMin, 1.0f, sliderMax, true);
486 return true;
489 case ACTION_PLAYER_PROGRAM_SELECT:
491 std::vector<ProgramInfo> programs;
492 appPlayer->GetPrograms(programs);
493 CGUIDialogSelect *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
494 if (dialog)
496 int playing = 0;
497 int idx = 0;
498 for (const auto& prog : programs)
500 dialog->Add(prog.name);
501 if (prog.playing)
502 playing = idx;
503 idx++;
505 dialog->SetHeading(CVariant{g_localizeStrings.Get(39109)});
506 dialog->SetSelected(playing);
507 dialog->Open();
508 idx = dialog->GetSelectedItem();
509 if (idx > 0)
510 appPlayer->SetProgram(programs[idx].id);
512 return true;
515 case ACTION_PLAYER_RESOLUTION_SELECT:
517 std::vector<CVariant> indexList = CServiceBroker::GetSettingsComponent()->GetSettings()->GetList(CSettings::SETTING_VIDEOSCREEN_WHITELIST);
519 CGUIDialogSelect *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
520 if (dialog)
522 int current = 0;
523 int idx = 0;
524 auto currentRes = CServiceBroker::GetWinSystem()->GetGfxContext().GetVideoResolution();
525 for (const CVariant &mode : indexList)
527 auto res = CDisplaySettings::GetInstance().GetResFromString(mode.asString());
528 const RESOLUTION_INFO info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(res);
529 dialog->Add(info.strMode);
530 if (res == currentRes)
531 current = idx;
532 idx++;
534 dialog->SetHeading(CVariant{g_localizeStrings.Get(39110)});
535 dialog->SetSelected(current);
536 dialog->Open();
537 idx = dialog->GetSelectedItem();
538 if (idx >= 0)
540 auto res = CDisplaySettings::GetInstance().GetResFromString(indexList[idx].asString());
541 CServiceBroker::GetWinSystem()->GetGfxContext().SetVideoResolution(res, false);
544 return true;
547 default:
548 break;
551 return false;
554 void CPlayerController::ShowSlider(int action, int label, float value, float min, float delta, float max, bool modal)
556 m_sliderAction = action;
557 if (modal)
558 CGUIDialogSlider::ShowAndGetInput(g_localizeStrings.Get(label), value, min, delta, max, this);
559 else
560 CGUIDialogSlider::Display(label, value, min, delta, max, this);
563 void CPlayerController::OnSliderChange(void *data, CGUISliderControl *slider)
565 if (!slider)
566 return;
568 if (m_sliderAction == ACTION_ZOOM_OUT || m_sliderAction == ACTION_ZOOM_IN ||
569 m_sliderAction == ACTION_INCREASE_PAR || m_sliderAction == ACTION_DECREASE_PAR ||
570 m_sliderAction == ACTION_VSHIFT_UP || m_sliderAction == ACTION_VSHIFT_DOWN)
572 std::string strValue = StringUtils::Format("{:1.2f}", slider->GetFloatValue());
573 slider->SetTextValue(strValue);
575 else if (m_sliderAction == ACTION_SUBTITLE_VSHIFT_UP ||
576 m_sliderAction == ACTION_SUBTITLE_VSHIFT_DOWN)
578 std::string strValue = StringUtils::Format("{:.0f}px", slider->GetFloatValue());
579 slider->SetTextValue(strValue);
581 else if (m_sliderAction == ACTION_VOLAMP_UP ||
582 m_sliderAction == ACTION_VOLAMP_DOWN ||
583 m_sliderAction == ACTION_VOLAMP)
584 slider->SetTextValue(CGUIDialogAudioSettings::FormatDecibel(slider->GetFloatValue()));
585 else
586 slider->SetTextValue(
587 CGUIDialogAudioSettings::FormatDelay(slider->GetFloatValue(), AUDIO_DELAY_STEP));
589 auto& components = CServiceBroker::GetAppComponents();
590 const auto appPlayer = components.GetComponent<CApplicationPlayer>();
592 if (appPlayer->HasPlayer())
594 if (m_sliderAction == ACTION_AUDIO_DELAY)
596 appPlayer->SetAVDelay(slider->GetFloatValue());
598 else if (m_sliderAction == ACTION_SUBTITLE_DELAY)
600 appPlayer->SetSubTitleDelay(slider->GetFloatValue());
602 else if (m_sliderAction == ACTION_VOLAMP)
604 appPlayer->SetDynamicRangeCompression((long)(slider->GetFloatValue() * 100));