diff options
author | Rainer Hochecker <fernetmenta@online.de> | 2018-08-20 08:47:05 +0200 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2018-08-20 14:34:43 +0200 |
commit | 2fe7d9df6f7fde3350e9587a8b80320bc3d6cb44 (patch) | |
tree | a190476e4d92b3096a43b36d1b4f343a44e32200 | |
parent | 50d4a65e3b8101930bb1068cbd3eca10838bbb6d (diff) |
VideoPlayer: add audiosetting for downmix clev
-rw-r--r-- | addons/resource.language.en_gb/resources/strings.po | 12 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 8 | ||||
-rw-r--r-- | xbmc/cores/VideoSettings.cpp | 1 | ||||
-rw-r--r-- | xbmc/cores/VideoSettings.h | 1 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 14 | ||||
-rw-r--r-- | xbmc/video/dialogs/GUIDialogAudioSettings.cpp | 14 |
6 files changed, 45 insertions, 5 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 324b2048ef..6ab1d83df0 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -21489,3 +21489,15 @@ msgstr "" msgctxt "#39111" msgid "original" msgstr "" + +#. Used for a setting which allows centre channel (voice/speech) volume to be adjusted when downmixing. +#: xbmc/video/dialogs/GUIDialogAudioSettings.cpp +msgctxt "#39112" +msgid "Downmix: Center Mix Level" +msgstr "" + +#. Help text for 39112 +#: xbmc/video/dialogs/GUIDialogAudioSettings.cpp +msgctxt "#39113" +msgid "Center Mix Level in dB relative to metadata or default (-3 dB)" +msgstr "" diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp index 48067ab393..1cef284024 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp @@ -420,6 +420,8 @@ bool CVideoPlayerAudio::ProcessDecoderOutput(DVDAudioFrame &audioframe) { if (audioframe.nb_frames <= audioframe.framesOut) { + audioframe.hasDownmix = false; + m_pAudioCodec->GetData(audioframe); if (audioframe.nb_frames == 0) @@ -485,6 +487,12 @@ bool CVideoPlayerAudio::ProcessDecoderOutput(DVDAudioFrame &audioframe) } SetSyncType(audioframe.passthrough); + + // downmix + double clev = audioframe.hasDownmix ? audioframe.centerMixLevel : M_SQRT1_2; + double curDB = 20 * log10(clev); + audioframe.centerMixLevel = pow(10, (curDB + m_processInfo.GetVideoSettings().m_CenterMixLevel) / 20); + audioframe.hasDownmix = true; } diff --git a/xbmc/cores/VideoSettings.cpp b/xbmc/cores/VideoSettings.cpp index 96886bd49d..b9c3259c52 100644 --- a/xbmc/cores/VideoSettings.cpp +++ b/xbmc/cores/VideoSettings.cpp @@ -65,6 +65,7 @@ bool CVideoSettings::operator!=(const CVideoSettings &right) const if (m_ToneMapMethod != right.m_ToneMapMethod) return true; if (m_ToneMapParam != right.m_ToneMapParam) return true; if (m_Orientation != right.m_Orientation) return true; + if (m_CenterMixLevel != right.m_CenterMixLevel) return true; return false; } diff --git a/xbmc/cores/VideoSettings.h b/xbmc/cores/VideoSettings.h index 7f279a803e..bedeb37dcd 100644 --- a/xbmc/cores/VideoSettings.h +++ b/xbmc/cores/VideoSettings.h @@ -114,6 +114,7 @@ public: int m_ToneMapMethod = VS_TONEMAPMETHOD_REINHARD; float m_ToneMapParam = 1.0; int m_Orientation = 0; + int m_CenterMixLevel = 0; // relative to metadata or default }; class CCriticalSection; diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 20608e405a..de4ad914eb 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -92,7 +92,7 @@ void CVideoDatabase::CreateTables() "VolumeAmplification float, AudioDelay float, ResumeTime integer," "Sharpness float, NoiseReduction float, NonLinStretch bool, PostProcess bool," "ScalingMethod integer, DeinterlaceMode integer, StereoMode integer, StereoInvert bool, VideoStream integer," - "TonemapMethod integer, TonemapParam float, Orientation integer)\n"); + "TonemapMethod integer, TonemapParam float, Orientation integer, CenterMixLevel integer)\n"); CLog::Log(LOGINFO, "create stacktimes table"); m_pDS->exec("CREATE TABLE stacktimes (idFile integer, times text)\n"); @@ -4326,6 +4326,7 @@ bool CVideoDatabase::GetVideoSettings(int idFile, CVideoSettings &settings) settings.m_ToneMapMethod = m_pDS->fv("TonemapMethod").get_asInt(); settings.m_ToneMapParam = m_pDS->fv("TonemapParam").get_asFloat(); settings.m_Orientation = m_pDS->fv("Orientation").get_asInt(); + settings.m_CenterMixLevel = m_pDS->fv("CenterMixLevel").get_asInt(); m_pDS->close(); if (settings.m_ToneMapParam == 0.0) @@ -4390,15 +4391,15 @@ void CVideoDatabase::SetVideoSettings(int idFile, const CVideoSettings &setting) "AudioStream,SubtitleStream,SubtitleDelay,SubtitlesOn,Brightness," "Contrast,Gamma,VolumeAmplification,AudioDelay," "ResumeTime," - "Sharpness,NoiseReduction,NonLinStretch,PostProcess,ScalingMethod,StereoMode,StereoInvert,VideoStream,TonemapMethod,TonemapParam,Orientation) " + "Sharpness,NoiseReduction,NonLinStretch,PostProcess,ScalingMethod,StereoMode,StereoInvert,VideoStream,TonemapMethod,TonemapParam,Orientation,CenterMixLevel) " "VALUES "; - strSQL += PrepareSQL("(%i,%i,%i,%f,%f,%f,%i,%i,%f,%i,%f,%f,%f,%f,%f,%i,%f,%f,%i,%i,%i,%i,%i,%i,%i,%f,%i)", + strSQL += PrepareSQL("(%i,%i,%i,%f,%f,%f,%i,%i,%f,%i,%f,%f,%f,%f,%f,%i,%f,%f,%i,%i,%i,%i,%i,%i,%i,%f,%i,%i)", idFile, setting.m_InterlaceMethod, setting.m_ViewMode, setting.m_CustomZoomAmount, setting.m_CustomPixelRatio, setting.m_CustomVerticalShift, setting.m_AudioStream, setting.m_SubtitleStream, setting.m_SubtitleDelay, setting.m_SubtitleOn, setting.m_Brightness, setting.m_Contrast, setting.m_Gamma, setting.m_VolumeAmplification, setting.m_AudioDelay, setting.m_ResumeTime, setting.m_Sharpness, setting.m_NoiseReduction, setting.m_CustomNonLinStretch, setting.m_PostProcess, setting.m_ScalingMethod, - setting.m_StereoMode, setting.m_StereoInvert, setting.m_VideoStream, setting.m_ToneMapMethod, setting.m_ToneMapParam, setting.m_Orientation); + setting.m_StereoMode, setting.m_StereoInvert, setting.m_VideoStream, setting.m_ToneMapMethod, setting.m_ToneMapParam, setting.m_Orientation,setting.m_CenterMixLevel); m_pDS->exec(strSQL); } } @@ -5343,11 +5344,14 @@ void CVideoDatabase::UpdateTables(int iVersion) if (iVersion < 111) m_pDS->exec("ALTER TABLE settings ADD Orientation integer"); + + if (iVersion < 112) + m_pDS->exec("ALTER TABLE settings ADD CenterMixLevel integer"); } int CVideoDatabase::GetSchemaVersion() const { - return 111; + return 112; } bool CVideoDatabase::LookupByFolders(const std::string &path, bool shows) diff --git a/xbmc/video/dialogs/GUIDialogAudioSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSettings.cpp index 6cb2c2abf6..ead92bc2cb 100644 --- a/xbmc/video/dialogs/GUIDialogAudioSettings.cpp +++ b/xbmc/video/dialogs/GUIDialogAudioSettings.cpp @@ -41,6 +41,7 @@ #define SETTING_AUDIO_VOLUME "audio.volume" #define SETTING_AUDIO_VOLUME_AMPLIFICATION "audio.volumeamplification" +#define SETTING_AUDIO_CENTERMIXLEVEL "audio.centermixlevel" #define SETTING_AUDIO_DELAY "audio.delay" #define SETTING_AUDIO_STREAM "audio.stream" #define SETTING_AUDIO_PASSTHROUGH "audio.digitalanalog" @@ -110,6 +111,12 @@ void CGUIDialogAudioSettings::OnSettingChanged(std::shared_ptr<const CSetting> s float value = static_cast<float>(std::static_pointer_cast<const CSettingNumber>(setting)->GetValue()); g_application.GetAppPlayer().SetDynamicRangeCompression((long)(value * 100)); } + else if (settingId == SETTING_AUDIO_CENTERMIXLEVEL) + { + CVideoSettings vs = g_application.GetAppPlayer().GetVideoSettings(); + vs.m_CenterMixLevel = std::static_pointer_cast<const CSettingInt>(setting)->GetValue(); + g_application.GetAppPlayer().SetVideoSettings(vs); + } else if (settingId == SETTING_AUDIO_DELAY) { float value = static_cast<float>(std::static_pointer_cast<const CSettingNumber>(setting)->GetValue()); @@ -242,6 +249,13 @@ void CGUIDialogAudioSettings::InitializeSettings() settingAudioVolumeAmplification->SetDependencies(depsAudioOutputPassthroughDisabled); } + // downmix: center mix level + { + AddSlider(groupAudio, SETTING_AUDIO_CENTERMIXLEVEL, 39112, SettingLevel::Basic, + videoSettings.m_CenterMixLevel, 14050, -10, 1, 30, + -1, false, false, true, 39113); + } + // audio delay setting if (SupportsAudioFeature(IPC_AUD_OFFSET)) { |