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.
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"
36 using namespace UTILS
;
38 CPlayerController::CPlayerController()
40 MOVING_SPEED::EventCfg eventCfg
{100.0f
, 300.0f
, 200};
41 m_movingSpeed
.AddEventConfig(ACTION_SUBTITLE_VSHIFT_UP
, eventCfg
);
42 m_movingSpeed
.AddEventConfig(ACTION_SUBTITLE_VSHIFT_DOWN
, eventCfg
);
45 CPlayerController::~CPlayerController() = default;
47 CPlayerController
& CPlayerController::GetInstance()
49 static CPlayerController instance
;
53 bool CPlayerController::OnAction(const CAction
&action
)
55 const unsigned int MsgTime
= 300;
56 const unsigned int DisplTime
= 2000;
58 auto& components
= CServiceBroker::GetAppComponents();
59 const auto appPlayer
= components
.GetComponent
<CApplicationPlayer
>();
61 if (appPlayer
->IsPlayingVideo())
63 switch (action
.GetID())
65 case ACTION_SHOW_SUBTITLES
:
67 if (appPlayer
->GetSubtitleCount() == 0)
69 CGUIDialogKaiToast::QueueNotification(
70 CGUIDialogKaiToast::Info
, g_localizeStrings
.Get(287), g_localizeStrings
.Get(10005),
71 DisplTime
, false, MsgTime
);
75 bool subsOn
= !appPlayer
->GetSubtitleVisible();
76 appPlayer
->SetSubtitleVisible(subsOn
);
81 SubtitleStreamInfo info
;
82 appPlayer
->GetSubtitleStreamInfo(CURRENT_STREAM
, info
);
83 if (!g_LangCodeExpander
.Lookup(info
.language
, lang
))
84 lang
= g_localizeStrings
.Get(13205); // Unknown
86 if (info
.name
.length() == 0)
89 sub
= StringUtils::Format("{} - {}", lang
, info
.name
);
92 sub
= g_localizeStrings
.Get(1223);
93 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info
,
94 g_localizeStrings
.Get(287), sub
, DisplTime
, false, MsgTime
);
98 case ACTION_NEXT_SUBTITLE
:
99 case ACTION_CYCLE_SUBTITLE
:
101 if (appPlayer
->GetSubtitleCount() == 0)
104 int currentSub
= appPlayer
->GetSubtitle();
105 bool currentSubVisible
= true;
107 if (appPlayer
->GetSubtitleVisible())
109 if (++currentSub
>= appPlayer
->GetSubtitleCount())
112 if (action
.GetID() == ACTION_NEXT_SUBTITLE
)
114 appPlayer
->SetSubtitleVisible(false);
115 currentSubVisible
= false;
118 appPlayer
->SetSubtitle(currentSub
);
120 else if (action
.GetID() == ACTION_NEXT_SUBTITLE
)
122 appPlayer
->SetSubtitleVisible(true);
125 std::string sub
, lang
;
126 if (currentSubVisible
)
128 SubtitleStreamInfo info
;
129 appPlayer
->GetSubtitleStreamInfo(currentSub
, info
);
130 if (!g_LangCodeExpander
.Lookup(info
.language
, lang
))
131 lang
= g_localizeStrings
.Get(13205); // Unknown
133 if (info
.name
.length() == 0)
136 sub
= StringUtils::Format("{} - {}", lang
, info
.name
);
139 sub
= g_localizeStrings
.Get(1223);
140 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info
, g_localizeStrings
.Get(287), sub
, DisplTime
, false, MsgTime
);
144 case ACTION_SUBTITLE_DELAY_MIN
:
146 float videoSubsDelayRange
= CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange
;
147 CVideoSettings vs
= appPlayer
->GetVideoSettings();
148 vs
.m_SubtitleDelay
-= 0.1f
;
149 if (vs
.m_SubtitleDelay
< -videoSubsDelayRange
)
150 vs
.m_SubtitleDelay
= -videoSubsDelayRange
;
151 appPlayer
->SetSubTitleDelay(vs
.m_SubtitleDelay
);
153 ShowSlider(action
.GetID(), 22006, appPlayer
->GetVideoSettings().m_SubtitleDelay
,
154 -videoSubsDelayRange
, 0.1f
, videoSubsDelayRange
);
158 case ACTION_SUBTITLE_DELAY_PLUS
:
160 float videoSubsDelayRange
= CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange
;
161 CVideoSettings vs
= appPlayer
->GetVideoSettings();
162 vs
.m_SubtitleDelay
+= 0.1f
;
163 if (vs
.m_SubtitleDelay
> videoSubsDelayRange
)
164 vs
.m_SubtitleDelay
= videoSubsDelayRange
;
165 appPlayer
->SetSubTitleDelay(vs
.m_SubtitleDelay
);
167 ShowSlider(action
.GetID(), 22006, appPlayer
->GetVideoSettings().m_SubtitleDelay
,
168 -videoSubsDelayRange
, 0.1f
, videoSubsDelayRange
);
172 case ACTION_SUBTITLE_DELAY
:
174 float videoSubsDelayRange
= CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange
;
175 ShowSlider(action
.GetID(), 22006, appPlayer
->GetVideoSettings().m_SubtitleDelay
,
176 -videoSubsDelayRange
, 0.1f
, videoSubsDelayRange
, true);
180 case ACTION_AUDIO_DELAY
:
182 float videoAudioDelayRange
= CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoAudioDelayRange
;
183 ShowSlider(action
.GetID(), 297, appPlayer
->GetVideoSettings().m_AudioDelay
,
184 -videoAudioDelayRange
, AUDIO_DELAY_STEP
, videoAudioDelayRange
, true);
188 case ACTION_AUDIO_DELAY_MIN
:
190 float videoAudioDelayRange
= CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoAudioDelayRange
;
191 CVideoSettings vs
= appPlayer
->GetVideoSettings();
192 vs
.m_AudioDelay
-= AUDIO_DELAY_STEP
;
193 if (vs
.m_AudioDelay
< -videoAudioDelayRange
)
194 vs
.m_AudioDelay
= -videoAudioDelayRange
;
195 appPlayer
->SetAVDelay(vs
.m_AudioDelay
);
197 ShowSlider(action
.GetID(), 297, appPlayer
->GetVideoSettings().m_AudioDelay
,
198 -videoAudioDelayRange
, AUDIO_DELAY_STEP
, videoAudioDelayRange
);
202 case ACTION_AUDIO_DELAY_PLUS
:
204 float videoAudioDelayRange
= CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoAudioDelayRange
;
205 CVideoSettings vs
= appPlayer
->GetVideoSettings();
206 vs
.m_AudioDelay
+= AUDIO_DELAY_STEP
;
207 if (vs
.m_AudioDelay
> videoAudioDelayRange
)
208 vs
.m_AudioDelay
= videoAudioDelayRange
;
209 appPlayer
->SetAVDelay(vs
.m_AudioDelay
);
211 ShowSlider(action
.GetID(), 297, appPlayer
->GetVideoSettings().m_AudioDelay
,
212 -videoAudioDelayRange
, AUDIO_DELAY_STEP
, videoAudioDelayRange
);
216 case ACTION_AUDIO_NEXT_LANGUAGE
:
218 if (appPlayer
->GetAudioStreamCount() == 1)
221 int currentAudio
= appPlayer
->GetAudioStream();
222 int audioStreamCount
= appPlayer
->GetAudioStreamCount();
224 if (++currentAudio
>= audioStreamCount
)
226 appPlayer
->SetAudioStream(currentAudio
); // Set the audio stream to the one selected
229 AudioStreamInfo info
;
230 appPlayer
->GetAudioStreamInfo(currentAudio
, info
);
231 if (!g_LangCodeExpander
.Lookup(info
.language
, lan
))
232 lan
= g_localizeStrings
.Get(13205); // Unknown
233 if (info
.name
.empty())
236 aud
= StringUtils::Format("{} - {}", lan
, info
.name
);
237 std::string caption
= g_localizeStrings
.Get(460);
238 caption
+= StringUtils::Format(" ({}/{})", currentAudio
+ 1, audioStreamCount
);
239 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info
, caption
, aud
, DisplTime
, false, MsgTime
);
243 case ACTION_VIDEO_NEXT_STREAM
:
245 if (appPlayer
->GetVideoStreamCount() == 1)
248 int currentVideo
= appPlayer
->GetVideoStream();
249 int videoStreamCount
= appPlayer
->GetVideoStreamCount();
251 if (++currentVideo
>= videoStreamCount
)
253 appPlayer
->SetVideoStream(currentVideo
);
254 VideoStreamInfo info
;
255 appPlayer
->GetVideoStreamInfo(currentVideo
, info
);
256 std::string caption
= g_localizeStrings
.Get(38031);
257 caption
+= StringUtils::Format(" ({}/{})", currentVideo
+ 1, videoStreamCount
);
258 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info
, caption
, info
.name
, DisplTime
, false, MsgTime
);
264 CVideoSettings vs
= appPlayer
->GetVideoSettings();
265 vs
.m_CustomZoomAmount
+= 0.01f
;
266 if (vs
.m_CustomZoomAmount
> 2.f
)
267 vs
.m_CustomZoomAmount
= 2.f
;
268 vs
.m_ViewMode
= ViewModeCustom
;
269 appPlayer
->SetRenderViewMode(ViewModeCustom
, vs
.m_CustomZoomAmount
, vs
.m_CustomPixelRatio
,
270 vs
.m_CustomVerticalShift
, vs
.m_CustomNonLinStretch
);
271 ShowSlider(action
.GetID(), 216, vs
.m_CustomZoomAmount
, 0.5f
, 0.1f
, 2.0f
);
275 case ACTION_ZOOM_OUT
:
277 CVideoSettings vs
= appPlayer
->GetVideoSettings();
278 vs
.m_CustomZoomAmount
-= 0.01f
;
279 if (vs
.m_CustomZoomAmount
< 0.5f
)
280 vs
.m_CustomZoomAmount
= 0.5f
;
281 vs
.m_ViewMode
= ViewModeCustom
;
282 appPlayer
->SetRenderViewMode(ViewModeCustom
, vs
.m_CustomZoomAmount
, vs
.m_CustomPixelRatio
,
283 vs
.m_CustomVerticalShift
, vs
.m_CustomNonLinStretch
);
284 ShowSlider(action
.GetID(), 216, vs
.m_CustomZoomAmount
, 0.5f
, 0.1f
, 2.0f
);
288 case ACTION_INCREASE_PAR
:
290 CVideoSettings vs
= appPlayer
->GetVideoSettings();
291 vs
.m_CustomPixelRatio
+= 0.01f
;
292 if (vs
.m_CustomPixelRatio
> 2.f
)
293 vs
.m_CustomPixelRatio
= 2.f
;
294 vs
.m_ViewMode
= ViewModeCustom
;
295 appPlayer
->SetRenderViewMode(ViewModeCustom
, vs
.m_CustomZoomAmount
, vs
.m_CustomPixelRatio
,
296 vs
.m_CustomVerticalShift
, vs
.m_CustomNonLinStretch
);
297 ShowSlider(action
.GetID(), 217, vs
.m_CustomPixelRatio
, 0.5f
, 0.1f
, 2.0f
);
301 case ACTION_DECREASE_PAR
:
303 CVideoSettings vs
= appPlayer
->GetVideoSettings();
304 vs
.m_CustomPixelRatio
-= 0.01f
;
305 if (vs
.m_CustomPixelRatio
< 0.5f
)
306 vs
.m_CustomPixelRatio
= 0.5f
;
307 vs
.m_ViewMode
= ViewModeCustom
;
308 appPlayer
->SetRenderViewMode(ViewModeCustom
, vs
.m_CustomZoomAmount
, vs
.m_CustomPixelRatio
,
309 vs
.m_CustomVerticalShift
, vs
.m_CustomNonLinStretch
);
310 ShowSlider(action
.GetID(), 217, vs
.m_CustomPixelRatio
, 0.5f
, 0.1f
, 2.0f
);
314 case ACTION_VSHIFT_UP
:
316 CVideoSettings vs
= appPlayer
->GetVideoSettings();
317 vs
.m_CustomVerticalShift
-= 0.01f
;
318 if (vs
.m_CustomVerticalShift
< -2.0f
)
319 vs
.m_CustomVerticalShift
= -2.0f
;
320 vs
.m_ViewMode
= ViewModeCustom
;
321 appPlayer
->SetRenderViewMode(ViewModeCustom
, vs
.m_CustomZoomAmount
, vs
.m_CustomPixelRatio
,
322 vs
.m_CustomVerticalShift
, vs
.m_CustomNonLinStretch
);
323 ShowSlider(action
.GetID(), 225, vs
.m_CustomVerticalShift
, -2.0f
, 0.1f
, 2.0f
);
327 case ACTION_VSHIFT_DOWN
:
329 CVideoSettings vs
= appPlayer
->GetVideoSettings();
330 vs
.m_CustomVerticalShift
+= 0.01f
;
331 if (vs
.m_CustomVerticalShift
> 2.0f
)
332 vs
.m_CustomVerticalShift
= 2.0f
;
333 vs
.m_ViewMode
= ViewModeCustom
;
334 appPlayer
->SetRenderViewMode(ViewModeCustom
, vs
.m_CustomZoomAmount
, vs
.m_CustomPixelRatio
,
335 vs
.m_CustomVerticalShift
, vs
.m_CustomNonLinStretch
);
336 ShowSlider(action
.GetID(), 225, vs
.m_CustomVerticalShift
, -2.0f
, 0.1f
, 2.0f
);
340 case ACTION_SUBTITLE_VSHIFT_UP
:
342 const auto settings
{CServiceBroker::GetSettingsComponent()->GetSubtitlesSettings()};
343 SUBTITLES::Align subAlign
{settings
->GetAlignment()};
344 if (subAlign
!= SUBTITLES::Align::BOTTOM_OUTSIDE
&& subAlign
!= SUBTITLES::Align::MANUAL
)
347 RESOLUTION_INFO resInfo
= CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo();
348 CVideoSettings vs
= appPlayer
->GetVideoSettings();
350 int maxPos
= resInfo
.Overscan
.bottom
;
351 if (subAlign
== SUBTITLES::Align::BOTTOM_OUTSIDE
)
354 resInfo
.Overscan
.bottom
+ static_cast<int>(static_cast<float>(resInfo
.iHeight
) / 100 *
355 settings
->GetVerticalMarginPerc());
358 vs
.m_subtitleVerticalPosition
-=
359 static_cast<int>(m_movingSpeed
.GetUpdatedDistance(ACTION_SUBTITLE_VSHIFT_UP
));
360 if (vs
.m_subtitleVerticalPosition
< resInfo
.Overscan
.top
)
361 vs
.m_subtitleVerticalPosition
= resInfo
.Overscan
.top
;
362 appPlayer
->SetSubtitleVerticalPosition(vs
.m_subtitleVerticalPosition
,
363 action
.GetText() == "save");
365 ShowSlider(action
.GetID(), 277, static_cast<float>(vs
.m_subtitleVerticalPosition
),
366 static_cast<float>(resInfo
.Overscan
.top
), 1.0f
, static_cast<float>(maxPos
));
370 case ACTION_SUBTITLE_VSHIFT_DOWN
:
372 const auto settings
{CServiceBroker::GetSettingsComponent()->GetSubtitlesSettings()};
373 SUBTITLES::Align subAlign
{settings
->GetAlignment()};
374 if (subAlign
!= SUBTITLES::Align::BOTTOM_OUTSIDE
&& subAlign
!= SUBTITLES::Align::MANUAL
)
377 RESOLUTION_INFO resInfo
= CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo();
378 CVideoSettings vs
= appPlayer
->GetVideoSettings();
380 int maxPos
= resInfo
.Overscan
.bottom
;
381 if (subAlign
== SUBTITLES::Align::BOTTOM_OUTSIDE
)
383 // In this case the position not includes the vertical margin,
384 // so to be able to move the text to the bottom of the screen
385 // we must extend the maximum position with the vertical margin.
386 // Note that the text may go also slightly off-screen, this is
387 // caused by Libass see "displacement compensation" on OverlayRenderer
389 resInfo
.Overscan
.bottom
+ static_cast<int>(static_cast<float>(resInfo
.iHeight
) / 100 *
390 settings
->GetVerticalMarginPerc());
393 vs
.m_subtitleVerticalPosition
+=
394 static_cast<int>(m_movingSpeed
.GetUpdatedDistance(ACTION_SUBTITLE_VSHIFT_DOWN
));
395 if (vs
.m_subtitleVerticalPosition
> maxPos
)
396 vs
.m_subtitleVerticalPosition
= maxPos
;
397 appPlayer
->SetSubtitleVerticalPosition(vs
.m_subtitleVerticalPosition
,
398 action
.GetText() == "save");
400 ShowSlider(action
.GetID(), 277, static_cast<float>(vs
.m_subtitleVerticalPosition
),
401 static_cast<float>(resInfo
.Overscan
.top
), 1.0f
, static_cast<float>(maxPos
));
405 case ACTION_SUBTITLE_ALIGN
:
407 const auto settings
{CServiceBroker::GetSettingsComponent()->GetSubtitlesSettings()};
408 SUBTITLES::Align align
{settings
->GetAlignment()};
410 align
= static_cast<SUBTITLES::Align
>(static_cast<int>(align
) + 1);
412 if (align
!= SUBTITLES::Align::MANUAL
&& align
!= SUBTITLES::Align::BOTTOM_INSIDE
&&
413 align
!= SUBTITLES::Align::BOTTOM_OUTSIDE
&& align
!= SUBTITLES::Align::TOP_INSIDE
&&
414 align
!= SUBTITLES::Align::TOP_OUTSIDE
)
416 align
= SUBTITLES::Align::MANUAL
;
419 settings
->SetAlignment(align
);
420 CGUIDialogKaiToast::QueueNotification(
421 CGUIDialogKaiToast::Info
, g_localizeStrings
.Get(21460),
422 g_localizeStrings
.Get(21461 + static_cast<int>(align
)), TOAST_DISPLAY_TIME
, false);
426 case ACTION_VOLAMP_UP
:
427 case ACTION_VOLAMP_DOWN
:
429 // Don't allow change with passthrough audio
430 if (appPlayer
->IsPassthrough())
432 CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning
,
433 g_localizeStrings
.Get(660),
434 g_localizeStrings
.Get(29802),
435 TOAST_DISPLAY_TIME
, false);
439 float sliderMax
= VOLUME_DRC_MAXIMUM
/ 100.0f
;
440 float sliderMin
= VOLUME_DRC_MINIMUM
/ 100.0f
;
442 CVideoSettings vs
= appPlayer
->GetVideoSettings();
443 if (action
.GetID() == ACTION_VOLAMP_UP
)
444 vs
.m_VolumeAmplification
+= 1.0f
;
446 vs
.m_VolumeAmplification
-= 1.0f
;
448 vs
.m_VolumeAmplification
=
449 std::max(std::min(vs
.m_VolumeAmplification
, sliderMax
), sliderMin
);
451 appPlayer
->SetDynamicRangeCompression((long)(vs
.m_VolumeAmplification
* 100));
453 ShowSlider(action
.GetID(), 660, vs
.m_VolumeAmplification
, sliderMin
, 1.0f
, sliderMax
);
459 float sliderMax
= VOLUME_DRC_MAXIMUM
/ 100.0f
;
460 float sliderMin
= VOLUME_DRC_MINIMUM
/ 100.0f
;
461 ShowSlider(action
.GetID(), 660, appPlayer
->GetVideoSettings().m_VolumeAmplification
,
462 sliderMin
, 1.0f
, sliderMax
, true);
466 case ACTION_PLAYER_PROGRAM_SELECT
:
468 std::vector
<ProgramInfo
> programs
;
469 appPlayer
->GetPrograms(programs
);
470 CGUIDialogSelect
*dialog
= CServiceBroker::GetGUI()->GetWindowManager().GetWindow
<CGUIDialogSelect
>(WINDOW_DIALOG_SELECT
);
475 for (const auto& prog
: programs
)
477 dialog
->Add(prog
.name
);
482 dialog
->SetHeading(CVariant
{g_localizeStrings
.Get(39109)});
483 dialog
->SetSelected(playing
);
485 idx
= dialog
->GetSelectedItem();
487 appPlayer
->SetProgram(programs
[idx
].id
);
492 case ACTION_PLAYER_RESOLUTION_SELECT
:
494 std::vector
<CVariant
> indexList
= CServiceBroker::GetSettingsComponent()->GetSettings()->GetList(CSettings::SETTING_VIDEOSCREEN_WHITELIST
);
496 CGUIDialogSelect
*dialog
= CServiceBroker::GetGUI()->GetWindowManager().GetWindow
<CGUIDialogSelect
>(WINDOW_DIALOG_SELECT
);
501 auto currentRes
= CServiceBroker::GetWinSystem()->GetGfxContext().GetVideoResolution();
502 for (const CVariant
&mode
: indexList
)
504 auto res
= CDisplaySettings::GetInstance().GetResFromString(mode
.asString());
505 const RESOLUTION_INFO info
= CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(res
);
506 dialog
->Add(info
.strMode
);
507 if (res
== currentRes
)
511 dialog
->SetHeading(CVariant
{g_localizeStrings
.Get(39110)});
512 dialog
->SetSelected(current
);
514 idx
= dialog
->GetSelectedItem();
517 auto res
= CDisplaySettings::GetInstance().GetResFromString(indexList
[idx
].asString());
518 CServiceBroker::GetWinSystem()->GetGfxContext().SetVideoResolution(res
, false);
531 void CPlayerController::ShowSlider(int action
, int label
, float value
, float min
, float delta
, float max
, bool modal
)
533 m_sliderAction
= action
;
535 CGUIDialogSlider::ShowAndGetInput(g_localizeStrings
.Get(label
), value
, min
, delta
, max
, this);
537 CGUIDialogSlider::Display(label
, value
, min
, delta
, max
, this);
540 void CPlayerController::OnSliderChange(void *data
, CGUISliderControl
*slider
)
545 if (m_sliderAction
== ACTION_ZOOM_OUT
|| m_sliderAction
== ACTION_ZOOM_IN
||
546 m_sliderAction
== ACTION_INCREASE_PAR
|| m_sliderAction
== ACTION_DECREASE_PAR
||
547 m_sliderAction
== ACTION_VSHIFT_UP
|| m_sliderAction
== ACTION_VSHIFT_DOWN
)
549 std::string strValue
= StringUtils::Format("{:1.2f}", slider
->GetFloatValue());
550 slider
->SetTextValue(strValue
);
552 else if (m_sliderAction
== ACTION_SUBTITLE_VSHIFT_UP
||
553 m_sliderAction
== ACTION_SUBTITLE_VSHIFT_DOWN
)
555 std::string strValue
= StringUtils::Format("{:.0f}px", slider
->GetFloatValue());
556 slider
->SetTextValue(strValue
);
558 else if (m_sliderAction
== ACTION_VOLAMP_UP
||
559 m_sliderAction
== ACTION_VOLAMP_DOWN
||
560 m_sliderAction
== ACTION_VOLAMP
)
561 slider
->SetTextValue(CGUIDialogAudioSettings::FormatDecibel(slider
->GetFloatValue()));
563 slider
->SetTextValue(
564 CGUIDialogAudioSettings::FormatDelay(slider
->GetFloatValue(), AUDIO_DELAY_STEP
));
566 auto& components
= CServiceBroker::GetAppComponents();
567 const auto appPlayer
= components
.GetComponent
<CApplicationPlayer
>();
569 if (appPlayer
->HasPlayer())
571 if (m_sliderAction
== ACTION_AUDIO_DELAY
)
573 appPlayer
->SetAVDelay(slider
->GetFloatValue());
575 else if (m_sliderAction
== ACTION_SUBTITLE_DELAY
)
577 appPlayer
->SetSubTitleDelay(slider
->GetFloatValue());
579 else if (m_sliderAction
== ACTION_VOLAMP
)
581 appPlayer
->SetDynamicRangeCompression((long)(slider
->GetFloatValue() * 100));