aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2018-04-02 16:47:33 +0200
committerGitHub <noreply@github.com>2018-04-02 16:47:33 +0200
commit45765e5185478ee3e6bda009d7240e91ac2cc816 (patch)
treed1888efe187ba9009eddc01e9886b067709ea5dd
parent57b491fd373b35dc21e4fcf0fcd3126a006c0d0d (diff)
parent2f9feb2a5a6627f11e6874bd75a7c399d172143a (diff)
Merge pull request #13723 from FernetMenta/adsp
remove Audio DSP, it is unmaintained and not in a working state
-rw-r--r--xbmc/Application.cpp1
-rw-r--r--xbmc/DatabaseManager.cpp3
-rw-r--r--xbmc/GUIInfoManager.cpp114
-rw-r--r--xbmc/addons/AddonBuilder.cpp3
-rw-r--r--xbmc/addons/AddonInfo.cpp1
-rw-r--r--xbmc/addons/AddonInfo.h1
-rw-r--r--xbmc/addons/GUIDialogAddonInfo.cpp1
-rw-r--r--xbmc/addons/binary-addons/AddonDll.cpp3
-rw-r--r--xbmc/addons/interfaces/AudioEngine.h191
-rw-r--r--xbmc/addons/interfaces/CMakeLists.txt2
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h597
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt1
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h1288
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt3
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h4
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h16
-rw-r--r--xbmc/cores/AudioEngine/CMakeLists.txt12
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp2
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp1
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h1
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp949
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h394
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.cpp508
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.h425
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.cpp542
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.h219
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.cpp432
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h328
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.cpp1429
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h313
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.cpp47
-rw-r--r--xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.h43
-rw-r--r--xbmc/filesystem/AddonsDirectory.cpp2
-rw-r--r--xbmc/guiinfo/GUIInfoLabels.h22
-rw-r--r--xbmc/settings/AdvancedSettings.cpp16
-rw-r--r--xbmc/settings/dialogs/CMakeLists.txt6
-rw-r--r--xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp1027
-rw-r--r--xbmc/settings/dialogs/GUIDialogAudioDSPManager.h90
-rw-r--r--xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp1015
-rw-r--r--xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h115
-rw-r--r--xbmc/windows/GUIWindowLoginScreen.cpp1
41 files changed, 4 insertions, 10164 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 666462b7ad..145abb7561 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -36,7 +36,6 @@
#include "guilib/TextureManager.h"
#include "cores/IPlayer.h"
#include "cores/VideoPlayer/DVDFileInfo.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
#include "cores/AudioEngine/Interfaces/AE.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/playercorefactory/PlayerCoreFactory.h"
diff --git a/xbmc/DatabaseManager.cpp b/xbmc/DatabaseManager.cpp
index 1d764f6804..e8d178f64f 100644
--- a/xbmc/DatabaseManager.cpp
+++ b/xbmc/DatabaseManager.cpp
@@ -29,10 +29,8 @@
#include "pvr/epg/EpgDatabase.h"
#include "games/addons/savestates/SavestateDatabase.h"
#include "settings/AdvancedSettings.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
using namespace PVR;
-using namespace ActiveAE;
CDatabaseManager::CDatabaseManager() :
m_bIsUpgrading(false)
@@ -61,7 +59,6 @@ void CDatabaseManager::Initialize()
{ CVideoDatabase db; UpdateDatabase(db, &g_advancedSettings.m_databaseVideo); }
{ CPVRDatabase db; UpdateDatabase(db, &g_advancedSettings.m_databaseTV); }
{ CPVREpgDatabase db; UpdateDatabase(db, &g_advancedSettings.m_databaseEpg); }
- { CActiveAEDSPDatabase db; UpdateDatabase(db, &g_advancedSettings.m_databaseADSP); }
CLog::Log(LOGDEBUG, "%s, updating databases... DONE", __FUNCTION__);
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index 57a56b5b34..5de6ea791b 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -105,7 +105,6 @@
#include "music/MusicThumbLoader.h"
#include "video/VideoDatabase.h"
#include "cores/IPlayer.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/VideoPlayer/VideoRenderers/BaseRenderer.h"
#include "interfaces/info/InfoExpression.h"
@@ -784,12 +783,6 @@ const infomap weather[] = {{ "isfetched", WEATHER_IS_FETCHED },
/// _boolean_,
/// Returns true if at least one pvr client addon is installed and enabled.
/// }
-/// \table_row3{ <b>`System.HasADSP`</b>,
-/// \anchor System_HasADSP
-/// _boolean_,
-/// Returns true if ADSP is supported from Kodi
-/// \note normally always true
-/// }
/// \table_row3{ <b>`System.HasCMS`</b>,
/// \anchor System_HasCMS
/// _boolean_,
@@ -1222,7 +1215,6 @@ const infomap system_labels[] = {{ "hasnetwork", SYSTEM_ETHERNET_LINK_ACT
{ "haspvr", SYSTEM_HAS_PVR },
{ "startupwindow", SYSTEM_STARTUP_WINDOW },
{ "stereoscopicmode", SYSTEM_STEREOSCOPIC_MODE },
- { "hasadsp", SYSTEM_HAS_ADSP },
{ "hascms", SYSTEM_HAS_CMS },
{ "privacypolicy", SYSTEM_PRIVACY_POLICY },
{ "haspvraddon", SYSTEM_HAS_PVR_ADDON }};
@@ -4832,101 +4824,6 @@ const infomap pvr_times[] = {{ "epgeventduration", PVR_EPG_EVENT_DURA
{ "timeshiftoffset", PVR_TIMESHIFT_OFFSET }};
/// \page modules__General__List_of_gui_access
-/// \section modules__General__List_of_gui_access_ADSP ADSP
-/// @{
-/// \table_start
-/// \table_h3{ Labels, Type, Description }
-/// \table_row3{ <b>`ADSP.IsActive`</b>,
-/// \anchor ADSP_IsActive
-/// _boolean_,
-/// Returns true if dsp system is enabled
-/// }
-/// \table_row3{ <b>`ADSP.HasModes`</b>,
-/// \anchor ADSP_HasModes
-/// _boolean_,
-/// Returns true if one or more modes are present on any of the types
-/// }
-/// \table_row3{ <b>`ADSP.HasInputResample`</b>,
-/// \anchor ADSP_HasInputResample
-/// _boolean_,
-/// Returns true if on stream is a input resample is active
-/// }
-/// \table_row3{ <b>`ADSP.HasPreProcess`</b>,
-/// \anchor ADSP_HasPreProcess
-/// _boolean_,
-/// Returns true if on stream is a pre process mode active
-/// }
-/// \table_row3{ <b>`ADSP.HasMasterProcess`</b>,
-/// \anchor ADSP_HasMasterProcess
-/// _boolean_,
-/// Returns true if on stream is a master process mode available
-/// }
-/// \table_row3{ <b>`ADSP.HasPostProcess`</b>,
-/// \anchor ADSP_HasPostProcess
-/// _boolean_,
-/// Returns true if on stream is a post process
-/// }
-/// \table_row3{ <b>`ADSP.HasOutputResample`</b>,
-/// \anchor ADSP_HasOutputResample
-/// _boolean_,
-/// Returns true if on stream is a output resample
-/// }
-/// \table_row3{ <b>`ADSP.MasterActive`</b>,
-/// \anchor ADSP_MasterActive
-/// _boolean_,
-/// Returns true if on stream is a master mode selected and active
-/// }
-/// \table_row3{ <b>`ADSP.ActiveStreamType`</b>,
-/// \anchor ADSP_ActiveStreamType
-/// _string_,
-/// From user wanted and selected stream type\, e.g. music or video
-/// }
-/// \table_row3{ <b>`ADSP.DetectedStreamType`</b>,
-/// \anchor ADSP_DetectedStreamType
-/// _string_,
-/// From Kodi detected stream type
-/// }
-/// \table_row3{ <b>`ADSP.MasterName`</b>,
-/// \anchor ADSP_MasterName
-/// _string_,
-/// Name of the currently selected and used master dsp mode
-/// }
-/// \table_row3{ <b>`ADSP.MasterInfo`</b>,
-/// \anchor ADSP_MasterInfo
-/// _string_,
-/// Continues updated information label of master mode (if available)
-/// }
-/// \table_row3{ <b>`ADSP.MasterOwnIcon`</b>,
-/// \anchor ADSP_MasterOwnIcon
-/// _string_,
-/// Icon to use for selected master mode
-/// }
-/// \table_row3{ <b>`ADSP.MasterOverrideIcon`</b>,
-/// \anchor ADSP_MasterOverrideIcon
-/// _string_,
-/// Icon to override Kodi's codec icon with one of add-on\, e.g. Dolby
-/// Digital EX on Dolby Digital
-/// }
-/// \table_end
-///
-/// -----------------------------------------------------------------------------
-/// @}
-const infomap adsp[] = {{ "isactive", ADSP_IS_ACTIVE },
- { "hasmodes", ADSP_HAS_MODES },
- { "hasinputresample", ADSP_HAS_INPUT_RESAMPLE },
- { "haspreprocess", ADSP_HAS_PRE_PROCESS },
- { "hasmasterprocess", ADSP_HAS_MASTER_PROCESS },
- { "haspostprocess", ADSP_HAS_POST_PROCESS },
- { "hasoutputresample", ADSP_HAS_OUTPUT_RESAMPLE },
- { "masteractive", ADSP_MASTER_ACTIVE },
- { "activestreamtype", ADSP_ACTIVE_STREAM_TYPE },
- { "detectedstreamtype", ADSP_DETECTED_STREAM_TYPE },
- { "mastername", ADSP_MASTER_NAME },
- { "masterinfo", ADSP_MASTER_INFO },
- { "masterownicon", ADSP_MASTER_OWN_ICON },
- { "masteroverrideicon", ADSP_MASTER_OVERRIDE_ICON }};
-
-/// \page modules__General__List_of_gui_access
/// \section modules__General__List_of_gui_access_RDS Radio RDS
/// \note Only be supported on PVR Radio where the related add-on client can
/// bring it.
@@ -5908,14 +5805,6 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool
return AddMultiInfo(GUIInfo(pvr_times[i].val, TranslateTimeFormat(prop.param())));
}
}
- else if (cat.name == "adsp")
- {
- for (size_t i = 0; i < sizeof(adsp) / sizeof(infomap); i++)
- {
- if (prop.name == adsp[i].str)
- return adsp[i].val;
- }
- }
else if (cat.name == "rds")
{
if (prop.name == "getline")
@@ -7205,9 +7094,6 @@ bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListI
bReturn = (pvrAddons.size() > 0);
}
break;
- case SYSTEM_HAS_ADSP:
- bReturn = true;
- break;
case SYSTEM_HAS_CMS:
#if defined(HAS_GL) || defined(HAS_DX)
bReturn = true;
diff --git a/xbmc/addons/AddonBuilder.cpp b/xbmc/addons/AddonBuilder.cpp
index 95d04afcf8..c3de8e047b 100644
--- a/xbmc/addons/AddonBuilder.cpp
+++ b/xbmc/addons/AddonBuilder.cpp
@@ -85,7 +85,6 @@ std::shared_ptr<IAddon> CAddonBuilder::Build()
if (type == ADDON_VIZ ||
type == ADDON_SCREENSAVER ||
type == ADDON_PVRDLL ||
- type == ADDON_ADSPDLL ||
type == ADDON_AUDIOENCODER ||
type == ADDON_AUDIODECODER ||
type == ADDON_VFS ||
@@ -121,7 +120,6 @@ std::shared_ptr<IAddon> CAddonBuilder::Build()
case ADDON_SCRAPER_TVSHOWS:
case ADDON_SCRAPER_LIBRARY:
return CScraper::FromExtension(std::move(m_addonInfo), m_extPoint);
- case ADDON_ADSPDLL:
case ADDON_AUDIODECODER:
case ADDON_AUDIOENCODER:
case ADDON_IMAGEDECODER:
@@ -189,7 +187,6 @@ AddonPtr CAddonBuilder::FromProps(CAddonInfo addonInfo)
return AddonPtr(new CScraper(std::move(addonInfo)));
case ADDON_SKIN:
return AddonPtr(new CSkinInfo(std::move(addonInfo)));
- case ADDON_ADSPDLL:
case ADDON_AUDIODECODER:
case ADDON_AUDIOENCODER:
case ADDON_IMAGEDECODER:
diff --git a/xbmc/addons/AddonInfo.cpp b/xbmc/addons/AddonInfo.cpp
index 3f3bfd0356..22929b96b6 100644
--- a/xbmc/addons/AddonInfo.cpp
+++ b/xbmc/addons/AddonInfo.cpp
@@ -72,7 +72,6 @@ static const TypeMapping types[] =
{"kodi.resource.uisounds", ADDON_RESOURCE_UISOUNDS, 24006, "DefaultAddonUISounds.png" },
{"kodi.resource.games", ADDON_RESOURCE_GAMES, 35209, "DefaultAddonGame.png" },
{"kodi.resource.font", ADDON_RESOURCE_FONT, 13303, "DefaultAddonFont.png" },
- {"kodi.adsp", ADDON_ADSPDLL, 24135, "DefaultAddonAudioDSP.png" },
{"kodi.inputstream", ADDON_INPUTSTREAM, 24048, "DefaultAddonInputstream.png" },
{"kodi.vfs", ADDON_VFS, 39013, "DefaultAddonVfs.png" },
{"kodi.imagedecoder", ADDON_IMAGEDECODER, 39015, "DefaultAddonImageDecoder.png" },
diff --git a/xbmc/addons/AddonInfo.h b/xbmc/addons/AddonInfo.h
index b2ea73ea79..0095871c12 100644
--- a/xbmc/addons/AddonInfo.h
+++ b/xbmc/addons/AddonInfo.h
@@ -36,7 +36,6 @@ namespace ADDON
ADDON_VIZ,
ADDON_SKIN,
ADDON_PVRDLL,
- ADDON_ADSPDLL,
ADDON_INPUTSTREAM,
ADDON_GAMEDLL,
ADDON_PERIPHERALDLL,
diff --git a/xbmc/addons/GUIDialogAddonInfo.cpp b/xbmc/addons/GUIDialogAddonInfo.cpp
index 14c3111c65..3df70994cd 100644
--- a/xbmc/addons/GUIDialogAddonInfo.cpp
+++ b/xbmc/addons/GUIDialogAddonInfo.cpp
@@ -28,7 +28,6 @@
#include "ServiceBroker.h"
#include "filesystem/Directory.h"
#include "addons/settings/GUIDialogAddonSettings.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
#include "dialogs/GUIDialogContextMenu.h"
#include "dialogs/GUIDialogSelect.h"
#include "dialogs/GUIDialogYesNo.h"
diff --git a/xbmc/addons/binary-addons/AddonDll.cpp b/xbmc/addons/binary-addons/AddonDll.cpp
index d1ee18c374..2eb5d5a8a1 100644
--- a/xbmc/addons/binary-addons/AddonDll.cpp
+++ b/xbmc/addons/binary-addons/AddonDll.cpp
@@ -42,7 +42,6 @@
#include "Util.h"
// Global addon callback handle classes
-#include "addons/interfaces/AudioEngine.h"
#include "addons/interfaces/Filesystem.h"
#include "addons/interfaces/General.h"
#include "addons/interfaces/Network.h"
@@ -539,7 +538,6 @@ bool CAddonDll::InitInterface(KODI_HANDLE firstKodiInstance)
m_interface.toAddon = (KodiToAddonFuncTable_Addon*) calloc(1, sizeof(KodiToAddonFuncTable_Addon));
Interface_General::Init(&m_interface);
- Interface_AudioEngine::Init(&m_interface);
Interface_Filesystem::Init(&m_interface);
Interface_Network::Init(&m_interface);
Interface_GUIGeneral::Init(&m_interface);
@@ -554,7 +552,6 @@ void CAddonDll::DeInitInterface()
Interface_GUIGeneral::DeInit(&m_interface);
Interface_Network::DeInit(&m_interface);
Interface_Filesystem::DeInit(&m_interface);
- Interface_AudioEngine::DeInit(&m_interface);
Interface_General::DeInit(&m_interface);
if (m_interface.libBasePath)
diff --git a/xbmc/addons/interfaces/AudioEngine.h b/xbmc/addons/interfaces/AudioEngine.h
deleted file mode 100644
index fa857877b6..0000000000
--- a/xbmc/addons/interfaces/AudioEngine.h
+++ /dev/null
@@ -1,191 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2005-2017 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h"
-
-namespace ADDON
-{
-
- struct Interface_AudioEngine
- {
- static void Init(AddonGlobalInterface* addonInterface);
- static void DeInit(AddonGlobalInterface* addonInterface);
-
- /**
- * Creates and returns a new handle to an IAEStream in the format specified, this function should never fail
- * @param[in] streamFormat Format to use for stream
- * @param[in] options A bit field of stream options (see: enum AEStreamOptions)
- * @return a new Handle to an IAEStream that will accept data in the requested format
- */
- static AEStreamHandle* audioengine_make_stream(void *kodiBase, AudioEngineFormat* streamFormat, unsigned int options);
-
- /**
- * This method will remove the specifyed stream from the engine.
- * For OSX/IOS this is essential to reconfigure the audio output.
- * @param[in] streamHandle The stream to be altered
- */
- static void audioengine_free_stream(void *kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Get the current sink data format
- *
- * @param[in] sinkFormat sink data format. For more details see AudioEngineFormat.
- * @return Returns true on success, else false.
- */
- static bool audioengine_get_current_sink_format(void* kodiBase, AudioEngineFormat *sinkFormat);
-
- /**
- * Returns the amount of space available in the stream
- * @return The number of bytes AddData will consume
- */
- static unsigned int aestream_get_space(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Add planar or interleaved PCM data to the stream
- * @param[in] data array of pointers to the planes
- * @param[in] offset to frame in frames
- * @param[in] frames number of frames
- * @return The number of frames consumed
- */
- static unsigned int aestream_add_data(void* kodiBase, AEStreamHandle* streamHandle, uint8_t* const *data,
- unsigned int offset, unsigned int frames, double pts);
-
- /**
- * Returns the time in seconds that it will take
- * for the next added packet to be heard from the speakers.
- * @return seconds
- */
- static double aestream_get_delay(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Returns if the stream is buffering
- * @return True if the stream is buffering
- */
- static bool aestream_is_buffering(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Returns the time in seconds that it will take
- * to underrun the cache if no sample is added.
- * @return seconds
- */
- static double aestream_get_cache_time(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Returns the total time in seconds of the cache
- * @return seconds
- */
- static double aestream_get_cache_total(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Pauses the stream playback
- */
- static void aestream_pause(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Resumes the stream after pausing
- */
- static void aestream_resume(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Start draining the stream
- * @note Once called AddData will not consume more data.
- */
- static void aestream_drain(void* kodiBase, AEStreamHandle* streamHandle, bool wait);
-
- /**
- * Returns true if the is stream draining
- */
- static bool aestream_is_draining(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Returns true if the is stream has finished draining
- */
- static bool aestream_is_drained(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Flush all buffers dropping the audio data
- */
- static void aestream_flush(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Return the stream's current volume level
- * @return The volume level between 0.0 and 1.0
- */
- static float aestream_get_volume(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Set the stream's volume level
- * @param volume The new volume level between 0.0 and 1.0
- */
- static void aestream_set_volume(void* kodiBase, AEStreamHandle* streamHandle, float volume);
-
- /**
- * Gets the stream's volume amplification in linear units.
- * @return The volume amplification factor between 1.0 and 1000.0
- */
- static float aestream_get_amplification(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Sets the stream's volume amplification in linear units.
- * @param amplify The volume amplification factor between 1.0 and 1000.0
- */
- static void aestream_set_amplification(void* kodiBase, AEStreamHandle* streamHandle, float amplify);
-
- /**
- * Returns the size of one audio frame in bytes (channelCount * resolution)
- * @return The size in bytes of one frame
- */
- static unsigned int aestream_get_frame_size(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Returns the number of channels the stream is configured to accept
- * @return The channel count
- */
- static unsigned int aestream_get_channel_count(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Returns the stream's sample rate, if the stream is using a dynamic sample rate, this value will NOT reflect any changes made by calls to SetResampleRatio()
- * @return The stream's sample rate (eg, 48000)
- */
- static unsigned int aestream_get_sample_rate(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Return the data format the stream has been configured with
- * @return The stream's data format (eg, AE_FMT_S16LE)
- */
- static AEDataFormat aestream_get_data_format(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Return the resample ratio
- * @note This will return an undefined value if the stream is not resampling
- * @return the current resample ratio or undefined if the stream is not resampling
- */
- static double aestream_get_resample_ratio(void* kodiBase, AEStreamHandle* streamHandle);
-
- /**
- * Sets the resample ratio
- * @note This function may return false if the stream is not resampling, if you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option
- * @param[in] ratio the new sample rate ratio, calculated by ((double)desiredRate / (double)GetSampleRate())
- */
- static void aestream_set_resample_ratio(void* kodiBase, AEStreamHandle* streamHandle, double ratio);
-};
-
-} /* namespace ADDON */
diff --git a/xbmc/addons/interfaces/CMakeLists.txt b/xbmc/addons/interfaces/CMakeLists.txt
index cd2f330a97..a064cf2d5d 100644
--- a/xbmc/addons/interfaces/CMakeLists.txt
+++ b/xbmc/addons/interfaces/CMakeLists.txt
@@ -1,11 +1,9 @@
set(SOURCES AddonInterfaces.cpp
- AudioEngine.cpp
General.cpp
Filesystem.cpp
Network.cpp)
set(HEADERS AddonInterfaces.h
- AudioEngine.h
General.h
Filesystem.h
Network.h)
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h
deleted file mode 100644
index 02faf86e85..0000000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AudioEngine.h
+++ /dev/null
@@ -1,597 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2005-2017 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Kodi; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "AddonBase.h"
-
-#ifdef BUILD_KODI_ADDON
-#include "AEChannelData.h"
-#else
-#include "cores/AudioEngine/Utils/AEChannelData.h"
-#endif
-
-//==============================================================================
-///
-/// \defgroup cpp_kodi_audioengine Interface - kodi::audioengine
-/// \ingroup cpp
-/// @brief **Audio engine functions**
-///
-///
-/// It has the header \ref AudioEngine.h "#include <kodi/AudioEngine.h>" be included
-/// to enjoy it.
-///
-//------------------------------------------------------------------------------
-
-//==============================================================================
-///
-/// \defgroup cpp_kodi_audioengine_Defs Definitions, structures and enumerators
-/// \ingroup cpp_kodi_audioengine
-/// @brief **Library definition values**
-///
-//------------------------------------------------------------------------------
-
-extern "C"
-{
-
- //============================================================================
- /// \ingroup cpp_kodi_audioengine_Defs
- /// @brief Bit options to pass to CAddonAEStream
- ///
- typedef enum AudioEngineStreamOptions
- {
- /// force resample even if rates match
- AUDIO_STREAM_FORCE_RESAMPLE = 1 << 0,
- /// create the stream paused
- AUDIO_STREAM_PAUSED = 1 << 1,
- /// autostart the stream when enough data is buffered
- AUDIO_STREAM_AUTOSTART = 1 << 2,
- /// if this option is set the ADSP-System is bypassed and the raw stream
- /// will be passed through IAESink
- AUDIO_STREAM_BYPASS_ADSP = 1 << 3
- } AudioEngineStreamOptions;
- //----------------------------------------------------------------------------
-
- //============================================================================
- /// \defgroup cpp_kodi_audioengine_Defs_AudioEngineFormat struct AudioEngineFormat
- /// \ingroup cpp_kodi_audioengine_Defs
- /// @brief The audio format structure that fully defines a stream's audio
- /// information
- ///
- //@{
- struct AudioEngineFormat
- {
- /// The stream's data format (eg, AE_FMT_S16LE)
- enum AEDataFormat m_dataFormat;
-
- /// The stream's sample rate (eg, 48000)
- unsigned int m_sampleRate;
-
- /// The encoded streams sample rate if a bitstream, otherwise undefined
- unsigned int m_encodedRate;
-
- /// The amount of used speaker channels
- unsigned int m_channelCount;
-
- /// The stream's channel layout
- enum AEChannel m_channels[AE_CH_MAX];
-
- /// The number of frames per period
- unsigned int m_frames;
-
- /// The size of one frame in bytes
- unsigned int m_frameSize;
-
- AudioEngineFormat()
- {
- m_dataFormat = AE_FMT_INVALID;
- m_sampleRate = 0;
- m_encodedRate = 0;
- m_frames = 0;
- m_frameSize = 0;
- m_channelCount = 0;
-
- for (unsigned int ch = 0; ch < AE_CH_MAX; ++ch)
- {
- m_channels[ch] = AE_CH_MAX;
- }
- }
-
- /// Function to compare the format structure with another
- bool compareFormat(const AudioEngineFormat *fmt)
- {
- if (!fmt)
- {
- return false;
- }
-
- if (m_dataFormat != fmt->m_dataFormat ||
- m_sampleRate != fmt->m_sampleRate ||
- m_encodedRate != fmt->m_encodedRate ||
- m_frames != fmt->m_frames ||
- m_frameSize != fmt->m_frameSize ||
- m_channelCount != fmt->m_channelCount)
- {
- return false;
- }
-
- for (unsigned int ch = 0; ch < AE_CH_MAX; ++ch)
- {
- if (fmt->m_channels[ch] != m_channels[ch])
- {
- return false;
- }
- }
-
- return true;
- }
- };
- //@}
- //----------------------------------------------------------------------------
-
- /* A stream handle pointer, which is only used internally by the addon stream handle */
- typedef void AEStreamHandle;
-
- /*
- * Function address structure, not need to visible on dev kit doxygen
- * documentation
- */
- typedef struct AddonToKodiFuncTable_kodi_audioengine
- {
- AEStreamHandle* (*make_stream)(void *kodiBase, AudioEngineFormat* format, unsigned int options);
- void (*free_stream)(void *kodiBase, AEStreamHandle *stream);
- bool (*get_current_sink_format)(void *kodiBase, AudioEngineFormat* sink_format);
-
- // Audio Engine Stream definitions
- unsigned int (*aestream_get_space)(void *kodiBase, AEStreamHandle *handle);
- unsigned int (*aestream_add_data)(void *kodiBase, AEStreamHandle *handle, uint8_t* const *data,
- unsigned int offset, unsigned int frames, double pts);
- double (*aestream_get_delay)(void *kodiBase, AEStreamHandle *handle);
- bool (*aestream_is_buffering)(void *kodiBase, AEStreamHandle *handle);
- double (*aestream_get_cache_time)(void *kodiBase, AEStreamHandle *handle);
- double (*aestream_get_cache_total)(void *kodiBase, AEStreamHandle *handle);
- void (*aestream_pause)(void *kodiBase, AEStreamHandle *handle);
- void (*aestream_resume)(void *kodiBase, AEStreamHandle *handle);
- void (*aestream_drain)(void *kodiBase, AEStreamHandle *handle, bool wait);
- bool (*aestream_is_draining)(void *kodiBase, AEStreamHandle *handle);
- bool (*aestream_is_drained)(void *kodiBase, AEStreamHandle *handle);
- void (*aestream_flush)(void *kodiBase, AEStreamHandle *handle);
- float (*aestream_get_volume)(void *kodiBase, AEStreamHandle *handle);
- void (*aestream_set_volume)(void *kodiBase, AEStreamHandle *handle, float volume);
- float (*aestream_get_amplification)(void *kodiBase, AEStreamHandle *handle);
- void (*aestream_set_amplification)(void *kodiBase, AEStreamHandle *handle, float amplify);
- unsigned int (*aestream_get_frame_size)(void *kodiBase, AEStreamHandle *handle);
- unsigned int (*aestream_get_channel_count)(void *kodiBase, AEStreamHandle *handle);
- unsigned int (*aestream_get_sample_rate)(void *kodiBase, AEStreamHandle *handle);
- AEDataFormat (*aestream_get_data_format)(void *kodiBase, AEStreamHandle *handle);
- double (*aestream_get_resample_ratio)(void *kodiBase, AEStreamHandle *handle);
- void (*aestream_set_resample_ratio)(void *kodiBase, AEStreamHandle *handle, double ratio);
- } AddonToKodiFuncTable_kodi_audioengine;
-
-} /* extern "C" */
-
-namespace kodi
-{
-namespace audioengine
-{
-
- //============================================================================
- ///
- /// \defgroup cpp_kodi_audioengine_CAddonAEStream class CAddonAEStream
- /// \ingroup cpp_kodi_audioengine
- /// @brief **Audio Engine Stream Class**
- ///
- ///
- /// It has the header \ref AudioEngine.h "#include <kodi/AudioEngine.h>" be
- /// included to enjoy it.
- ///
- //----------------------------------------------------------------------------
- class CAddonAEStream
- {
- public:
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Contructs new class to an Kodi IAEStream in the format specified.
- ///
- /// @param[in] format The data format the incoming audio will be in
- /// (e.g. \ref AE_FMT_S16LE)
- /// @param[in] options [opt] A bit field of stream options (see: enum \ref AudioEngineStreamOptions)
- ///
- ///
- /// ------------------------------------------------------------------------
- ///
- /// **Audio engine format information:**
- /// @code
- /// /*
- /// * Audio engine format information
- /// *
- /// * Only as example shown here! See always the original structure on related header.
- /// */
- /// typedef struct AudioEngineFormat
- /// {
- /// enum AEDataFormat m_dataFormat; /* The stream's data format (eg, AE_FMT_S16LE) */
- /// unsigned int m_sampleRate; /* The stream's sample rate (eg, 48000) */
- /// unsigned int m_encodedRate; /* The encoded streams sample rate if a bitstream, otherwise undefined */
- /// unsigned int m_channelCount; /* The amount of used speaker channels */
- /// enum AEChannel m_channels[AE_CH_MAX]; /* The stream's channel layout */
- /// unsigned int m_frames; /* The number of frames per period */
- /// unsigned int m_frameSamples; /* The number of samples in one frame */
- /// unsigned int m_frameSize; /* The size of one frame in bytes */
- ///
- /// /* Function to compare the format structure with another */
- /// bool compareFormat(const AudioEngineFormat *fmt);
- /// } AudioEngineFormat;
- /// @endcode
- ///
- /// ------------------------------------------------------------------------
- ///
- /// **Bit options to pass to CAELib_Stream (on Kodi by <c>IAE::MakeStream</c>)**
- ///
- /// | enum AEStreamOptions | Value: | Description:
- /// |----------------------------:|:------:|:-----------------------------------
- /// | AUDIO_STREAM_FORCE_RESAMPLE | 1 << 0 | Force resample even if rates match
- /// | AUDIO_STREAM_PAUSED | 1 << 1 | Create the stream paused
- /// | AUDIO_STREAM_AUTOSTART | 1 << 2 | Autostart the stream when enough data is buffered
- /// | AUDIO_STREAM_BYPASS_ADSP | 1 << 3 | if this option is set the ADSP-System is bypassed and the raw stream will be passed through IAESink.
- ///
- ///
- /// ------------------------------------------------------------------------
- ///
- /// **Example:**
- /// ~~~~~~~~~~~~~{.cpp}
- ///
- /// #include <kodi/AudioEngine.h>
- ///
- /// using namespace kodi::audioengine;
- ///
- /// ...
- ///
- /// AudioEngineFormat format;
- /// format.m_dataFormat = AE_FMT_FLOAT;
- /// format.m_channelCount = 2;
- /// format.m_channels[0] = AE_CH_FL;
- /// format.m_channels[1] = AE_CH_FR;
- /// format.m_channels[2] = AE_CH_NULL;
- /// format.m_sampleRate = 48000;
- /// format.m_frameSize = sizeof(float)*format.m_channelCount;
- /// format.m_frames = 512;
- /// CAddonAEStream* stream = new CAddonAEStream(format, AE_STREAM_AUTOSTART | AE_STREAM_BYPASS_ADSP);
- ///
- /// ~~~~~~~~~~~~~
- ///
- CAddonAEStream(AudioEngineFormat format, unsigned int options = 0)
- : m_kodiBase(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase),
- m_cb(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_audioengine)
- {
- m_StreamHandle = m_cb->make_stream(m_kodiBase, &format, options);
- if (m_StreamHandle == nullptr)
- {
- kodi::Log(ADDON_LOG_FATAL, "CAddonAEStream: make_stream failed!");
- }
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Class destructor
- ///
- ~CAddonAEStream()
- {
- if (m_StreamHandle)
- {
- m_cb->free_stream(m_kodiBase, m_StreamHandle);
- m_StreamHandle = nullptr;
- }
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns the amount of space available in the stream
- ///
- /// @return The number of bytes AddData will consume
- ///
- unsigned int GetSpace()
- {
- return m_cb->aestream_get_space(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Add planar or interleaved PCM data to the stream
- ///
- /// @param[in] data array of pointers to the planes
- /// @param[in] offset to frame in frames
- /// @param[in] frames number of frames
- /// @param[in] pts presentation timestamp
- /// @return The number of frames consumed
- ///
- unsigned int AddData(uint8_t* const *data, unsigned int offset, unsigned int frames, double pts = 0.0)
- {
- return m_cb->aestream_add_data(m_kodiBase, m_StreamHandle, data, offset, frames, pts);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns the time in seconds that it will take for the next added
- /// packet to be heard from the speakers.
- ///
- /// @return seconds
- ///
- double GetDelay()
- {
- return m_cb->aestream_get_delay(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns if the stream is buffering
- ///
- /// @return True if the stream is buffering
- ///
- bool IsBuffering()
- {
- return m_cb->aestream_is_buffering(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns the time in seconds of the stream's cached audio samples.
- /// Engine buffers excluded.
- ///
- /// @return seconds
- ///
- double GetCacheTime()
- {
- return m_cb->aestream_get_cache_time(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns the total time in seconds of the cache
- ///
- /// @return seconds
- ///
- double GetCacheTotal()
- {
- return m_cb->aestream_get_cache_total(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Pauses the stream playback
- ///
- void Pause()
- {
- return m_cb->aestream_pause(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Resumes the stream after pausing
- ///
- void Resume()
- {
- return m_cb->aestream_resume(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Start draining the stream
- ///
- /// @param[in] wait [opt] Wait until drain is finished if set to
- /// true, otherwise it returns direct
- ///
- /// @note Once called AddData will not consume more data.
- ///
- void Drain(bool wait = true)
- {
- return m_cb->aestream_drain(m_kodiBase, m_StreamHandle, wait);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns true if the is stream draining
- ///
- bool IsDraining()
- {
- return m_cb->aestream_is_draining(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns true if the is stream has finished draining
- ///
- bool IsDrained()
- {
- return m_cb->aestream_is_drained(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Flush all buffers dropping the audio data
- ///
- void Flush()
- {
- return m_cb->aestream_flush(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Return the stream's current volume level
- ///
- /// @return The volume level between 0.0 and 1.0
- ///
- float GetVolume()
- {
- return m_cb->aestream_get_volume(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Set the stream's volume level
- ///
- /// @param[in] volume The new volume level between 0.0 and 1.0
- ///
- void SetVolume(float volume)
- {
- return m_cb->aestream_set_volume(m_kodiBase, m_StreamHandle, volume);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Gets the stream's volume amplification in linear units.
- ///
- /// @return The volume amplification factor between 1.0 and 1000.0
- ///
- float GetAmplification()
- {
- return m_cb->aestream_get_amplification(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Sets the stream's volume amplification in linear units.
- ///
- /// @param[in] amplify The volume amplification factor between
- /// 1.0 and 1000.0
- ///
- void SetAmplification(float amplify)
- {
- return m_cb->aestream_set_amplification(m_kodiBase, m_StreamHandle, amplify);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns the size of one audio frame in bytes (channelCount * resolution)
- ///
- /// @return The size in bytes of one frame
- ///
- unsigned int GetFrameSize() const
- {
- return m_cb->aestream_get_frame_size(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns the number of channels the stream is configured to accept
- ///
- /// @return The channel count
- ///
- unsigned int GetChannelCount() const
- {
- return m_cb->aestream_get_channel_count(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Returns the stream's sample rate, if the stream is using a dynamic
- /// sample rate, this value will NOT reflect any changes made by calls to
- /// SetResampleRatio()
- ///
- /// @return The stream's sample rate (eg, 48000)
- ///
- unsigned int GetSampleRate() const
- {
- return m_cb->aestream_get_sample_rate(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Return the data format the stream has been configured with
- ///
- /// @return The stream's data format (eg, AUDIOENGINE_FMT_S16LE)
- ///
- AEDataFormat GetDataFormat() const
- {
- return m_cb->aestream_get_data_format(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Return the resample ratio
- ///
- /// @note This will return an undefined value if the stream is not resampling
- ///
- /// @return the current resample ratio or undefined if the stream is not resampling
- ///
- double GetResampleRatio()
- {
- return m_cb->aestream_get_resample_ratio(m_kodiBase, m_StreamHandle);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @ingroup cpp_kodi_audioengine_CAddonAEStream
- /// @brief Sets the resample ratio
- ///
- /// @note This function may return false if the stream is not resampling, if
- /// you wish to use this be sure to set the AESTREAM_FORCE_RESAMPLE option
- ///
- /// @param[in] ratio the new sample rate ratio, calculated by
- /// ((double)desiredRate / (double)GetSampleRate())
- ///
- void SetResampleRatio(double ratio)
- {
- m_cb->aestream_set_resample_ratio(m_kodiBase, m_StreamHandle, ratio);
- }
- //--------------------------------------------------------------------------
-
- private:
- void* m_kodiBase;
- AddonToKodiFuncTable_kodi_audioengine* m_cb;
- AEStreamHandle *m_StreamHandle;
- };
-
- //============================================================================
- /// @ingroup cpp_kodi_audioengine
- /// @brief Get the current sink data format
- ///
- /// @param[in] format Current sink data format. For more details see AudioEngineFormat.
- /// @return Returns true on success, else false.
- ///
- inline bool GetCurrentSinkFormat(AudioEngineFormat &format)
- {
- using namespace kodi::addon;
- return CAddonBase::m_interface->toKodi->kodi_audioengine->get_current_sink_format(CAddonBase::m_interface->toKodi->kodiBase, &format);
- }
- //----------------------------------------------------------------------------
-
-} /* audioengine */
-} /* kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt
index 6d644dbb3e..2b98154966 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt
@@ -1,5 +1,4 @@
set(HEADERS AddonBase.h
- AudioEngine.h
Filesystem.h
General.h
Network.h
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h
deleted file mode 100644
index 3f43a12589..0000000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h
+++ /dev/null
@@ -1,1288 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2005-2015 Team Kodi
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Kodi; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "../AddonBase.h"
-
-#define AE_DSP_STREAM_MAX_STREAMS 8
-#define AE_DSP_STREAM_MAX_MODES 32
-
-/*!
- * @file Addon.h
- * @section sec1 Basic audio dsp addon interface description
- * @author Team Kodi
- * @date 10. May 2014
- * @version 0.1.5
- *
- * @subsection sec1_1 General
- * @li The basic support on the addon is supplied with the
- * AE_DSP_ADDON_CAPABILITIES data which becomes asked over
- * GetCapabilities(...), further the addon must register his available
- * modes on startup with the RegisterMode(...) callback function.
- * If one of this two points is not set the addon becomes
- * ignored for the chain step.
- *
- * @subsection sec1_2 Processing
- * @li On start of new stream the addon becomes called with StreamCreate(...)
- * to check about given values that it support it basically and can create
- * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME.
- *
- * @li As next step StreamIsModeSupported(...) becomes called for every
- * available and enabled modes, is separated due to more as one available mode
- * on the addon is possible, if the mode is not supported it can also be return
- * AE_DSP_ERROR_IGNORE_ME.
- * - If mode is a resample mode and returns no error it becomes asked with
- * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant
- * to his type) about his given sample rate.
- * - About the from user selected master processing mode the related addon
- * becomes called now with MasterProcessSetMode(...) to handle it's
- * selectionon the addon given by the own addon type identifier or by
- * KODI's useddatabase id, also the currently used stream type (e.g.
- * Music or Video) is send.
- * - If the addon supports only one master mode it can ignore this function
- * and return always AE_DSP_ERROR_NO_ERROR.
- * - If the master mode is set the addon becomes asked about the from him
- * given output channel layout related to up- or downmix modes, if
- * nothing becomes changed on the layout it can return -1.
- * - The MasterProcessSetMode(...) is also called if from user a another
- * mode becomes selected.
- *
- * @li Then as last step shortly before the first process call becomes executed
- * the addon is called one time with StreamInitialize(...) to inform that
- * processing is started on the given settings.
- * - This function becomes also called on all add-ons if the master process
- * becomes changed.
- * - Also every process after StreamInitialize on the addon mode becomes asked
- * with _..._ProcessNeededSamplesize(...) about required memory size for the
- * output of his data, if no other size is required it can return 0.
- *
- * @li From now the processing becomes handled for the different steps with
- * _..._Process(...).
- * - Further it becomes asked with _..._GetDelay(...) about his processing
- * time as float value in seconds, needed for video and audio alignment.
- *
- * @li On the end of the processing if the source becomes stopped the
- * StreamDestroy(...) function becomes called on all active processing add-ons.
- *
- * @note
- * The StreamCreate(...) can be becomes called for a new stream before the
- * previous was closed with StreamDestroy(...) ! To have a speed improve.
- */
-
-namespace kodi { namespace addon { class CInstanceAudioDSP; }}
-
-extern "C" {
-
- typedef void* ADSPHANDLE;
-
- typedef unsigned int AE_DSP_STREAM_ID;
-
- /*!
- * @brief Audio DSP add-on error codes
- */
- typedef enum
- {
- AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */
- AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */
- AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */
- AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */
- AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */
- AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */
- AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */
- AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */
- AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */
- AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */
- } AE_DSP_ERROR;
-
- /*!
- * @brief The possible DSP channels (used as pointer inside arrays)
- */
- typedef enum
- {
- AE_DSP_CH_INVALID = -1,
- AE_DSP_CH_FL = 0,
- AE_DSP_CH_FR,
- AE_DSP_CH_FC,
- AE_DSP_CH_LFE,
- AE_DSP_CH_BL,
- AE_DSP_CH_BR,
- AE_DSP_CH_FLOC,
- AE_DSP_CH_FROC,
- AE_DSP_CH_BC,
- AE_DSP_CH_SL,
- AE_DSP_CH_SR,
- AE_DSP_CH_TFL,
- AE_DSP_CH_TFR,
- AE_DSP_CH_TFC,
- AE_DSP_CH_TC,
- AE_DSP_CH_TBL,
- AE_DSP_CH_TBR,
- AE_DSP_CH_TBC,
- AE_DSP_CH_BLOC,
- AE_DSP_CH_BROC,
-
- AE_DSP_CH_MAX
- } AE_DSP_CHANNEL;
-
- /*!
- * @brief Present channel flags
- */
- typedef enum
- {
- AE_DSP_PRSNT_CH_UNDEFINED = 0,
- AE_DSP_PRSNT_CH_FL = 1<<AE_DSP_CH_FL,
- AE_DSP_PRSNT_CH_FR = 1<<AE_DSP_CH_FR,
- AE_DSP_PRSNT_CH_FC = 1<<AE_DSP_CH_FC,
- AE_DSP_PRSNT_CH_LFE = 1<<AE_DSP_CH_LFE,
- AE_DSP_PRSNT_CH_BL = 1<<AE_DSP_CH_BL,
- AE_DSP_PRSNT_CH_BR = 1<<AE_DSP_CH_BR,
- AE_DSP_PRSNT_CH_FLOC = 1<<AE_DSP_CH_FLOC,
- AE_DSP_PRSNT_CH_FROC = 1<<AE_DSP_CH_FROC,
- AE_DSP_PRSNT_CH_BC = 1<<AE_DSP_CH_BC,
- AE_DSP_PRSNT_CH_SL = 1<<AE_DSP_CH_SL,
- AE_DSP_PRSNT_CH_SR = 1<<AE_DSP_CH_SR,
- AE_DSP_PRSNT_CH_TFL = 1<<AE_DSP_CH_TFL,
- AE_DSP_PRSNT_CH_TFR = 1<<AE_DSP_CH_TFR,
- AE_DSP_PRSNT_CH_TFC = 1<<AE_DSP_CH_TFC,
- AE_DSP_PRSNT_CH_TC = 1<<AE_DSP_CH_TC,
- AE_DSP_PRSNT_CH_TBL = 1<<AE_DSP_CH_TBL,
- AE_DSP_PRSNT_CH_TBR = 1<<AE_DSP_CH_TBR,
- AE_DSP_PRSNT_CH_TBC = 1<<AE_DSP_CH_TBC,
- AE_DSP_PRSNT_CH_BLOC = 1<<AE_DSP_CH_BLOC,
- AE_DSP_PRSNT_CH_BROC = 1<<AE_DSP_CH_BROC
- } AE_DSP_CHANNEL_PRESENT;
-
- /**
- * @brief The various stream type formats
- * Used for audio DSP processing to know input audio type
- */
- typedef enum
- {
- AE_DSP_ASTREAM_INVALID = -1,
- AE_DSP_ASTREAM_BASIC = 0,
- AE_DSP_ASTREAM_MUSIC,
- AE_DSP_ASTREAM_MOVIE,
- AE_DSP_ASTREAM_GAME,
- AE_DSP_ASTREAM_APP,
- AE_DSP_ASTREAM_PHONE,
- AE_DSP_ASTREAM_MESSAGE,
-
- AE_DSP_ASTREAM_AUTO,
- AE_DSP_ASTREAM_MAX
- } AE_DSP_STREAMTYPE;
-
- /*!
- * @brief Add-ons supported audio stream type flags
- * used on master mode information on AE_DSP_MODES to know
- * on which audio stream the master mode is supported
- */
- typedef enum
- {
- AE_DSP_PRSNT_ASTREAM_BASIC = 1<<AE_DSP_ASTREAM_BASIC,
- AE_DSP_PRSNT_ASTREAM_MUSIC = 1<<AE_DSP_ASTREAM_MUSIC,
- AE_DSP_PRSNT_ASTREAM_MOVIE = 1<<AE_DSP_ASTREAM_MOVIE,
- AE_DSP_PRSNT_ASTREAM_GAME = 1<<AE_DSP_ASTREAM_GAME,
- AE_DSP_PRSNT_ASTREAM_APP = 1<<AE_DSP_ASTREAM_APP,
- AE_DSP_PRSNT_ASTREAM_PHONE = 1<<AE_DSP_ASTREAM_PHONE,
- AE_DSP_PRSNT_ASTREAM_MESSAGE = 1<<AE_DSP_ASTREAM_MESSAGE,
- } AE_DSP_ASTREAM_PRESENT;
-
- /**
- * @brief The various base type formats
- * Used for audio DSP processing to know input audio source
- */
- typedef enum
- {
- AE_DSP_ABASE_INVALID = -1,
- AE_DSP_ABASE_STEREO = 0,
- AE_DSP_ABASE_MONO,
- AE_DSP_ABASE_MULTICHANNEL,
- AE_DSP_ABASE_AC3,
- AE_DSP_ABASE_EAC3,
- AE_DSP_ABASE_DTS,
- AE_DSP_ABASE_DTSHD_MA,
- AE_DSP_ABASE_DTSHD_HRA,
- AE_DSP_ABASE_TRUEHD,
- AE_DSP_ABASE_MLP,
- AE_DSP_ABASE_FLAC,
-
- AE_DSP_ABASE_MAX
- } AE_DSP_BASETYPE;
-
-
- /**
- * @brief The from KODI in settings requested audio process quality.
- * The KODI internal used quality levels is translated to this values
- * for usage on DSP processing add-ons. Is present on iQualityLevel
- * inside AE_DSP_SETTINGS.
- */
- typedef enum
- {
- AE_DSP_QUALITY_UNKNOWN = -1, /*!< @brief Unset, unknown or incorrect quality level */
- AE_DSP_QUALITY_DEFAULT = 0, /*!< @brief Engine's default quality level */
-
- /* Basic quality levels */
- AE_DSP_QUALITY_LOW = 20, /*!< @brief Low quality level */
- AE_DSP_QUALITY_MID = 30, /*!< @brief Standard quality level */
- AE_DSP_QUALITY_HIGH = 50, /*!< @brief Best sound processing quality */
-
- /* Optional quality levels */
- AE_DSP_QUALITY_REALLYHIGH = 100 /*!< @brief Uncompromising optional quality level, usually with unmeasurable and unnoticeable improvement */
- } AE_DSP_QUALITY;
-
- /*!
- * @brief Audio DSP menu hook categories.
- * Used to identify on AE_DSP_MENUHOOK given add-on related skin dialog/windows.
- * Except AE_DSP_MENUHOOK_ALL and AE_DSP_MENUHOOK_SETTING are the menus available
- * from DSP playback dialogue which can be opened over KODI file context menu and over
- * button on full screen OSD window.
- *
- * Menu hook AE_DSP_MENUHOOK_SETTING is available from DSP processing setup dialogue.
- */
- typedef enum
- {
- AE_DSP_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */
- AE_DSP_MENUHOOK_ALL = 0, /*!< @brief all categories */
- AE_DSP_MENUHOOK_PRE_PROCESS = 1, /*!< @brief for pre processing */
- AE_DSP_MENUHOOK_MASTER_PROCESS = 2, /*!< @brief for master processing */
- AE_DSP_MENUHOOK_POST_PROCESS = 3, /*!< @brief for post processing */
- AE_DSP_MENUHOOK_RESAMPLE = 4, /*!< @brief for re sample */
- AE_DSP_MENUHOOK_MISCELLANEOUS = 5, /*!< @brief for miscellaneous dialogues */
- AE_DSP_MENUHOOK_INFORMATION = 6, /*!< @brief dialogue to show processing information */
- AE_DSP_MENUHOOK_SETTING = 7, /*!< @brief for settings */
- } AE_DSP_MENUHOOK_CAT;
-
- /*!
- * @brief Menu hooks that are available in the menus while playing a stream via this add-on.
- */
- typedef struct AE_DSP_MENUHOOK
- {
- unsigned int iHookId; /*!< @brief (required) this hook's identifier */
- unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */
- AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */
- unsigned int iRelevantModeId; /*!< @brief (required) except category AE_DSP_MENUHOOK_SETTING and AE_DSP_MENUHOOK_ALL must be the related mode id present here */
- bool bNeedPlayback; /*!< @brief (required) set to true if menu hook need playback and active processing */
- } ATTRIBUTE_PACKED AE_DSP_MENUHOOK;
-
- /*!
- * @brief Audio DSP add-on capabilities. All capabilities are set to "false" as default.
- * If a capability is set to true, then the corresponding methods from kodi_audiodsp_dll.h need to be implemented.
- */
- typedef struct AE_DSP_ADDON_CAPABILITIES
- {
- bool bSupportsInputProcess; /*!< @brief true if this add-on provides audio input processing */
- bool bSupportsInputResample; /*!< @brief true if this add-on provides audio resample before master handling */
- bool bSupportsPreProcess; /*!< @brief true if this add-on provides audio pre processing */
- bool bSupportsMasterProcess; /*!< @brief true if this add-on provides audio master processing */
- bool bSupportsPostProcess; /*!< @brief true if this add-on provides audio post processing */
- bool bSupportsOutputResample; /*!< @brief true if this add-on provides audio re sample after master handling */
- } ATTRIBUTE_PACKED AE_DSP_ADDON_CAPABILITIES;
-
- /*!
- * @brief Audio processing settings for in and out arrays
- * Send on creation and before first processed audio packet to add-on
- */
- typedef struct AE_DSP_SETTINGS
- {
- AE_DSP_STREAM_ID iStreamID; /*!< @brief id of the audio stream packets */
- AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */
- int iInChannels; /*!< @brief the amount of input channels */
- unsigned long lInChannelPresentFlags; /*!< @brief the exact channel mapping flags of input */
- int iInFrames; /*!< @brief the input frame size from KODI */
- unsigned int iInSamplerate; /*!< @brief the basic sample rate of the audio packet */
- int iProcessFrames; /*!< @brief the processing frame size inside add-on's */
- unsigned int iProcessSamplerate; /*!< @brief the sample rate after input resample present in master processing */
- int iOutChannels; /*!< @brief the amount of output channels */
- unsigned long lOutChannelPresentFlags; /*!< @brief the exact channel mapping flags for output */
- int iOutFrames; /*!< @brief the final out frame size for KODI */
- unsigned int iOutSamplerate; /*!< @brief the final sample rate of the audio packet */
- bool bInputResamplingActive; /*!< @brief if a re-sampling is performed before master processing this flag is set to true */
- bool bStereoUpmix; /*!< @brief true if the stereo upmix setting on kodi is set */
- int iQualityLevel; /*!< @brief the from KODI selected quality level for signal processing */
- /*!
- * @note about "iProcessSamplerate" and "iProcessFrames" is set from KODI after call of StreamCreate on input re sample add-on, if re-sampling
- * and processing is handled inside the same add-on, this value must be ignored!
- */
- } AE_DSP_SETTINGS;
-
- /*!
- * @brief Stream profile properties
- * Can be used to detect best master processing mode and for post processing methods.
- */
-//@{
-
- /*!
- * @brief Dolby profile types. Given from several formats, e.g. Dolby Digital or TrueHD
- * Used on AE_DSP_PROFILE_AC3_EAC3 and AE_DSP_PROFILE_MLP_TRUEHD
- */
- #define AE_DSP_PROFILE_DOLBY_NONE 0
- #define AE_DSP_PROFILE_DOLBY_SURROUND 1
- #define AE_DSP_PROFILE_DOLBY_PLII 2
- #define AE_DSP_PROFILE_DOLBY_PLIIX 3
- #define AE_DSP_PROFILE_DOLBY_PLIIZ 4
- #define AE_DSP_PROFILE_DOLBY_EX 5
- #define AE_DSP_PROFILE_DOLBY_HEADPHONE 6
-
- /*!
- * @brief DTS/DTS HD profile types
- * Used on AE_DSP_PROFILE_DTS_DTSHD
- */
- #define AE_DSP_PROFILE_DTS 0
- #define AE_DSP_PROFILE_DTS_ES 1
- #define AE_DSP_PROFILE_DTS_96_24 2
- #define AE_DSP_PROFILE_DTS_HD_HRA 3
- #define AE_DSP_PROFILE_DTS_HD_MA 4
-
- /*!
- * @brief AC3/EAC3 based service types
- * Used on AE_DSP_PROFILE_AC3_EAC3
- */
- #define AE_DSP_SERVICE_TYPE_MAIN 0
- #define AE_DSP_SERVICE_TYPE_EFFECTS 1
- #define AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED 2
- #define AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED 3
- #define AE_DSP_SERVICE_TYPE_DIALOGUE 4
- #define AE_DSP_SERVICE_TYPE_COMMENTARY 5
- #define AE_DSP_SERVICE_TYPE_EMERGENCY 6
- #define AE_DSP_SERVICE_TYPE_VOICE_OVER 7
- #define AE_DSP_SERVICE_TYPE_KARAOKE 8
-
- /*!
- * @brief AC3/EAC3 based room types
- * Present on AE_DSP_PROFILE_AC3_EAC3 and can be used for frequency corrections
- * at post processing, e.g. THX Re-Equalization
- */
- #define AE_DSP_ROOM_TYPE_UNDEFINED 0
- #define AE_DSP_ROOM_TYPE_SMALL 1
- #define AE_DSP_ROOM_TYPE_LARGE 2
-
- /*!
- * @brief AC3/EAC3 stream profile properties
- */
- //! @todo add handling for it (currently never becomes set)
- typedef struct AE_DSP_PROFILE_AC3_EAC3
- {
- unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */
- unsigned int iServiceType; /*!< defined by AE_DSP_SERVICE_TYPE_* */
- unsigned int iRoomType; /*!< defined by AE_DSP_ROOM_TYPE_* (NOTICE: Information about it currently not supported from ffmpeg and must be implemented) */
- } ATTRIBUTE_PACKED AE_DSP_PROFILE_AC3_EAC3;
-
- /*!
- * @brief MLP/Dolby TrueHD stream profile properties
- */
- //! @todo add handling for it (currently never becomes set)
- typedef struct AE_DSP_PROFILE_MLP_TRUEHD
- {
- unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */
- } ATTRIBUTE_PACKED AE_DSP_PROFILE_MLP_TRUEHD;
-
- /*!
- * @brief DTS/DTS HD stream profile properties
- */
- //! @todo add handling for it (currently never becomes set)
- typedef struct AE_DSP_PROFILE_DTS_DTSHD
- {
- unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DTS* */
- bool bSurroundMatrix; /*!< if set to true given 2.0 stream is surround encoded */
- } ATTRIBUTE_PACKED AE_DSP_PROFILE_DTS_DTSHD;
-
- union AE_DSP_PROFILE
- {
- AE_DSP_PROFILE_AC3_EAC3 ac3_eac3; /*!< Dolby Digital/Digital+ profile data */
- AE_DSP_PROFILE_MLP_TRUEHD mlp_truehd; /*!< MLP or Dolby TrueHD profile data */
- AE_DSP_PROFILE_DTS_DTSHD dts_dtshd; /*!< DTS/DTS-HD profile data */
- };
- //@}
-
- /*!
- * @brief Audio DSP stream properties
- * Used to check for the DSP add-on that the stream is supported,
- * as example Dolby Digital Ex processing is only required on Dolby Digital with 5.1 layout
- */
- typedef struct AE_DSP_STREAM_PROPERTIES
- {
- AE_DSP_STREAM_ID iStreamID; /*!< @brief stream id of the audio stream packets */
- AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */
- int iBaseType; /*!< @brief the input stream base type source eg, Dolby Digital */
- const char* strName; /*!< @brief the audio stream name */
- const char* strCodecId; /*!< @brief codec id string of the audio stream */
- const char* strLanguage; /*!< @brief language id of the audio stream */
- int iIdentifier; /*!< @brief audio stream id inside player */
- int iChannels; /*!< @brief amount of basic channels */
- int iSampleRate; /*!< @brief sample rate */
- AE_DSP_PROFILE Profile; /*!< @brief current running stream profile data */
- } AE_DSP_STREAM_PROPERTIES;
-
- /*!
- * @brief Audio DSP mode categories
- */
- typedef enum
- {
- AE_DSP_MODE_TYPE_UNDEFINED = -1, /*!< @brief undefined type, never be used from add-on! */
- AE_DSP_MODE_TYPE_INPUT_RESAMPLE = 0, /*!< @brief for input re sample */
- AE_DSP_MODE_TYPE_PRE_PROCESS = 1, /*!< @brief for preprocessing */
- AE_DSP_MODE_TYPE_MASTER_PROCESS = 2, /*!< @brief for master processing */
- AE_DSP_MODE_TYPE_POST_PROCESS = 3, /*!< @brief for post processing */
- AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE = 4, /*!< @brief for output re sample */
- AE_DSP_MODE_TYPE_MAX = 5
- } AE_DSP_MODE_TYPE;
-
- /*!
- * @brief Audio DSP master mode information
- * Used to get all available modes for current input stream
- */
- typedef struct AE_DSP_MODES
- {
- unsigned int iModesCount; /*!< @brief (required) count of how much modes are in AE_DSP_MODES */
- struct AE_DSP_MODE
- {
- int iUniqueDBModeId; /*!< @brief (required) the inside add-on used identifier for the mode, set by KODI's audio DSP database */
- AE_DSP_MODE_TYPE iModeType; /*!< @brief (required) the processong mode type, see AE_DSP_MODE_TYPE */
- char strModeName[ADDON_STANDARD_STRING_LENGTH]; /*!< @brief (required) the addon name of the mode, used on KODI's logs */
-
- unsigned int iModeNumber; /*!< @brief (required) number of this mode on the add-on, is used on process functions with value "mode_id" */
- unsigned int iModeSupportTypeFlags; /*!< @brief (required) flags about supported input types for this mode, see AE_DSP_ASTREAM_PRESENT */
- bool bHasSettingsDialog; /*!< @brief (required) if setting dialog(s) are available it must be set to true */
- bool bIsDisabled; /*!< @brief (optional) true if this mode is marked as disabled and not enabled default, only relevant for master processes, all other types always disabled as default */
-
- unsigned int iModeName; /*!< @brief (required) the name id of the mode for this hook in g_localizeStrings */
- unsigned int iModeSetupName; /*!< @brief (optional) the name id of the mode inside settings for this hook in g_localizeStrings */
- unsigned int iModeDescription; /*!< @brief (optional) the description id of the mode for this hook in g_localizeStrings */
- unsigned int iModeHelp; /*!< @brief (optional) help string id for inside DSP settings dialog of the mode for this hook in g_localizeStrings */
-
- char strOwnModeImage[ADDON_STANDARD_STRING_LENGTH]; /*!< @brief (optional) flag image for the mode */
- char strOverrideModeImage[ADDON_STANDARD_STRING_LENGTH];/*!< @brief (optional) image to override KODI Image for the mode, eg. Dolby Digital with Dolby Digital Ex (only used on master modes) */
- } mode[AE_DSP_STREAM_MAX_MODES]; /*!< @brief Modes array storage */
- } ATTRIBUTE_PACKED AE_DSP_MODES;
-
- /*!
- * @brief Audio DSP menu hook data
- */
- typedef struct AE_DSP_MENUHOOK_DATA
- {
- AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) related menuhook data category */
- union data {
- AE_DSP_STREAM_ID iStreamId; /*!< @brief currently only stream id is used, is used as union to have extension possibility */
- } data; /*!< @brief related category related data */
- } ATTRIBUTE_PACKED AE_DSP_MENUHOOK_DATA;
-
- /*!
- * @brief Properties passed to the Create() method of an add-on.
- */
- typedef struct AddonProps_AudioDSP
- {
- const char* strUserPath; /*!< @brief path to the user profile */
- const char* strAddonPath; /*!< @brief path to this add-on */
- } AddonProps_AudioDSP;
-
- typedef struct AddonToKodiFuncTable_AudioDSP
- {
- void* kodiInstance;
- void (*add_menu_hook)(void* kodiInstance, AE_DSP_MENUHOOK *hook);
- void (*remove_menu_hook)(void* kodiInstance, AE_DSP_MENUHOOK *hook);
- void (*register_mode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode);
- void (*unregister_mode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode);
- } AddonToKodiFuncTable_AudioDSP;
-
- struct AddonInstance_AudioDSP;
- typedef struct KodiToAddonFuncTable_AudioDSP
- {
- kodi::addon::CInstanceAudioDSP* addonInstance;
- void (__cdecl* get_capabilities)(AddonInstance_AudioDSP const* addonInstance, AE_DSP_ADDON_CAPABILITIES*);
- const char* (__cdecl* get_dsp_name)(AddonInstance_AudioDSP const* addonInstance);
- const char* (__cdecl* get_dsp_version)(AddonInstance_AudioDSP const* addonInstance);
- AE_DSP_ERROR (__cdecl* menu_hook)(AddonInstance_AudioDSP const* addonInstance, const AE_DSP_MENUHOOK*, const AE_DSP_MENUHOOK_DATA*);
-
- AE_DSP_ERROR (__cdecl* stream_create)(AddonInstance_AudioDSP const* addonInstance, const AE_DSP_SETTINGS*, const AE_DSP_STREAM_PROPERTIES*, ADDON_HANDLE);
- AE_DSP_ERROR (__cdecl* stream_destroy)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- AE_DSP_ERROR (__cdecl* stream_is_mode_supported)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, AE_DSP_MODE_TYPE, unsigned int, int);
- AE_DSP_ERROR (__cdecl* stream_initialize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const AE_DSP_SETTINGS*);
-
- bool (__cdecl* input_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, unsigned int);
-
- unsigned int (__cdecl* input_resample_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- unsigned int (__cdecl* input_resample_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int);
- float (__cdecl* input_resample_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- int (__cdecl* input_resample_samplerate)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
-
- unsigned int (__cdecl* pre_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
- float (__cdecl* pre_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
- unsigned int (__cdecl* pre_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int, const float**, float**, unsigned int);
-
- AE_DSP_ERROR (__cdecl* master_process_set_mode)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, AE_DSP_STREAMTYPE, unsigned int, int);
- unsigned int (__cdecl* master_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- float (__cdecl* master_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- int (__cdecl* master_process_get_out_channels)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned long*);
- unsigned int (__cdecl* master_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int);
- const char* (__cdecl* master_process_get_stream_info_string)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
-
- unsigned int (__cdecl* post_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
- float (__cdecl* post_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
- unsigned int (__cdecl* post_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int, const float**, float**, unsigned int);
-
- unsigned int (__cdecl* output_resample_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- unsigned int (__cdecl* output_resample_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int);
- float (__cdecl* output_resample_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- int (__cdecl* output_resample_samplerate)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
- } KodiToAddonFuncTable_AudioDSP;
-
- typedef struct AddonInstance_AudioDSP
- {
- AddonProps_AudioDSP props;
- AddonToKodiFuncTable_AudioDSP toKodi;
- KodiToAddonFuncTable_AudioDSP toAddon;
- } AddonInstance_AudioDSP;
-
-} /* extern "C" */
-
-namespace kodi {
-namespace addon {
-
- class CInstanceAudioDSP : public IAddonInstance
- {
- public:
- //==========================================================================
- /// @brief Class constructor
- ///
- CInstanceAudioDSP()
- : IAddonInstance(ADDON_INSTANCE_ADSP)
- {
- if (CAddonBase::m_interface->globalSingleInstance != nullptr)
- throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of more as one in single instance way is not allowed!");
-
- SetAddonStruct(CAddonBase::m_interface->firstKodiInstance);
- CAddonBase::m_interface->globalSingleInstance = this;
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- /// @brief Class constructor
- ///
- /// @param[in] instance The from Kodi given instance given be
- /// add-on CreateInstance call with instance
- /// id ADDON_INSTANCE_ADSP.
- ///
- explicit CInstanceAudioDSP(KODI_HANDLE instance)
- : IAddonInstance(ADDON_INSTANCE_ADSP)
- {
- if (CAddonBase::m_interface->globalSingleInstance != nullptr)
- throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of multiple together with single instance way is not allowed!");
-
- SetAddonStruct(instance);
- }
- //--------------------------------------------------------------------------
-
- /*! @name Audio DSP add-on methods */
- //@{
- //==========================================================================
- ///
- /// @brief Get the list of features that this add-on provides.
- /// Called by KODI to query the add-ons capabilities.
- /// Used to check which options should be presented in the DSP, which methods
- /// to call, etc.
- /// All capabilities that the add-on supports should be set to true.
- /// @param capabilities The add-ons capabilities.
- /// @remarks Valid implementation required.
- ///
- virtual void GetCapabilities(AE_DSP_ADDON_CAPABILITIES& capabilities) = 0;
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @return The name reported by the back end that will be displayed in the
- /// UI.
- /// @remarks Valid implementation required.
- ///
- virtual std::string GetDSPName() = 0;
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @return The version string reported by the back end that will be displayed
- /// in the UI.
- /// @remarks Valid implementation required.
- ///
- virtual std::string GetDSPVersion() = 0;
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Call one of the menu hooks (if supported).
- /// Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(),
- /// by calling AddMenuHook() on the callback.
- /// @param menuhook The hook to call.
- /// @param item The selected item for which the hook was called.
- /// @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully.
- /// @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on
- /// won't provide this function.
- ///
- virtual AE_DSP_ERROR MenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA& item) { return AE_DSP_ERROR_NOT_IMPLEMENTED; }
- //--------------------------------------------------------------------------
- //@}
-
- //==========================================================================
- /// @name DSP processing control, used to open and close a stream
- /// @remarks Valid implementation required.
- ///
- //@{
- ///
- /// @brief Set up Audio DSP with selected audio settings (use the basic
- /// present audio stream data format).
- /// Used to detect available add-ons for present stream, as example stereo
- /// surround upmix not needed on 5.1 audio stream.
- /// @param addonSettings The add-ons audio settings.
- /// @param properties The properties of the currently playing stream.
- /// @param handle On this becomes addon informated about stream id and can set function addresses which need on calls
- /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
- /// and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not
- /// supported, but without fault.
- /// @remarks Valid implementation required.
- ///
- virtual AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS& addonSettings, const AE_DSP_STREAM_PROPERTIES& properties, ADDON_HANDLE handle) = 0;
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// Remove the selected id from currently used DSP processes
- /// @param handle identification data for stream
- /// @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed
- /// @remarks Valid implementation required.
- ///
- virtual AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle) = 0;
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Ask the add-on about a requested processing mode that it is
- /// supported on the current stream. Is called about every add-on mode after
- /// successed StreamCreate.
- /// @param handle identification data for stream
- /// @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions
- /// @param mode_id The mode inside add-on which must be performed on call. Id
- /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
- /// RegisterMode callback,
- /// @param unique_db_mode_id The Mode unique id generated from dsp database.
- /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
- /// or if the stream is not supported the add-on must return
- /// AE_DSP_ERROR_IGNORE_ME.
- /// @remarks Valid implementation required.
- ///
- virtual AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id) = 0;
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Set up Audio DSP with selected audio settings (detected on data of
- /// first present audio packet)
- /// @param addonSettings The add-ons audio settings.
- /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully.
- /// @remarks Valid implementation required.
- ///
- virtual AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS& addonSettings) = 0;
- //--------------------------------------------------------------------------
-
- //@}
-
- /// @name DSP input processing
- /// @remarks Only used by KODI if bSupportsInputProcess is set to true.
- ///
- //@{
- //==========================================================================
- ///
- /// @brief DSP input processing
- /// Can be used to have unchanged stream..
- /// All DSP add-ons allowed to-do this.
- /// @param handle identification data for stream
- /// @param array_in Pointer to data memory
- /// @param samples Amount of samples inside array_in
- /// @return true if work was OK
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual bool InputProcess(const ADDON_HANDLE handle, const float** array_in, unsigned int samples) { return true; }
- //--------------------------------------------------------------------------
- //@}
-
- /// @name DSP pre-resampling
- /// @remarks Only used by KODI if bSupportsInputResample is set to true.
- ///
- //@{
- //==========================================================================
- ///
- /// @brief If the add-on operate with buffered arrays and the output size can
- /// be higher as the input it becomes asked about needed size before any
- /// InputResampleProcess call.
- /// @param handle identification data for stream
- /// @return The needed size of output array or 0 if no changes within it
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief DSP re sample processing before master.
- /// Here a high quality resample can be performed.
- /// Only one DSP add-on is allowed to-do this!
- /// @param handle identification data for stream
- /// @param array_in Pointer to input data memory
- /// @param array_out Pointer to output data memory
- /// @param samples Amount of samples inside array_in
- /// @return Amount of samples processed
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int InputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Returns the re-sampling generated new sample rate used before the
- /// master process
- /// @param handle identification data for stream
- /// @return The new sample rate
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual int InputResampleSampleRate(const ADDON_HANDLE handle) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Returns the time in seconds that it will take
- /// for the next added packet to be returned to KODI.
- /// @param handle identification data for stream
- /// @return the delay in seconds
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual float InputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; }
- //--------------------------------------------------------------------------
- //@}
-
- /** @name DSP Pre processing
- * @remarks Only used by KODI if bSupportsPreProcess is set to true.
- */
- //@{
- //==========================================================================
- ///
- /// @brief If the addon operate with buffered arrays and the output size can
- /// be higher as the input it becomes asked about needed size before any
- /// PreProcess call.
- /// @param handle identification data for stream
- /// @param mode_id The mode inside add-on which must be performed on call. Id
- /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
- /// RegisterMode callback and can be defined from add-on as a structure
- /// pointer or anything else what is needed to find it.
- /// @return The needed size of output array or 0 if no changes within it
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Returns the time in seconds that it will take
- /// for the next added packet to be returned to KODI.
- /// @param handle identification data for stream
- /// @param mode_id The mode inside add-on which must be performed on call. Id
- /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
- /// RegisterMode callback and can be defined from add-on as a structure
- /// pointer or anything else what is needed to find it.
- /// @return the delay in seconds
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief DSP preprocessing
- /// All DSP add-ons allowed to-do this.
- /// @param handle identification data for stream
- /// @param mode_id The mode inside add-on which must be performed on call. Id
- /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
- /// RegisterMode callback and can be defined from add-on as a structure
- /// pointer or anything else what is needed to find it.
- /// @param array_in Pointer to input data memory
- /// @param array_out Pointer to output data memory
- /// @param samples Amount of samples inside array_in
- /// @return Amount of samples processed
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; }
- //--------------------------------------------------------------------------
- //@}
-
- /** @name DSP Master processing
- * @remarks Only used by KODI if bSupportsMasterProcess is set to true.
- */
- //@{
- //==========================================================================
- ///
- /// @brief Set the active master process mode
- /// @param handle identification data for stream
- /// @param type Requested stream type for the selected master mode
- /// @param mode_id The Mode identifier.
- /// @param unique_db_mode_id The Mode unique id generated from DSP database.
- /// @return AE_DSP_ERROR_NO_ERROR if the setup was successful
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id) { return AE_DSP_ERROR_NOT_IMPLEMENTED; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief If the add-on operate with buffered arrays and the output size can
- /// be higher as the input it becomes asked about needed size before any
- /// MasterProcess call.
- /// @param handle identification data for stream
- /// @return The needed size of output array or 0 if no changes within it
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Returns the time in seconds that it will take
- /// for the next added packet to be returned to KODI.
- /// @param handle identification data for stream
- /// @return the delay in seconds
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual float MasterProcessGetDelay(const ADDON_HANDLE handle) { return 0.0f; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Returns the from selected master mode performed channel alignment
- /// @param handle identification data for stream
- /// @retval out_channel_present_flags the exact channel present flags after
- /// performed up-/downmix
- /// @return the amount channels
- /// @remarks Optional. Must be used and set if a channel up- or downmix is
- /// processed from the active master mode
- ///
- virtual int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long& out_channel_present_flags) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Master processing becomes performed with it
- /// Here a channel up-mix/down-mix for stereo surround sound can be performed
- /// Only one DSP add-on is allowed to-do this!
- /// @param handle identification data for stream
- /// @param array_in Pointer to input data memory
- /// @param array_out Pointer to output data memory
- /// @param samples Amount of samples inside array_in
- /// @return Amount of samples processed
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int MasterProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// Used to get a information string about the processed work to show on skin
- /// @return A string to show
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual std::string MasterProcessGetStreamInfoString(const ADDON_HANDLE handle) { return ""; }
- //--------------------------------------------------------------------------
- //@}
-
- /** @name DSP Post processing
- * @remarks Only used by KODI if bSupportsPostProcess is set to true.
- */
- //@{
- //==========================================================================
- ///
- /// If the add-on operate with buffered arrays and the output size can be
- /// higher as the input it becomes asked about needed size before any
- /// PostProcess call.
- /// @param handle identification data for stream
- /// @param mode_id The mode inside add-on which must be performed on call. Id
- /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
- /// RegisterMode callback, and can be defined from add-on as a structure
- /// pointer or anything else what is needed to find it.
- /// @return The needed size of output array or 0 if no changes within it
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// Returns the time in seconds that it will take
- /// for the next added packet to be returned to KODI.
- /// @param handle identification data for stream
- /// @param mode_id The mode inside add-on which must be performed on call. Id
- /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
- /// RegisterMode callback, and can be defined from add-on as a structure
- /// pointer or anything else what is needed to find it.
- /// @return the delay in seconds
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
-
- ///
- /// @brief DSP post processing
- /// On the post processing can be things performed with additional channel
- /// upmix like 6.1 to 7.1
- /// or frequency/volume corrections, speaker distance handling, equalizer... .
- /// All DSP add-ons allowed to-do this.
- /// @param handle identification data for stream
- /// @param mode_id The mode inside add-on which must be performed on call. Id
- /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
- /// RegisterMode callback, and can be defined from add-on as a structure
- /// pointer or anything else what is needed to find it.
- /// @param array_in Pointer to input data memory
- /// @param array_out Pointer to output data memory
- /// @param samples Amount of samples inside array_in
- /// @return Amount of samples processed
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; }
-
- //--------------------------------------------------------------------------
- //@}
-
- /** @name DSP Post re-sampling
- * @remarks Only used by KODI if bSupportsOutputResample is set to true.
- */
- //@{
- //==========================================================================
- ///
- /// @brief If the add-on operate with buffered arrays and the output size
- /// can be higher as the input
- /// it becomes asked about needed size before any OutputResampleProcess call.
- /// @param handle identification data for stream
- /// @return The needed size of output array or 0 if no changes within it
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Re-sampling after master processing becomes performed with it if
- /// needed, only
- /// one add-on can perform it.
- /// @param handle identification data for stream
- /// @param array_in Pointer to input data memory
- /// @param array_out Pointer to output data memory
- /// @param samples Amount of samples inside array_in
- /// @return Amount of samples processed
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual unsigned int OutputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Returns the re-sampling generated new sample rate used after the
- /// master process.
- /// @param handle identification data for stream
- /// @return The new sample rate
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual int OutputResampleSampleRate(const ADDON_HANDLE handle) { return 0; }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Returns the time in seconds that it will take for the next added
- /// packet to be returned to KODI.
- /// @param handle identification data for stream
- /// @return the delay in seconds
- /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
- /// GetCapabilities
- ///
- virtual float OutputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; }
- //--------------------------------------------------------------------------
- //@}
-
- //==========================================================================
- ///
- /// @brief Add or replace a menu hook for the context menu for this add-on
- /// @param hook The hook to add
- ///
- void AddMenuHook(AE_DSP_MENUHOOK* hook)
- {
- return m_instanceData->toKodi.add_menu_hook(m_instanceData->toKodi.kodiInstance, hook);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Remove a menu hook for the context menu for this add-on
- /// @param hook The hook to remove
- ///
- void RemoveMenuHook(AE_DSP_MENUHOOK* hook)
- {
- return m_instanceData->toKodi.remove_menu_hook(m_instanceData->toKodi.kodiInstance, hook);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Add or replace master mode information inside audio dsp database.
- /// Becomes identifier written inside mode to iModeID if it was 0 (undefined)
- /// @param mode The master mode to add or update inside database
- ///
- void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode)
- {
- return m_instanceData->toKodi.register_mode(m_instanceData->toKodi.kodiInstance, mode);
- }
- //--------------------------------------------------------------------------
-
- //==========================================================================
- ///
- /// @brief Remove a master mode from audio dsp database
- /// @param mode The Mode to remove
- ///
- void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode)
- {
- return m_instanceData->toKodi.unregister_mode(m_instanceData->toKodi.kodiInstance, mode);
- }
- //--------------------------------------------------------------------------
-
- private:
- void SetAddonStruct(KODI_HANDLE instance)
- {
- if (instance == nullptr)
- throw std::logic_error("kodi::addon::CInstanceAudioDSP: Null pointer instance passed.");
-
- m_instanceData = static_cast<AddonInstance_AudioDSP*>(instance);
-
- m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities;
- m_instanceData->toAddon.get_dsp_name = ADDON_GetDSPName;
- m_instanceData->toAddon.get_dsp_version = ADDON_GetDSPVersion;
- m_instanceData->toAddon.menu_hook = ADDON_MenuHook;
-
- m_instanceData->toAddon.stream_create = ADDON_StreamCreate;
- m_instanceData->toAddon.stream_destroy = ADDON_StreamDestroy;
- m_instanceData->toAddon.stream_is_mode_supported = ADDON_StreamIsModeSupported;
- m_instanceData->toAddon.stream_initialize = ADDON_StreamInitialize;
-
- m_instanceData->toAddon.input_process = ADDON_InputProcess;
-
- m_instanceData->toAddon.input_resample_process_needed_samplesize = ADDON_InputResampleProcessNeededSamplesize;
- m_instanceData->toAddon.input_resample_process = ADDON_InputResampleProcess;
- m_instanceData->toAddon.input_resample_get_delay = ADDON_InputResampleGetDelay;
- m_instanceData->toAddon.input_resample_samplerate = ADDON_InputResampleSampleRate;
-
- m_instanceData->toAddon.pre_process_needed_samplesize = ADDON_PreProcessNeededSamplesize;
- m_instanceData->toAddon.pre_process_get_delay = ADDON_PreProcessGetDelay;
- m_instanceData->toAddon.pre_process = ADDON_PreProcess;
-
- m_instanceData->toAddon.master_process_set_mode = ADDON_MasterProcessSetMode;
- m_instanceData->toAddon.master_process_needed_samplesize = ADDON_MasterProcessNeededSamplesize;
- m_instanceData->toAddon.master_process_get_delay = ADDON_MasterProcessGetDelay;
- m_instanceData->toAddon.master_process_get_out_channels = ADDON_MasterProcessGetOutChannels;
- m_instanceData->toAddon.master_process = ADDON_MasterProcess;
- m_instanceData->toAddon.master_process_get_stream_info_string = ADDON_MasterProcessGetStreamInfoString;
-
- m_instanceData->toAddon.post_process_needed_samplesize = ADDON_PostProcessNeededSamplesize;
- m_instanceData->toAddon.post_process_get_delay = ADDON_PostProcessGetDelay;
- m_instanceData->toAddon.post_process = ADDON_PostProcess;
-
- m_instanceData->toAddon.output_resample_process_needed_samplesize = ADDON_OutputResampleProcessNeededSamplesize;
- m_instanceData->toAddon.output_resample_process = ADDON_OutputResampleProcess;
- m_instanceData->toAddon.output_resample_get_delay = ADDON_OutputResampleGetDelay;
- m_instanceData->toAddon.output_resample_samplerate = ADDON_OutputResampleSampleRate;
- }
-
- static inline void ADDON_GetCapabilities(AddonInstance_AudioDSP const* instance, AE_DSP_ADDON_CAPABILITIES *capabilities)
- {
- instance->toAddon.addonInstance->GetCapabilities(*capabilities);
- }
-
- static inline const char* ADDON_GetDSPName(AddonInstance_AudioDSP const* instance)
- {
- instance->toAddon.addonInstance->m_dspName = instance->toAddon.addonInstance->GetDSPName();
- return instance->toAddon.addonInstance->m_dspName.c_str();
- }
-
- static inline const char* ADDON_GetDSPVersion(AddonInstance_AudioDSP const* instance)
- {
- instance->toAddon.addonInstance->m_dspVersion = instance->toAddon.addonInstance->GetDSPVersion();
- return instance->toAddon.addonInstance->m_dspVersion.c_str();
- }
-
- static inline AE_DSP_ERROR ADDON_MenuHook(AddonInstance_AudioDSP const* instance, const AE_DSP_MENUHOOK* menuhook, const AE_DSP_MENUHOOK_DATA* item)
- {
- return instance->toAddon.addonInstance->MenuHook(*menuhook, *item);
- }
-
- static inline AE_DSP_ERROR ADDON_StreamCreate(AddonInstance_AudioDSP const* instance, const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* properties, ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->StreamCreate(*addonSettings, *properties, handle);
- }
-
- static inline AE_DSP_ERROR ADDON_StreamDestroy(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->StreamDestroy(handle);
- }
-
- static inline AE_DSP_ERROR ADDON_StreamIsModeSupported(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id)
- {
- return instance->toAddon.addonInstance->StreamIsModeSupported(handle, type, mode_id, unique_db_mode_id);
- }
-
- static inline AE_DSP_ERROR ADDON_StreamInitialize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings)
- {
- return instance->toAddon.addonInstance->StreamInitialize(handle, *addonSettings);
- }
-
- static inline bool ADDON_InputProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, unsigned int samples)
- {
- return instance->toAddon.addonInstance->InputProcess(handle, array_in, samples);
- }
-
- static inline unsigned int ADDON_InputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->InputResampleProcessNeededSamplesize(handle);
- }
-
- static inline unsigned int ADDON_InputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples)
- {
- return instance->toAddon.addonInstance->InputResampleProcess(handle, array_in, array_out, samples);
- }
-
- static inline int ADDON_InputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->InputResampleSampleRate(handle);
- }
-
- static inline float ADDON_InputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->InputResampleGetDelay(handle);
- }
-
- static inline unsigned int ADDON_PreProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
- {
- return instance->toAddon.addonInstance->PreProcessNeededSamplesize(handle, mode_id);
- }
-
- static inline float ADDON_PreProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
- {
- return instance->toAddon.addonInstance->PreProcessGetDelay(handle, mode_id);
- }
-
- static inline unsigned int ADDON_PreProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples)
- {
- return instance->toAddon.addonInstance->PreProcess(handle, mode_id, array_in, array_out, samples);
- }
-
- static inline AE_DSP_ERROR ADDON_MasterProcessSetMode(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id)
- {
- return instance->toAddon.addonInstance->MasterProcessSetMode(handle, type, mode_id, unique_db_mode_id);
- }
-
- static inline unsigned int ADDON_MasterProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->MasterProcessNeededSamplesize(handle);
- }
-
- static inline float ADDON_MasterProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->MasterProcessGetDelay(handle);
- }
-
- static inline int ADDON_MasterProcessGetOutChannels(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned long* out_channel_present_flags)
- {
- return instance->toAddon.addonInstance->MasterProcessGetOutChannels(handle, *out_channel_present_flags);
- }
-
- static inline unsigned int ADDON_MasterProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples)
- {
- return instance->toAddon.addonInstance->MasterProcess(handle, array_in, array_out, samples);
- }
-
- static inline const char* ADDON_MasterProcessGetStreamInfoString(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- instance->toAddon.addonInstance->m_streamInfoString = instance->toAddon.addonInstance->MasterProcessGetStreamInfoString(handle);
- return instance->toAddon.addonInstance->m_streamInfoString.c_str();
- }
-
- static inline unsigned int ADDON_PostProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
- {
- return instance->toAddon.addonInstance->PostProcessNeededSamplesize(handle, mode_id);
- }
-
- static inline float ADDON_PostProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
- {
- return instance->toAddon.addonInstance->PostProcessGetDelay(handle, mode_id);
- }
-
- static inline unsigned int ADDON_PostProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples)
- {
- return instance->toAddon.addonInstance->PostProcess(handle, mode_id, array_in, array_out, samples);
- }
-
- static inline unsigned int ADDON_OutputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->OutputResampleProcessNeededSamplesize(handle);
- }
-
- static inline unsigned int ADDON_OutputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples)
- {
- return instance->toAddon.addonInstance->OutputResampleProcess(handle, array_in, array_out, samples);
- }
-
- static inline int ADDON_OutputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->OutputResampleSampleRate(handle);
- }
-
- static inline float ADDON_OutputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
- {
- return instance->toAddon.addonInstance->OutputResampleGetDelay(handle);
- }
-
- std::string m_dspName;
- std::string m_dspVersion;
- std::string m_streamInfoString;
- AddonInstance_AudioDSP* m_instanceData;
- };
-
-} /* namespace addon */
-} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt
index ba4f889444..44aaf054f0 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt
@@ -1,5 +1,4 @@
-set(HEADERS AudioDSP.h
- AudioDecoder.h
+set(HEADERS AudioDecoder.h
AudioEncoder.h
ImageDecoder.h
Inputstream.h
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
index 0ff862d7de..271df98d0d 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
@@ -71,8 +71,6 @@ typedef void* (*KODIGUILib_RegisterMe)(void *addonData);
typedef void (*KODIGUILib_UnRegisterMe)(void *addonData, void *cbTable);
typedef void* (*KODIPVRLib_RegisterMe)(void *addonData);
typedef void (*KODIPVRLib_UnRegisterMe)(void *addonData, void *cbTable);
-typedef void* (*KODIADSPLib_RegisterMe)(void *addonData);
-typedef void (*KODIADSPLib_UnRegisterMe)(void *addonData, void *cbTable);
typedef void* (*KODICodecLib_RegisterMe)(void *addonData);
typedef void (*KODICodecLib_UnRegisterMe)(void *addonData, void *cbTable);
typedef void* (*KODIINPUTSTREAMLib_RegisterMe)(void *addonData);
@@ -96,8 +94,6 @@ typedef struct AddonCB
KODIGUILib_UnRegisterMe GUILib_UnRegisterMe;
KODIPVRLib_RegisterMe PVRLib_RegisterMe;
KODIPVRLib_UnRegisterMe PVRLib_UnRegisterMe;
- KODIADSPLib_RegisterMe ADSPLib_RegisterMe;
- KODIADSPLib_UnRegisterMe ADSPLib_UnRegisterMe;
KODIINPUTSTREAMLib_RegisterMe INPUTSTREAMLib_RegisterMe;
KODIINPUTSTREAMLib_UnRegisterMe INPUTSTREAMLib_UnRegisterMe;
KODIPeripheralLib_RegisterMe PeripheralLib_RegisterMe;
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h
index 2650f82017..b893517464 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h
@@ -76,11 +76,6 @@
#define ADDON_GLOBAL_VERSION_NETWORK_XML_ID "kodi.binary.global.network"
#define ADDON_GLOBAL_VERSION_NETWORK_DEPENDS "Network.h"
-#define ADDON_INSTANCE_VERSION_ADSP "0.2.0"
-#define ADDON_INSTANCE_VERSION_ADSP_MIN "0.2.0"
-#define ADDON_INSTANCE_VERSION_ADSP_XML_ID "kodi.binary.instance.adsp"
-#define ADDON_INSTANCE_VERSION_ADSP_DEPENDS "addon-instance/AudioDSP.h"
-
#define ADDON_INSTANCE_VERSION_AUDIODECODER "2.0.0"
#define ADDON_INSTANCE_VERSION_AUDIODECODER_MIN "2.0.0"
#define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID "kodi.binary.instance.audiodecoder"
@@ -164,7 +159,6 @@ typedef enum ADDON_TYPE
ADDON_GLOBAL_MAX = 5, // Last used global id, used in loops to check versions. Need to change if new global type becomes added.
/* addon type instances */
- ADDON_INSTANCE_ADSP = 101,
ADDON_INSTANCE_AUDIODECODER = 102,
ADDON_INSTANCE_AUDIOENCODER = 103,
ADDON_INSTANCE_GAME = 104,
@@ -224,10 +218,6 @@ inline const char* GetTypeVersion(int type)
#endif
/* addon type instances */
-#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_ADSP_USED)
- case ADDON_INSTANCE_ADSP:
- return ADDON_INSTANCE_VERSION_ADSP;
-#endif
#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_AUDIODECODER_USED)
case ADDON_INSTANCE_AUDIODECODER:
return ADDON_INSTANCE_VERSION_AUDIODECODER;
@@ -303,8 +293,6 @@ inline const char* GetTypeMinVersion(int type)
return ADDON_GLOBAL_VERSION_NETWORK_MIN;
/* addon type instances */
- case ADDON_INSTANCE_ADSP:
- return ADDON_INSTANCE_VERSION_ADSP_MIN;
case ADDON_INSTANCE_AUDIODECODER:
return ADDON_INSTANCE_VERSION_AUDIODECODER_MIN;
case ADDON_INSTANCE_AUDIOENCODER:
@@ -357,8 +345,6 @@ inline const char* GetTypeName(int type)
return "Network";
/* addon type instances */
- case ADDON_INSTANCE_ADSP:
- return "ADSP";
case ADDON_INSTANCE_AUDIODECODER:
return "AudioDecoder";
case ADDON_INSTANCE_AUDIOENCODER:
@@ -408,8 +394,6 @@ inline int GetTypeId(const char* name)
return ADDON_GLOBAL_FILESYSTEM;
else if (strcmp(name, "network") == 0)
return ADDON_GLOBAL_NETWORK;
- else if (strcmp(name, "adsp") == 0)
- return ADDON_INSTANCE_ADSP;
else if (strcmp(name, "audiodecoder") == 0)
return ADDON_INSTANCE_AUDIODECODER;
else if (strcmp(name, "audioencoder") == 0)
diff --git a/xbmc/cores/AudioEngine/CMakeLists.txt b/xbmc/cores/AudioEngine/CMakeLists.txt
index da19fdd093..af0d552d7c 100644
--- a/xbmc/cores/AudioEngine/CMakeLists.txt
+++ b/xbmc/cores/AudioEngine/CMakeLists.txt
@@ -1,11 +1,5 @@
set(SOURCES AEResampleFactory.cpp
AESinkFactory.cpp
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.cpp
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.cpp
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.cpp
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.cpp
- Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.cpp
Encoders/AEEncoderFFmpeg.cpp
Engines/ActiveAE/ActiveAE.cpp
Engines/ActiveAE/ActiveAEBuffer.cpp
@@ -24,12 +18,6 @@ set(SOURCES AEResampleFactory.cpp
set(HEADERS AEResampleFactory.h
AESinkFactory.h
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.h
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.h
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h
- Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h
- Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.h
Encoders/AEEncoderFFmpeg.h
Engines/ActiveAE/ActiveAE.h
Engines/ActiveAE/ActiveAEBuffer.h
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
index 21902bdbcd..177d4ba630 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
@@ -26,8 +26,6 @@ using namespace ActiveAE;
#include "ActiveAESound.h"
#include "ActiveAEStream.h"
#include "ServiceBroker.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/AudioEngine/Utils/AEStreamInfo.h"
#include "cores/AudioEngine/AEResampleFactory.h"
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
index bca6d0c651..1f188f90cf 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
@@ -21,7 +21,6 @@
#include "ActiveAE.h"
#include "ActiveAEBuffer.h"
#include "ActiveAEFilter.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h"
#include "cores/AudioEngine/Engines/ActiveAE/ActiveAE.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/AudioEngine/AEResampleFactory.h"
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
index f17510699d..502691a7e1 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
@@ -21,7 +21,6 @@
#include "cores/AudioEngine/Utils/AEAudioFormat.h"
#include "cores/AudioEngine/Interfaces/AE.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
#include <deque>
#include <memory>
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp
deleted file mode 100644
index 5297b6dcae..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp
+++ /dev/null
@@ -1,949 +0,0 @@
-/*
- * Copyright (C) 2010-2015 Team Kodi
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Kodi; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ActiveAEDSP.h"
-#include "ServiceBroker.h"
-
-#include <utility>
-#include <functional>
-
-extern "C" {
-#include "libavutil/channel_layout.h"
-}
-
-#include "ActiveAEDSPProcess.h"
-#include "addons/AddonInstaller.h"
-#include "addons/AddonSystemSettings.h"
-#include "addons/binary-addons/BinaryAddonBase.h"
-#include "addons/settings/GUIDialogAddonSettings.h"
-#include "Application.h"
-#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h"
-#include "cores/AudioEngine/Interfaces/AEResample.h"
-#include "cores/AudioEngine/Utils/AEUtil.h"
-#include "dialogs/GUIDialogKaiToast.h"
-#include "dialogs/GUIDialogSelect.h"
-#include "guiinfo/GUIInfoLabels.h"
-#include "guilib/GUIComponent.h"
-#include "guilib/GUIWindowManager.h"
-#include "guilib/LocalizeStrings.h"
-#include "messaging/ApplicationMessenger.h"
-#include "messaging/helpers/DialogHelper.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/dialogs/GUIDialogAudioDSPManager.h"
-#include "settings/MediaSettings.h"
-#include "settings/MediaSourceSettings.h"
-#include "settings/Settings.h"
-#include "utils/JobManager.h"
-#include "utils/log.h"
-#include "utils/StringUtils.h"
-
-
-using namespace ADDON;
-using namespace ActiveAE;
-using namespace KODI::MESSAGING;
-
-using KODI::MESSAGING::HELPERS::DialogResponse;
-
-#define MIN_DSP_ARRAY_SIZE 4096
-
-/*! @name Master audio dsp control class */
-//@{
-CActiveAEDSP::CActiveAEDSP()
- : m_isActive(false)
- , m_usedProcessesCnt(0)
- , m_activeProcessId(-1)
- , m_isValidAudioDSPSettings(false)
-{
- Cleanup();
-}
-
-CActiveAEDSP::~CActiveAEDSP()
-{
- Shutdown();
- //CSettings::GetInstance().UnregisterCallback(this);
- //CLog::Log(LOGDEBUG, "ActiveAE DSP - destroyed");
-}
-
-/*! @name initialization and configuration methods */
-//@{
-void CActiveAEDSP::Init(void)
-{
- /* create and open database */
- if (!m_databaseDSP.IsOpen())
- m_databaseDSP.Open();
-
- std::set<std::string> settingSet;
- settingSet.insert(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED);
- settingSet.insert(CSettings::SETTING_AUDIOOUTPUT_DSPSETTINGS);
- settingSet.insert(CSettings::SETTING_AUDIOOUTPUT_DSPRESETDB);
- //! @todo reimplement this with AudioDSP V2.0
- //CSettings::GetInstance().RegisterCallback(this, settingSet);
-
- CSingleLock lock(m_critSection);
-
- UpdateAddons();
- m_isActive = true;
-}
-//@}
-
-class CActiveAEDSPModeUpdateJob : public CJob
-{
-public:
- CActiveAEDSPModeUpdateJob() = default;
- ~CActiveAEDSPModeUpdateJob(void) override = default;
-
- bool DoWork(void) override
- {
- return true;
- }
-};
-
-void CActiveAEDSP::TriggerModeUpdate(bool bAsync /* = true */)
-{
- if (bAsync)
- {
- CActiveAEDSPModeUpdateJob *job = new CActiveAEDSPModeUpdateJob();
- CJobManager::GetInstance().AddJob(job, NULL);
- return;
- }
-
- CLog::Log(LOGINFO, "ActiveAE DSP - %s - Update mode selections", __FUNCTION__);
-
-
- CSingleLock lock(m_critSection);
-
- if (!m_databaseDSP.IsOpen())
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - failed to open the database");
- return;
- }
-
- for (unsigned int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i)
- {
- m_modes[i].clear();
- m_databaseDSP.GetModes(m_modes[i], i);
- }
-
- if (m_addonToDestroy.size() > 0)
- {
- for (std::list<AE_DSP_ADDON>::iterator iter = m_addonToDestroy.begin(); iter != m_addonToDestroy.end(); ++iter)
- {
- if ((*iter)->ReadyToUse())
- {
- (*iter)->Destroy();
- }
- }
- m_addonToDestroy.clear();
- }
-
- if (m_usedProcessesCnt > 0)
- {
- for (unsigned int i = 0; i < m_usedProcessesCnt; i++)
- {
- m_usedProcesses[i]->ForceReinit();
- }
- }
-}
-
-void CActiveAEDSP::Shutdown(void)
-{
- /* check whether the audio dsp is loaded */
- if (!m_isActive)
- return;
-
- CSingleLock lock(m_critSection);
-
- CLog::Log(LOGNOTICE, "ActiveAE DSP - stopping");
-
- m_addonMap.clear();
-
- /* unload all data */
- Cleanup();
-
- /* close database */
- if (m_databaseDSP.IsOpen())
- m_databaseDSP.Close();
-}
-
-void CActiveAEDSP::Cleanup(void)
-{
- CActiveAEDSPProcessPtr tmp;
- for (unsigned int i = 0; i < AE_DSP_STREAM_MAX_STREAMS; ++i)
- m_usedProcesses[i] = tmp;
-
- m_isActive = false;
- m_usedProcessesCnt = 0;
- m_isValidAudioDSPSettings = false;
-
- for (unsigned int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i)
- m_modes[i].clear();
-}
-
-bool CActiveAEDSP::InstallAddonAllowed(const std::string &strAddonId) const
-{
- return !m_isActive ||
- !IsInUse(strAddonId) ||
- m_usedProcessesCnt == 0;
-}
-
-void CActiveAEDSP::ResetDatabase(void)
-{
- CLog::Log(LOGNOTICE, "ActiveAE DSP - clearing the audio DSP database");
-
- if (IsProcessing())
- {
- CLog::Log(LOGNOTICE, "ActiveAE DSP - stopping playback");
- CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_STOP);
- }
-
- /* stop the system */
- //! @todo why is a deactivation of adsp needed?
- //Deactivate();
-
- if (m_databaseDSP.Open())
- {
- m_databaseDSP.DeleteModes();
- m_databaseDSP.DeleteActiveDSPSettings();
- m_databaseDSP.DeleteAddons();
-
- m_databaseDSP.Close();
- }
-
- CLog::Log(LOGNOTICE, "ActiveAE DSP - database cleared");
-
- CLog::Log(LOGNOTICE, "ActiveAE DSP - restarting the audio DSP handler");
- m_databaseDSP.Open();
- Cleanup();
- //! @todo why is a deactivation of adsp needed?
- //Activate();
-}
-//@}
-
-/*! @name Settings and action callback methods (OnAction currently unused */
-//@{
-void CActiveAEDSP::OnSettingAction(std::shared_ptr<const CSetting> setting)
-{
- if (setting == NULL)
- return;
-
- const std::string &settingId = setting->GetId();
-
- if (settingId == CSettings::SETTING_AUDIOOUTPUT_DSPSETTINGS)
- {
- CGUIDialogAudioDSPManager *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogAudioDSPManager>(WINDOW_DIALOG_AUDIO_DSP_MANAGER);
-
- if (dialog)
- dialog->Open();
- }
- else if (settingId == CSettings::SETTING_AUDIOOUTPUT_DSPRESETDB)
- {
- if (HELPERS::ShowYesNoDialogLines(CVariant{19098}, CVariant{36440}, CVariant{750}) ==
- DialogResponse::YES)
- {
- CDateTime::ResetTimezoneBias();
- ResetDatabase();
- }
- }
-}
-//@}
-
-/*! @name addon installation callback methods */
-//@{
-bool CActiveAEDSP::IsInUse(const std::string &strAddonId) const
-{
- CSingleLock lock(m_critSection);
-
- for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
- if (!CServiceBroker::GetAddonMgr().IsAddonDisabled(citr->second->ID()) && citr->second->ID() == strAddonId)
- return true;
- return false;
-}
-
-bool CActiveAEDSP::IsKnownAudioDSPAddon(const std::string& addonId) const
-{
- // database IDs start at 1
- return GetAudioDSPAddonId(addonId) > 0;
-}
-
-int CActiveAEDSP::GetAudioDSPAddonId(const std::string& addonId) const
-{
- CSingleLock lock(m_critSection);
-
- for (auto &entry : m_addonMap)
- {
- if (entry.second->ID() == addonId)
- {
- return entry.first;
- }
- }
-
- return -1;
-}
-//@}
-
-/*! @name GUIInfoManager calls */
-//@{
-bool CActiveAEDSP::TranslateBoolInfo(DWORD dwInfo) const
-{
- bool bReturn = false;
-
- CSingleLock lock(m_critSection);
-
- if (m_activeProcessId < 0)
- {
- return false;
- }
-
- if (dwInfo == ADSP_HAS_MODES)
- return HasAvailableModes();
-
- if (!IsProcessing() || !m_usedProcesses[m_activeProcessId])
- return false;
-
- switch (dwInfo)
- {
- case ADSP_IS_ACTIVE:
- bReturn = true;
- break;
- case ADSP_HAS_INPUT_RESAMPLE:
- bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_INPUT_RESAMPLE);
- break;
- case ADSP_HAS_PRE_PROCESS:
- bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_PRE_PROCESS);
- break;
- case ADSP_HAS_MASTER_PROCESS:
- bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_MASTER_PROCESS);
- break;
- case ADSP_HAS_POST_PROCESS:
- bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_POST_PROCESS);
- break;
- case ADSP_HAS_OUTPUT_RESAMPLE:
- bReturn = m_usedProcesses[m_activeProcessId]->HasActiveModes(AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE);
- break;
- case ADSP_MASTER_ACTIVE:
- bReturn = m_usedProcesses[m_activeProcessId]->GetActiveMasterMode() != NULL;
- break;
- default:
- break;
- };
-
- return bReturn;
-}
-
-bool CActiveAEDSP::TranslateCharInfo(DWORD dwInfo, std::string &strValue) const
-{
- bool bReturn = false;
-
- CSingleLock lock(m_critSection);
-
- if (m_activeProcessId < 0)
- {
- return false;
- }
-
- if (!IsProcessing() || !m_usedProcesses[m_activeProcessId])
- return false;
-
- CActiveAEDSPModePtr activeMaster = m_usedProcesses[m_activeProcessId]->GetActiveMasterMode();
- if (activeMaster == NULL)
- return false;
-
- switch (dwInfo)
- {
- case ADSP_ACTIVE_STREAM_TYPE:
- bReturn = true;
- strValue = g_localizeStrings.Get(GetStreamTypeName(m_usedProcesses[m_activeProcessId]->GetUsedStreamType()));
- break;
- case ADSP_DETECTED_STREAM_TYPE:
- bReturn = true;
- strValue = g_localizeStrings.Get(GetStreamTypeName(m_usedProcesses[m_activeProcessId]->GetDetectedStreamType()));
- break;
- case ADSP_MASTER_NAME:
- {
- bReturn = true;
- AE_DSP_ADDON addon;
- int modeId = activeMaster->ModeID();
- if (modeId == AE_DSP_MASTER_MODE_ID_PASSOVER || modeId >= AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES)
- strValue = g_localizeStrings.Get(activeMaster->ModeName());
- }
- break;
- case ADSP_MASTER_INFO:
- bReturn = m_usedProcesses[m_activeProcessId]->GetMasterModeStreamInfoString(strValue);
- break;
- case ADSP_MASTER_OWN_ICON:
- bReturn = true;
- strValue = activeMaster->IconOwnModePath();
- break;
- case ADSP_MASTER_OVERRIDE_ICON:
- bReturn = true;
- strValue = activeMaster->IconOverrideModePath();
- break;
- default:
- strValue.clear();
- bReturn = false;
- break;
- };
-
- return bReturn;
-}
-//@}
-
-/*! @name Current processing streams control function methods */
-//@{
-CAEChannelInfo CActiveAEDSP::GetInternalChannelLayout(AEStdChLayout stdLayout)
-{
- uint64_t channelLayoutOut;
- switch (stdLayout)
- {
- default:
- case AE_CH_LAYOUT_2_0:
- channelLayoutOut = AV_CH_LAYOUT_STEREO;
- break;
- case AE_CH_LAYOUT_2_1:
- channelLayoutOut = AV_CH_LAYOUT_2POINT1;
- break;
- case AE_CH_LAYOUT_3_0:
- channelLayoutOut = AV_CH_LAYOUT_SURROUND;
- break;
- case AE_CH_LAYOUT_3_1:
- channelLayoutOut = AV_CH_LAYOUT_3POINT1;
- break;
- case AE_CH_LAYOUT_4_0:
- channelLayoutOut = AV_CH_LAYOUT_2_2;
- break;
- case AE_CH_LAYOUT_4_1:
- channelLayoutOut = AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY;
- break;
- case AE_CH_LAYOUT_5_0:
- channelLayoutOut = AV_CH_LAYOUT_5POINT0;
- break;
- case AE_CH_LAYOUT_5_1:
- channelLayoutOut = AV_CH_LAYOUT_5POINT1;
- break;
- case AE_CH_LAYOUT_7_0:
- channelLayoutOut = AV_CH_LAYOUT_7POINT0;
- break;
- case AE_CH_LAYOUT_7_1:
- channelLayoutOut = AV_CH_LAYOUT_7POINT1;
- break;
- }
- return CAEUtil::GetAEChannelLayout(channelLayoutOut);
-}
-
-int CActiveAEDSP::CreateDSPs(int streamId, CActiveAEDSPProcessPtr &process, const AEAudioFormat &inputFormat, const AEAudioFormat &outputFormat, bool upmix,
- bool bypassDSP, AEQuality quality, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type,
- int profile)
-{
- if (!IsActivated() || m_usedProcessesCnt >= AE_DSP_STREAM_MAX_STREAMS)
- return -1;
-
- CSingleLock lock(m_critSection);
-
- AE_DSP_STREAMTYPE requestedStreamType = LoadCurrentAudioSettings();
-
- bool wasActive = streamId != -1;
-
- CActiveAEDSPProcessPtr usedProc;
- if (0 <= streamId && streamId < AE_DSP_STREAM_MAX_STREAMS)
- {
- if (m_usedProcesses[streamId] != NULL)
- {
- usedProc = m_usedProcesses[streamId];
- }
- }
- else
- {
- for (unsigned int i = 0; i < AE_DSP_STREAM_MAX_STREAMS; ++i)
- {
- /* find a free position */
- if (m_usedProcesses[i] == NULL)
- {
- usedProc = CActiveAEDSPProcessPtr(new CActiveAEDSPProcess(i));
- streamId = i;
- break;
- }
- }
- }
-
- if (usedProc == NULL)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - can't find active processing class", __FUNCTION__);
- return -1;
- }
-
- if (!usedProc->Create(inputFormat, outputFormat, upmix, bypassDSP, quality, requestedStreamType, matrix_encoding, audio_service_type, profile))
- {
- m_usedProcesses[streamId] = CActiveAEDSPProcessPtr();
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - Creation of processing class failed", __FUNCTION__);
- return -1;
- }
-
- if (!wasActive)
- {
- process = usedProc;
- m_activeProcessId = streamId;
- m_usedProcesses[streamId] = usedProc;
- m_usedProcessesCnt++;
- }
-
- return streamId;
-}
-
-void CActiveAEDSP::DestroyDSPs(int streamId)
-{
- CSingleLock lock(m_critSection);
-
- if (0 <= streamId && streamId < AE_DSP_STREAM_MAX_STREAMS && m_usedProcesses[streamId] != NULL)
- {
- m_usedProcesses[streamId]->Destroy();
- m_usedProcesses[streamId] = CActiveAEDSPProcessPtr();
- --m_usedProcessesCnt;
- }
- if (m_usedProcessesCnt == 0)
- {
- m_activeProcessId = -1;
- }
-}
-
-CActiveAEDSPProcessPtr CActiveAEDSP::GetDSPProcess(int streamId)
-{
- CSingleLock lock(m_critSection);
-
- if (0 <= streamId && streamId < AE_DSP_STREAM_MAX_STREAMS && m_usedProcesses[streamId])
- return m_usedProcesses[streamId];
- return CActiveAEDSPProcessPtr();
-}
-
-unsigned int CActiveAEDSP::GetProcessingStreamsAmount(void)
-{
- CSingleLock lock(m_critSection);
- return m_usedProcessesCnt;
-}
-
-int CActiveAEDSP::GetActiveStreamId(void)
-{
- CSingleLock lock(m_critSection);
-
- return m_activeProcessId;
-}
-
-bool CActiveAEDSP::HasAvailableModes(void) const
-{
- CSingleLock lock(m_critSection);
-
- for (unsigned int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i)
- {
- if (!m_modes[i].empty())
- return true;
- }
-
- return false;
-}
-
-const AE_DSP_MODELIST &CActiveAEDSP::GetAvailableModes(AE_DSP_MODE_TYPE modeType)
-{
- static AE_DSP_MODELIST emptyArray;
- if (modeType < 0 || modeType >= AE_DSP_MODE_TYPE_MAX)
- return emptyArray;
-
- /*! @todo this is very hacky, AudioDSP should never return a std::vector which is protected by a CSingleLock!*/
- CSingleLock lock(m_critSection);
- return m_modes[modeType];
-}
-
-/*! @name addon update process methods */
-//@{
-bool CActiveAEDSP::StopAudioDSPAddon(AddonPtr addon, bool bRestart)
-{
- CSingleLock lock(m_critSection);
-
- int iId = GetAudioDSPAddonId(addon->ID());
- AE_DSP_ADDON mappedAddon;
- if (GetReadyAudioDSPAddon(iId, mappedAddon))
- {
- if (bRestart)
- mappedAddon->ReCreate();
- else
- mappedAddon->Destroy();
-
- return true;
- }
-
- return false;
-}
-
-void CActiveAEDSP::UpdateAddons()
-{
- AE_DSP_ADDON dspAddon;
-
- BinaryAddonBaseList addonInfos;
- CServiceBroker::GetBinaryAddonManager().GetAddonInfos(addonInfos, false, ADDON_ADSPDLL);
- if (addonInfos.empty())
- return;
-
- for (auto &addonInfo : addonInfos)
- {
- bool bEnabled = !CServiceBroker::GetAddonMgr().IsAddonDisabled(addonInfo->ID());
- if (bEnabled && (!IsKnownAudioDSPAddon(addonInfo->ID()) || !IsReadyAudioDSPAddon(addonInfo)))
- {
- std::hash<std::string> hasher;
- int iAddonId = static_cast<int>(hasher(addonInfo->ID()));
- if (iAddonId < 0)
- iAddonId = -iAddonId;
-
- if (IsKnownAudioDSPAddon(addonInfo->ID()))
- {
- AE_DSP_ADDON dspAddon;
- GetAudioDSPAddon(iAddonId, dspAddon);
- dspAddon->Create(iAddonId);
- }
- else
- {
- AE_DSP_ADDON dspAddon = std::make_shared<CActiveAEDSPAddon>(addonInfo);
- dspAddon.get()->Create(iAddonId);
- CSingleLock lock(m_critSection);
- // register the add-on
- if (m_addonMap.find(iAddonId) == m_addonMap.end())
- {
- m_addonMap.insert(std::make_pair(iAddonId, dspAddon));
- m_addonNameIds.insert(make_pair(addonInfo->ID(), iAddonId));
- }
- }
- }
- else if (!bEnabled && IsKnownAudioDSPAddon(addonInfo->ID()))
- {
- CLog::Log(LOGDEBUG, "Disabling AudioDSP add-on: %s", addonInfo->ID().c_str());
-
- CSingleLock lock(m_critSection);
- AE_DSP_ADDONMAP::iterator iter = m_addonMap.find(GetAudioDSPAddonId(addonInfo->ID()));
- if (iter != m_addonMap.end())
- {
- m_addonMap.erase(iter);
- m_addonToDestroy.push_back(dspAddon);
- }
- }
- }
-
- TriggerModeUpdate();
-}
-//@}
-
-/*! @name Played source settings methods
- * @note for save of settings see CSaveFileStateJob */
-//@{
-AE_DSP_STREAMTYPE CActiveAEDSP::LoadCurrentAudioSettings(void)
-{
- CSingleLock lock(m_critSection);
-
- AE_DSP_STREAMTYPE type = AE_DSP_ASTREAM_INVALID;
-
- if (g_application.GetAppPlayer().HasPlayer())
- {
- CFileItem currentFile(g_application.CurrentFileItem());
-
- /* load the persisted audio settings and set them as current */
- //CAudioSettings loadedAudioSettings = CMediaSettings::GetInstance().GetDefaultAudioSettings();
- //m_databaseDSP.GetActiveDSPSettings(currentFile, loadedAudioSettings);
-
- // CMediaSettings::GetInstance().GetCurrentAudioSettings() = loadedAudioSettings;
- //type = (AE_DSP_STREAMTYPE) loadedAudioSettings.m_MasterStreamTypeSel;
-
- /* settings can be saved on next audio stream change */
- m_isValidAudioDSPSettings = true;
- }
- return type;
-}
-//@}
-
-/*! @name Backend methods */
-//@{
-
-bool CActiveAEDSP::IsProcessing(void) const
-{
- return m_isActive && m_usedProcessesCnt > 0;
-}
-
-bool CActiveAEDSP::IsActivated(void) const
-{
- return m_isActive;
-}
-
-int CActiveAEDSP::EnabledAudioDSPAddonAmount(void) const
-{
- int iReturn(0);
- CSingleLock lock(m_critUpdateSection);
-
- for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
- {
- if (!CServiceBroker::GetAddonMgr().IsAddonDisabled(citr->second->ID()))
- ++iReturn;
- }
-
- return iReturn;
-}
-
-bool CActiveAEDSP::HasEnabledAudioDSPAddons(void) const
-{
- return EnabledAudioDSPAddonAmount() > 0;
-}
-
-int CActiveAEDSP::GetEnabledAudioDSPAddons(AE_DSP_ADDONMAP &addons) const
-{
- int iReturn(0);
- CSingleLock lock(m_critSection);
-
- for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
- {
- if (!CServiceBroker::GetAddonMgr().IsAddonDisabled(citr->second->ID()))
- {
- addons.insert(std::make_pair(citr->second->GetID(), citr->second));
- ++iReturn;
- }
- }
-
- return iReturn;
-}
-
-int CActiveAEDSP::ReadyAudioDSPAddonAmount(void) const
-{
- int iReturn(0);
- CSingleLock lock(m_critSection);
-
- for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
- {
- if (citr->second->ReadyToUse())
- ++iReturn;
- }
-
- return iReturn;
-}
-
-bool CActiveAEDSP::HasReadyAudioDSPAddons(void) const
-{
- return ReadyAudioDSPAddonAmount() > 0;
-}
-
-bool CActiveAEDSP::IsReadyAudioDSPAddon(int iAddonId) const
-{
- AE_DSP_ADDON addon;
- return GetReadyAudioDSPAddon(iAddonId, addon);
-}
-
-bool CActiveAEDSP::IsReadyAudioDSPAddon(const BinaryAddonBasePtr &addon)
-{
- CSingleLock lock(m_critSection);
-
- for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
- {
- if (citr->second->ID() == addon->ID())
- return citr->second->ReadyToUse();
- }
-
- return false;
-}
-
-int CActiveAEDSP::GetAddonId(const std::string& strId) const
-{
- CSingleLock lock(m_critSection);
- std::map<std::string, int>::const_iterator it = m_addonNameIds.find(strId);
- return it != m_addonNameIds.end() ? it->second : -1;
-}
-
-bool CActiveAEDSP::GetReadyAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) const
-{
- if (GetAudioDSPAddon(iAddonId, addon))
- return addon->ReadyToUse();
- return false;
-}
-
-bool CActiveAEDSP::GetAudioDSPAddonName(int iAddonId, std::string &strName) const
-{
- bool bReturn(false);
- AE_DSP_ADDON addon;
- if ((bReturn = GetReadyAudioDSPAddon(iAddonId, addon)) == true)
- strName = addon->GetAudioDSPName();
-
- return bReturn;
-}
-
-bool CActiveAEDSP::GetAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) const
-{
- bool bReturn(false);
- if (iAddonId <= AE_DSP_INVALID_ADDON_ID)
- return bReturn;
-
- CSingleLock lock(m_critSection);
-
- AE_DSP_ADDONMAP_CITR citr = m_addonMap.find(iAddonId);
- if (citr != m_addonMap.end())
- {
- addon = citr->second;
- bReturn = true;
- }
-
- return bReturn;
-}
-
-bool CActiveAEDSP::GetAudioDSPAddon(const std::string &strId, AE_DSP_ADDON &addon) const
-{
- CSingleLock lock(m_critSection);
- for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
- {
- if (citr->second->ID() == strId)
- {
- addon = citr->second;
- return true;
- }
- }
- return false;
-}
-//@}
-
-/*! @name Menu hook methods */
-//@{
-bool CActiveAEDSP::HaveMenuHooks(AE_DSP_MENUHOOK_CAT cat, int iDSPAddonID)
-{
- CSingleLock lock(m_critSection);
- for (AE_DSP_ADDONMAP_CITR citr = m_addonMap.begin(); citr != m_addonMap.end(); ++citr)
- {
- if (citr->second->ReadyToUse())
- {
- if (citr->second->HaveMenuHooks(cat))
- {
- if (iDSPAddonID > 0 && citr->second->GetID() == iDSPAddonID)
- return true;
- else if (iDSPAddonID < 0)
- return true;
- }
- else if (cat == AE_DSP_MENUHOOK_SETTING)
- {
- AddonPtr addon;
- if (CServiceBroker::GetAddonMgr().GetAddon(citr->second->ID(), addon) && addon->HasSettings())
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool CActiveAEDSP::GetMenuHooks(int iDSPAddonID, AE_DSP_MENUHOOK_CAT cat, AE_DSP_MENUHOOKS &hooks)
-{
- bool bReturn(false);
-
- if (iDSPAddonID < 0)
- return bReturn;
-
- AE_DSP_ADDON addon;
- if (GetReadyAudioDSPAddon(iDSPAddonID, addon) && addon->HaveMenuHooks(cat))
- {
- AE_DSP_MENUHOOKS *addonhooks = addon->GetMenuHooks();
- for (unsigned int i = 0; i < addonhooks->size(); ++i)
- {
- if (cat == AE_DSP_MENUHOOK_ALL || addonhooks->at(i).category == cat)
- {
- hooks.push_back(addonhooks->at(i));
- bReturn = true;
- }
- }
- }
-
- return bReturn;
-}
-//@}
-
-/*! @name General helper functions */
-//@{
-enum AEChannel CActiveAEDSP::GetKODIChannel(AE_DSP_CHANNEL channel)
-{
- switch (channel)
- {
- case AE_DSP_CH_FL: return AE_CH_FL;
- case AE_DSP_CH_FR: return AE_CH_FR;
- case AE_DSP_CH_FC: return AE_CH_FC;
- case AE_DSP_CH_LFE: return AE_CH_LFE;
- case AE_DSP_CH_BL: return AE_CH_BL;
- case AE_DSP_CH_BR: return AE_CH_BR;
- case AE_DSP_CH_FLOC: return AE_CH_FLOC;
- case AE_DSP_CH_FROC: return AE_CH_FROC;
- case AE_DSP_CH_BC: return AE_CH_BC;
- case AE_DSP_CH_SL: return AE_CH_SL;
- case AE_DSP_CH_SR: return AE_CH_SR;
- case AE_DSP_CH_TC: return AE_CH_TC;
- case AE_DSP_CH_TFL: return AE_CH_TFL;
- case AE_DSP_CH_TFC: return AE_CH_TFC;
- case AE_DSP_CH_TFR: return AE_CH_TFR;
- case AE_DSP_CH_TBL: return AE_CH_TBL;
- case AE_DSP_CH_TBC: return AE_CH_TBC;
- case AE_DSP_CH_TBR: return AE_CH_TBR;
- default:
- return AE_CH_NULL;
- }
-}
-
-AE_DSP_CHANNEL CActiveAEDSP::GetDSPChannel(enum AEChannel channel)
-{
- switch (channel)
- {
- case AE_CH_FL: return AE_DSP_CH_FL;
- case AE_CH_FR: return AE_DSP_CH_FR;
- case AE_CH_FC: return AE_DSP_CH_FC;
- case AE_CH_LFE: return AE_DSP_CH_LFE;
- case AE_CH_BL: return AE_DSP_CH_BL;
- case AE_CH_BR: return AE_DSP_CH_BR;
- case AE_CH_FLOC: return AE_DSP_CH_FLOC;
- case AE_CH_FROC: return AE_DSP_CH_FROC;
- case AE_CH_BC: return AE_DSP_CH_BC;
- case AE_CH_SL: return AE_DSP_CH_SL;
- case AE_CH_SR: return AE_DSP_CH_SR;
- case AE_CH_TC: return AE_DSP_CH_TC;
- case AE_CH_TFL: return AE_DSP_CH_TFL;
- case AE_CH_TFC: return AE_DSP_CH_TFC;
- case AE_CH_TFR: return AE_DSP_CH_TFR;
- case AE_CH_TBL: return AE_DSP_CH_TBL;
- case AE_CH_TBC: return AE_DSP_CH_TBC;
- case AE_CH_TBR: return AE_DSP_CH_TBR;
- default:
- return AE_DSP_CH_INVALID;
- }
-}
-
-/*!
- * Contains string name id's related to the AE_DSP_ASTREAM_ values
- */
-const int CActiveAEDSP::m_StreamTypeNameTable[] =
-{
- 15004, //!< "Basic"
- 249, //!< "Music"
- 157, //!< "Video"
- 15016, //!< "Games"
- 15005, //!< "Application"
- 15006, //!< "Phone"
- 15007, //!< "Message"
- 14061 //!< "Auto"
-};
-
-int CActiveAEDSP::GetStreamTypeName(unsigned int streamType)
-{
- if (streamType > AE_DSP_ASTREAM_AUTO)
- return -1;
- return m_StreamTypeNameTable[streamType];
-}
-//@}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h
deleted file mode 100644
index eed6cb85dc..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h
+++ /dev/null
@@ -1,394 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2010-2014 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ServiceBroker.h"
-#include "cores/AudioEngine/Utils/AEAudioFormat.h"
-#include "cores/AudioEngine/Interfaces/AE.h"
-#include "threads/CriticalSection.h"
-#include "threads/Thread.h"
-#include "utils/Observer.h"
-#include "messaging/IMessageTarget.h"
-
-#include "ActiveAEDSPAddon.h"
-#include "ActiveAEDSPDatabase.h"
-#include "ActiveAEDSPMode.h"
-
-#define ACTIVE_AE_DSP_STATE_OFF 0
-#define ACTIVE_AE_DSP_STATE_ON 1
-
-#define ACTIVE_AE_DSP_SYNC_ACTIVATE 0
-#define ACTIVE_AE_DSP_ASYNC_ACTIVATE 1
-
-extern "C" {
-#include "libavcodec/avcodec.h"
-}
-
-class CAction;
-
-namespace ActiveAE
-{
- class CActiveAEDSPProcess;
- class CActiveAEDSPAddon;
-
- typedef std::shared_ptr<ActiveAE::CActiveAEDSPProcess> CActiveAEDSPProcessPtr;
- typedef std::map< int, AE_DSP_ADDON > AE_DSP_ADDONMAP;
- typedef std::map< int, AE_DSP_ADDON >::iterator AE_DSP_ADDONMAP_ITR;
- typedef std::map< int, AE_DSP_ADDON >::const_iterator AE_DSP_ADDONMAP_CITR;
-
- //@{
- /*!
- * Static dsp handling class
- */
- class CActiveAEDSP : public ISettingCallback
- {
- /*! @name Master audio dsp control class */
- //@{
- public:
- /*!
- * @brief Create a new CActiveAEDSP instance, which handles all audio DSP related operations in KODI.
- */
- CActiveAEDSP(void);
-
- /*!
- * @brief Stop the ActiveAEDSP and destroy all objects it created.
- */
- ~CActiveAEDSP() override;
- //@}
-
- /*! @name initialization and configuration methods */
- //@{
- void Init(void);
- /*!
- * @brief Stops dsp processing and the backend info update thread.
- */
- void Shutdown(void);
-
- /*!
- * @brief Delete all objects and processing classes.
- */
- void Cleanup(void);
-
- /*!
- * @brief Reset the audio dsp database to it's initial state and delete all the data inside.
- */
- void ResetDatabase(void);
-
- /*!
- * @brief Check whether an add-on can be upgraded or installed without restarting the audio dsp, when the add-on is in use
- * @param strAddonId The add-on to check.
- * @return True when the add-on can be installed, false otherwise.
- */
- bool InstallAddonAllowed(const std::string& strAddonId) const;
-
- /*!
- * @brief Get the audio dsp database pointer.
- * @return The audio dsp database.
- */
- CActiveAEDSPDatabase *GetADSPDatabase(void) { return &m_databaseDSP; }
- //@}
-
- /*! @name Settings and action callback methods */
- //@{
- void OnSettingAction(std::shared_ptr<const CSetting> setting) override;
- //@}
-
- /*! @name Backend methods */
- //@{
- /*!
- * @return True when processing is possible
- */
- bool IsActivated(void) const;
-
- /*!
- * @return True when processing is active
- */
- bool IsProcessing(void) const;
- //@}
-
- /*! @name addon installation callback methods */
- //@{
- /*!
- * @brief Checks whether an add-on is loaded
- * @param strAddonId The add-on id to check
- * @return True when in use, false otherwise
- */
- bool IsInUse(const std::string& strAddonId) const;
-
- /*!
- * @brief Stop a audio dsp addon.
- * @param addon The dsp addon to stop.
- * @param bRestart If true, restart the addon.
- * @return True if the it was found, false otherwise.
- */
- bool StopAudioDSPAddon(ADDON::AddonPtr addon, bool bRestart);
-
- /*!
- * @return The amount of enabled audio dsp addons.
- */
- int EnabledAudioDSPAddonAmount(void) const;
-
- /*!
- * @return True when at least one audio dsp addon is known and enabled, false otherwise.
- */
- bool HasEnabledAudioDSPAddons(void) const;
-
- /*!
- * @brief Get all enabled audio dsp addons.
- * @param addons Store the enabled addons in this map.
- * @return The amount of enabled audio addons.
- */
- int GetEnabledAudioDSPAddons(AE_DSP_ADDONMAP &addons) const;
-
- /*!
- * @return The amount of ready audio dsp addons on current stream.
- */
- int ReadyAudioDSPAddonAmount(void) const;
-
- /*!
- * @brief Check whether there are any ready audio dsp addons.
- * @return True if at least one audio dsp addon is ready.
- */
- bool HasReadyAudioDSPAddons(void) const;
-
- /*!
- * @brief Check whether a audio dsp addon ID points to a valid and ready add-on.
- * @param iAddonId The addon ID.
- * @return True when the addon ID is valid and ready, false otherwise.
- */
- bool IsReadyAudioDSPAddon(int iAddonId) const;
-
- /*!
- * @brief Check whether a audio dsp addon pointer points to a valid and ready add-on.
- * @param addon The addon base information pointer.
- * @return True when the addon pointer is valid and ready, false otherwise.
- */
- bool IsReadyAudioDSPAddon(const ADDON::BinaryAddonBasePtr& addon);
-
- /*!
- * @brief Get the instance of the audio dsp addon.
- * @param strId The string id of the addon to get.
- * @param addon The audio dsp addon.
- * @return True if the addon was found, false otherwise.
- */
- bool GetAudioDSPAddon(const std::string &strId, AE_DSP_ADDON &addon) const;
-
- /*!
- * @brief Get the instance of the audio dsp addon.
- * @param iAddonId The id of the addon to get.
- * @param addon The audio dsp addon.
- * @return True if the addon was found, false otherwise.
- */
- bool GetAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) const;
-
- /*!
- * @brief Get the friendly name for the audio dsp addon with the given id.
- * @param iAddonId The id of the addon.
- * @param strName The friendly name of the audio dsp addon or an empty string when it wasn't found.
- * @return True if it was found, false otherwise.
- */
- bool GetAudioDSPAddonName(int iAddonId, std::string &strName) const;
-
- /*!
- * @brief Update add-ons from the AddonManager
- */
- void UpdateAddons(void);
-
- int GetAddonId(const std::string& strId) const;
- //@}
-
- /*! @name GUIInfoManager calls */
- //@{
- /*!
- * @brief Get a GUIInfoManager boolean.
- * @param dwInfo The boolean to get.
- * @return The requested boolean or false if it wasn't found.
- */
- bool TranslateBoolInfo(DWORD dwInfo) const;
-
- /*!
- * @brief Get a GUIInfoManager character string.
- * @param dwInfo The string to get.
- * @return The requested string or an empty one if it wasn't found.
- */
- bool TranslateCharInfo(DWORD dwInfo, std::string &strValue) const;
- //@}
-
- /*! @name Current processing streams control function methods */
- //@{
- /*!>
- * Get the channel position defination for given channel layout
- * @param stdLayout The layout identifier
- * @return the from given identifier set channel information class
- */
- CAEChannelInfo GetInternalChannelLayout(AEStdChLayout stdLayout);
-
- /*!>
- * Create the dsp processing with check of all addons about the used input and output audio format.
- * @param streamId The id of this stream
- * @param inputFormat The used audio stream input format
- * @param outputFormat Audio output format which is needed to send to the sinks
- * @param quality The requested quality from settings
- * @param upmix if true, the internal gets enabled
- * @param bypassDSP it true, all active AudioDSP are skipped
- * @param wasActive if it is true a recreation of present stream control becomes performed (process class becomes not deleted)
- * @return True if the dsp processing becomes available
- */
- int CreateDSPs(int streamId, CActiveAEDSPProcessPtr &process, const AEAudioFormat &inputFormat, const AEAudioFormat &outputFormat,
- bool upmix, bool bypassDSP, AEQuality quality, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type,
- int profile);
-
- /*!>
- * Destroy all allocated dsp add-ons streamId and stop processing.
- * @param streamId Stream id that should be destroyed.
- */
- void DestroyDSPs(int streamId);
-
- /*!>
- * Get the dsp processing class of given stream id
- * @param streamId The id of this stream
- */
- CActiveAEDSPProcessPtr GetDSPProcess(int streamId);
-
- /*!>
- * Get the amount of used dsp process stream handlers
- * @return Returns amount of processes
- */
- unsigned int GetProcessingStreamsAmount(void);
-
- /*!>
- * Get the currently active processing stream id
- * @return Stream id, or max unsigned int value (-1) if not active
- */
- int GetActiveStreamId(void);
-
- /*!
- * @brief Check for available modes present from add-ons
- *
- * @return true if one or more modes are available
- */
- bool HasAvailableModes(void) const;
-
- /*!>
- * Used to get all available modes on currently enabled add-ons
- * It is used from CActiveAEDSPProcess to get a sorted modes list for a processing
- * over the add-ons, several call to the same addon is possible with different mode id's.
- * @param modeType The type to get
- * @return modes Pointer to a buffer array where all available modes of type written in
- */
- const AE_DSP_MODELIST &GetAvailableModes(AE_DSP_MODE_TYPE modeType);
-
- /*!
- * @brief Load the settings for the current audio from the database.
- * @return If it was present inside settings it return the type of this settings
- */
- AE_DSP_STREAMTYPE LoadCurrentAudioSettings(void);
-
- /*!
- * @brief Perfoms a update of all processing calls over the add-ons
- * @param bAsync if true the update becomes performed on background
- */
- void TriggerModeUpdate(bool bAsync = true);
- //@}
-
- /*! @name Menu hook methods */
- //@{
- /*!
- * @brief Check whether a audio dsp addon has any audio DSP specific menu entries.
- * @param cat The category to know
- * @param iAddonId The ID of the addon to get the menu entries for. Get the menu for the active channel if iAddonId < 0.
- * @return True if the dsp addon has any menu hooks, false otherwise.
- * @note The main usage for this method is to have bigger modifiable addon setting dialogs which make the usage of
- * standard addon settings dialog as option to it
- * see <kodi/addon-instance/AudioDSP.h> for available types
- */
- bool HaveMenuHooks(AE_DSP_MENUHOOK_CAT cat, int iAddonId = -1);
-
- /*!
- * @brief Get the menu hooks for a dsp addon.
- * @param iDSPAddonID The dsp addon to get the hooks for.
- * @param cat The requested menu category
- * @param hooks The container to add the hooks to.
- * @return True if the hooks were added successfully (if any), false otherwise.
- * @note The main usage for this method is to have bigger modifiable addon setting dialogs, the basic addon settings dialog
- * can't be opened with it (is only in the menu list from ProcessMenuHooks)
- * see <kodi/addon-instance/AudioDSP.h> for available types
- */
- bool GetMenuHooks(int iDSPAddonID, AE_DSP_MENUHOOK_CAT cat, AE_DSP_MENUHOOKS &hooks);
- //@}
-
- /*! @name General helper functions */
- //@{
- /*!
- * @brief Translate audio dsp channel flag to KODI channel flag
- */
- static enum AEChannel GetKODIChannel(AE_DSP_CHANNEL channel);
-
- /*!
- * @brief Translate KODI channel flag to audio dsp channel flag
- */
- static AE_DSP_CHANNEL GetDSPChannel(enum AEChannel channel);
-
- /*!
- * @brief Get name label id to given stream type id
- */
- static int GetStreamTypeName(unsigned int streamType);
- //@}
-
- protected:
- /*!
- * @brief Check whether a dsp addon is registered.
- * @param addonId The addon ID name.
- * @return True if this addon is registered, false otherwise.
- */
- bool IsKnownAudioDSPAddon(const std::string& addonId) const;
-
- /*!
- * @brief Get the instance of the dsp addon, if it's ready.
- * @param iAddonId The id of the dsp addon to get.
- * @param addon The addon data pointer.
- * @return True if the addon is ready, false otherwise.
- */
- bool GetReadyAudioDSPAddon(int iAddonId, AE_DSP_ADDON &addon) const;
-
- /*!
- * @brief Get the dsp related Id for selected addon
- * @param addonId The addon ID name.
- * @return the id of the asked addon, -1 if not available
- */
- int GetAudioDSPAddonId(const std::string& addonId) const;
-
-
- static const int m_StreamTypeNameTable[]; /*!< Table for stream type strings related to type id */
- bool m_isActive; /*!< set to true if all available dsp addons are loaded */
- AE_DSP_ADDONMAP m_addonMap; /*!< a map of all known audio dsp addons */
- std::list<AE_DSP_ADDON> m_addonToDestroy; /*!< a map of all known audio dsp addons */
- CActiveAEDSPDatabase m_databaseDSP; /*!< the database for all audio DSP related data */
- CCriticalSection m_critSection; /*!< Critical lock for control functions */
- CCriticalSection m_critUpdateSection; /*!< Critical lock for update thread related functions */
- unsigned int m_usedProcessesCnt; /*!< the amount of used addon processes */
- CActiveAEDSPProcessPtr m_usedProcesses[AE_DSP_STREAM_MAX_STREAMS]; /*!< Pointer to active process performing classes */
- int m_activeProcessId; /*!< The currently active audio stream id of a playing file source */
- bool m_isValidAudioDSPSettings; /*!< if settings load was successfull it becomes true */
- AE_DSP_MODELIST m_modes[AE_DSP_MODE_TYPE_MAX]; /*!< list of currently used dsp processing calls */
- std::map<std::string, int> m_addonNameIds; /*!< map add-on names to IDs */
- };
- //@}
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.cpp
deleted file mode 100644
index 4d16435018..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.cpp
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright (C) 2010-2015 Team Kodi
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Kodi; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <vector>
-#include "Application.h"
-#include "ActiveAEDSPAddon.h"
-#include "ActiveAEDSP.h"
-#include "filesystem/SpecialProtocol.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/Settings.h"
-#include "utils/log.h"
-#include "utils/StringUtils.h"
-
-using namespace ADDON;
-using namespace ActiveAE;
-
-#define DEFAULT_INFO_STRING_VALUE "unknown"
-
-CActiveAEDSPAddon::CActiveAEDSPAddon(BinaryAddonBasePtr addonInfo)
- : IAddonInstanceHandler(ADDON_INSTANCE_ADSP, addonInfo)
-{
- ResetProperties();
-}
-
-CActiveAEDSPAddon::~CActiveAEDSPAddon(void)
-{
- Destroy();
-}
-
-void CActiveAEDSPAddon::ResetProperties(int iClientId /* = AE_DSP_INVALID_ADDON_ID */)
-{
- /* initialise members */
- m_menuhooks.clear();
- m_strUserPath = CSpecialProtocol::TranslatePath(Profile());
- m_strAddonPath = CSpecialProtocol::TranslatePath(Path());
- m_bReadyToUse = false;
- m_isInUse = false;
- m_iClientId = iClientId;
- m_strAudioDSPVersion = DEFAULT_INFO_STRING_VALUE;
- m_strFriendlyName = DEFAULT_INFO_STRING_VALUE;
- m_strAudioDSPName = DEFAULT_INFO_STRING_VALUE;
- m_addonCapabilities = {0};
-
- m_struct = {{0}};
- m_struct.props.strUserPath = m_strUserPath.c_str();
- m_struct.props.strAddonPath = m_strAddonPath.c_str();
-
- m_struct.toKodi.kodiInstance = this;
- m_struct.toKodi.add_menu_hook = cb_add_menu_hook;
- m_struct.toKodi.remove_menu_hook = cb_remove_menu_hook;
- m_struct.toKodi.register_mode = cb_register_mode;
- m_struct.toKodi.unregister_mode = cb_unregister_mode;
-}
-
-bool CActiveAEDSPAddon::Create(int iClientId)
-{
- if (iClientId <= AE_DSP_INVALID_ADDON_ID)
- return false;
-
- /* ensure that a previous instance is destroyed */
- Destroy();
-
- /* reset all properties to defaults */
- ResetProperties(iClientId);
-
- /* initialise the add-on */
- CLog::Log(LOGDEBUG, "ActiveAE DSP - %s - creating audio dsp add-on instance '%s'", __FUNCTION__, Name().c_str());
- /* Open the class "kodi::addon::CInstanceAudioDSP" on add-on side */
- m_bReadyToUse = (CreateInstance(&m_struct) == ADDON_STATUS_OK);
- if (!m_bReadyToUse)
- {
- CLog::Log(LOGFATAL, "ActiveAE DSP: failed to create instance for '%s' and not usable!", ID().c_str());
- return false;
- }
-
- GetAddonProperties();
-
- return true;
-}
-
-void CActiveAEDSPAddon::Destroy(void)
-{
- /* reset 'ready to use' to false */
- if (!m_bReadyToUse)
- return;
- m_bReadyToUse = false;
-
- CLog::Log(LOGDEBUG, "ActiveAE DSP - %s - destroying audio dsp add-on '%s'", __FUNCTION__, GetFriendlyName().c_str());
-
- /* Destroy the class "kodi::addon::CInstanceAudioDSP" on add-on side */
- DestroyInstance();
-
- /* reset all properties to defaults */
- ResetProperties();
-}
-
-void CActiveAEDSPAddon::ReCreate(void)
-{
- int iClientID(m_iClientId);
- Destroy();
-
- /* recreate the instance */
- Create(iClientID);
-}
-
-bool CActiveAEDSPAddon::ReadyToUse(void) const
-{
- return m_bReadyToUse;
-}
-
-int CActiveAEDSPAddon::GetID(void) const
-{
- return m_iClientId;
-}
-
-bool CActiveAEDSPAddon::IsInUse() const
-{
- return m_isInUse;
-}
-
-void CActiveAEDSPAddon::GetAddonProperties(void)
-{
- AE_DSP_ADDON_CAPABILITIES addonCapabilities;
-
- /* get the capabilities */
- addonCapabilities = {0};
- m_struct.toAddon.get_capabilities(&m_struct, &addonCapabilities);
-
- /* get the name of the dsp addon */
- std::string strDSPName = m_struct.toAddon.get_dsp_name(&m_struct);
-
- /* display name = backend name string */
- std::string strFriendlyName = StringUtils::Format("%s", strDSPName.c_str());
-
- /* backend version number */
- std::string strAudioDSPVersion = m_struct.toAddon.get_dsp_version(&m_struct);
-
- /* update the members */
- m_strAudioDSPName = strDSPName;
- m_strFriendlyName = strFriendlyName;
- m_strAudioDSPVersion = strAudioDSPVersion;
- m_addonCapabilities = addonCapabilities;
-}
-
-AE_DSP_ADDON_CAPABILITIES CActiveAEDSPAddon::GetAddonCapabilities(void) const
-{
- AE_DSP_ADDON_CAPABILITIES addonCapabilities(m_addonCapabilities);
- return addonCapabilities;
-}
-
-const std::string &CActiveAEDSPAddon::GetAudioDSPName(void) const
-{
- return m_strAudioDSPName;
-}
-
-const std::string &CActiveAEDSPAddon::GetAudioDSPVersion(void) const
-{
- return m_strAudioDSPVersion;
-}
-
-const std::string &CActiveAEDSPAddon::GetFriendlyName(void) const
-{
- return m_strFriendlyName;
-}
-
-bool CActiveAEDSPAddon::HaveMenuHooks(AE_DSP_MENUHOOK_CAT cat) const
-{
- if (m_bReadyToUse && !m_menuhooks.empty())
- {
- for (unsigned int i = 0; i < m_menuhooks.size(); ++i)
- {
- if (m_menuhooks[i].category == cat || m_menuhooks[i].category == AE_DSP_MENUHOOK_ALL)
- return true;
- }
- }
- return false;
-}
-
-AE_DSP_MENUHOOKS *CActiveAEDSPAddon::GetMenuHooks(void)
-{
- return &m_menuhooks;
-}
-
-void CActiveAEDSPAddon::CallMenuHook(const AE_DSP_MENUHOOK &hook, AE_DSP_MENUHOOK_DATA &hookData)
-{
- if (!m_bReadyToUse || hookData.category == AE_DSP_MENUHOOK_UNKNOWN)
- return;
-
- m_struct.toAddon.menu_hook(&m_struct, &hook, &hookData);
-}
-
-AE_DSP_ERROR CActiveAEDSPAddon::StreamCreate(const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* pProperties, ADDON_HANDLE handle)
-{
- AE_DSP_ERROR retVal = m_struct.toAddon.stream_create(&m_struct, addonSettings, pProperties, handle);
- if (retVal == AE_DSP_ERROR_NO_ERROR)
- m_isInUse = true;
- LogError(retVal, __FUNCTION__);
-
- return retVal;
-}
-
-void CActiveAEDSPAddon::StreamDestroy(const ADDON_HANDLE handle)
-{
- m_struct.toAddon.stream_destroy(&m_struct, handle);
-
- m_isInUse = false;
-}
-
-bool CActiveAEDSPAddon::StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int addon_mode_id, int unique_db_mode_id)
-{
- AE_DSP_ERROR retVal = m_struct.toAddon.stream_is_mode_supported(&m_struct, handle, type, addon_mode_id, unique_db_mode_id);
- if (retVal == AE_DSP_ERROR_NO_ERROR)
- return true;
- else if (retVal != AE_DSP_ERROR_IGNORE_ME)
- LogError(retVal, __FUNCTION__);
-
- return false;
-}
-
-AE_DSP_ERROR CActiveAEDSPAddon::StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings)
-{
- AE_DSP_ERROR retVal = m_struct.toAddon.stream_initialize(&m_struct, handle, addonSettings);
- LogError(retVal, __FUNCTION__);
-
- return retVal;
-}
-
-bool CActiveAEDSPAddon::InputProcess(const ADDON_HANDLE handle, const float **array_in, unsigned int samples)
-{
- return m_struct.toAddon.input_process(&m_struct, handle, array_in, samples);
-}
-
-unsigned int CActiveAEDSPAddon::InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.input_resample_process_needed_samplesize(&m_struct, handle);
-}
-
-unsigned int CActiveAEDSPAddon::InputResampleProcess(const ADDON_HANDLE handle, const float **array_in, float **array_out, unsigned int samples)
-{
- return m_struct.toAddon.input_resample_process(&m_struct, handle, array_in, array_out, samples);
-}
-
-int CActiveAEDSPAddon::InputResampleSampleRate(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.input_resample_samplerate(&m_struct, handle);
-}
-
-float CActiveAEDSPAddon::InputResampleGetDelay(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.input_resample_get_delay(&m_struct, handle);
-}
-
-unsigned int CActiveAEDSPAddon::PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id)
-{
- return m_struct.toAddon.pre_process_needed_samplesize(&m_struct, handle, mode_id);
-}
-
-float CActiveAEDSPAddon::PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id)
-{
- return m_struct.toAddon.pre_process_get_delay(&m_struct, handle, mode_id);
-}
-
-unsigned int CActiveAEDSPAddon::PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float **array_in, float **array_out, unsigned int samples)
-{
- return m_struct.toAddon.pre_process(&m_struct, handle, mode_id, array_in, array_out, samples);
-}
-
-AE_DSP_ERROR CActiveAEDSPAddon::MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id)
-{
- AE_DSP_ERROR retVal = m_struct.toAddon.master_process_set_mode(&m_struct, handle, type, mode_id, unique_db_mode_id);
- LogError(retVal, __FUNCTION__);
-
- return retVal;
-}
-
-unsigned int CActiveAEDSPAddon::MasterProcessNeededSamplesize(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.master_process_needed_samplesize(&m_struct, handle);
-}
-
-float CActiveAEDSPAddon::MasterProcessGetDelay(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.master_process_get_delay(&m_struct, handle);
-}
-
-int CActiveAEDSPAddon::MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long &out_channel_present_flags)
-{
- return m_struct.toAddon.master_process_get_out_channels(&m_struct, handle, &out_channel_present_flags);
-}
-
-unsigned int CActiveAEDSPAddon::MasterProcess(const ADDON_HANDLE handle, const float **array_in, float **array_out, unsigned int samples)
-{
- return m_struct.toAddon.master_process(&m_struct, handle, array_in, array_out, samples);
-}
-
-std::string CActiveAEDSPAddon::MasterProcessGetStreamInfoString(const ADDON_HANDLE handle)
-{
- std::string strReturn;
-
- if (!m_bReadyToUse)
- return strReturn;
-
- strReturn = m_struct.toAddon.master_process_get_stream_info_string(&m_struct, handle);
- return strReturn;
-}
-
-unsigned int CActiveAEDSPAddon::PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id)
-{
- return m_struct.toAddon.post_process_needed_samplesize(&m_struct, handle, mode_id);
-}
-
-float CActiveAEDSPAddon::PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id)
-{
- return m_struct.toAddon.post_process_get_delay(&m_struct, handle, mode_id);
-}
-
-unsigned int CActiveAEDSPAddon::PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float **array_in, float **array_out, unsigned int samples)
-{
- return m_struct.toAddon.post_process(&m_struct, handle, mode_id, array_in, array_out, samples);
-}
-
-unsigned int CActiveAEDSPAddon::OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.output_resample_process_needed_samplesize(&m_struct, handle);
-}
-
-unsigned int CActiveAEDSPAddon::OutputResampleProcess(const ADDON_HANDLE handle, const float **array_in, float **array_out, unsigned int samples)
-{
- return m_struct.toAddon.output_resample_process(&m_struct, handle, array_in, array_out, samples);
-}
-
-int CActiveAEDSPAddon::OutputResampleSampleRate(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.output_resample_samplerate(&m_struct, handle);
-}
-
-float CActiveAEDSPAddon::OutputResampleGetDelay(const ADDON_HANDLE handle)
-{
- return m_struct.toAddon.output_resample_get_delay(&m_struct, handle);
-}
-
-bool CActiveAEDSPAddon::SupportsInputInfoProcess(void) const
-{
- return m_addonCapabilities.bSupportsInputProcess;
-}
-
-bool CActiveAEDSPAddon::SupportsInputResample(void) const
-{
- return m_addonCapabilities.bSupportsInputResample;
-}
-
-bool CActiveAEDSPAddon::SupportsPreProcess(void) const
-{
- return m_addonCapabilities.bSupportsPreProcess;
-}
-
-bool CActiveAEDSPAddon::SupportsMasterProcess(void) const
-{
- return m_addonCapabilities.bSupportsMasterProcess;
-}
-
-bool CActiveAEDSPAddon::SupportsPostProcess(void) const
-{
- return m_addonCapabilities.bSupportsPostProcess;
-}
-
-bool CActiveAEDSPAddon::SupportsOutputResample(void) const
-{
- return m_addonCapabilities.bSupportsOutputResample;
-}
-
-const char *CActiveAEDSPAddon::ToString(const AE_DSP_ERROR error)
-{
- switch (error)
- {
- case AE_DSP_ERROR_NO_ERROR:
- return "no error";
- case AE_DSP_ERROR_NOT_IMPLEMENTED:
- return "not implemented";
- case AE_DSP_ERROR_REJECTED:
- return "rejected by the backend";
- case AE_DSP_ERROR_INVALID_PARAMETERS:
- return "invalid parameters for this method";
- case AE_DSP_ERROR_INVALID_SAMPLERATE:
- return "invalid samplerate for this method";
- case AE_DSP_ERROR_INVALID_IN_CHANNELS:
- return "invalid input channel layout for this method";
- case AE_DSP_ERROR_INVALID_OUT_CHANNELS:
- return "invalid output channel layout for this method";
- case AE_DSP_ERROR_FAILED:
- return "the command failed";
- case AE_DSP_ERROR_UNKNOWN:
- default:
- return "unknown error";
- }
-}
-
-bool CActiveAEDSPAddon::LogError(const AE_DSP_ERROR error, const char *strMethod) const
-{
- if (error != AE_DSP_ERROR_NO_ERROR && error != AE_DSP_ERROR_IGNORE_ME)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - addon '%s' returned an error: %s",
- strMethod, GetFriendlyName().c_str(), ToString(error));
- return false;
- }
- return true;
-}
-
-void CActiveAEDSPAddon::cb_add_menu_hook(void *kodiInstance, AE_DSP_MENUHOOK *hook)
-{
- CActiveAEDSPAddon *client = static_cast<CActiveAEDSPAddon*>(kodiInstance);
- if (!hook || !client)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid handler data", __FUNCTION__);
- return;
- }
-
- AE_DSP_MENUHOOKS *hooks = client->GetMenuHooks();
- if (hooks)
- {
- AE_DSP_MENUHOOK hookInt;
- hookInt.iHookId = hook->iHookId;
- hookInt.iLocalizedStringId = hook->iLocalizedStringId;
- hookInt.category = hook->category;
- hookInt.iRelevantModeId = hook->iRelevantModeId;
- hookInt.bNeedPlayback = hook->bNeedPlayback;
-
- /* add this new hook */
- hooks->push_back(hookInt);
- }
-}
-
-void CActiveAEDSPAddon::cb_remove_menu_hook(void *kodiInstance, AE_DSP_MENUHOOK *hook)
-{
- CActiveAEDSPAddon *client = static_cast<CActiveAEDSPAddon*>(kodiInstance);
- if (!hook || !client)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid handler data", __FUNCTION__);
- return;
- }
-
- AE_DSP_MENUHOOKS *hooks = client->GetMenuHooks();
- if (hooks)
- {
- for (unsigned int i = 0; i < hooks->size(); i++)
- {
- if (hooks->at(i).iHookId == hook->iHookId)
- {
- /* remove this hook */
- hooks->erase(hooks->begin()+i);
- break;
- }
- }
- }
-}
-
-void CActiveAEDSPAddon::cb_register_mode(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE* mode)
-{
- CActiveAEDSPAddon *addon = static_cast<CActiveAEDSPAddon*>(kodiInstance);
- if (!mode || !addon)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid mode data", __FUNCTION__);
- return;
- }
-
- CActiveAEDSPMode transferMode(*mode, addon->GetID());
- int idMode = transferMode.AddUpdate();
- mode->iUniqueDBModeId = idMode;
-
- if (idMode > AE_DSP_INVALID_ADDON_ID)
- {
- CLog::Log(LOGDEBUG, "Audio DSP - %s - successfully registered mode %s of %s adsp-addon", __FUNCTION__, mode->strModeName, addon->Name().c_str());
- }
- else
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - failed to register mode %s of %s adsp-addon", __FUNCTION__, mode->strModeName, addon->Name().c_str());
- }
-}
-
-void CActiveAEDSPAddon::cb_unregister_mode(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE* mode)
-{
- CActiveAEDSPAddon *addon = static_cast<CActiveAEDSPAddon*>(kodiInstance);
- if (!mode || !addon)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid mode data", __FUNCTION__);
- return;
- }
-
- CActiveAEDSPMode transferMode(*mode, addon->GetID());
- transferMode.Delete();
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.h
deleted file mode 100644
index c89fa0eb78..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPAddon.h
+++ /dev/null
@@ -1,425 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2010-2014 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "addons/binary-addons/AddonInstanceHandler.h"
-#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h"
-
-namespace ActiveAE
-{
- class CActiveAEDSPAddon;
-
- typedef std::vector<AE_DSP_MENUHOOK> AE_DSP_MENUHOOKS;
- typedef std::shared_ptr<ActiveAE::CActiveAEDSPAddon> AE_DSP_ADDON;
-
- #define AE_DSP_INVALID_ADDON_ID (-1)
-
- /*!
- * Interface from KODI to a Audio DSP add-on.
- *
- * Also translates KODI's C++ structures to the addon's C structures.
- */
- class CActiveAEDSPAddon : public ADDON::IAddonInstanceHandler
- {
- public:
- explicit CActiveAEDSPAddon(ADDON::BinaryAddonBasePtr addonInfo);
- ~CActiveAEDSPAddon(void) override;
-
- /** @name Audio DSP add-on methods */
- //@{
- /*!
- * @brief Initialise the instance of this add-on.
- * @param iClientId The ID of this add-on.
- */
- bool Create(int iClientId);
-
- /*!
- * @brief Destroy the instance of this add-on.
- */
- void Destroy(void);
-
- /*!
- * @brief Destroy and recreate this add-on.
- */
- void ReCreate(void);
-
- /*!
- * @return True if this instance is initialised, false otherwise.
- */
- bool ReadyToUse(void) const;
-
- /*!
- * @return The ID of this instance.
- */
- int GetID(void) const;
-
- /*!
- * @return The false if this addon is currently not used.
- */
- virtual bool IsInUse() const;
- //@}
-
- /** @name Audio DSP processing methods */
- //@{
- /*!
- * @brief Query this add-on's capabilities.
- * @return pCapabilities The add-on's capabilities.
- */
- AE_DSP_ADDON_CAPABILITIES GetAddonCapabilities(void) const;
-
- /*!
- * @return The name reported by the backend.
- */
- const std::string &GetAudioDSPName(void) const;
-
- /*!
- * @return The version string reported by the backend.
- */
- const std::string &GetAudioDSPVersion(void) const;
-
- /*!
- * @return A friendly name for this add-on that can be used in log messages.
- */
- const std::string &GetFriendlyName(void) const;
-
- /*!
- * @return True if this add-on has menu hooks, false otherwise.
- */
- bool HaveMenuHooks(AE_DSP_MENUHOOK_CAT cat) const;
-
- /*!
- * @return The menu hooks for this add-on.
- */
- AE_DSP_MENUHOOKS *GetMenuHooks(void);
-
- /*!
- * @brief Call one of the menu hooks of this addon.
- * @param hook The hook to call.
- * @param item The selected file item for which the hook was called.
- */
- void CallMenuHook(const AE_DSP_MENUHOOK &hook, AE_DSP_MENUHOOK_DATA &hookData);
-
- /*!
- * Set up Audio DSP with selected audio settings (use the basic present audio stream data format)
- * Used to detect available addons for present stream, as example stereo surround upmix not needed on 5.1 audio stream
- * @param addonSettings The add-on's audio settings.
- * @param pProperties The properties of the currently playing stream.
- * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not supported, but without fault.
- */
- AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* pProperties, ADDON_HANDLE handle);
-
- /*!
- * Remove the selected id from currently used dsp processes
- * @param id The stream id
- */
- void StreamDestroy(const ADDON_HANDLE handle);
-
- /*!
- * @brief Ask the addon about a requested processing mode that it is supported on the current
- * stream. Is called about every addon mode after successed StreamCreate.
- * @param id The stream id
- * @param addon_mode_id The mode inside addon which must be performed on call. Id is set from addon by iModeNumber on AE_DSP_MODE structure during RegisterMode callback,
- * @param unique_mode_id The Mode unique id generated from dsp database.
- * @return true if supported
- */
- bool StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int addon_mode_id, int unique_db_mode_id);
-
- /*!
- * Set up Audio DSP with selected audio settings (detected on data of first present audio packet)
- * @param addonSettings The add-on's audio settings.
- * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully.
- */
- AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings);
-
- /*!
- * @brief DSP input processing
- * Can be used to have unchanged stream..
- * All DSP add-ons allowed to-do this.
- * @param id The stream id
- * @param array_in Pointer to data memory
- * @param samples Amount of samples inside array_in
- * @return true if work was OK
- * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with GetAddonCapabilities
- */
- bool InputProcess(const ADDON_HANDLE handle, const float **array_in, unsigned int samples);
-
- /*!
- * If the add-on operate with buffered arrays and the output size can be higher as the input
- * it becomes asked about needed size before any InputResampleProcess call.
- * @param id The stream id
- * @return The needed size of output array or 0 if no changes within it
- */
- unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle);
-
- /*!
- * @brief DSP re sample processing before master Here a high quality resample can be performed.
- * Only one DSP add-on is allowed to-do this!
- * @param id The stream id
- * @param array_in Pointer to input data memory
- * @param array_out Pointer to output data memory
- * @param samples Amount of samples inside array_in
- * @return Amount of samples processed
- */
- unsigned int InputResampleProcess(const ADDON_HANDLE handle, const float **array_in, float **array_out, unsigned int samples);
-
- /*!
- * Returns the re-sampling generated new sample rate used before the master process
- * @param id The stream id
- * @return The new sample rate
- */
- int InputResampleSampleRate(const ADDON_HANDLE handle);
-
- /*!
- * Returns the time in seconds that it will take
- * for the next added packet to be heard from the speakers.
- * @param id The stream id
- * @return the delay in seconds
- */
- float InputResampleGetDelay(const ADDON_HANDLE handle);
-
- /*!
- * If the addon operate with buffered arrays and the output size can be higher as the input
- * it becomes asked about needed size before any PreProcess call.
- * @param id The stream id
- * @param mode_id The mode inside add-on which must be performed on call. Id is set from add-on by iModeNumber on AE_DSP_MODE structure during RegisterMode callback,
- * and can be defined from add-on as a structure pointer or anything else what is needed to find it.
- * @return The needed size of output array or 0 if no changes within it
- */
- unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id);
-
- /*!
- * Returns the time in seconds that it will take
- * for the next added packet to be heard from the speakers.
- * @param id The stream id
- * @param mode_id The mode inside add-on which must be performed on call. Id is set from add-on by iModeNumber on AE_DSP_MODE structure during RegisterMode callback,
- * and can be defined from add-on as a structure pointer or anything else what is needed to find it.
- * @return the delay in seconds
- */
- float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id);
-
- /*!
- * @brief DSP preprocessing
- * All DSP add-ons allowed to-do this.
- * @param id The stream id
- * @param mode_id The mode inside add-on which must be performed on call. Id is set from add-on by iModeNumber on AE_DSP_MODE structure during RegisterMode callback,
- * and can be defined from add-on as a structure pointer or anything else what is needed to find it.
- * @param array_in Pointer to input data memory
- * @param array_out Pointer to output data memory
- * @param samples Amount of samples inside array_in
- * @return Amount of samples processed
- */
- unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float **array_in, float **array_out, unsigned int samples);
-
- /*!
- * @brief Set the active master process mode
- * @param id The stream id
- * @param type Requested stream type for the selected master mode
- * @param mode_id The Mode identifier.
- * @param unique_mode_id The Mode unique id generated from DSP database.
- * @return AE_DSP_ERROR_NO_ERROR if the setup was successful
- */
- AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id);
-
- /*!
- * @brief If the add-on operate with buffered arrays and the output size can be higher as the input
- * it becomes asked about needed size before any MasterProcess call.
- * @param id The stream id
- * @return The needed size of output array or 0 if no changes within it
- */
- unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle);
-
- /*!
- * @brief Returns the time in seconds that it will take
- * for the next added packet to be heard from the speakers.
- * @param id The stream id
- * @return the delay in seconds
- */
- float MasterProcessGetDelay(const ADDON_HANDLE handle);
-
- /*!
- * @brief Returns the from selected master mode performed channel alignment
- * @param id The stream id
- * @retval out_channel_present_flags the exact channel present flags after performed up-/downmix
- * @return the amount channels
- */
- int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long &out_channel_present_flags);
-
- /*!
- * @brief Master processing becomes performed with it
- * Here a channel up-mix/down-mix for stereo surround sound can be performed
- * Only one DSP add-on is allowed to-do this!
- * @param id The stream id
- * @param array_in Pointer to input data memory
- * @param array_out Pointer to output data memory
- * @param samples Amount of samples inside array_in
- * @return Amount of samples processed
- */
- unsigned int MasterProcess(const ADDON_HANDLE handle, const float **array_in, float **array_out, unsigned int samples);
-
- /*!
- * @brief Get a from addon generated information string
- * @param id The stream id
- * @return Info string
- */
- std::string MasterProcessGetStreamInfoString(const ADDON_HANDLE handle);
-
- /*!
- * If the add-on operate with buffered arrays and the output size can be higher as the input
- * it becomes asked about needed size before any PostProcess call.
- * @param id The stream id
- * @param mode_id The mode inside add-on which must be performed on call. Id is set from add-on by iModeNumber on AE_DSP_MODE structure during RegisterMode callback,
- * and can be defined from add-on as a structure pointer or anything else what is needed to find it.
- * @return The needed size of output array or 0 if no changes within it
- */
- unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id);
-
- /*!
- * Returns the time in seconds that it will take
- * for the next added packet to be heard from the speakers.
- * @param id The stream id
- * @param mode_id The mode inside add-on which must be performed on call. Id is set from add-on by iModeNumber on AE_DSP_MODE structure during RegisterMode callback,
- * and can be defined from add-on as a structure pointer or anything else what is needed to find it.
- * @return the delay in seconds
- */
- float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id);
-
- /*!
- * @brief DSP post processing
- * @param id The stream id
- * @param mode_id The mode inside add-on which must be performed on call. Id is set from add-on by iModeNumber on AE_DSP_MODE structure during RegisterMode callback,
- * and can be defined from add-on as a structure pointer or anything else what is needed to find it.
- * @param array_in Pointer to input data memory
- * @param array_out Pointer to output data memory
- * @param samples Amount of samples inside array_in
- * @return Amount of samples processed
- */
- unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float **array_in, float **array_out, unsigned int samples);
-
- /*!
- * @brief If the add-on operate with buffered arrays and the output size can be higher as the input
- * it becomes asked about needed size before any OutputResampleProcess call.
- * @param id The stream id
- * @return The needed size of output array or 0 if no changes within it
- */
- unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle);
-
- /*!
- * @brief Re-sampling after master processing becomes performed with it if needed, only
- * one add-on can perform it.
- * @param id The stream id
- * @param array_in Pointer to input data memory
- * @param array_out Pointer to output data memory
- * @param samples Amount of samples inside array_in
- * @return Amount of samples processed
- */
- unsigned int OutputResampleProcess(const ADDON_HANDLE handle, const float **array_in, float **array_out, unsigned int samples);
-
- /*!
- * Returns the re-sampling generated new sample rate used after the master process
- * @param id The stream id
- * @return The new sample rate
- */
- int OutputResampleSampleRate(const ADDON_HANDLE handle);
-
- /*!
- * Returns the time in seconds that it will take
- * for the next added packet to be heard from the speakers.
- * @param id The stream id
- * @return the delay in seconds
- */
- float OutputResampleGetDelay(const ADDON_HANDLE handle);
-
- bool SupportsInputInfoProcess(void) const;
- bool SupportsPreProcess(void) const;
- bool SupportsInputResample(void) const;
- bool SupportsMasterProcess(void) const;
- bool SupportsPostProcess(void) const;
- bool SupportsOutputResample(void) const;
-
- static const char *ToString(const AE_DSP_ERROR error);
-
- private:
- /*!
- * @brief Resets all class members to their defaults. Called by the constructors.
- */
- void ResetProperties(int iClientId = AE_DSP_INVALID_ADDON_ID);
-
- void GetAddonProperties(void);
-
- bool LogError(const AE_DSP_ERROR error, const char *strMethod) const;
-
- /*!
- * @brief Callback functions from addon to kodi
- */
- //@{
- /*!
- * @brief Add or replace a menu hook for the menu for this add-on
- * @param kodiInstance A pointer to the add-on.
- * @param hook The hook to add.
- */
- static void cb_add_menu_hook(void* kodiInstance, AE_DSP_MENUHOOK* hook);
-
- /*!
- * @brief Remove a menu hook for the menu for this add-on
- * @param kodiInstance A pointer to the add-on.
- * @param hook The hook to remove.
- */
- static void cb_remove_menu_hook(void* kodiInstance, AE_DSP_MENUHOOK* hook);
-
- /*!
- * @brief Add or replace master mode information inside audio dsp database.
- * Becomes identifier written inside mode to iModeID if it was 0 (undefined)
- * @param kodiInstance A pointer to the add-on.
- * @param mode The master mode to add or update inside database
- */
- static void cb_register_mode(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE* mode);
-
- /*!
- * @brief Remove a master mode from audio dsp database
- * @param kodiInstance A pointer to the add-on.
- * @param mode The Mode to remove
- */
- static void cb_unregister_mode(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE* mode);
- //@}
-
- bool m_bReadyToUse; /*!< true if this add-on is connected to the audio DSP, false otherwise */
- bool m_isInUse; /*!< true if this add-on currently processing data */
- AE_DSP_MENUHOOKS m_menuhooks; /*!< the menu hooks for this add-on */
- int m_iClientId; /*!< database ID of the audio DSP */
-
- /* cached data */
- std::string m_strAudioDSPName; /*!< the cached audio DSP name */
- std::string m_strAudioDSPVersion; /*!< the cached audio DSP version */
- std::string m_strFriendlyName; /*!< the cached friendly name */
- AE_DSP_ADDON_CAPABILITIES m_addonCapabilities; /*!< the cached add-on capabilities */
-
- /* stored strings to make sure const char* members in AE_DSP_PROPERTIES stay valid */
- std::string m_strUserPath; /*!< @brief translated path to the user profile */
- std::string m_strAddonPath ; /*!< @brief translated path to this add-on */
-
- CCriticalSection m_critSection;
-
- AddonInstance_AudioDSP m_struct; /*!< Interface table who contains function addresses and fixed values */
- };
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.cpp
deleted file mode 100644
index 11ac544fa2..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.cpp
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Copyright (C) 2012-2014 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ActiveAEDSPDatabase.h"
-#include "ActiveAEDSP.h"
-
-#include "URL.h"
-#include "dbwrappers/dataset.h"
-#include "settings/AdvancedSettings.h"
-#include "AudioDSPSettings.h"
-#include "utils/log.h"
-#include "utils/StringUtils.h"
-#include "utils/URIUtils.h"
-
-using namespace dbiplus;
-using namespace ActiveAE;
-using namespace ADDON;
-
-#define ADSPDB_DEBUGGING 0
-
-bool CActiveAEDSPDatabase::Open()
-{
- return CDatabase::Open(g_advancedSettings.m_databaseADSP);
-}
-
-void CActiveAEDSPDatabase::CreateTables()
-{
- BeginTransaction();
- CLog::Log(LOGINFO, "Audio DSP - %s - creating tables", __FUNCTION__);
-
- CLog::Log(LOGDEBUG, "Audio DSP - %s - creating table 'addons'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE addons ("
- "idAddon integer primary key, "
- "sName varchar(64), "
- "sUid varchar(32)"
- ")"
- );
-
- CLog::Log(LOGDEBUG, "Audio DSP - %s - creating table 'modes'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE modes ("
- "idMode integer primary key, "
- "iType integer, "
- "iPosition integer, "
- "iStreamTypeFlags integer, "
- "iBaseType integer, "
- "bIsEnabled bool, "
- "sOwnIconPath varchar(255), "
- "sOverrideIconPath varchar(255), "
- "iModeName integer, "
- "iModeSetupName integer, "
- "iModeHelp integer, "
- "iModeDescription integer, "
- "sAddonModeName varchar(64), "
- "iAddonId integer, "
- "iAddonModeNumber integer, "
- "bHasSettings bool"
- ")"
- );
-
- CLog::Log(LOGDEBUG, "Audio DSP - %s - create settings table", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE settings ("
- "id integer primary key, "
- "strPath varchar(255), "
- "strFileName varchar(255), "
- "MasterStreamTypeSel integer, "
- "MasterStreamType integer, "
- "MasterBaseType integer, "
- "MasterModeId integer"
- ")"
- );
-
- // disable all Audio DSP add-on when started the first time
- ADDON::VECADDONS addons;
- if (CServiceBroker::GetAddonMgr().GetAddons(addons, ADDON_ADSPDLL))
- {
- for (IVECADDONS it = addons.begin(); it != addons.end(); ++it)
- CServiceBroker::GetAddonMgr().DisableAddon(it->get()->ID());
- }
-}
-
-void CActiveAEDSPDatabase::CreateAnalytics()
-{
- CLog::Log(LOGINFO, "Audio DSP - %s - creating indices", __FUNCTION__);
- m_pDS->exec("CREATE UNIQUE INDEX idx_mode_iAddonId_iAddonModeNumber on modes(iAddonId, iAddonModeNumber);");
- m_pDS->exec("CREATE UNIQUE INDEX ix_settings ON settings ( id )\n");
-}
-
-void CActiveAEDSPDatabase::UpdateTables(int iVersion)
-{
-}
-
-/********** Mode methods **********/
-
-bool CActiveAEDSPDatabase::ContainsModes(int modeType)
-{
- return !GetSingleValue(PrepareSQL("SELECT 1 FROM modes WHERE modes.iType='%i'", modeType)).empty();
-}
-
-bool CActiveAEDSPDatabase::DeleteModes(void)
-{
- CLog::Log(LOGDEBUG, "Audio DSP - %s - deleting all modes from the database", __FUNCTION__);
- return DeleteValues("modes");
-}
-
-bool CActiveAEDSPDatabase::DeleteModes(int modeType)
-{
- /* invalid addon Id */
- if (modeType <= 0)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid mode type id: %i", __FUNCTION__, modeType);
- return false;
- }
-
- CLog::Log(LOGDEBUG, "Audio DSP - %s - deleting all modes from type '%i' from the database", __FUNCTION__, modeType);
-
- Filter filter;
- filter.AppendWhere(PrepareSQL("iType = %u", modeType));
-
- return DeleteValues("modes", filter);
-}
-
-bool CActiveAEDSPDatabase::DeleteAddonModes(int addonId)
-{
- /* invalid addon Id */
- if (addonId <= 0)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid add-on id: %i", __FUNCTION__, addonId);
- return false;
- }
-
- CLog::Log(LOGDEBUG, "Audio DSP - %s - deleting all modes from add-on '%i' from the database", __FUNCTION__, addonId);
-
- Filter filter;
- filter.AppendWhere(PrepareSQL("iAddonId = %u", addonId));
-
- return DeleteValues("modes", filter);
-}
-
-bool CActiveAEDSPDatabase::DeleteMode(const CActiveAEDSPMode &mode)
-{
- /* invalid mode */
- if (mode.ModeID() <= 0)
- return false;
-
- CLog::Log(LOGDEBUG, "Audio DSP - %s - deleting mode '%s' from the database", __FUNCTION__, mode.AddonModeName().c_str());
-
- Filter filter;
- filter.AppendWhere(PrepareSQL("idMode = %u", mode.ModeID()));
-
- return DeleteValues("modes", filter);
-}
-
-bool CActiveAEDSPDatabase::PersistModes(std::vector<CActiveAEDSPModePtr> &modes, int modeType)
-{
- bool bReturn(true);
-
- for (unsigned int iModePtr = 0; iModePtr < modes.size(); ++iModePtr)
- {
- CActiveAEDSPModePtr member = modes.at(iModePtr);
- if (!member->IsInternal() && (member->IsChanged() || member->IsNew()))
- {
- bReturn &= AddUpdateMode(*member);
- }
- }
-
- bReturn &= CommitInsertQueries();
-
- return bReturn;
-}
-
-bool CActiveAEDSPDatabase::UpdateMode(int modeType, bool active, int addonId, int addonModeNumber, int listNumber)
-{
- return ExecuteQuery(PrepareSQL("UPDATE modes SET iPosition=%i,bIsEnabled=%i WHERE modes.iAddonId=%i AND modes.iAddonModeNumber=%i AND modes.iType=%i",
- listNumber,
- (active ? 1 : 0),
- addonId,
- addonModeNumber,
- modeType));
-}
-
-bool CActiveAEDSPDatabase::AddUpdateMode(CActiveAEDSPMode &mode)
-{
- bool bReturn(true);
-
- try
- {
- if (mode.IsInternal())
- return false;
-
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
- std::string strSQL = PrepareSQL("SELECT * FROM modes WHERE modes.iAddonId=%i AND modes.iAddonModeNumber=%i AND modes.iType=%i", mode.AddonID(), mode.AddonModeNumber(), mode.ModeType());
-
- m_pDS->query( strSQL );
- if (m_pDS->num_rows() > 0)
- {
- /* get user selected settings */
- mode.m_iModeId = m_pDS->fv("idMode").get_asInt();
- mode.m_iModePosition = m_pDS->fv("iPosition").get_asInt();
- mode.m_iBaseType = (AE_DSP_BASETYPE)m_pDS->fv("iBaseType").get_asInt();
- mode.m_bIsEnabled = m_pDS->fv("bIsEnabled").get_asBool();
- m_pDS->close();
-
- /* update addon related settings */
- strSQL = PrepareSQL(
- "UPDATE modes set "
- "iStreamTypeFlags=%i, "
- "sOwnIconPath='%s', "
- "sOverrideIconPath='%s', "
- "iModeName=%i, "
- "iModeSetupName=%i, "
- "iModeHelp=%i, "
- "iModeDescription=%i, "
- "sAddonModeName='%s', "
- "bHasSettings=%i "
- "WHERE modes.iAddonId=%i AND modes.iAddonModeNumber=%i AND modes.iType=%i",
- mode.StreamTypeFlags(),
- mode.IconOwnModePath().c_str(),
- mode.IconOverrideModePath().c_str(),
- mode.ModeName(),
- mode.ModeSetupName(),
- mode.ModeHelp(),
- mode.ModeDescription(),
- mode.AddonModeName().c_str(),
- (mode.HasSettingsDialog() ? 1 : 0),
- mode.AddonID(), mode.AddonModeNumber(), mode.ModeType());
- bReturn = m_pDS->exec(strSQL);
- }
- else
- { // add the items
- m_pDS->close();
- strSQL = PrepareSQL(
- "INSERT INTO modes ("
- "iType, "
- "iPosition, "
- "iStreamTypeFlags, "
- "iBaseType, "
- "bIsEnabled, "
- "sOwnIconPath, "
- "sOverrideIconPath, "
- "iModeName, "
- "iModeSetupName, "
- "iModeHelp, "
- "iModeDescription, "
- "sAddonModeName, "
- "iAddonId, "
- "iAddonModeNumber, "
- "bHasSettings) "
- "VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, %i, %i, '%s', %i, %i, %i)",
- mode.ModeType(),
- mode.ModePosition(),
- mode.StreamTypeFlags(),
- mode.BaseType(),
- (mode.IsEnabled() ? 1 : 0),
- mode.IconOwnModePath().c_str(),
- mode.IconOverrideModePath().c_str(),
- mode.ModeName(),
- mode.ModeSetupName(),
- mode.ModeHelp(),
- mode.ModeDescription(),
- mode.AddonModeName().c_str(),
- mode.AddonID(),
- mode.AddonModeNumber(),
- (mode.HasSettingsDialog() ? 1 : 0));
- bReturn = m_pDS->exec(strSQL);
- }
- }
- catch (...)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - (Addon='%i', Mode='%i', Name: %s) failed", __FUNCTION__, mode.AddonID(), mode.AddonModeNumber(), mode.AddonModeName().c_str());
- }
- return bReturn;
-}
-
-int CActiveAEDSPDatabase::GetModeId(const CActiveAEDSPMode &mode)
-{
- std::string id = GetSingleValue(PrepareSQL("SELECT * from modes WHERE modes.iAddonId=%i and modes.iAddonModeNumber=%i and modes.iType=%i", mode.AddonID(), mode.AddonModeNumber(), mode.ModeType()));
- if (id.empty())
- return -1;
- return strtol(id.c_str(), NULL, 10);
-}
-
-int CActiveAEDSPDatabase::GetModes(AE_DSP_MODELIST &results, int modeType)
-{
- int iReturn(0);
-
- std::string strQuery=PrepareSQL("SELECT * FROM modes WHERE modes.iType=%i ORDER BY iPosition", modeType);
-
- m_pDS->query( strQuery );
- if (m_pDS->num_rows() > 0)
- {
- try
- {
- while (!m_pDS->eof())
- {
- CActiveAEDSPModePtr mode = CActiveAEDSPModePtr(new CActiveAEDSPMode());
-
- mode->m_iModeId = m_pDS->fv("idMode").get_asInt();
- mode->m_iModeType = (AE_DSP_MODE_TYPE)m_pDS->fv("iType").get_asInt();
- mode->m_iModePosition = m_pDS->fv("iPosition").get_asInt();
- mode->m_iStreamTypeFlags = m_pDS->fv("iStreamTypeFlags").get_asInt();
- mode->m_iBaseType = (AE_DSP_BASETYPE)m_pDS->fv("iBaseType").get_asInt();
- mode->m_bIsEnabled = m_pDS->fv("bIsEnabled").get_asBool();
- mode->m_strOwnIconPath = m_pDS->fv("sOwnIconPath").get_asString();
- mode->m_strOverrideIconPath = m_pDS->fv("sOverrideIconPath").get_asString();
- mode->m_iModeName = m_pDS->fv("iModeName").get_asInt();
- mode->m_iModeSetupName = m_pDS->fv("iModeSetupName").get_asInt();
- mode->m_iModeHelp = m_pDS->fv("iModeHelp").get_asInt();
- mode->m_iModeDescription = m_pDS->fv("iModeDescription").get_asInt();
- mode->m_strModeName = m_pDS->fv("sAddonModeName").get_asString();
- mode->m_iAddonId = m_pDS->fv("iAddonId").get_asInt();
- mode->m_iAddonModeNumber = m_pDS->fv("iAddonModeNumber").get_asInt();
- mode->m_bHasSettingsDialog = m_pDS->fv("bHasSettings").get_asBool();
-
-#ifdef ADSPDB_DEBUGGING
- CLog::Log(LOGDEBUG, "Audio DSP - %s - mode '%s' loaded from the database", __FUNCTION__, mode->m_strModeName.c_str());
-#endif
- m_pDS->next();
- ++iReturn;
- }
- m_pDS->close();
- }
- catch (...)
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - couldn't load modes from the database", __FUNCTION__);
- }
- }
- else
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - query failed", __FUNCTION__);
- }
-
- m_pDS->close();
- return iReturn;
-}
-
-/********** Settings methods **********/
-
-bool CActiveAEDSPDatabase::DeleteActiveDSPSettings()
-{
- CLog::Log(LOGDEBUG, "Audio DSP - %s - deleting all active dsp settings from the database", __FUNCTION__);
- return DeleteValues("settings");
-}
-
-bool CActiveAEDSPDatabase::DeleteActiveDSPSettings(const CFileItem &item)
-{
- std::string strPath, strFileName;
- URIUtils::Split(item.GetPath(), strPath, strFileName);
- return ExecuteQuery(PrepareSQL("DELETE FROM settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str()));
-}
-
-bool CActiveAEDSPDatabase::GetActiveDSPSettings(const CFileItem &item, CAudioSettings &settings)
-{
- try
- {
- if (NULL == m_pDB.get()) return false;
- if (NULL == m_pDS.get()) return false;
- std::string strPath, strFileName;
- URIUtils::Split(item.GetPath(), strPath, strFileName);
- std::string strSQL=PrepareSQL("SELECT * FROM settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str());
-
- m_pDS->query( strSQL );
- if (m_pDS->num_rows() > 0)
- { // get the audio dsp settings info
- settings.m_MasterStreamTypeSel = m_pDS->fv("MasterStreamTypeSel").get_asInt();
- int type = m_pDS->fv("MasterStreamType").get_asInt();
- int base = m_pDS->fv("MasterBaseType").get_asInt();
- settings.m_MasterStreamType = type;
- settings.m_MasterStreamBase = base;
- settings.m_MasterModes[type][base] = m_pDS->fv("MasterModeId").get_asInt();
-
- /*! if auto mode is selected, copy the identifier of previous used processor to the auto mode entry */
- settings.m_MasterModes[settings.m_MasterStreamTypeSel][base] = settings.m_MasterModes[type][base];
-
- m_pDS->close();
- return true;
- }
- m_pDS->close();
- }
- catch (...)
- {
- CLog::Log(LOGERROR, "%s failed", __FUNCTION__);
- }
- return false;
-}
-
-void CActiveAEDSPDatabase::SetActiveDSPSettings(const CFileItem &item, const CAudioSettings &setting)
-{
- try
- {
- if (NULL == m_pDB.get()) return ;
- if (NULL == m_pDS.get()) return ;
- std::string strPath, strFileName;
- URIUtils::Split(item.GetPath(), strPath, strFileName);
- std::string strSQL = StringUtils::Format("select * from settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str());
- m_pDS->query( strSQL );
- if (m_pDS->num_rows() > 0)
- {
- m_pDS->close();
- // update the item
- strSQL=PrepareSQL(
- "update settings set "
- "MasterStreamTypeSel=%i,"
- "MasterStreamType=%i,"
- "MasterBaseType=%i,"
- "MasterModeId=%i,"
- "WHERE settings.strPath='%s' and settings.strFileName='%s'\n",
- setting.m_MasterStreamTypeSel,
- setting.m_MasterStreamType,
- setting.m_MasterStreamBase,
- setting.m_MasterModes[setting.m_MasterStreamType][setting.m_MasterStreamBase],
- strPath.c_str(),
- strFileName.c_str());
- m_pDS->exec(strSQL);
- return ;
- }
- else
- { // add the items
- m_pDS->close();
- strSQL= "INSERT INTO settings ("
- "id, "
- "strPath,"
- "strFileName,"
- "MasterStreamTypeSel,"
- "MasterStreamType,"
- "MasterBaseType,"
- "MasterModeId) "
- "VALUES ";
- strSQL += PrepareSQL("(NULL,'%s','%s',%i,%i,%i,%i)",
- strPath.c_str(),
- strFileName.c_str(),
- setting.m_MasterStreamTypeSel,
- setting.m_MasterStreamType,
- setting.m_MasterStreamBase,
- setting.m_MasterModes[setting.m_MasterStreamType][setting.m_MasterStreamBase]);
- m_pDS->exec(strSQL);
- }
- }
- catch (...)
- {
- CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, item.GetPath().c_str());
- }
-}
-
-void CActiveAEDSPDatabase::EraseActiveDSPSettings()
-{
- CLog::Log(LOGINFO, "Deleting dsp settings information for all files");
- ExecuteQuery(PrepareSQL("DELETE from settings"));
-}
-
-void CActiveAEDSPDatabase::SplitPath(const std::string& strFileNameAndPath, std::string& strPath, std::string& strFileName)
-{
- if (URIUtils::IsStack(strFileNameAndPath) || StringUtils::StartsWithNoCase(strFileNameAndPath, "rar://") || StringUtils::StartsWithNoCase(strFileNameAndPath, "zip://"))
- {
- URIUtils::GetParentPath(strFileNameAndPath,strPath);
- strFileName = strFileNameAndPath;
- }
- else if (URIUtils::IsPlugin(strFileNameAndPath))
- {
- CURL url(strFileNameAndPath);
- strPath = url.GetWithoutFilename();
- strFileName = strFileNameAndPath;
- }
- else
- URIUtils::Split(strFileNameAndPath,strPath, strFileName);
-}
-
-/********** Audio DSP add-on methods **********/
-
-bool CActiveAEDSPDatabase::DeleteAddons()
-{
- CLog::Log(LOGDEBUG, "Audio DSP - %s - deleting all add-on's from the database", __FUNCTION__);
-
- return DeleteValues("addons");
-}
-
-bool CActiveAEDSPDatabase::Delete(const std::string &strAddonUid)
-{
- /* invalid addon uid */
- if (strAddonUid.empty())
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid addon uid", __FUNCTION__);
- return false;
- }
-
- Filter filter;
- filter.AppendWhere(PrepareSQL("sUid = '%s'", strAddonUid.c_str()));
-
- return DeleteValues("addons", filter);
-}
-
-int CActiveAEDSPDatabase::GetAudioDSPAddonId(const std::string &strAddonUid)
-{
- std::string strWhereClause = PrepareSQL("sUid = '%s'", strAddonUid.c_str());
- std::string strValue = GetSingleValue("addons", "idAddon", strWhereClause);
-
- if (strValue.empty())
- return -1;
-
- return strtol(strValue.c_str(), NULL, 10);
-}
-
-int CActiveAEDSPDatabase::Persist(const AddonPtr& addon)
-{
- int iReturn(-1);
-
- /* invalid addon uid or name */
- if (addon->Name().empty() || addon->ID().empty())
- {
- CLog::Log(LOGERROR, "Audio DSP - %s - invalid add-on uid or name", __FUNCTION__);
- return iReturn;
- }
-
- std::string strQuery = PrepareSQL("REPLACE INTO addons (sName, sUid) VALUES ('%s', '%s');",
- addon->Name().c_str(), addon->ID().c_str());
-
- if (ExecuteQuery(strQuery))
- iReturn = (int) m_pDS->lastinsertid();
-
- return iReturn;
-}
-
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.h
deleted file mode 100644
index 688da7a065..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.h
+++ /dev/null
@@ -1,219 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2012-2014 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <string>
-#include <vector>
-
-#include "ActiveAEDSPMode.h"
-
-class CAudioSettings;
-
-namespace ActiveAE
-{
- class CActiveAEDSPAddon;
- class CActiveAEDSPProcess;
-
- /** The audio DSP database */
-
- class CActiveAEDSPDatabase : public CDatabase
- {
- public:
- /*!
- * @brief Create a new instance of the audio DSP database.
- */
- CActiveAEDSPDatabase(void) = default;
- ~CActiveAEDSPDatabase(void) override = default;
-
- /*!
- * @brief Open the database.
- * @return True if it was opened successfully, false otherwise.
- */
- bool Open() override;
-
- /*!
- * @brief Get the minimal database version that is required to operate correctly.
- * @return The minimal database version.
- */
- virtual int GetMinVersion() const { return 1; };
-
- /*!
- * @brief Get the default sqlite database filename.
- * @return The default filename.
- */
- const char *GetBaseDBName() const override { return "ADSP"; };
-
- /*! @name mode methods */
- //@{
- /*!
- * @brief Used to check for present mode types
- * @param modeType The mode type identifier
- * @return True if modes present of given type
- */
- bool ContainsModes(int modeType);
-
- /*!
- * @brief Remove all modes from the database.
- * @return True if all modes were removed, false otherwise.
- */
- bool DeleteModes(void);
-
- /*!
- * @brief Remove all modes from the database of a type.
- * @param modeType The mode type identifier of functions to delete.
- * @return True if the modes were deleted, false otherwise.
- */
- bool DeleteModes(int modeType);
-
- /*!
- * @brief Remove all modes from a add-on from the database.
- * @param addonId The add-on identifier to delete the modes for.
- * @return True if the modes were deleted, false otherwise.
- */
- bool DeleteAddonModes(int addonId);
-
- /*!
- * @brief Remove a mode entry from the database
- * @param mode The mode to remove.
- * @return True if the mode was removed, false otherwise.
- */
- bool DeleteMode(const CActiveAEDSPMode &mode);
-
- /*!
- * @brief Add or update mode entries in the database
- * @param modes The modes to persist.
- * @param modeType If true, don't write immediately
- * @return True when persisted or queued, false otherwise.
- */
- bool PersistModes(std::vector<CActiveAEDSPModePtr> &modes, int modeType);
-
- /*!
- * @brief Update user selectable mode settings inside database
- * @param modeType the mode type to get
- * @param active true if the mode is enabled
- * @param addonId the addon id of this mode
- * @param addonModeNumber the from addon set mode number
- * @param listNumber the list number on processing chain
- * @return True if the modes were updated, false otherwise.
- */
- bool UpdateMode(int modeType, bool active, int addonId, int addonModeNumber, int listNumber);
-
- /*!
- * @brief Add or if present update mode inside database
- * @param addon The add-on to check the modes for.
- * @return True if the modes were updated or added, false otherwise.
- */
- bool AddUpdateMode(CActiveAEDSPMode &mode);
-
- /*!
- * @brief Get id of mode inside database
- * @param mode The mode to check for inside the database
- * @return The id or -1 if not found
- */
- int GetModeId(const CActiveAEDSPMode &mode);
-
- /*!
- * @brief Get the list of modes from type on database
- * @param results The mode group to store the results in.
- * @param modeType the mode type to get
- * @return The amount of modes that were added.
- */
- int GetModes(AE_DSP_MODELIST &results, int modeType);
- //@}
-
- /*! @name Add-on methods */
- //@{
- /*!
- * @brief Remove all add-on information from the database.
- * @return True if all add-on's were removed successfully.
- */
- bool DeleteAddons();
-
- /*!
- * @brief Remove a add-on from the database
- * @param strAddonUid The unique ID of the add-on.
- * @return True if the add-on was removed successfully, false otherwise.
- */
- bool Delete(const std::string &strAddonUid);
-
- /*!
- * @brief Get the database ID of a add-on.
- * @param strAddonUid The unique ID of the add-on.
- * @return The database ID of the add-on or -1 if it wasn't found.
- */
- int GetAudioDSPAddonId(const std::string &strAddonUid);
-
- /*!
- * @brief Add a add-on to the database if it's not already in there.
- * @param addon The pointer to the addon class
- * @return The database ID of the client.
- */
- int Persist(const ADDON::AddonPtr &addon);
- //@}
-
- /*! @name Settings methods */
- //@{
-
- /*!
- * @brief Remove all active dsp settings from the database.
- * @return True if all dsp data were removed successfully, false if not.
- */
- bool DeleteActiveDSPSettings();
-
- /*!
- * @brief Remove active dsp settings from the database for file.
- * @return True if dsp data were removed successfully, false if not.
- */
- bool DeleteActiveDSPSettings(const CFileItem &item);
-
- /*!
- * @brief GetVideoSettings() obtains any saved video settings for the current file.
- * @return Returns true if the settings exist, false otherwise.
- */
- bool GetActiveDSPSettings(const CFileItem &item, CAudioSettings &settings);
-
- /*!
- * @brief Sets the settings for a particular used file
- */
- void SetActiveDSPSettings(const CFileItem &item, const CAudioSettings &settings);
-
- /*!
- * @brief EraseActiveDSPSettings() Erases the dsp Settings table and reconstructs it
- */
- void EraseActiveDSPSettings();
- //@}
-
- private:
- /*!
- * @brief Create the audio DSP database tables.
- */
- void CreateTables() override;
- void CreateAnalytics() override;
-
- /*!
- * @brief Update an old version of the database.
- * @param version The version to update the database from.
- */
- void UpdateTables(int version) override;
- int GetSchemaVersion() const override { return 0; }
-
- void SplitPath(const std::string& strFileNameAndPath, std::string& strPath, std::string& strFileName);
- };
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.cpp
deleted file mode 100644
index 166d108c12..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * Copyright (C) 2010-2014 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ActiveAEDSPMode.h"
-#include "ActiveAEDSPDatabase.h"
-#include "ActiveAEDSP.h"
-#include "guilib/LocalizeStrings.h"
-#include "utils/log.h"
-#include "utils/StringUtils.h"
-
-using namespace ActiveAE;
-
-bool CActiveAEDSPMode::operator==(const CActiveAEDSPMode &right) const
-{
- return (m_iModeId == right.m_iModeId &&
- m_iAddonId == right.m_iAddonId &&
- m_iAddonModeNumber == right.m_iAddonModeNumber &&
- m_iModeType == right.m_iModeType &&
- m_iModePosition == right.m_iModePosition);
-}
-
-bool CActiveAEDSPMode::operator!=(const CActiveAEDSPMode &right) const
-{
- return !(*this == right);
-}
-
-CActiveAEDSPMode::CActiveAEDSPMode()
-{
- m_iModeType = AE_DSP_MODE_TYPE_UNDEFINED;
- m_iModeId = -1;
- m_iModePosition = -1;
- m_bIsEnabled = false;
- m_strOwnIconPath = "";
- m_strOverrideIconPath = "";
- m_iStreamTypeFlags = 0;
- m_iBaseType = AE_DSP_ABASE_INVALID;
- m_iModeName = -1;
- m_iModeSetupName = -1;
- m_iModeDescription = -1;
- m_iModeHelp = -1;
- m_bChanged = false;
- m_bIsInternal = false;
- m_bHasSettingsDialog = false;
-
- m_fCPUUsage = 0.0f;
-
- m_iAddonId = -1;
- m_iAddonModeNumber = -1;
- m_strModeName = "";
-}
-
-CActiveAEDSPMode::CActiveAEDSPMode(int modeId, const AE_DSP_BASETYPE baseType)
-{
- m_iModeType = AE_DSP_MODE_TYPE_MASTER_PROCESS;
- m_iModeId = modeId;
- m_iModePosition = 0;
- m_bIsEnabled = true;
- m_strOwnIconPath = "";
- m_strOverrideIconPath = "";
- m_iStreamTypeFlags = AE_DSP_PRSNT_ASTREAM_BASIC |
- AE_DSP_PRSNT_ASTREAM_MUSIC |
- AE_DSP_PRSNT_ASTREAM_MOVIE/* |
- AE_DSP_PRSNT_ASTREAM_GAME |
- AE_DSP_PRSNT_ASTREAM_APP |
- AE_DSP_PRSNT_ASTREAM_PHONE |
- AE_DSP_PRSNT_ASTREAM_MESSAGE*/;
- m_iBaseType = baseType;
-
- switch (modeId)
- {
- case AE_DSP_MASTER_MODE_ID_PASSOVER:
- m_iModeName = 16039;
- m_iModeDescription = -1;
- m_iModeHelp = -1;
- m_iModeSetupName = -1;
- m_strModeName = "Passover";
- break;
- case AE_DSP_MASTER_MODE_ID_INTERNAL_STEREO_UPMIX:
- m_iModeName = 252;
- m_iModeDescription = 36364;
- m_iModeHelp = -1;
- m_iModeSetupName = -1;
- m_strModeName = "Stereo Upmix";
- break;
- default:
- m_iModeName = 16039;
- m_iModeDescription = -1;
- m_iModeHelp = -1;
- m_iModeSetupName = -1;
- m_strModeName = "Unknown";
- break;
- };
-
- m_bChanged = false;
- m_bIsInternal = true;
- m_bHasSettingsDialog = false;
-
- m_fCPUUsage = 0.0f;
-
- m_iAddonId = -1;
- m_iAddonModeNumber = -1;
-}
-
-CActiveAEDSPMode::CActiveAEDSPMode(const AE_DSP_MODES::AE_DSP_MODE &mode, int iAddonId)
-{
- m_iModeType = mode.iModeType;
- m_iModePosition = -1;
- m_iModeId = mode.iUniqueDBModeId;
- m_iAddonId = iAddonId;
- m_iBaseType = AE_DSP_ABASE_INVALID;
- m_bIsEnabled = m_iModeType == AE_DSP_MODE_TYPE_MASTER_PROCESS ? !mode.bIsDisabled : false;
- m_strOwnIconPath = mode.strOwnModeImage;
- m_strOverrideIconPath = mode.strOverrideModeImage;
- m_iStreamTypeFlags = mode.iModeSupportTypeFlags;
- m_iModeName = mode.iModeName;
- m_iModeSetupName = mode.iModeSetupName;
- m_iModeDescription = mode.iModeDescription;
- m_iModeHelp = mode.iModeHelp;
- m_iAddonModeNumber = mode.iModeNumber;
- m_strModeName = mode.strModeName;
- m_bHasSettingsDialog = mode.bHasSettingsDialog;
- m_bChanged = false;
- m_bIsInternal = false;
-
- m_fCPUUsage = 0.0f;
-
- if (m_strModeName.empty())
- m_strModeName = StringUtils::Format("%s %d", g_localizeStrings.Get(15023).c_str(), m_iModeId);
-}
-
-CActiveAEDSPMode::CActiveAEDSPMode(const CActiveAEDSPMode &mode)
-{
- *this = mode;
-}
-
-CActiveAEDSPMode &CActiveAEDSPMode::operator=(const CActiveAEDSPMode &mode)
-{
- m_iModeId = mode.m_iModeId;
- m_iModeType = mode.m_iModeType;
- m_iModePosition = mode.m_iModePosition;
- m_bIsEnabled = mode.m_bIsEnabled;
- m_strOwnIconPath = mode.m_strOwnIconPath;
- m_strOverrideIconPath = mode.m_strOverrideIconPath;
- m_iStreamTypeFlags = mode.m_iStreamTypeFlags;
- m_iBaseType = mode.m_iBaseType;
- m_iModeName = mode.m_iModeName;
- m_iModeSetupName = mode.m_iModeSetupName;
- m_iModeDescription = mode.m_iModeDescription;
- m_iModeHelp = mode.m_iModeHelp;
- m_iAddonId = mode.m_iAddonId;
- m_iAddonModeNumber = mode.m_iAddonModeNumber;
- m_strModeName = mode.m_strModeName;
- m_bChanged = mode.m_bChanged;
- m_bIsInternal = mode.m_bIsInternal;
- m_bHasSettingsDialog = mode.m_bHasSettingsDialog;
- m_fCPUUsage = mode.m_fCPUUsage;
-
- return *this;
-}
-
-/********** General mode related functions **********/
-
-bool CActiveAEDSPMode::IsNew(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModeId <= 0;
-}
-
-bool CActiveAEDSPMode::IsChanged(void) const
-{
- CSingleLock lock(m_critSection);
- return m_bChanged;
-}
-
-
-bool CActiveAEDSPMode::IsInternal(void) const
-{
- CSingleLock lock(m_critSection);
- return m_bIsInternal;
-}
-
-bool CActiveAEDSPMode::IsEnabled(void) const
-{
- CSingleLock lock(m_critSection);
- return m_bIsEnabled;
-}
-
-bool CActiveAEDSPMode::SetEnabled(bool bIsEnabled)
-{
- CSingleLock lock(m_critSection);
-
- if (m_bIsEnabled != bIsEnabled)
- {
- /* update the Enabled flag */
- m_bIsEnabled = bIsEnabled;
- SetChanged();
- m_bChanged = true;
-
- return true;
- }
-
- return false;
-}
-
-int CActiveAEDSPMode::ModePosition(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModePosition;
-}
-
-bool CActiveAEDSPMode::SetModePosition(int iModePosition)
-{
- CSingleLock lock(m_critSection);
- if (m_iModePosition != iModePosition)
- {
- /* update the type */
- m_iModePosition = iModePosition;
- SetChanged();
- m_bChanged = true;
-
- return true;
- }
-
- return false;
-}
-
-bool CActiveAEDSPMode::SupportStreamType(AE_DSP_STREAMTYPE streamType, unsigned int flags)
-{
- if (streamType == AE_DSP_ASTREAM_BASIC && (flags & AE_DSP_PRSNT_ASTREAM_BASIC)) return true;
- else if (streamType == AE_DSP_ASTREAM_MUSIC && (flags & AE_DSP_PRSNT_ASTREAM_MUSIC)) return true;
- else if (streamType == AE_DSP_ASTREAM_MOVIE && (flags & AE_DSP_PRSNT_ASTREAM_MOVIE)) return true;
- else if (streamType == AE_DSP_ASTREAM_GAME && (flags & AE_DSP_PRSNT_ASTREAM_GAME)) return true;
- else if (streamType == AE_DSP_ASTREAM_APP && (flags & AE_DSP_PRSNT_ASTREAM_APP)) return true;
- else if (streamType == AE_DSP_ASTREAM_PHONE && (flags & AE_DSP_PRSNT_ASTREAM_PHONE)) return true;
- else if (streamType == AE_DSP_ASTREAM_MESSAGE && (flags & AE_DSP_PRSNT_ASTREAM_MESSAGE)) return true;
- return false;
-}
-
-bool CActiveAEDSPMode::SupportStreamType(AE_DSP_STREAMTYPE streamType) const
-{
- return SupportStreamType(streamType, m_iStreamTypeFlags);
-}
-
-/********** Mode user interface related data functions **********/
-
-int CActiveAEDSPMode::ModeName(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModeName;
-}
-
-int CActiveAEDSPMode::ModeSetupName(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModeSetupName;
-}
-
-int CActiveAEDSPMode::ModeDescription(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModeDescription;
-}
-
-int CActiveAEDSPMode::ModeHelp(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModeHelp;
-}
-
-const std::string &CActiveAEDSPMode::IconOwnModePath(void) const
-{
- CSingleLock lock(m_critSection);
- return m_strOwnIconPath;
-}
-
-const std::string &CActiveAEDSPMode::IconOverrideModePath(void) const
-{
- CSingleLock lock(m_critSection);
- return m_strOverrideIconPath;
-}
-
-
-/********** Master mode type related functions **********/
-
-bool CActiveAEDSPMode::SetBaseType(AE_DSP_BASETYPE baseType)
-{
- CSingleLock lock(m_critSection);
- if (m_iBaseType != baseType)
- {
- /* update the mode base */
- m_iBaseType = baseType;
- SetChanged();
- m_bChanged = true;
-
- return true;
- }
-
- return false;
-}
-
-AE_DSP_BASETYPE CActiveAEDSPMode::BaseType(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iBaseType;
-}
-
-
-/********** Audio DSP database related functions **********/
-
-int CActiveAEDSPMode::ModeID(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModeId;
-}
-
-int CActiveAEDSPMode::AddUpdate(bool force)
-{
- if (!force)
- {
- // not changed
- CSingleLock lock(m_critSection);
- if (!m_bChanged && m_iModeId > 0)
- return m_iModeId;
- }
-
- CActiveAEDSPDatabase *database = nullptr;
- if (!database || !database->IsOpen())
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - failed to open the database");
- return -1;
- }
-
- database->AddUpdateMode(*this);
- m_iModeId = database->GetModeId(*this);
-
- return m_iModeId;
-}
-
-bool CActiveAEDSPMode::Delete(void)
-{
- CActiveAEDSPDatabase *database = nullptr;
- if (!database || !database->IsOpen())
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - failed to open the database");
- return false;
- }
-
- return database->DeleteMode(*this);
-}
-
-bool CActiveAEDSPMode::IsKnown(void) const
-{
- CActiveAEDSPDatabase *database = nullptr;
- if (!database || !database->IsOpen())
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - failed to open the database");
- return false;
- }
-
- return database->GetModeId(*this) > 0;
-}
-
-
-/********** Dynamic processing related data methods **********/
-
-void CActiveAEDSPMode::SetCPUUsage(float percent)
-{
- CSingleLock lock(m_critSection);
- m_fCPUUsage = percent;
-}
-
-float CActiveAEDSPMode::CPUUsage(void) const
-{
- CSingleLock lock(m_critSection);
- return m_fCPUUsage;
-}
-
-
-/********** Fixed addon related Mode methods **********/
-
-int CActiveAEDSPMode::AddonID(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iAddonId;
-}
-
-unsigned int CActiveAEDSPMode::AddonModeNumber(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iAddonModeNumber;
-}
-
-AE_DSP_MODE_TYPE CActiveAEDSPMode::ModeType(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iModeType;
-}
-
-const std::string &CActiveAEDSPMode::AddonModeName(void) const
-{
- CSingleLock lock(m_critSection);
- return m_strModeName;
-}
-
-bool CActiveAEDSPMode::HasSettingsDialog(void) const
-{
- CSingleLock lock(m_critSection);
- return m_bHasSettingsDialog;
-}
-
-unsigned int CActiveAEDSPMode::StreamTypeFlags(void) const
-{
- CSingleLock lock(m_critSection);
- return m_iStreamTypeFlags;
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h
deleted file mode 100644
index 61536ace7b..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h
+++ /dev/null
@@ -1,328 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2010-2014 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "ActiveAEDSPAddon.h"
-#include "threads/CriticalSection.h"
-#include "utils/Observer.h"
-
-namespace ActiveAE
-{
- class CActiveAEDSPMode;
- class CActiveAEDSPDatabase;
-
- typedef std::shared_ptr<CActiveAEDSPMode> CActiveAEDSPModePtr;
- typedef std::pair <CActiveAEDSPModePtr, AE_DSP_ADDON> AE_DSP_MODEPAIR;
- typedef std::vector<AE_DSP_MODEPAIR> AE_DSP_MODELIST;
-
- #define AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES 0xFF00
- #define AE_DSP_MASTER_MODE_ID_INTERNAL_STEREO_UPMIX (AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES) /*!< Used to for internal stereo upmix over ffmpeg */
- #define AE_DSP_MASTER_MODE_ID_PASSOVER 0 /*!< Used to ignore master processing */
- #define AE_DSP_MASTER_MODE_ID_INVALID -1
-
- /*!
- * DSP Mode information class
- */
- //@{
- class CActiveAEDSPMode : public Observable
- {
- public:
- /*! @brief Create a new mode */
- CActiveAEDSPMode();
-
- /*!
- * @brief Create a KODI internal processing mode infomation class
- * @param modeId internal processing mode identifier
- * @param baseType the used base of this internal mode
- * @note this creation is only used to get a internal bypass mode (no addon call process mode)
- */
- CActiveAEDSPMode(int modeId, const AE_DSP_BASETYPE baseType);
-
- /*!
- * @brief Create the class about from addon given values
- * @param mode the from addon set identification structure
- * @param iAddonId the addon identification of the given data
- */
- CActiveAEDSPMode(const AE_DSP_MODES::AE_DSP_MODE &mode, int iAddonId);
-
- /*!
- * @brief Create a new class about given class
- * @param mode the parent mode to copy data from
- */
- CActiveAEDSPMode(const CActiveAEDSPMode &mode);
-
- bool operator ==(const CActiveAEDSPMode &right) const;
- bool operator !=(const CActiveAEDSPMode &right) const;
- CActiveAEDSPMode &operator=(const CActiveAEDSPMode &mode);
-
- /*! @name General mode related functions
- * @note changes are not written inside database and must be performed with AddUpdate call
- */
- //@{
- /*!
- * @brief Check this mode as known or new one
- * @return true if this mode is new and not stored inside database
- */
- bool IsNew(void) const;
-
- /*!
- * @brief Check this mode about data changes
- * @return true if anything becomes changed on the mode data
- */
- bool IsChanged(void) const;
-
- /*!
- * @brief Check this mode about source
- * @return true if internal KODI mode
- */
- bool IsInternal(void) const;
-
- /*!
- * @brief Check this mode is enabled for usage
- * @return true if enabled
- */
- bool IsEnabled(void) const;
-
- /*!
- * @brief Enable or disable the usage of this mode
- * @param bIsEnabled true to enable
- * @return true if set was successful
- */
- bool SetEnabled(bool bIsEnabled);
-
- /*!
- * @brief Get the mode process chain position inside his mode type
- * @return the mode process position or -1 not set
- */
- int ModePosition(void) const;
-
- /*!
- * @brief Set the mode process chain position inside his mode type
- * @param iModePosition the process chain position
- * @return true if the position becomes set and a database update becomes required
- */
- bool SetModePosition(int iModePosition);
-
- /*!
- * @brief Ask about stream type to given flags
- * @param streamType the type to ask
- * @param flags the stream types flags to check in accordance with AE_DSP_ASTREAM_PRESENT
- * @return true if the mode is set as enabled under the flags
- */
- static bool SupportStreamType(AE_DSP_STREAMTYPE streamType, unsigned int flags);
-
- /*!
- * @brief Ask this mode about stream type
- * @param streamType the type to ask
- * @return true if the mode is set as enabled of this mode
- */
- bool SupportStreamType(AE_DSP_STREAMTYPE streamType) const;
- //@}
-
- /*! @name Mode user interface related data functions
- */
- //@{
- /*!
- * @brief Get the mode name string identification code
- * @return the identifier code on addon strings or -1 if unset
- */
- int ModeName(void) const;
-
- /*!
- * @brief Get the mode name string identification code used on setup entries
- * @return the identifier code on addon strings or -1 if unset
- */
- int ModeSetupName(void) const;
-
- /*!
- * @brief Get the mode help string identification code used as help text on dsp manager helper dialog
- * @return the identifier code on addon strings or -1 if unset
- */
- int ModeHelp(void) const;
-
- /*!
- * @brief Get the mode description string identification code used as small help text on dsp manager dialog
- * @return the identifier code on addon strings or -1 if unset
- */
- int ModeDescription(void) const;
-
- /*!
- * @brief Get the path to a from addon set mode identification image
- * @return the path to the image or empty if not present
- */
- const std::string &IconOwnModePath(void) const;
-
- /*!
- * @brief Get the path to a from addon set mode identification image to override the from KODI used one, e.g. Dolby Digital with Dolby Digital EX
- * @return the path to the image or empty if not present
- */
- const std::string &IconOverrideModePath(void) const;
- //@}
-
- /*! @name Master mode type related functions
- */
- //@{
- /*!
- * @brief Get the used base type of this mode
- * @return the base type
- */
- AE_DSP_BASETYPE BaseType(void) const;
-
- /*!
- * @brief Set the used base type of this mode
- * @return baseType the base type to set
- * @return true if the position becomes set and a database update becomes required
- */
- bool SetBaseType(AE_DSP_BASETYPE baseType);
- //@}
-
- /*! @name Audio DSP database related functions
- */
- //@{
- /*!
- * @brief Get the identifier of this mode used on database
- * @return the mode identifier or -1 if unknown and not saved to database
- */
- int ModeID(void) const;
-
- /*!
- * @brief Add or update this mode to the audio DSP database
- * @param force if it is false it write only to the database on uknown id or if a change was inside the mode
- * @return the database identifier of this mode, or -1 if a error was occurred
- */
- int AddUpdate(bool force = false);
-
- /*!
- * @brief Delete this mode from the audio dsp database
- * @return true if deletion was successful
- */
- bool Delete(void);
-
- /*!
- * @brief Ask database about this mode that it is already known
- * @return true if present inside database
- */
- bool IsKnown(void) const;
- //@}
-
- /*! @name Dynamic processing related functions
- */
- //@{
- /*!
- * @brief Get the cpu usage of this mode
- * @return percent The percent value (0.0 - 100.0)
- * @note only be usable if mode is active in process chain
- */
- float CPUUsage(void) const;
-
- /*!
- * @brief Set the cpu usage of this mode if active and in process list
- * @param percent The percent value (0.0 - 100.0)
- */
- void SetCPUUsage(float percent);
- //@}
-
- /*! @name Fixed audio dsp add-on related mode functions
- */
- //@{
- /*!
- * @brief Get the addon identifier
- * @return returns the inside addon database used identifier of this mode based addon
- */
- int AddonID(void) const;
-
- /*!
- * @brief Get the addon processing mode identifier
- * @return returns the from addon itself set identifier of this mode
- */
- unsigned int AddonModeNumber(void) const;
-
- /*!
- * @brief The processing mode type identifier of this mode
- * @return returns the mode type, it should be never AE_DSP_MODE_TYPE_UNDEFINED
- */
- AE_DSP_MODE_TYPE ModeType(void) const;
-
- /*!
- * @brief Get the addon mode name
- * @return returns the from addon set name of this mode, used for log messages
- */
- const std::string &AddonModeName(void) const;
-
- /*!
- * @brief Have this mode settings dialogs
- * @return returns true if one or more dialogs are available to this mode
- * @note if it is true the addon menu hook database can be checked with the addon mode identifier
- */
- bool HasSettingsDialog(void) const;
-
- /*!
- * @brief Get the from addon mode supported stream type flags
- * @return returns the flags in accordance with AE_DSP_ASTREAM_PRESENT
- */
- unsigned int StreamTypeFlags(void) const;
- //@}
-
- private:
- friend class CActiveAEDSPDatabase;
-
- /*! @name KODI related mode data
- */
- //@{
- AE_DSP_MODE_TYPE m_iModeType; /*!< the processing mode type */
- int m_iModePosition; /*!< the processing mode position */
- int m_iModeId; /*!< the identifier given to this mode by the DSP database */
- AE_DSP_BASETYPE m_iBaseType; /*!< The stream source coding format */
- bool m_bIsEnabled; /*!< true if this mode is enabled, false if not */
- std::string m_strOwnIconPath; /*!< the path to the icon for this mode */
- std::string m_strOverrideIconPath; /*!< the path to the icon for this mode */
- int m_iModeName; /*!< the name id for this mode used by KODI */
- int m_iModeSetupName; /*!< the name id for this mode inside settings used by KODI */
- int m_iModeDescription; /*!< the description id for this mode used by KODI */
- int m_iModeHelp; /*!< the help id for this mode used by KODI */
- bool m_bChanged; /*!< true if anything in this entry was changed that needs to be persisted */
- bool m_bIsInternal; /*!< true if this mode is an internal KODI mode */
- std::string m_strModeName; /*!< the log name of this mode on the Addon or inside KODI */
- //@}
-
- /*! @name Dynamic processing related data
- */
- //@{
- float m_fCPUUsage; /*!< if mode is active the used cpu force in percent is set here */
- //@}
-
- /*! @name Audio dsp add-on related mode data
- */
- //@{
- int m_iAddonId; /*!< the identifier of the Addon that serves this mode */
- unsigned int m_iAddonModeNumber; /*!< the mode number on the Addon */
- bool m_bHasSettingsDialog; /*!< the mode have a own settings dialog */
- unsigned int m_iStreamTypeFlags; /*!< The stream content type flags in accordance with AE_DSP_ASTREAM_PRESENT */
- //@}
-
- CCriticalSection m_critSection;
- };
- //@}
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.cpp
deleted file mode 100644
index ad575ebd0f..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.cpp
+++ /dev/null
@@ -1,1429 +0,0 @@
-/*
- * Copyright (C) 2010-2015 Team Kodi
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Kodi; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ActiveAEDSPProcess.h"
-
-#include <utility>
-
-extern "C" {
-#include "libavutil/channel_layout.h"
-#include "libavutil/opt.h"
-}
-
-#include "ActiveAEDSPMode.h"
-#include "Application.h"
-#include "cores/AudioEngine/AEResampleFactory.h"
-#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h"
-#include "cores/AudioEngine/Utils/AEUtil.h"
-#include "cores/IPlayer.h"
-#include "settings/MediaSettings.h"
-#include "utils/TimeUtils.h"
-#include "utils/log.h"
-
-using namespace ADDON;
-using namespace ActiveAE;
-
-#define MIN_DSP_ARRAY_SIZE 4096
-#define FFMPEG_PROC_ARRAY_IN 0
-#define FFMPEG_PROC_ARRAY_OUT 1
-
-
-CActiveAEDSPProcess::CActiveAEDSPProcess(AE_DSP_STREAM_ID streamId)
- : m_streamId(streamId)
-{
- m_channelLayoutIn = 0; /* Undefined input channel layout */
- m_channelLayoutOut = 0; /* Undefined output channel layout */
- m_streamTypeUsed = AE_DSP_ASTREAM_INVALID;
- m_NewStreamType = AE_DSP_ASTREAM_INVALID;
- m_NewMasterMode = AE_DSP_MASTER_MODE_ID_INVALID;
- m_forceInit = false;
- m_resamplerDSPProcessor = NULL;
- m_convertInput = NULL;
- m_convertOutput = NULL;
- m_iLastProcessTime = 0;
-
- /*!
- * Create predefined process arrays on every supported channel for audio dsp's.
- * All are set if used or not for safety reason and unsued ones can be used from
- * dsp addons as buffer arrays.
- * If a bigger size is neeeded it becomes reallocated during DSP processing.
- */
- m_processArraySize = MIN_DSP_ARRAY_SIZE;
- for (int i = 0; i < AE_DSP_CH_MAX; ++i)
- {
- m_processArray[0][i] = (float*)calloc(m_processArraySize, sizeof(float));
- m_processArray[1][i] = (float*)calloc(m_processArraySize, sizeof(float));
- }
-}
-
-CActiveAEDSPProcess::~CActiveAEDSPProcess()
-{
- ResetStreamFunctionsSelection();
-
- delete m_resamplerDSPProcessor;
- m_resamplerDSPProcessor = NULL;
-
- /* Clear the buffer arrays */
- for (int i = 0; i < AE_DSP_CH_MAX; ++i)
- {
- if(m_processArray[0][i])
- free(m_processArray[0][i]);
- if(m_processArray[1][i])
- free(m_processArray[1][i]);
- }
-
- swr_free(&m_convertInput);
- swr_free(&m_convertOutput);
-}
-
-void CActiveAEDSPProcess::ResetStreamFunctionsSelection()
-{
- m_NewMasterMode = AE_DSP_MASTER_MODE_ID_INVALID;
- m_NewStreamType = AE_DSP_ASTREAM_INVALID;
- m_addon_InputResample.Clear();
- m_addon_OutputResample.Clear();
-
- m_addons_InputProc.clear();
- m_addons_PreProc.clear();
- m_addons_MasterProc.clear();
- m_addons_PostProc.clear();
- m_usedMap.clear();
-}
-
-bool CActiveAEDSPProcess::Create(const AEAudioFormat &inputFormat, const AEAudioFormat &outputFormat, bool upmix, bool bypassDSP, AEQuality quality, AE_DSP_STREAMTYPE iStreamType,
- enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type, int profile)
-{
- m_inputFormat = inputFormat; /*!< Input format of processed stream */
- m_outputFormat = outputFormat; /*!< Output format of required stream (set from ADSP system on startup, to have ffmpeg compatible format */
- m_outputFormat.m_sampleRate = m_inputFormat.m_sampleRate; /*!< If no resampler addon is present output samplerate is the same as input */
- m_outputFormat.m_frames = m_inputFormat.m_frames;
- m_streamQuality = quality; /*!< from KODI on settings selected resample quality, also passed to addons to support different quality */
- m_activeMode = AE_DSP_MASTER_MODE_ID_PASSOVER; /*!< Reset the pointer for m_MasterModes about active master process, set here during mode selection */
- m_ffMpegMatrixEncoding = matrix_encoding;
- m_ffMpegAudioServiceType= audio_service_type;
- m_ffMpegProfile = profile;
- m_bypassDSP = bypassDSP;
-
- CSingleLock lock(m_restartSection);
-
- //CLog::Log(LOGDEBUG, "ActiveAE DSP - %s - Audio DSP processing id %d created:", __FUNCTION__, m_streamId);
-
- m_convertInput = swr_alloc_set_opts(m_convertInput,
- CAEUtil::GetAVChannelLayout(m_inputFormat.m_channelLayout),
- AV_SAMPLE_FMT_FLTP,
- m_inputFormat.m_sampleRate,
- CAEUtil::GetAVChannelLayout(m_inputFormat.m_channelLayout),
- CAEUtil::GetAVSampleFormat(m_inputFormat.m_dataFormat),
- m_inputFormat.m_sampleRate,
- 0, NULL);
- if (m_convertInput == NULL)
- {
- //CLog::Log(LOGERROR, "ActiveAE DSP - %s - DSP input convert with data format '%s' not supported!", __FUNCTION__, CAEUtil::DataFormatToStr(inputFormat.m_dataFormat));
- return false;
- }
-
- if (swr_init(m_convertInput) < 0)
- {
- //CLog::Log(LOGERROR, "ActiveAE DSP - %s - DSP input convert failed", __FUNCTION__);
- return false;
- }
-
- m_convertOutput = swr_alloc_set_opts(m_convertOutput,
- CAEUtil::GetAVChannelLayout(m_outputFormat.m_channelLayout),
- CAEUtil::GetAVSampleFormat(m_outputFormat.m_dataFormat),
- m_outputFormat.m_sampleRate,
- CAEUtil::GetAVChannelLayout(m_outputFormat.m_channelLayout),
- AV_SAMPLE_FMT_FLTP,
- m_outputFormat.m_sampleRate,
- 0, NULL);
- if (m_convertOutput == NULL)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - DSP output convert with data format '%s' not supported!", __FUNCTION__, CAEUtil::DataFormatToStr(outputFormat.m_dataFormat));
- return false;
- }
-
- if (swr_init(m_convertOutput) < 0)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - DSP output convert failed", __FUNCTION__);
- return false;
- }
-
- ResetStreamFunctionsSelection();
-
- CFileItem currentFile(g_application.CurrentFileItem());
-
- m_streamTypeDetected = DetectStreamType(&currentFile);
-
- if (iStreamType == AE_DSP_ASTREAM_AUTO)
- m_streamTypeUsed = m_streamTypeDetected;
- else if (iStreamType >= AE_DSP_ASTREAM_BASIC && iStreamType < AE_DSP_ASTREAM_AUTO)
- m_streamTypeUsed = iStreamType;
- else
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - Unknown audio stream type, falling back to basic", __FUNCTION__);
- m_streamTypeUsed = AE_DSP_ASTREAM_BASIC;
- }
-
- /*!
- * Set general stream information about the processed stream
- */
- if (g_application.GetAppPlayer().GetAudioStreamCount() > 0)
- {
- int identifier = g_application.GetAppPlayer().GetAudioStream();
- if (identifier < 0)
- identifier = 0;
-
- AudioStreamInfo info;
- g_application.GetAppPlayer().GetAudioStreamInfo(identifier, info);
-
- m_addonStreamProperties.strName = info.name.c_str();
- m_addonStreamProperties.strLanguage = info.language.c_str();
- m_addonStreamProperties.strCodecId = info.codecName.c_str();
- m_addonStreamProperties.iIdentifier = identifier;
- m_addonStreamProperties.iSampleRate = info.samplerate;
- m_addonStreamProperties.iChannels = info.channels;
- }
- else
- {
- m_addonStreamProperties.strName = "Unknown";
- m_addonStreamProperties.strLanguage = "";
- m_addonStreamProperties.strCodecId = "";
- m_addonStreamProperties.iIdentifier = m_streamId;
- m_addonStreamProperties.iSampleRate = m_inputFormat.m_sampleRate;
- m_addonStreamProperties.iChannels = m_inputFormat.m_channelLayout.Count();
- }
-
- m_addonStreamProperties.iStreamID = m_streamId;
- m_addonStreamProperties.iStreamType = m_streamTypeUsed;
- m_addonStreamProperties.iBaseType = GetBaseType(&m_addonStreamProperties);
-
- /*!
- * Create the profile about additional stream related data, e.g. the different Dolby Digital stream flags
- */
- CreateStreamProfile();
-
- /*!
- * Set exact input and output format settings
- */
- m_addonSettings.iStreamID = m_streamId;
- m_addonSettings.iStreamType = m_streamTypeUsed;
- m_addonSettings.lInChannelPresentFlags = 0; /*!< Reset input channel present flags, becomes set on next steps */
- m_addonSettings.iInChannels = m_inputFormat.m_channelLayout.Count();/*!< The from stream given channel amount */
- m_addonSettings.iInFrames = m_inputFormat.m_frames; /*!< Input frames given */
- m_addonSettings.iInSamplerate = m_inputFormat.m_sampleRate; /*!< The basic input samplerate from stream source */
- m_addonSettings.iProcessFrames = m_inputFormat.m_frames; /*!< Default the same as input frames, if input resampler is present it becomes corrected */
- m_addonSettings.iProcessSamplerate = m_inputFormat.m_sampleRate; /*!< Default the same as input samplerate, if input resampler is present it becomes corrected */
- m_addonSettings.lOutChannelPresentFlags = 0; /*!< Reset output channel present flags, becomes set on next steps */
- m_addonSettings.iOutChannels = m_outputFormat.m_channelLayout.Count(); /*!< The for output required amount of channels */
- m_addonSettings.iOutFrames = m_outputFormat.m_frames; /*! Output frames requested */
- m_addonSettings.iOutSamplerate = m_outputFormat.m_sampleRate; /*!< The required sample rate for pass over resampling on ActiveAEResample */
- m_addonSettings.bStereoUpmix = upmix; /*! Stereo upmix value given from KODI settings */
- m_addonSettings.bInputResamplingActive = false; /*! Becomes true if input resampling is in use */
- m_addonSettings.iQualityLevel = m_streamQuality; /*! Requested stream processing quality, is optional and can be from addon ignored */
-
- /*! @warning If you change or add new channel enums to AEChannel in
- * xbmc/cores/AudioEngine/Utils/AEChannelData.h you have to adapt this loop
- */
- for (int ii = 0; ii < AE_DSP_CH_MAX; ii++)
- {
- if (m_inputFormat.m_channelLayout.HasChannel((AEChannel)(ii + 1)))
- {
- m_addonSettings.lInChannelPresentFlags |= 1 << ii;
- }
- }
-
- for (int ii = 0; ii < AE_DSP_CH_MAX; ii++)
- {
- if (m_outputFormat.m_channelLayout.HasChannel((AEChannel)(ii + 1)))
- {
- m_addonSettings.lOutChannelPresentFlags |= 1 << ii;
- }
- }
-
- UpdateActiveModes();
-
- /*!
- * Initialize fallback matrix mixer
- */
- InitFFMpegDSPProcessor();
-
- if (CLog::GetLogLevel() == LOGDEBUG) // Speed improve
- {
- CLog::Log(LOGDEBUG, " ---- Input stream ----");
- CLog::Log(LOGDEBUG, " | Identifier : %d", m_addonStreamProperties.iIdentifier);
- CLog::Log(LOGDEBUG, " | Stream Type : %s", m_addonStreamProperties.iStreamType == AE_DSP_ASTREAM_BASIC ? "Basic" :
- m_addonStreamProperties.iStreamType == AE_DSP_ASTREAM_MUSIC ? "Music" :
- m_addonStreamProperties.iStreamType == AE_DSP_ASTREAM_MOVIE ? "Movie" :
- m_addonStreamProperties.iStreamType == AE_DSP_ASTREAM_GAME ? "Game" :
- m_addonStreamProperties.iStreamType == AE_DSP_ASTREAM_APP ? "App" :
- m_addonStreamProperties.iStreamType == AE_DSP_ASTREAM_PHONE ? "Phone" :
- m_addonStreamProperties.iStreamType == AE_DSP_ASTREAM_MESSAGE ? "Message" :
- "Unknown");
- CLog::Log(LOGDEBUG, " | Name : %s", m_addonStreamProperties.strName);
- CLog::Log(LOGDEBUG, " | Language : %s", m_addonStreamProperties.strLanguage);
- CLog::Log(LOGDEBUG, " | Codec : %s", m_addonStreamProperties.strCodecId);
- CLog::Log(LOGDEBUG, " | Sample Rate : %d", m_addonStreamProperties.iSampleRate);
- CLog::Log(LOGDEBUG, " | Channels : %d", m_addonStreamProperties.iChannels);
- CLog::Log(LOGDEBUG, " ---- Input format ----");
- CLog::Log(LOGDEBUG, " | Sample Rate : %d", m_addonSettings.iInSamplerate);
- CLog::Log(LOGDEBUG, " | Sample Format : %s", CAEUtil::DataFormatToStr(m_inputFormat.m_dataFormat));
- CLog::Log(LOGDEBUG, " | Channel Count : %d", m_inputFormat.m_channelLayout.Count());
- CLog::Log(LOGDEBUG, " | Channel Layout : %s", ((std::string)m_inputFormat.m_channelLayout).c_str());
- CLog::Log(LOGDEBUG, " | Frames : %d", m_addonSettings.iInFrames);
- CLog::Log(LOGDEBUG, " ---- Process format ----");
- CLog::Log(LOGDEBUG, " | Sample Rate : %d", m_addonSettings.iProcessSamplerate);
- CLog::Log(LOGDEBUG, " | Sample Format : %s", "AE_FMT_FLOATP");
- CLog::Log(LOGDEBUG, " | Frames : %d", m_addonSettings.iProcessFrames);
- CLog::Log(LOGDEBUG, " | Internal processing : %s", m_resamplerDSPProcessor ? "yes" : "no");
- CLog::Log(LOGDEBUG, " ---- Output format ----");
- CLog::Log(LOGDEBUG, " | Sample Rate : %d", m_outputFormat.m_sampleRate);
- CLog::Log(LOGDEBUG, " | Sample Format : %s", CAEUtil::DataFormatToStr(m_outputFormat.m_dataFormat));
- CLog::Log(LOGDEBUG, " | Channel Count : %d", m_outputFormat.m_channelLayout.Count());
- CLog::Log(LOGDEBUG, " | Channel Layout : %s", ((std::string)m_outputFormat.m_channelLayout).c_str());
- CLog::Log(LOGDEBUG, " | Frames : %d", m_outputFormat.m_frames);
- }
-
- m_forceInit = true;
- return true;
-}
-
-void CActiveAEDSPProcess::InitFFMpegDSPProcessor()
-{
- /*!
- * If ffmpeg resampler is already present delete it first to create it from new
- */
- if (m_resamplerDSPProcessor)
- {
- delete m_resamplerDSPProcessor;
- m_resamplerDSPProcessor = NULL;
- }
-
- /*!
- * if the amount of input channels is higher as output and the active master mode gives more channels out or if it is not set of it
- * a forced channel downmix becomes enabled.
- */
- bool upmix = m_addonSettings.bStereoUpmix && m_addons_MasterProc[m_activeMode].pMode->ModeID() == AE_DSP_MASTER_MODE_ID_INTERNAL_STEREO_UPMIX ? true : false;
- if (upmix || (m_addonSettings.iInChannels > m_addonSettings.iOutChannels && (m_activeModeOutChannels <= 0 || m_activeModeOutChannels > m_addonSettings.iOutChannels)))
- {
- m_resamplerDSPProcessor = CAEResampleFactory::Create();
- if (!m_resamplerDSPProcessor->Init(CAEUtil::GetAVChannelLayout(m_outputFormat.m_channelLayout),
- m_outputFormat.m_channelLayout.Count(),
- m_addonSettings.iProcessSamplerate,
- AV_SAMPLE_FMT_FLTP, sizeof(float) << 3, 0,
- CAEUtil::GetAVChannelLayout(m_inputFormat.m_channelLayout),
- m_inputFormat.m_channelLayout.Count(),
- m_addonSettings.iProcessSamplerate,
- AV_SAMPLE_FMT_FLTP, sizeof(float) << 3, 0,
- upmix,
- true,
- NULL,
- m_streamQuality,
- true))
- {
- delete m_resamplerDSPProcessor;
- m_resamplerDSPProcessor = NULL;
-
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - Initialize of channel mixer failed", __FUNCTION__);
- }
- }
-}
-
-bool CActiveAEDSPProcess::CreateStreamProfile()
-{
- bool ret = true;
-
- switch (m_addonStreamProperties.iBaseType)
- {
- case AE_DSP_ABASE_AC3:
- case AE_DSP_ABASE_EAC3:
- {
- unsigned int iProfile;
- switch (m_ffMpegMatrixEncoding)
- {
- case AV_MATRIX_ENCODING_DOLBY:
- iProfile = AE_DSP_PROFILE_DOLBY_SURROUND;
- break;
- case AV_MATRIX_ENCODING_DPLII:
- iProfile = AE_DSP_PROFILE_DOLBY_PLII;
- break;
- case AV_MATRIX_ENCODING_DPLIIX:
- iProfile = AE_DSP_PROFILE_DOLBY_PLIIX;
- break;
- case AV_MATRIX_ENCODING_DPLIIZ:
- iProfile = AE_DSP_PROFILE_DOLBY_PLIIZ;
- break;
- case AV_MATRIX_ENCODING_DOLBYEX:
- iProfile = AE_DSP_PROFILE_DOLBY_EX;
- break;
- case AV_MATRIX_ENCODING_DOLBYHEADPHONE:
- iProfile = AE_DSP_PROFILE_DOLBY_HEADPHONE;
- break;
- case AV_MATRIX_ENCODING_NONE:
- default:
- iProfile = AE_DSP_PROFILE_DOLBY_NONE;
- break;
- }
-
- unsigned int iServiceType;
- switch (m_ffMpegAudioServiceType)
- {
- case AV_AUDIO_SERVICE_TYPE_EFFECTS:
- iServiceType = AE_DSP_SERVICE_TYPE_EFFECTS;
- break;
- case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:
- iServiceType = AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED;
- break;
- case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:
- iServiceType = AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED;
- break;
- case AV_AUDIO_SERVICE_TYPE_DIALOGUE:
- iServiceType = AE_DSP_SERVICE_TYPE_DIALOGUE;
- break;
- case AV_AUDIO_SERVICE_TYPE_COMMENTARY:
- iServiceType = AE_DSP_SERVICE_TYPE_COMMENTARY;
- break;
- case AV_AUDIO_SERVICE_TYPE_EMERGENCY:
- iServiceType = AE_DSP_SERVICE_TYPE_EMERGENCY;
- break;
- case AV_AUDIO_SERVICE_TYPE_VOICE_OVER:
- iServiceType = AE_DSP_SERVICE_TYPE_VOICE_OVER;
- break;
- case AV_AUDIO_SERVICE_TYPE_KARAOKE:
- iServiceType = AE_DSP_SERVICE_TYPE_KARAOKE;
- break;
- case AV_AUDIO_SERVICE_TYPE_MAIN:
- default:
- iServiceType = AE_DSP_SERVICE_TYPE_MAIN;
- break;
- }
- m_addonStreamProperties.Profile.ac3_eac3.iProfile = iProfile;
- m_addonStreamProperties.Profile.ac3_eac3.iServiceType = iServiceType;
- break;
- }
- case AE_DSP_ABASE_DTS:
- case AE_DSP_ABASE_DTSHD_HRA:
- case AE_DSP_ABASE_DTSHD_MA:
- {
-
- unsigned int iProfile;
- switch (m_ffMpegProfile)
- {
- case FF_PROFILE_DTS_ES:
- iProfile = AE_DSP_PROFILE_DTS_ES;
- break;
- case FF_PROFILE_DTS_96_24:
- iProfile = AE_DSP_PROFILE_DTS_96_24;
- break;
- case FF_PROFILE_DTS_HD_HRA:
- iProfile = AE_DSP_PROFILE_DTS_HD_HRA;
- break;
- case FF_PROFILE_DTS_HD_MA:
- iProfile = AE_DSP_PROFILE_DTS_HD_MA;
- break;
- case FF_PROFILE_DTS:
- default:
- iProfile = AE_DSP_PROFILE_DTS;
- break;
- }
-
- m_addonStreamProperties.Profile.dts_dtshd.iProfile = iProfile;
- m_addonStreamProperties.Profile.dts_dtshd.bSurroundMatrix = m_ffMpegMatrixEncoding == AV_MATRIX_ENCODING_DOLBY ? true : false;
- break;
- }
- case AE_DSP_ABASE_TRUEHD:
- case AE_DSP_ABASE_MLP:
- {
- unsigned int iProfile;
- switch (m_ffMpegMatrixEncoding)
- {
- case AV_MATRIX_ENCODING_DOLBY:
- iProfile = AE_DSP_PROFILE_DOLBY_SURROUND;
- break;
- case AV_MATRIX_ENCODING_DPLII:
- iProfile = AE_DSP_PROFILE_DOLBY_PLII;
- break;
- case AV_MATRIX_ENCODING_DPLIIX:
- iProfile = AE_DSP_PROFILE_DOLBY_PLIIX;
- break;
- case AV_MATRIX_ENCODING_DPLIIZ:
- iProfile = AE_DSP_PROFILE_DOLBY_PLIIZ;
- break;
- case AV_MATRIX_ENCODING_DOLBYEX:
- iProfile = AE_DSP_PROFILE_DOLBY_EX;
- break;
- case AV_MATRIX_ENCODING_DOLBYHEADPHONE:
- iProfile = AE_DSP_PROFILE_DOLBY_HEADPHONE;
- break;
- case AV_MATRIX_ENCODING_NONE:
- default:
- iProfile = AE_DSP_PROFILE_DOLBY_NONE;
- break;
- }
-
- m_addonStreamProperties.Profile.mlp_truehd.iProfile = iProfile;
- break;
- }
- case AE_DSP_ABASE_FLAC:
- break;
- default:
- ret = false;
- break;
- }
-
- return ret;
-}
-
-void CActiveAEDSPProcess::Destroy()
-{
- CSingleLock lock(m_restartSection);
- return;
-
- for (AE_DSP_ADDONMAP_ITR itr = m_usedMap.begin(); itr != m_usedMap.end(); ++itr)
- {
- itr->second->StreamDestroy(&m_addon_Handles[itr->first]);
- }
-
- ResetStreamFunctionsSelection();
-}
-
-void CActiveAEDSPProcess::ForceReinit()
-{
- CSingleLock lock(m_restartSection);
- m_forceInit = true;
-}
-
-AE_DSP_STREAMTYPE CActiveAEDSPProcess::DetectStreamType(const CFileItem *item)
-{
- AE_DSP_STREAMTYPE detected = AE_DSP_ASTREAM_BASIC;
- if (item->HasMusicInfoTag())
- detected = AE_DSP_ASTREAM_MUSIC;
- else if (item->HasVideoInfoTag() || g_application.GetAppPlayer().HasVideo())
- detected = AE_DSP_ASTREAM_MOVIE;
-// else if (item->HasVideoInfoTag())
-// detected = AE_DSP_ASTREAM_GAME;
-// else if (item->HasVideoInfoTag())
-// detected = AE_DSP_ASTREAM_APP;
-// else if (item->HasVideoInfoTag())
-// detected = AE_DSP_ASTREAM_MESSAGE;
-// else if (item->HasVideoInfoTag())
-// detected = AE_DSP_ASTREAM_PHONE;
- else
- detected = AE_DSP_ASTREAM_BASIC;
-
- return detected;
-}
-
-AE_DSP_STREAM_ID CActiveAEDSPProcess::GetStreamId() const
-{
- return m_streamId;
-}
-
-AEAudioFormat ActiveAE::CActiveAEDSPProcess::GetOutputFormat()
-{
- return m_outputFormat;
-}
-
-unsigned int CActiveAEDSPProcess::GetProcessSamplerate()
-{
- return m_addonSettings.iProcessSamplerate;
-}
-
-float CActiveAEDSPProcess::GetCPUUsage(void) const
-{
- return m_fLastProcessUsage;
-}
-
-AEAudioFormat CActiveAEDSPProcess::GetInputFormat()
-{
- return m_inputFormat;
-}
-
-AE_DSP_STREAMTYPE CActiveAEDSPProcess::GetDetectedStreamType()
-{
- return m_streamTypeDetected;
-}
-
-AE_DSP_STREAMTYPE CActiveAEDSPProcess::GetUsedStreamType()
-{
- return m_streamTypeUsed;
-}
-
-AE_DSP_BASETYPE CActiveAEDSPProcess::GetBaseType(AE_DSP_STREAM_PROPERTIES *props)
-{
- if (!strcmp(props->strCodecId, "ac3"))
- return AE_DSP_ABASE_AC3;
- else if (!strcmp(props->strCodecId, "eac3"))
- return AE_DSP_ABASE_EAC3;
- else if (!strcmp(props->strCodecId, "dca") || !strcmp(props->strCodecId, "dts"))
- return AE_DSP_ABASE_DTS;
- else if (!strcmp(props->strCodecId, "dtshd_hra"))
- return AE_DSP_ABASE_DTSHD_HRA;
- else if (!strcmp(props->strCodecId, "dtshd_ma"))
- return AE_DSP_ABASE_DTSHD_MA;
- else if (!strcmp(props->strCodecId, "truehd"))
- return AE_DSP_ABASE_TRUEHD;
- else if (!strcmp(props->strCodecId, "mlp"))
- return AE_DSP_ABASE_MLP;
- else if (!strcmp(props->strCodecId, "flac"))
- return AE_DSP_ABASE_FLAC;
- else if (props->iChannels > 2)
- return AE_DSP_ABASE_MULTICHANNEL;
- else if (props->iChannels == 2)
- return AE_DSP_ABASE_STEREO;
- else
- return AE_DSP_ABASE_MONO;
-}
-
-AE_DSP_BASETYPE CActiveAEDSPProcess::GetUsedBaseType()
-{
- return GetBaseType(&m_addonStreamProperties);
-}
-
-bool CActiveAEDSPProcess::GetMasterModeStreamInfoString(std::string &strInfo)
-{
- if (m_activeMode <= AE_DSP_MASTER_MODE_ID_PASSOVER)
- {
- strInfo = "";
- return true;
- }
-
- if (m_activeMode < 0 || !m_addons_MasterProc[m_activeMode].pAddon)
- return false;
-
- strInfo = m_addons_MasterProc[m_activeMode].pAddon->MasterProcessGetStreamInfoString(&m_addons_MasterProc[m_activeMode].handle);
-
- return true;
-}
-
-bool CActiveAEDSPProcess::GetMasterModeTypeInformation(AE_DSP_STREAMTYPE &streamTypeUsed, AE_DSP_BASETYPE &baseType, int &iModeID)
-{
- streamTypeUsed = (AE_DSP_STREAMTYPE)m_addonStreamProperties.iStreamType;
-
- if (m_activeMode < 0)
- return false;
-
- baseType = m_addons_MasterProc[m_activeMode].pMode->BaseType();
- iModeID = m_addons_MasterProc[m_activeMode].pMode->ModeID();
- return true;
-}
-
-const char *CActiveAEDSPProcess::GetStreamTypeName(AE_DSP_STREAMTYPE iStreamType)
-{
- return iStreamType == AE_DSP_ASTREAM_BASIC ? "Basic" :
- iStreamType == AE_DSP_ASTREAM_MUSIC ? "Music" :
- iStreamType == AE_DSP_ASTREAM_MOVIE ? "Movie" :
- iStreamType == AE_DSP_ASTREAM_GAME ? "Game" :
- iStreamType == AE_DSP_ASTREAM_APP ? "App" :
- iStreamType == AE_DSP_ASTREAM_PHONE ? "Phone" :
- iStreamType == AE_DSP_ASTREAM_MESSAGE ? "Message" :
- iStreamType == AE_DSP_ASTREAM_AUTO ? "Automatic" :
- "Unknown";
-}
-
-bool CActiveAEDSPProcess::MasterModeChange(int iModeID, AE_DSP_STREAMTYPE iStreamType)
-{
- bool bReturn = false;
- bool bSwitchStreamType = iStreamType != AE_DSP_ASTREAM_INVALID;
-
- /* The Mode is already used and need not to set up again */
- if (m_addons_MasterProc[m_activeMode].pMode->ModeID() == iModeID && !bSwitchStreamType)
- return true;
-
- CSingleLock lock(m_restartSection);
-
- CLog::Log(LOGDEBUG, "ActiveAE DSP - %s - Audio DSP processing id %d mode change:", __FUNCTION__, m_streamId);
- if (bSwitchStreamType && m_streamTypeUsed != iStreamType)
- {
- AE_DSP_STREAMTYPE old = m_streamTypeUsed;
- CLog::Log(LOGDEBUG, " ---- Input stream ----");
- if (iStreamType == AE_DSP_ASTREAM_AUTO)
- m_streamTypeUsed = m_streamTypeDetected;
- else if (iStreamType >= AE_DSP_ASTREAM_BASIC && iStreamType < AE_DSP_ASTREAM_AUTO)
- m_streamTypeUsed = iStreamType;
- else
- {
- CLog::Log(LOGWARNING, "ActiveAE DSP - %s - Unknown audio stream type, falling back to basic", __FUNCTION__);
- m_streamTypeUsed = AE_DSP_ASTREAM_BASIC;
- }
-
- CLog::Log(LOGDEBUG, " | Stream Type change : From '%s' to '%s'", GetStreamTypeName(old), GetStreamTypeName(m_streamTypeUsed));
- }
-
- /*!
- * Set the new stream type to the addon settings and properties structures.
- * If the addon want to use another stream type, it can be becomes written inside
- * the m_addonStreamProperties.iStreamType.
- */
- m_addonStreamProperties.iStreamType = m_streamTypeUsed;
- m_addonSettings.iStreamType = m_streamTypeUsed;
- m_activeModeOutChannels = -1;
-
- if (iModeID <= AE_DSP_MASTER_MODE_ID_PASSOVER)
- {
- CLog::Log(LOGINFO, "ActiveAE DSP - Switching master mode off");
- m_activeMode = 0;
- bReturn = true;
- }
- else
- {
- CActiveAEDSPModePtr mode;
- for (unsigned int ptr = 0; ptr < m_addons_MasterProc.size(); ++ptr)
- {
- mode = m_addons_MasterProc.at(ptr).pMode;
- if (mode->ModeID() == iModeID && mode->IsEnabled())
- {
- if (m_addons_MasterProc[ptr].pAddon)
- {
- AE_DSP_ERROR err = m_addons_MasterProc[ptr].pAddon->MasterProcessSetMode(&m_addons_MasterProc[ptr].handle, m_addonStreamProperties.iStreamType, mode->AddonModeNumber(), mode->ModeID());
- if (err != AE_DSP_ERROR_NO_ERROR)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - addon master mode selection failed on %s with Mode '%s' with %s",
- __FUNCTION__,
- m_addons_MasterProc[ptr].pAddon->GetAudioDSPName().c_str(),
- mode->AddonModeName().c_str(),
- CActiveAEDSPAddon::ToString(err));
- }
- else
- {
- CLog::Log(LOGINFO, "ActiveAE DSP - Switching master mode to '%s' as '%s' on '%s'",
- mode->AddonModeName().c_str(),
- GetStreamTypeName((AE_DSP_STREAMTYPE)m_addonStreamProperties.iStreamType),
- m_addons_MasterProc[ptr].pAddon->GetAudioDSPName().c_str());
-
- m_activeMode = (int)ptr;
- m_activeModeOutChannels = m_addons_MasterProc[m_activeMode].pAddon->MasterProcessGetOutChannels(&m_addons_MasterProc[ptr].handle, m_activeModeOutChannelsPresent);
- bReturn = true;
- }
- }
- else if (mode->ModeID() >= AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES)
- {
- CLog::Log(LOGINFO, "ActiveAE DSP - Switching master mode to internal '%s' as '%s'",
- mode->AddonModeName().c_str(),
- GetStreamTypeName((AE_DSP_STREAMTYPE)m_addonStreamProperties.iStreamType));
-
- m_activeMode = (int)ptr;
- m_activeModeOutChannels = -1;
- bReturn = true;
- }
- break;
- }
- }
- }
-
- /*!
- * Initialize fallback matrix mixer
- */
- InitFFMpegDSPProcessor();
-
- return bReturn;
-}
-
-void CActiveAEDSPProcess::ClearArray(float **array, unsigned int samples)
-{
- unsigned int presentFlag = 1;
- for (int i = 0; i < AE_DSP_CH_MAX; ++i)
- {
- if (m_addonSettings.lOutChannelPresentFlags & presentFlag)
- memset(array[i], 0, samples*sizeof(float));
- presentFlag <<= 1;
- }
-}
-
-bool CActiveAEDSPProcess::Process(CSampleBuffer *in, CSampleBuffer *out)
-{
- if (!in || !out)
- {
- return false;
- }
-
- CSingleLock lock(m_restartSection);
-
- bool needDSPAddonsReinit = m_forceInit;
- uint64_t iTime = static_cast<uint64_t>(XbmcThreads::SystemClockMillis()) * 10000;
- int64_t hostFrequency = CurrentHostFrequency();
- unsigned int frames = in->pkt->nb_samples;
-
- /* Detect interleaved input stream channel positions if unknown or changed */
- if (m_channelLayoutIn != in->pkt->config.channel_layout)
- {
- m_channelLayoutIn = in->pkt->config.channel_layout;
-
- memset(m_idx_in, -1, sizeof(m_idx_in));
- m_idx_in[AE_CH_FL] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_FRONT_LEFT);
- m_idx_in[AE_CH_FR] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_FRONT_RIGHT);
- m_idx_in[AE_CH_FC] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_FRONT_CENTER);
- m_idx_in[AE_CH_LFE] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_LOW_FREQUENCY);
- m_idx_in[AE_CH_BL] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_BACK_LEFT);
- m_idx_in[AE_CH_BR] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_BACK_RIGHT);
- m_idx_in[AE_CH_FLOC] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_FRONT_LEFT_OF_CENTER);
- m_idx_in[AE_CH_FROC] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_FRONT_RIGHT_OF_CENTER);
- m_idx_in[AE_CH_BC] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_BACK_CENTER);
- m_idx_in[AE_CH_SL] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_SIDE_LEFT);
- m_idx_in[AE_CH_SR] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_SIDE_RIGHT);
- m_idx_in[AE_CH_TC] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_TOP_CENTER);
- m_idx_in[AE_CH_TFL] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_TOP_FRONT_LEFT);
- m_idx_in[AE_CH_TFC] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_TOP_FRONT_CENTER);
- m_idx_in[AE_CH_TFR] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_TOP_FRONT_RIGHT);
- m_idx_in[AE_CH_TBL] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_TOP_BACK_LEFT);
- m_idx_in[AE_CH_TBC] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_TOP_BACK_CENTER);
- m_idx_in[AE_CH_TBR] = av_get_channel_layout_channel_index(m_channelLayoutIn, AV_CH_TOP_BACK_RIGHT);
- m_idx_in[AE_CH_BLOC] = -1; // manually disable these channels because ffmpeg does not support them
- m_idx_in[AE_CH_BROC] = -1;
-
- needDSPAddonsReinit = true;
- }
-
- /* Detect also interleaved output stream channel positions if unknown or changed */
- if (m_channelLayoutOut != out->pkt->config.channel_layout)
- {
- m_channelLayoutOut = out->pkt->config.channel_layout;
-
- memset(m_idx_out, -1, sizeof(m_idx_out));
- m_idx_out[AE_CH_FL] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_FRONT_LEFT);
- m_idx_out[AE_CH_FR] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_FRONT_RIGHT);
- m_idx_out[AE_CH_FC] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_FRONT_CENTER);
- m_idx_out[AE_CH_LFE] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_LOW_FREQUENCY);
- m_idx_out[AE_CH_BL] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_BACK_LEFT);
- m_idx_out[AE_CH_BR] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_BACK_RIGHT);
- m_idx_out[AE_CH_FLOC] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_FRONT_LEFT_OF_CENTER);
- m_idx_out[AE_CH_FROC] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_FRONT_RIGHT_OF_CENTER);
- m_idx_out[AE_CH_BC] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_BACK_CENTER);
- m_idx_out[AE_CH_SL] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_SIDE_LEFT);
- m_idx_out[AE_CH_SR] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_SIDE_RIGHT);
- m_idx_out[AE_CH_TC] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_TOP_CENTER);
- m_idx_out[AE_CH_TFL] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_TOP_FRONT_LEFT);
- m_idx_out[AE_CH_TFC] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_TOP_FRONT_CENTER);
- m_idx_out[AE_CH_TFR] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_TOP_FRONT_RIGHT);
- m_idx_out[AE_CH_TBL] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_TOP_BACK_LEFT);
- m_idx_out[AE_CH_TBC] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_TOP_BACK_CENTER);
- m_idx_out[AE_CH_TBR] = av_get_channel_layout_channel_index(m_channelLayoutOut, AV_CH_TOP_BACK_RIGHT);
- m_idx_out[AE_CH_BLOC] = -1; // manually disable these channels because ffmpeg does not support them
- m_idx_out[AE_CH_BROC] = -1;
-
- needDSPAddonsReinit = true;
- }
-
- if (needDSPAddonsReinit)
- {
- /*! @warning If you change or add new channel enums to AEChannel in
- * xbmc/cores/AudioEngine/Utils/AEChannelData.h you have to adapt this loop
- */
- m_addonSettings.lInChannelPresentFlags = 0;
- for (int ii = 0; ii < AE_DSP_CH_MAX; ii++)
- {
- if (m_idx_in[ii+1] >= 0)
- {
- m_addonSettings.lInChannelPresentFlags |= 1 << ii;
- }
- }
-
- /*! @warning If you change or add new channel enums to AEChannel in
- * xbmc/cores/AudioEngine/Utils/AEChannelData.h you have to adapt this loop
- */
- m_addonSettings.lOutChannelPresentFlags = 0;
- for (int ii = 0; ii < AE_DSP_CH_MAX; ii++)
- {
- if (m_idx_out[ii + 1] >= 0)
- {
- m_addonSettings.lOutChannelPresentFlags |= 1 << ii;
- }
- }
-
- m_addonSettings.iStreamID = m_streamId;
- m_addonSettings.iInChannels = in->pkt->config.channels;
- m_addonSettings.iOutChannels = out->pkt->config.channels;
- m_addonSettings.iInSamplerate = in->pkt->config.sample_rate;
- m_addonSettings.iProcessSamplerate = m_addon_InputResample.pAddon ? m_addon_InputResample.pAddon->InputResampleSampleRate(&m_addon_InputResample.handle) : m_addonSettings.iInSamplerate;
- m_addonSettings.iOutSamplerate = m_addon_OutputResample.pAddon ? m_addon_OutputResample.pAddon->OutputResampleSampleRate(&m_addon_OutputResample.handle) : m_addonSettings.iProcessSamplerate;
-
- if (m_NewMasterMode >= 0)
- {
- MasterModeChange(m_NewMasterMode, m_NewStreamType);
- m_NewMasterMode = AE_DSP_MASTER_MODE_ID_INVALID;
- m_NewStreamType = AE_DSP_ASTREAM_INVALID;
- }
-
- UpdateActiveModes();
- for (AE_DSP_ADDONMAP_ITR itr = m_usedMap.begin(); itr != m_usedMap.end(); ++itr)
- {
- AE_DSP_ERROR err = itr->second->StreamInitialize(&m_addon_Handles[itr->first], &m_addonSettings);
- if (err != AE_DSP_ERROR_NO_ERROR)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - addon initialize failed on %s with %s", __FUNCTION__, itr->second->GetAudioDSPName().c_str(), CActiveAEDSPAddon::ToString(err));
- }
- }
-
- RecheckProcessArray(frames);
- ClearArray(m_processArray[0], m_processArraySize);
- ClearArray(m_processArray[1], m_processArraySize);
-
- m_forceInit = false;
- m_iLastProcessTime = static_cast<uint64_t>(XbmcThreads::SystemClockMillis()) * 10000;
- m_iLastProcessUsage = 0;
- m_fLastProcessUsage = 0.0f;
-
- /**
- * Setup ffmpeg convert array for input stream
- */
- SetFFMpegDSPProcessorArray(m_ffMpegConvertArray[FFMPEG_PROC_ARRAY_IN], m_processArray[0], m_idx_in, m_addonSettings.lInChannelPresentFlags);
- }
-
- int64_t startTime;
- float **lastOutArray = m_processArray[0];
- unsigned int togglePtr = 1;
-
- /**
- * Convert to required planar float format inside dsp system
- */
- if (swr_convert(m_convertInput, (uint8_t **)m_ffMpegConvertArray[FFMPEG_PROC_ARRAY_IN], m_processArraySize, (const uint8_t **)in->pkt->data, in->pkt->nb_samples) < 0)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - input audio convert failed", __FUNCTION__);
- return false;
- }
-
- /**********************************************/
- /** DSP Processing Algorithms following here **/
- /**********************************************/
-
- /**
- * DSP input processing
- * Can be used to have unchanged input stream..
- * All DSP addons allowed todo this.
- */
- for (unsigned int i = 0; i < m_addons_InputProc.size(); ++i)
- {
- if (!m_addons_InputProc[i].pAddon->InputProcess(&m_addons_InputProc[i].handle, const_cast<const float**>(lastOutArray), frames))
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - input process failed on addon No. %i", __FUNCTION__, i);
- return false;
- }
- }
-
- /**
- * DSP resample processing before master
- * Here a high quality resample can be performed.
- * Only one DSP addon is allowed todo this!
- */
- if (m_addon_InputResample.pAddon && !m_bypassDSP)
- {
- startTime = CurrentHostCounter();
-
- frames = m_addon_InputResample.pAddon->InputResampleProcess(&m_addon_InputResample.handle,
- const_cast<const float**>(lastOutArray),
- m_processArray[togglePtr], frames);
- if (frames == 0)
- return false;
-
- m_addon_InputResample.iLastTime += 1000 * 10000 * (CurrentHostCounter() - startTime) / hostFrequency;
-
- lastOutArray = m_processArray[togglePtr];
- togglePtr ^= 1;
- }
-
- /**
- * DSP pre processing
- * All DSP addons allowed todo this and order of it set on settings.
- */
- for (unsigned int i = 0; i < m_addons_PreProc.size() && !m_bypassDSP; ++i)
- {
- startTime = CurrentHostCounter();
-
- frames = m_addons_PreProc[i].pAddon->PreProcess(&m_addons_PreProc[i].handle,
- m_addons_PreProc[i].iAddonModeNumber,
- const_cast<const float**>(lastOutArray), m_processArray[togglePtr], frames);
- if (frames == 0)
- return false;
-
- m_addons_PreProc[i].iLastTime += 1000 * 10000 * (CurrentHostCounter() - startTime) / hostFrequency;
-
- lastOutArray = m_processArray[togglePtr];
- togglePtr ^= 1;
- }
-
- /**
- * DSP master processing
- * Here a channel upmix/downmix for stereo surround sound can be performed
- * Only one DSP addon is allowed todo this!
- */
- if (m_addons_MasterProc[m_activeMode].pAddon && !m_bypassDSP)
- {
- startTime = CurrentHostCounter();
-
- frames = m_addons_MasterProc[m_activeMode].pAddon->MasterProcess(&m_addons_MasterProc[m_activeMode].handle,
- const_cast<const float**>(lastOutArray),
- m_processArray[togglePtr], frames);
- if (frames == 0)
- return false;
-
- m_addons_MasterProc[m_activeMode].iLastTime += 1000 * 10000 * (CurrentHostCounter() - startTime) / hostFrequency;
-
- lastOutArray = m_processArray[togglePtr];
- togglePtr ^= 1;
- }
-
- /**
- * Perform fallback channel mixing if input channel alignment is different
- * from output and not becomes processed by active master processing mode or
- * perform ffmpeg related internal master processes.
- */
- if (m_resamplerDSPProcessor)
- {
- startTime = CurrentHostCounter();
-
- if (needDSPAddonsReinit)
- {
- /*! @todo: test with an resampler add-on */
- SetFFMpegDSPProcessorArray(m_ffMpegProcessArray[FFMPEG_PROC_ARRAY_IN], lastOutArray, m_idx_in, m_addonSettings.lInChannelPresentFlags);
- SetFFMpegDSPProcessorArray(m_ffMpegProcessArray[FFMPEG_PROC_ARRAY_OUT], m_processArray[togglePtr], m_idx_out, m_addonSettings.lOutChannelPresentFlags);
- }
-
- frames = m_resamplerDSPProcessor->Resample((uint8_t**)m_ffMpegProcessArray[FFMPEG_PROC_ARRAY_OUT], frames, (uint8_t**)m_ffMpegProcessArray[FFMPEG_PROC_ARRAY_IN], frames, 1.0);
- if (frames <= 0)
- {
- CLog::Log(LOGERROR, "CActiveAEResample::Resample - resample failed");
- return false;
- }
-
- m_addons_MasterProc[m_activeMode].iLastTime += 1000 * 10000 * (CurrentHostCounter() - startTime) / hostFrequency;
-
- lastOutArray = m_processArray[togglePtr];
- togglePtr ^= 1;
- }
-
- /**
- * DSP post processing
- * On the post processing can be things performed with additional channel upmix like 6.1 to 7.1
- * or frequency/volume corrections, speaker distance handling, equalizer... .
- * All DSP addons allowed todo this and order of it set on settings.
- */
- for (unsigned int i = 0; i < m_addons_PostProc.size() && !m_bypassDSP; ++i)
- {
- startTime = CurrentHostCounter();
-
- frames = m_addons_PostProc[i].pAddon->PostProcess(&m_addons_PostProc[i].handle,
- m_addons_PostProc[i].iAddonModeNumber,
- const_cast<const float**>(lastOutArray),
- m_processArray[togglePtr], frames);
- if (frames == 0)
- return false;
-
- m_addons_PostProc[i].iLastTime += 1000 * 10000 * (CurrentHostCounter() - startTime) / hostFrequency;
-
- lastOutArray = m_processArray[togglePtr];
- togglePtr ^= 1;
- }
-
- /**
- * DSP resample processing behind master
- * Here a high quality resample can be performed.
- * Only one DSP addon is allowed todo this!
- */
- if (m_addon_OutputResample.pAddon && !m_bypassDSP)
- {
- startTime = CurrentHostCounter();
-
- frames = m_addon_OutputResample.pAddon->OutputResampleProcess(&m_addon_OutputResample.handle,
- const_cast<const float**>(lastOutArray),
- m_processArray[togglePtr], frames);
- if (frames == 0)
- return false;
-
- m_addon_OutputResample.iLastTime += 1000 * 10000 * (CurrentHostCounter() - startTime) / hostFrequency;
-
- lastOutArray = m_processArray[togglePtr];
- }
-
- /**
- * Setup ffmpeg convert array for output stream, performed here to now last array
- */
- if (needDSPAddonsReinit)
- SetFFMpegDSPProcessorArray(m_ffMpegConvertArray[FFMPEG_PROC_ARRAY_OUT], lastOutArray, m_idx_out, m_addonSettings.lOutChannelPresentFlags);
-
- /**
- * Convert back to required output format
- */
- if (swr_convert(m_convertOutput, (uint8_t **)out->pkt->data, out->pkt->max_nb_samples, (const uint8_t **)m_ffMpegConvertArray[FFMPEG_PROC_ARRAY_OUT], frames) < 0)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - output audio convert failed", __FUNCTION__);
- return false;
- }
- out->pkt->nb_samples = frames;
- out->pkt_start_offset = out->pkt->nb_samples;
-
- /**
- * Update cpu process percent usage values for modes and total (every second)
- */
- if (iTime >= m_iLastProcessTime + 1000*10000)
- CalculateCPUUsage(iTime);
-
- return true;
-}
-
-bool CActiveAEDSPProcess::RecheckProcessArray(unsigned int inputFrames)
-{
- /* Check for big enough array */
- unsigned int framesNeeded;
- unsigned int framesOut = m_processArraySize;
-
- if (inputFrames > framesOut)
- framesOut = inputFrames;
-
- if (m_addon_InputResample.pAddon)
- {
- framesNeeded = m_addon_InputResample.pAddon->InputResampleProcessNeededSamplesize(&m_addon_InputResample.handle);
- if (framesNeeded > framesOut)
- framesOut = framesNeeded;
- }
-
- for (unsigned int i = 0; i < m_addons_PreProc.size(); ++i)
- {
- framesNeeded = m_addons_PreProc[i].pAddon->PreProcessNeededSamplesize(&m_addons_PreProc[i].handle, m_addons_PreProc[i].iAddonModeNumber);
- if (framesNeeded > framesOut)
- framesOut = framesNeeded;
- }
-
- if (m_addons_MasterProc[m_activeMode].pAddon)
- {
- framesNeeded = m_addons_MasterProc[m_activeMode].pAddon->MasterProcessNeededSamplesize(&m_addons_MasterProc[m_activeMode].handle);
- if (framesNeeded > framesOut)
- framesOut = framesNeeded;
- }
-
- for (unsigned int i = 0; i < m_addons_PostProc.size(); ++i)
- {
- framesNeeded = m_addons_PostProc[i].pAddon->PostProcessNeededSamplesize(&m_addons_PostProc[i].handle, m_addons_PostProc[i].iAddonModeNumber);
- if (framesNeeded > framesOut)
- framesOut = framesNeeded;
- }
-
- if (m_addon_OutputResample.pAddon)
- {
- framesNeeded = m_addon_OutputResample.pAddon->OutputResampleProcessNeededSamplesize(&m_addon_OutputResample.handle);
- if (framesNeeded > framesOut)
- framesOut = framesNeeded;
- }
-
- if (framesOut > m_processArraySize)
- {
- if (!ReallocProcessArray(framesOut))
- return false;
-
- m_processArraySize = framesOut;
- }
- return true;
-}
-
-bool CActiveAEDSPProcess::ReallocProcessArray(unsigned int requestSize)
-{
- m_processArraySize = requestSize + MIN_DSP_ARRAY_SIZE / 10;
- for (int i = 0; i < AE_DSP_CH_MAX; ++i)
- {
- m_processArray[0][i] = (float*)realloc(m_processArray[0][i], m_processArraySize*sizeof(float));
- m_processArray[1][i] = (float*)realloc(m_processArray[1][i], m_processArraySize*sizeof(float));
- if (m_processArray[0][i] == NULL || m_processArray[1][i] == NULL)
- {
- CLog::Log(LOGERROR, "ActiveAE DSP - %s - realloc of process data array failed", __FUNCTION__);
- return false;
- }
- }
- return true;
-}
-
-// in this function the usage for each adsp-mode in percent is calculated
-void CActiveAEDSPProcess::CalculateCPUUsage(uint64_t iTime)
-{
- int64_t iUsage = CThread::GetCurrentThread()->GetAbsoluteUsage();
-
- if (iTime != m_iLastProcessTime)
- {
- // calculate usage only if we don't divide by zero
- if (m_iLastProcessUsage > 0 && m_iLastProcessTime > 0)
- {
- m_fLastProcessUsage = (float)(iUsage - m_iLastProcessUsage) / (float)(iTime - m_iLastProcessTime) * 100.0f;
- }
-
- float dTFactor = 100.0f / (float)(iTime - m_iLastProcessTime);
-
- if(m_addon_InputResample.pMode)
- {
- m_addon_InputResample.pMode->SetCPUUsage((float)(m_addon_InputResample.iLastTime)*dTFactor);
- m_addon_InputResample.iLastTime = 0;
- }
-
- for (unsigned int i = 0; i < m_addons_PreProc.size(); ++i)
- {
- m_addons_PreProc[i].pMode->SetCPUUsage((float)(m_addons_PreProc[i].iLastTime)*dTFactor);
- m_addons_PreProc[i].iLastTime = 0;
- }
-
- if (m_addons_MasterProc[m_activeMode].pMode)
- {
- m_addons_MasterProc[m_activeMode].pMode->SetCPUUsage((float)(m_addons_MasterProc[m_activeMode].iLastTime)*dTFactor);
- m_addons_MasterProc[m_activeMode].iLastTime = 0;
- }
-
- for (unsigned int i = 0; i < m_addons_PostProc.size(); ++i)
- {
- m_addons_PostProc[i].pMode->SetCPUUsage((float)(m_addons_PostProc[i].iLastTime)*dTFactor);
- m_addons_PostProc[i].iLastTime = 0;
- }
-
- if (m_addon_OutputResample.pMode)
- {
- m_addon_OutputResample.pMode->SetCPUUsage((float)(m_addon_OutputResample.iLastTime)*dTFactor);
- m_addon_OutputResample.iLastTime = 0;
- }
- }
-
- m_iLastProcessUsage = iUsage;
- m_iLastProcessTime = iTime;
-}
-
-void CActiveAEDSPProcess::SetFFMpegDSPProcessorArray(float *array_ffmpeg[AE_DSP_CH_MAX], float *array_dsp[AE_DSP_CH_MAX], int idx[AE_CH_MAX], unsigned long ChannelFlags)
-{
- /*!
- * Setup ffmpeg resampler channel setup, this way is not my favorite but it works to become
- * the correct channel alignment on the given input and output signal.
- * The problem is, the process array of ffmpeg is not fixed and for every selected channel setup
- * the positions are different. For this case a translation from the fixed dsp stream format to
- * ffmpeg format must be performed. It use a separate process array table which becomes set by
- * already present channel memory storage.
- */
-
- /*! @warning If you change or add new channel enums to AEChannel in
- * xbmc/cores/AudioEngine/Utils/AEChannelData.h you have to adapt this loop
- */
- memset(array_ffmpeg, 0, sizeof(float*)*AE_DSP_CH_MAX);
- for (int ii = 0; ii < AE_DSP_CH_MAX; ii++)
- {
- if (ChannelFlags & 1 << ii)
- {
- array_ffmpeg[idx[ii + 1]] = array_dsp[ii];
- }
-
- }
-}
-
-float CActiveAEDSPProcess::GetDelay()
-{
- float delay = 0.0f;
-
- CSingleLock lock(m_critSection);
-
- if (m_addon_InputResample.pAddon)
- delay += m_addon_InputResample.pAddon->InputResampleGetDelay(&m_addon_InputResample.handle);
-
- for (unsigned int i = 0; i < m_addons_PreProc.size(); ++i)
- delay += m_addons_PreProc[i].pAddon->PreProcessGetDelay(&m_addons_PreProc[i].handle, m_addons_PreProc[i].iAddonModeNumber);
-
- if (m_addons_MasterProc[m_activeMode].pAddon)
- delay += m_addons_MasterProc[m_activeMode].pAddon->MasterProcessGetDelay(&m_addons_MasterProc[m_activeMode].handle);
-
- for (unsigned int i = 0; i < m_addons_PostProc.size(); ++i)
- delay += m_addons_PostProc[i].pAddon->PostProcessGetDelay(&m_addons_PostProc[i].handle, m_addons_PostProc[i].iAddonModeNumber);
-
- if (m_addon_OutputResample.pAddon)
- delay += m_addon_OutputResample.pAddon->OutputResampleGetDelay(&m_addon_OutputResample.handle);
-
- return delay;
-}
-
-void CActiveAEDSPProcess::UpdateActiveModes()
-{
- m_addon_InputResample.Clear();
- m_addon_OutputResample.Clear();
-
- m_addons_InputProc.clear();
- m_addons_PreProc.clear();
- m_addons_MasterProc.clear();
- m_addons_PostProc.clear();
-
- /*!
- * Setup off mode, used if dsp master processing is set off, required to have data
- * for stream information functions.
- */
- sDSPProcessHandle internalMode;
- internalMode.Clear();
- internalMode.iAddonModeNumber = AE_DSP_MASTER_MODE_ID_PASSOVER;
- internalMode.pMode = CActiveAEDSPModePtr(new CActiveAEDSPMode(internalMode.iAddonModeNumber, (AE_DSP_BASETYPE)m_addonStreamProperties.iBaseType));
- internalMode.iLastTime = 0;
- m_addons_MasterProc.push_back(internalMode);
- m_activeMode = AE_DSP_MASTER_MODE_ID_PASSOVER;
-
- if (m_addonSettings.bStereoUpmix && m_addonSettings.iInChannels <= 2)
- {
- internalMode.Clear();
- internalMode.iAddonModeNumber = AE_DSP_MASTER_MODE_ID_INTERNAL_STEREO_UPMIX;
- internalMode.pMode = CActiveAEDSPModePtr(new CActiveAEDSPMode(internalMode.iAddonModeNumber, (AE_DSP_BASETYPE)m_addonStreamProperties.iBaseType));
- internalMode.iLastTime = 0;
- m_addons_MasterProc.push_back(internalMode);
- }
-}
-
-bool CActiveAEDSPProcess::HasActiveModes(AE_DSP_MODE_TYPE type)
-{
- bool bReturn(false);
-
- CSingleLock lock(m_critSection);
-
- switch (type)
- {
- case AE_DSP_MODE_TYPE_INPUT_RESAMPLE:
- if (m_addon_InputResample.pAddon != NULL)
- bReturn = true;
- break;
- case AE_DSP_MODE_TYPE_PRE_PROCESS:
- if (!m_addons_PreProc.empty())
- bReturn = true;
- break;
- case AE_DSP_MODE_TYPE_MASTER_PROCESS:
- if (!m_addons_MasterProc.empty())
- bReturn = true;
- break;
- case AE_DSP_MODE_TYPE_POST_PROCESS:
- if (!m_addons_PostProc.empty())
- bReturn = true;
- break;
- case AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE:
- if (m_addon_OutputResample.pAddon != NULL)
- bReturn = true;
- break;
- default:
- break;
- };
-
- return bReturn;
-}
-
-void CActiveAEDSPProcess::GetActiveModes(AE_DSP_MODE_TYPE type, std::vector<CActiveAEDSPModePtr> &modes)
-{
- CSingleLock lock(m_critSection);
-
- if (m_addon_InputResample.pAddon != NULL && (type == AE_DSP_MODE_TYPE_UNDEFINED || type == AE_DSP_MODE_TYPE_INPUT_RESAMPLE))
- modes.push_back(m_addon_InputResample.pMode);
-
- if (type == AE_DSP_MODE_TYPE_UNDEFINED || type == AE_DSP_MODE_TYPE_PRE_PROCESS)
- for (unsigned int i = 0; i < m_addons_PreProc.size(); ++i)
- modes.push_back(m_addons_PreProc[i].pMode);
-
- if (m_addons_MasterProc[m_activeMode].pAddon != NULL && (type == AE_DSP_MODE_TYPE_UNDEFINED || type == AE_DSP_MODE_TYPE_MASTER_PROCESS))
- modes.push_back(m_addons_MasterProc[m_activeMode].pMode);
-
- if (type == AE_DSP_MODE_TYPE_UNDEFINED || type == AE_DSP_MODE_TYPE_POST_PROCESS)
- for (unsigned int i = 0; i < m_addons_PostProc.size(); ++i)
- modes.push_back(m_addons_PostProc[i].pMode);
-
- if (m_addon_OutputResample.pAddon != NULL && (type == AE_DSP_MODE_TYPE_UNDEFINED || type == AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE))
- modes.push_back(m_addon_OutputResample.pMode);
-}
-
-void CActiveAEDSPProcess::GetAvailableMasterModes(AE_DSP_STREAMTYPE streamType, std::vector<CActiveAEDSPModePtr> &modes)
-{
- CSingleLock lock(m_critSection);
-
- for (unsigned int i = 0; i < m_addons_MasterProc.size(); ++i)
- {
- if (m_addons_MasterProc[i].pMode->SupportStreamType(streamType))
- modes.push_back(m_addons_MasterProc[i].pMode);
- }
-}
-
-int CActiveAEDSPProcess::GetActiveMasterModeID()
-{
- CSingleLock lock(m_critSection);
-
- return m_activeMode < 0 ? AE_DSP_MASTER_MODE_ID_INVALID : m_addons_MasterProc[m_activeMode].pMode->ModeID();
-}
-
-CActiveAEDSPModePtr CActiveAEDSPProcess::GetActiveMasterMode() const
-{
- CSingleLock lock(m_critSection);
-
- CActiveAEDSPModePtr mode;
-
- if (m_activeMode < 0)
- return mode;
-
- mode = m_addons_MasterProc[m_activeMode].pMode;
- return mode;
-}
-
-bool CActiveAEDSPProcess::SetMasterMode(AE_DSP_STREAMTYPE streamType, int iModeID, bool bSwitchStreamType)
-{
- CSingleLock lockMasterModes(m_critSection);
- /*!
- * if the unique master mode id is already used a reinit is not needed
- */
- if (m_addons_MasterProc[m_activeMode].pMode->ModeID() == iModeID && !bSwitchStreamType)
- return true;
-
- CSingleLock lock(m_restartSection);
-
- m_NewMasterMode = iModeID;
- m_NewStreamType = bSwitchStreamType ? streamType : AE_DSP_ASTREAM_INVALID;
- m_forceInit = true;
- return true;
-}
-
-bool CActiveAEDSPProcess::IsMenuHookModeActive(AE_DSP_MENUHOOK_CAT category, int iAddonId, unsigned int iModeNumber)
-{
- std::vector <sDSPProcessHandle> *addons = NULL;
-
- switch (category)
- {
- case AE_DSP_MENUHOOK_MASTER_PROCESS:
- addons = &m_addons_MasterProc;
- break;
- case AE_DSP_MENUHOOK_PRE_PROCESS:
- addons = &m_addons_PreProc;
- break;
- case AE_DSP_MENUHOOK_POST_PROCESS:
- addons = &m_addons_PostProc;
- break;
- case AE_DSP_MENUHOOK_RESAMPLE:
- {
- if (m_addon_InputResample.iAddonModeNumber > 0 &&
- m_addon_InputResample.pMode &&
- m_addon_InputResample.pMode->AddonID() == iAddonId &&
- m_addon_InputResample.pMode->AddonModeNumber() == iModeNumber)
- return true;
-
- if (m_addon_OutputResample.iAddonModeNumber > 0 &&
- m_addon_OutputResample.pMode &&
- m_addon_OutputResample.pMode->AddonID() == iAddonId &&
- m_addon_OutputResample.pMode->AddonModeNumber() == iModeNumber)
- return true;
- }
- default:
- break;
- }
-
- if (addons)
- {
- for (unsigned int i = 0; i < addons->size(); ++i)
- {
- if (addons->at(i).iAddonModeNumber > 0 &&
- addons->at(i).pMode->AddonID() == iAddonId &&
- addons->at(i).pMode->AddonModeNumber() == iModeNumber)
- return true;
- }
- }
- return false;
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h
deleted file mode 100644
index 93ee903cde..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h
+++ /dev/null
@@ -1,313 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2010-2014 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <vector>
-
-#include "ActiveAEDSP.h"
-
-extern "C" {
-#include "libavcodec/avcodec.h"
-#include "libswresample/swresample.h"
-}
-
-namespace ActiveAE
-{
- class CSampleBuffer;
- class IAEResample;
- class CActiveAEBufferPoolADSP;
-
- //@{
- /*!
- * Individual DSP Processing class
- */
- class CActiveAEDSPProcess
- {
- public:
- explicit CActiveAEDSPProcess(AE_DSP_STREAM_ID streamId);
- virtual ~CActiveAEDSPProcess();
-
- //@{
- /*!>
- * Create the dsp processing with check of all addons about the used input and output audio format.
- * @param inputFormat The used audio stream input format
- * @param outputFormat Audio output format which is needed to send to the sinks
- * @param upmix stereo upmix value from KODI settings is passed in with it
- * @param quality The requested quality from settings
- * @param streamType The input stream type to find allowed master process dsp addons for it, e.g. AE_DSP_ASTREAM_MUSIC
- * @return True if the dsp processing becomes available
- */
- bool Create(const AEAudioFormat &inputFormat, const AEAudioFormat &outputFormat, bool upmix, bool bypassDSP, AEQuality quality, AE_DSP_STREAMTYPE streamType,
- enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type, int profile);
-
- /*!>
- * Destroy all allocated dsp addons for this stream id and stops the processing.
- */
- void Destroy();
-
- /*!>
- * Force processing function (Process(...)) to perform a reinitialization of addons and data
- */
- void ForceReinit();
-
- /*!>
- * Get the stream id for this processing class
- */
- AE_DSP_STREAM_ID GetStreamId() const;
-
- /*!>
- * Get the currently used input stream format
- * @note used to have a fallback to normal operation without dsp
- */
- AEAudioFormat GetOutputFormat();
-
- /*!>
- * Get the currently used input stream format
- * @note used to have a fallback to normal operation without dsp
- */
- AEAudioFormat GetInputFormat();
-
- /*!>
- * Get the inside addons used samplerate for this class
- */
- unsigned int GetProcessSamplerate();
-
- /*!>
- * Get the amount of percent what the cpu need to process complete dsp stream
- * @return The current cpu usage
- */
- float GetCPUUsage(void) const;
-
- /*!>
- * It returns the on input source detected stream type, not always the active one.
- */
- AE_DSP_STREAMTYPE GetDetectedStreamType();
-
- /*!>
- * Get the currently on addons processed audio stream type which is set from KODI,
- * it is user selectable or if auto mode is enabled it becomes detected upon the
- * stream input source, eg. Movie, Music...
- */
- AE_DSP_STREAMTYPE GetUsedStreamType();
-
- /*!>
- * Get the currently on addons processed audio base type which is detected from KODI.
- * The base type is relevant to the type of input source, eg. Mono, Stereo, Dolby Digital...
- */
- AE_DSP_BASETYPE GetUsedBaseType();
-
- /*!>
- * Used to check for active modes to given type on running stream id
- * @param type The type to get, AE_DSP_MODE_TYPE_UNDEFINED to get from all types
- * @return true if any of selected type is present
- */
- bool HasActiveModes(AE_DSP_MODE_TYPE type);
-
- /*!>
- * Used to get all active mode classes to given type on running stream id
- * @param type The type to get, AE_DSP_MODE_TYPE_UNDEFINED to get from all types
- * @retval modes The active modes classes in process chain list
- */
- void GetActiveModes(AE_DSP_MODE_TYPE type, std::vector<CActiveAEDSPModePtr> &modes);
-
- /*!>
- * Used to get all available Master modes on current stream and base type.
- * It is used to get informations about selectable modes and can be used as information
- * for the gui to make the mode selection available.
- * @param streamType the stream type to check about available master modes, e.g. AE_DSP_ASTREAM_MUSIC
- * @retval modes Pointer to a buffer array where all available master mode written in
- */
- void GetAvailableMasterModes(AE_DSP_STREAMTYPE streamType, std::vector<CActiveAEDSPModePtr> &modes);
-
- /*!>
- * Get the 32 bit individual identification code of the running master mode
- * @return The identification code, or 0 if no master process is running
- */
- int GetActiveMasterModeID();
-
- /*!>
- * Returns the information class from the currently used dsp addon
- * @return pointer to the info class, or unitialized class if no master processing present
- */
- CActiveAEDSPModePtr GetActiveMasterMode() const;
-
- /*!>
- * Change master mode with the 32 bit individual identification code, the change
- * is not directly performed in this function, is changed on next processing
- * calls and must be observed that it becomes changed.
- * @param streamType Stream type on the selection of the master mode
- * @param iModeID The database identification code of the mode
- * @param bSwitchStreamType force switching to given stream type
- * @return True if the mode is allowed and can become changed
- */
- bool SetMasterMode(AE_DSP_STREAMTYPE streamType, int iModeID, bool bSwitchStreamType = false);
-
- /*!>
- * Read a description string from currently processed audio dsp master mode.
- * It can be used to show additional stream information as string on the skin.
- * The addon can have more stream information.
- * @retval strInfo Pointer to a string where it is written in
- * @return Returns false if no master processing is enabled
- */
- bool GetMasterModeStreamInfoString(std::string &strInfo);
-
- /*!>
- * Get all dsp addon relavant information to detect processing mode type and base values.
- * @retval streamTypeUsed The current stream type processed by addon
- * @retval baseType The current base type type processed by addon
- * @retval iModeID The database identification code of the mode
- * @return Returns false if no master processing is enabled
- */
- bool GetMasterModeTypeInformation(AE_DSP_STREAMTYPE &streamTypeUsed, AE_DSP_BASETYPE &baseType, int &iModeID);
-
- /*!>
- * Used check that asked addon with his mode id is used on given stream identifier
- * @param category The type to get
- * @param iAddonId The ID of the addon to get the menu entries for it
- * @param iModeNumber From addon defined identifier of the mode
- * @return true if in use
- */
- bool IsMenuHookModeActive(AE_DSP_MENUHOOK_CAT category, int iAddonId, unsigned int iModeNumber);
-
- protected:
- friend class CActiveAEBufferPoolADSP;
-
- /*!>
- * Master processing
- * @param in the ActiveAE input samples
- * @param out the processed ActiveAE output samples
- * @return true if processing becomes performed correct
- */
- bool Process(CSampleBuffer *in, CSampleBuffer *out);
-
- /*!>
- * Returns the time in seconds that it will take
- * for the next added packet to be heard from the speakers.
- * @return seconds
- */
- float GetDelay();
-
- /*!>
- * Update the state all AudioDSP modes.
- */
- void UpdateActiveModes();
- //@}
- private:
- //@{
- /*!
- * Helper functions
- */
- void InitFFMpegDSPProcessor();
- bool CreateStreamProfile();
- void ResetStreamFunctionsSelection();
- AE_DSP_STREAMTYPE DetectStreamType(const CFileItem *item);
- const char *GetStreamTypeName(AE_DSP_STREAMTYPE iStreamType);
- void ClearArray(float **array, unsigned int samples);
- bool MasterModeChange(int iModeID, AE_DSP_STREAMTYPE iStreamType = AE_DSP_ASTREAM_INVALID);
- AE_DSP_BASETYPE GetBaseType(AE_DSP_STREAM_PROPERTIES *props);
- bool RecheckProcessArray(unsigned int inputFrames);
- bool ReallocProcessArray(unsigned int requestSize);
- void CalculateCPUUsage(uint64_t iTime);
- void SetFFMpegDSPProcessorArray(float *array_ffmpeg[AE_DSP_CH_MAX], float *array_dsp[AE_DSP_CH_MAX], int idx[AE_CH_MAX], unsigned long ChannelFlags);
- //@}
- //@{
- /*!
- * Data
- */
- const AE_DSP_STREAM_ID m_streamId; /*!< stream id of this class, is a increase/decrease number of the amount of process streams */
- AE_DSP_STREAMTYPE m_streamTypeDetected; /*! The detected stream type of the stream from the source of it */
- AE_DSP_STREAMTYPE m_streamTypeUsed; /*!< The currently used stream type */
- bool m_forceInit; /*!< if set to true the process function perform a reinitialization of addons and data */
- AE_DSP_ADDONMAP m_usedMap; /*!< a map of all currently used audio dsp add-on's */
- AEAudioFormat m_inputFormat; /*!< the used input stream format */
- AEAudioFormat m_outputFormat; /*!< the from Kodi requested output format */
- AEQuality m_streamQuality; /*!< from KODI requested stream quality, based also to addons */
- bool m_bypassDSP; /*!< if true, all AudioDSP modes are skipped */
- AE_DSP_SETTINGS m_addonSettings; /*!< the current stream's settings passed to dsp add-ons */
- AE_DSP_STREAM_PROPERTIES m_addonStreamProperties; /*!< the current stream's properties (eg. stream type) passed to dsp add-ons */
- int m_NewMasterMode; /*!< if master mode is changed it set here and handled by process function */
- AE_DSP_STREAMTYPE m_NewStreamType; /*!< if stream type is changed it set here and handled by process function */
- enum AVMatrixEncoding m_ffMpegMatrixEncoding;
- enum AVAudioServiceType m_ffMpegAudioServiceType;
- int m_ffMpegProfile;
- SwrContext *m_convertInput;
- SwrContext *m_convertOutput;
-
- CCriticalSection m_critSection;
- CCriticalSection m_restartSection;
-
- /*!>
- * Selected dsp addon functions
- */
- struct sDSPProcessHandle
- {
- void Clear()
- {
- iAddonModeNumber = -1;
- iLastTime = 0;
- }
- unsigned int iAddonModeNumber; /*!< The identifier, send from addon during mode registration and can be used from addon to select mode from a function table */
- CActiveAEDSPModePtr pMode; /*!< Processing mode information data */
- AE_DSP_ADDON pAddon; /*!< Addon control class */
- ADDON_HANDLE_STRUCT handle;
- uint64_t iLastTime; /*!< last processing time of the mode */
- };
- std::vector <sDSPProcessHandle> m_addons_InputProc; /*!< Input processing list, called to all enabled dsp addons with the basic unchanged input stream, is read only. */
- sDSPProcessHandle m_addon_InputResample; /*!< Input stream resampling over one on settings enabled input resample function only on one addon */
- std::vector <sDSPProcessHandle> m_addons_PreProc; /*!< Input stream preprocessing function calls set and aligned from dsp settings stored inside database */
- std::vector <sDSPProcessHandle> m_addons_MasterProc; /*!< The current from user selected master processing function on addon */
- int m_activeMode; /*!< the current used master mode, is a pointer to m_addons_MasterProc */
- int m_activeModeOutChannels; /*!< Amount of channels given from active master mode or -1 if unhandled */
- unsigned long m_activeModeOutChannelsPresent; /*! The exact present flags of output processing channels from active master mode */
- std::vector <sDSPProcessHandle> m_addons_PostProc; /*!< Output stream postprocessing function calls set and aligned from dsp settings stored inside database */
- sDSPProcessHandle m_addon_OutputResample; /*!< Output stream resampling over one on settings enabled output resample function only on one addon */
- std::map<int,ADDON_HANDLE_STRUCT> m_addon_Handles; /*!< Handle identifier for the called dsp functions */
-
- /*!>
- * Process arrays
- */
- float *m_processArray[2][AE_DSP_CH_MAX];
- unsigned int m_processArraySize;
-
- /*!>
- * CPU usage data
- */
- uint64_t m_iLastProcessTime;
- uint64_t m_iLastProcessUsage;
- float m_fLastProcessUsage;
-
- /*!>
- * Internal ffmpeg process data
- */
- IAEResample *m_resamplerDSPProcessor; /*!< ffmpeg resampler usage for down mix of input stream to required output channel alignment or internal processing*/
- float *m_ffMpegConvertArray[2][AE_DSP_CH_MAX]; /*!< the process array memory pointers for ffmpeg used for format convert. No own memory only addresses taken from m_processArray in correct ffmpeg channel alignment */
- float *m_ffMpegProcessArray[2][AE_DSP_CH_MAX]; /*!< the process array memory pointers for ffmpeg. No own memory only addresses taken from m_processArray in correct ffmpeg channel alignment */
-
- /*!>
- * Index pointers for interleaved audio streams to detect correct channel alignment
- */
- int m_idx_in[AE_CH_MAX];
- uint64_t m_channelLayoutIn;
- int m_idx_out[AE_CH_MAX];
- uint64_t m_channelLayoutOut;
- //@}
- };
- //@}
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.cpp
deleted file mode 100644
index c2356d731a..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2005-2015 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-// AudioDSPSettings.cpp: implementation of the CAudioSettings class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "AudioDSPSettings.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-CAudioSettings::CAudioSettings()
-{
- m_MasterStreamType = AE_DSP_ASTREAM_AUTO;
- m_MasterStreamTypeSel = AE_DSP_ASTREAM_AUTO;
- m_MasterStreamBase = AE_DSP_ABASE_STEREO;
-
- memset(m_MasterModes, AE_DSP_MASTER_MODE_ID_PASSOVER, sizeof(m_MasterModes));
-}
-
-bool CAudioSettings::operator!=(const CAudioSettings &right) const
-{
- if (m_MasterStreamType != right.m_MasterStreamType) return true;
- if (m_MasterStreamTypeSel != right.m_MasterStreamTypeSel) return true;
- if (memcmp(m_MasterModes, right.m_MasterModes, sizeof(m_MasterModes))) return true;
-
- return false;
-}
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.h
deleted file mode 100644
index 46321862a5..0000000000
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/AudioDSPSettings.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2005-2015 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-// AudioDSPSettings.h: interface for the CAudioSettings class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h"
-#include "cores/AudioEngine/Utils/AEAudioFormat.h"
-
-class CAudioSettings
-{
-public:
- CAudioSettings();
- ~CAudioSettings() = default;
-
- bool operator!=(const CAudioSettings &right) const;
-
- int m_MasterStreamTypeSel;
- int m_MasterStreamType;
- int m_MasterStreamBase;
- int m_MasterModes[AE_DSP_ASTREAM_MAX][AE_DSP_ABASE_MAX];
-
-private:
-};
diff --git a/xbmc/filesystem/AddonsDirectory.cpp b/xbmc/filesystem/AddonsDirectory.cpp
index 63b3e4920c..c16ca841e7 100644
--- a/xbmc/filesystem/AddonsDirectory.cpp
+++ b/xbmc/filesystem/AddonsDirectory.cpp
@@ -704,8 +704,6 @@ bool CAddonsDirectory::GetDirectory(const CURL& url, CFileItemList &items)
if (path.GetFileName() == "xbmc.pvrclient")
type = ADDON_PVRDLL;
- else if (path.GetFileName() == "kodi.adsp")
- type = ADDON_ADSPDLL;
else if (path.GetFileName() == "kodi.vfs")
type = ADDON_VFS;
else
diff --git a/xbmc/guiinfo/GUIInfoLabels.h b/xbmc/guiinfo/GUIInfoLabels.h
index 24eaea41ea..9c0dca742b 100644
--- a/xbmc/guiinfo/GUIInfoLabels.h
+++ b/xbmc/guiinfo/GUIInfoLabels.h
@@ -444,7 +444,7 @@
#define FANART_IMAGE 1003
#define SYSTEM_PROFILEAUTOLOGIN 1004
-#define SYSTEM_HAS_ADSP 1005
+
#define SYSTEM_HAS_CMS 1006
#define PVR_CONDITIONS_START 1100
@@ -533,26 +533,6 @@
#define PVR_EPG_EVENT_SEEK_TIME (PVR_STRINGS_START + 63)
#define PVR_STRINGS_END PVR_EPG_EVENT_SEEK_TIME
-#define ADSP_CONDITIONS_START 1300
-#define ADSP_IS_ACTIVE (ADSP_CONDITIONS_START)
-#define ADSP_HAS_INPUT_RESAMPLE (ADSP_CONDITIONS_START + 1)
-#define ADSP_HAS_PRE_PROCESS (ADSP_CONDITIONS_START + 2)
-#define ADSP_HAS_MASTER_PROCESS (ADSP_CONDITIONS_START + 3)
-#define ADSP_HAS_POST_PROCESS (ADSP_CONDITIONS_START + 4)
-#define ADSP_HAS_OUTPUT_RESAMPLE (ADSP_CONDITIONS_START + 5)
-#define ADSP_MASTER_ACTIVE (ADSP_CONDITIONS_START + 6)
-#define ADSP_HAS_MODES (ADSP_CONDITIONS_START + 7)
-#define ADSP_CONDITIONS_END ADSP_HAS_MODES
-
-#define ADSP_STRINGS_START 1350
-#define ADSP_ACTIVE_STREAM_TYPE (ADSP_STRINGS_START)
-#define ADSP_DETECTED_STREAM_TYPE (ADSP_STRINGS_START + 1)
-#define ADSP_MASTER_NAME (ADSP_STRINGS_START + 7)
-#define ADSP_MASTER_INFO (ADSP_STRINGS_START + 8)
-#define ADSP_MASTER_OWN_ICON (ADSP_STRINGS_START + 9)
-#define ADSP_MASTER_OVERRIDE_ICON (ADSP_STRINGS_START + 10)
-#define ADSP_STRINGS_END ADSP_MASTER_OVERRIDE_ICON
-
#define RDS_DATA_START 1400
#define RDS_HAS_RDS (RDS_DATA_START)
#define RDS_HAS_RADIOTEXT (RDS_DATA_START + 1)
diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp
index bad75f3b27..b4c5b18ca3 100644
--- a/xbmc/settings/AdvancedSettings.cpp
+++ b/xbmc/settings/AdvancedSettings.cpp
@@ -1125,22 +1125,6 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file)
XMLUtils::GetBoolean(pDatabase, "compression", m_databaseTV.compression);
}
- pDatabase = pRootElement->FirstChildElement("adspdatabase");
- if (pDatabase)
- {
- XMLUtils::GetString(pDatabase, "type", m_databaseADSP.type);
- XMLUtils::GetString(pDatabase, "host", m_databaseADSP.host);
- XMLUtils::GetString(pDatabase, "port", m_databaseADSP.port);
- XMLUtils::GetString(pDatabase, "user", m_databaseADSP.user);
- XMLUtils::GetString(pDatabase, "pass", m_databaseADSP.pass);
- XMLUtils::GetString(pDatabase, "name", m_databaseADSP.name);
- XMLUtils::GetString(pDatabase, "key", m_databaseADSP.key);
- XMLUtils::GetString(pDatabase, "cert", m_databaseADSP.cert);
- XMLUtils::GetString(pDatabase, "ca", m_databaseADSP.ca);
- XMLUtils::GetString(pDatabase, "capath", m_databaseADSP.capath);
- XMLUtils::GetString(pDatabase, "ciphers", m_databaseADSP.ciphers);
- }
-
pDatabase = pRootElement->FirstChildElement("epgdatabase");
if (pDatabase)
{
diff --git a/xbmc/settings/dialogs/CMakeLists.txt b/xbmc/settings/dialogs/CMakeLists.txt
index 59ab1c831a..631e86ca2a 100644
--- a/xbmc/settings/dialogs/CMakeLists.txt
+++ b/xbmc/settings/dialogs/CMakeLists.txt
@@ -1,12 +1,10 @@
-set(SOURCES GUIDialogAudioDSPManager.cpp
- GUIDialogContentSettings.cpp
+set(SOURCES GUIDialogContentSettings.cpp
GUIDialogLibExportSettings.cpp
GUIDialogSettingsBase.cpp
GUIDialogSettingsManagerBase.cpp
GUIDialogSettingsManualBase.cpp)
-set(HEADERS GUIDialogAudioDSPManager.h
- GUIDialogContentSettings.h
+set(HEADERS GUIDialogContentSettings.h
GUIDialogLibExportSettings.h
GUIDialogSettingsBase.h
GUIDialogSettingsManagerBase.h
diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp
deleted file mode 100644
index b2192e4659..0000000000
--- a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp
+++ /dev/null
@@ -1,1027 +0,0 @@
-/*
- * Copyright (C) 2012-2015 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogAudioDSPManager.h"
-
-#include "FileItem.h"
-#include "Util.h"
-#include "ServiceBroker.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
-#include "dialogs/GUIDialogTextViewer.h"
-#include "dialogs/GUIDialogBusy.h"
-#include "dialogs/GUIDialogYesNo.h"
-#include "guilib/GUIComponent.h"
-#include "guilib/GUIWindowManager.h"
-#include "guilib/LocalizeStrings.h"
-#include "guilib/GUIListContainer.h"
-#include "guilib/GUIRadioButtonControl.h"
-#include "input/Key.h"
-#include "messaging/helpers/DialogOKHelper.h"
-#include "utils/log.h"
-#include "utils/StringUtils.h"
-
-#define CONTROL_LIST_AVAILABLE 20
-#define CONTROL_LIST_ACTIVE 21
-#define CONTROL_RADIO_BUTTON_CONTINUOUS_SAVING 22
-#define CONTROL_BUTTON_APPLY_CHANGES 23
-#define CONTROL_BUTTON_CLEAR_ACTIVE_MODES 24
-#define CONTROL_LIST_MODE_SELECTION 9000
-
-#define LIST_AVAILABLE 0
-#define LIST_ACTIVE 1
-
-#define LIST_INPUT_RESAMPLE 0
-#define LIST_PRE_PROCESS 1
-#define LIST_MASTER_PROCESS 2
-#define LIST_POST_PROCESS 3
-#define LIST_OUTPUT_RESAMPLE 4
-
-using namespace ActiveAE;
-using namespace KODI::MESSAGING;
-
-typedef struct
-{
- const char* sModeType;
- int iModeType;
- int iName;
- int iDescription;
-} DSP_MODE_TYPES;
-
-static const DSP_MODE_TYPES dsp_mode_types[] = {
- { "inputresampling", AE_DSP_MODE_TYPE_INPUT_RESAMPLE, 15057, 15114 },
- { "preprocessing", AE_DSP_MODE_TYPE_PRE_PROCESS, 15058, 15113 },
- { "masterprocessing", AE_DSP_MODE_TYPE_MASTER_PROCESS, 15059, 15115 },
- { "postprocessing", AE_DSP_MODE_TYPE_POST_PROCESS, 15060, 15117 },
- { "outputresampling", AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE, 15061, 15116 },
- { "undefined", AE_DSP_MODE_TYPE_UNDEFINED, 0, 0 }
-};
-
-CGUIDialogAudioDSPManager::CGUIDialogAudioDSPManager(void)
- : CGUIDialog(WINDOW_DIALOG_AUDIO_DSP_MANAGER, "DialogAudioDSPManager.xml")
-{
- m_bMovingMode = false;
- m_bContainsChanges = false;
- m_bContinuousSaving = true;
- m_iSelected[LIST_AVAILABLE] = 0;
- m_iSelected[LIST_ACTIVE] = 0;
-
- for (int ii = 0; ii < AE_DSP_MODE_TYPE_MAX; ii++)
- {
- m_activeItems[ii] = new CFileItemList;
- m_availableItems[ii] = new CFileItemList;
- }
-
- m_iCurrentType = AE_DSP_MODE_TYPE_MASTER_PROCESS;
-}
-
-CGUIDialogAudioDSPManager::~CGUIDialogAudioDSPManager(void)
-{
- for (int ii = 0; ii < AE_DSP_MODE_TYPE_MAX; ii++)
- {
- delete m_activeItems[ii];
- delete m_availableItems[ii];
- }
-}
-
-bool CGUIDialogAudioDSPManager::OnActionMove(const CAction &action)
-{
- bool bReturn(false);
- int iActionId = action.GetID();
-
- if (GetFocusedControlID() == CONTROL_LIST_ACTIVE)
- {
- if (iActionId == ACTION_MOUSE_MOVE)
- {
- int iSelected = m_activeViewControl.GetSelectedItem();
- if (m_iSelected[LIST_ACTIVE] < iSelected)
- {
- iActionId = ACTION_MOVE_DOWN;
- }
- else if (m_iSelected[LIST_ACTIVE] > iSelected)
- {
- iActionId = ACTION_MOVE_UP;
- }
- else
- {
- return bReturn;
- }
- }
-
- if (iActionId == ACTION_MOVE_DOWN || iActionId == ACTION_MOVE_UP ||
- iActionId == ACTION_PAGE_DOWN || iActionId == ACTION_PAGE_UP)
- {
- bReturn = true;
- CGUIDialog::OnAction(action);
-
- int iSelected = m_activeViewControl.GetSelectedItem();
- if (!m_bMovingMode)
- {
- if (iSelected != m_iSelected[LIST_ACTIVE])
- {
- m_iSelected[LIST_ACTIVE] = iSelected;
- }
- }
- else
- {
- bool bMoveUp = iActionId == ACTION_PAGE_UP || iActionId == ACTION_MOVE_UP;
- unsigned int iLines = bMoveUp ? abs(m_iSelected[LIST_ACTIVE] - iSelected) : 1;
- bool bOutOfBounds = bMoveUp ? m_iSelected[LIST_ACTIVE] <= 0 : m_iSelected[LIST_ACTIVE] >= m_activeItems[m_iCurrentType]->Size() - 1;
- if (bOutOfBounds)
- {
- bMoveUp = !bMoveUp;
- iLines = m_activeItems[m_iCurrentType]->Size() - 1;
- }
-
- std::string strNumber;
- for (unsigned int iLine = 0; iLine < iLines; iLine++)
- {
- unsigned int iNewSelect = bMoveUp ? m_iSelected[LIST_ACTIVE] - 1 : m_iSelected[LIST_ACTIVE] + 1;
- if (m_activeItems[m_iCurrentType]->Get(iNewSelect)->GetProperty("Number").asString() != "-")
- {
- strNumber = StringUtils::Format("%i", m_iSelected[LIST_ACTIVE]+1);
- m_activeItems[m_iCurrentType]->Get(iNewSelect)->SetProperty("Number", strNumber);
- strNumber = StringUtils::Format("%i", iNewSelect+1);
- m_activeItems[m_iCurrentType]->Get(m_iSelected[LIST_ACTIVE])->SetProperty("Number", strNumber);
- }
- m_activeItems[m_iCurrentType]->Swap(iNewSelect, m_iSelected[LIST_ACTIVE]);
- m_iSelected[LIST_ACTIVE] = iNewSelect;
- }
-
- SET_CONTROL_FOCUS(CONTROL_LIST_ACTIVE, 0);
-
- m_activeViewControl.SetItems(*m_activeItems[m_iCurrentType]);
- m_activeViewControl.SetSelectedItem(m_iSelected[LIST_ACTIVE]);
- }
- }
- }
-
- return bReturn;
-}
-
-bool CGUIDialogAudioDSPManager::OnAction(const CAction& action)
-{
- return OnActionMove(action) ||
- CGUIDialog::OnAction(action);
-}
-
-void CGUIDialogAudioDSPManager::OnInitWindow()
-{
- CGUIDialog::OnInitWindow();
-
- m_iSelected[LIST_AVAILABLE] = 0;
- m_iSelected[LIST_ACTIVE] = 0;
- m_bMovingMode = false;
- m_bContainsChanges = false;
-
- CGUIRadioButtonControl *radioButton = dynamic_cast<CGUIRadioButtonControl*>(GetControl(CONTROL_RADIO_BUTTON_CONTINUOUS_SAVING));
- CGUIButtonControl *applyButton = dynamic_cast<CGUIButtonControl*>(GetControl(CONTROL_BUTTON_APPLY_CHANGES));
- if (!radioButton || !applyButton)
- {
- helper_LogError(__FUNCTION__);
- return;
- }
-
- SET_CONTROL_SELECTED(GetID(), CONTROL_RADIO_BUTTON_CONTINUOUS_SAVING, m_bContinuousSaving);
- applyButton->SetEnabled(!m_bContinuousSaving);
-
- Update();
- SetSelectedModeType();
-}
-
-void CGUIDialogAudioDSPManager::OnDeinitWindow(int nextWindowID)
-{
- if (m_bContainsChanges)
- {
- if (m_bContinuousSaving)
- {
- SaveList();
- }
- else
- {
- if (CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(19098), g_localizeStrings.Get(15079)))
- {
- SaveList();
- }
- else
- {
- m_bContinuousSaving = false;
- }
- }
- }
-
- Clear();
-
- CGUIDialog::OnDeinitWindow(nextWindowID);
-}
-
-bool CGUIDialogAudioDSPManager::OnClickListAvailable(CGUIMessage &message)
-{
- int iAction = message.GetParam1();
- int iItem = m_availableViewControl.GetSelectedItem();
-
- /* Check file item is in list range and get his pointer */
- if (iItem < 0 || iItem >= (int)m_availableItems[m_iCurrentType]->Size()) return true;
-
- /* Process actions */
- if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_LEFT_CLICK || iAction == ACTION_MOUSE_RIGHT_CLICK)
- {
- /* Show Contextmenu */
- OnPopupMenu(iItem, LIST_AVAILABLE);
-
- return true;
- }
-
- return false;
-}
-
-bool CGUIDialogAudioDSPManager::OnClickListActive(CGUIMessage &message)
-{
- if (!m_bMovingMode)
- {
- int iAction = message.GetParam1();
- int iItem = m_activeViewControl.GetSelectedItem();
-
- /* Check file item is in list range and get his pointer */
- if (iItem < 0 || iItem >= (int)m_activeItems[m_iCurrentType]->Size()) return true;
-
- /* Process actions */
- if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_LEFT_CLICK || iAction == ACTION_MOUSE_RIGHT_CLICK)
- {
- /* Show Contextmenu */
- OnPopupMenu(iItem, LIST_ACTIVE);
-
- return true;
- }
- }
- else
- {
- CFileItemPtr pItem = m_activeItems[m_iCurrentType]->Get(m_iSelected[LIST_ACTIVE]);
- if (pItem)
- {
- pItem->Select(false);
- pItem->SetProperty("Changed", true);
- m_bMovingMode = false;
- m_bContainsChanges = true;
-
- if (m_bContinuousSaving)
- {
- SaveList();
- }
-
- CGUIListContainer *modeList = dynamic_cast<CGUIListContainer*>(GetControl(CONTROL_LIST_MODE_SELECTION));
- CGUIButtonControl *applyButton = dynamic_cast<CGUIButtonControl*>(GetControl(CONTROL_BUTTON_APPLY_CHANGES));
- CGUIButtonControl *clearActiveModesButton = dynamic_cast<CGUIButtonControl*>(GetControl(CONTROL_BUTTON_CLEAR_ACTIVE_MODES));
- if (!modeList || !applyButton || !clearActiveModesButton)
- {
- helper_LogError(__FUNCTION__);
- return false;
- }
-
- // reenable all buttons and mode selection list
- modeList->SetEnabled(true);
- clearActiveModesButton->SetEnabled(true);
- if (!m_bContinuousSaving)
- {
- applyButton->SetEnabled(true);
- }
-
- return true;
- }
- }
-
- return false;
-}
-
-bool CGUIDialogAudioDSPManager::OnClickRadioContinuousSaving(CGUIMessage &message)
-{
- CGUIRadioButtonControl *radioButton = dynamic_cast<CGUIRadioButtonControl*>(GetControl(CONTROL_RADIO_BUTTON_CONTINUOUS_SAVING));
- CGUIButtonControl *applyChangesButton = dynamic_cast<CGUIButtonControl*>(GetControl(CONTROL_BUTTON_APPLY_CHANGES));
-
- if (!radioButton || !applyChangesButton)
- {
- helper_LogError(__FUNCTION__);
- return false;
- }
-
- if (!radioButton->IsSelected())
- {
- applyChangesButton->SetEnabled(true);
- m_bContinuousSaving = false;
- }
- else
- {
- m_bContinuousSaving = true;
- applyChangesButton->SetEnabled(false);
- }
-
- return true;
-}
-
-bool CGUIDialogAudioDSPManager::OnClickApplyChanges(CGUIMessage &message)
-{
- SaveList();
- return true;
-}
-
-bool CGUIDialogAudioDSPManager::OnClickClearActiveModes(CGUIMessage &message)
-{
- if (m_activeItems[m_iCurrentType]->Size() > 0)
- {
- for (int iItem = 0; iItem < m_activeItems[m_iCurrentType]->Size(); iItem++)
- {
- CFileItemPtr pItem = m_activeItems[m_iCurrentType]->Get(iItem);
- if (pItem)
- {
- // remove mode from active mode list and add it to available mode list
- CFileItemPtr newItem(dynamic_cast<CFileItem*>(pItem->Clone()));
- newItem->SetProperty("ActiveMode", false);
- newItem->SetProperty("Changed", true);
- m_availableItems[m_iCurrentType]->Add(newItem);
- }
- }
- m_activeItems[m_iCurrentType]->Clear();
-
- // reorder available mode list, so that the mode order is always consistent
- m_availableItems[m_iCurrentType]->ClearSortState();
- m_availableItems[m_iCurrentType]->Sort(SortByLabel, SortOrderAscending);
-
- // update active and available mode list
- m_availableViewControl.SetItems(*m_availableItems[m_iCurrentType]);
- m_activeViewControl.SetItems(*m_activeItems[m_iCurrentType]);
-
- m_bContainsChanges = true;
- if (m_bContinuousSaving)
- {
- SaveList();
- }
- }
-
- return true;
-}
-
-bool CGUIDialogAudioDSPManager::OnMessageClick(CGUIMessage &message)
-{
- int iControl = message.GetSenderId();
- switch(iControl)
- {
- case CONTROL_LIST_AVAILABLE:
- return OnClickListAvailable(message);
- case CONTROL_LIST_ACTIVE:
- return OnClickListActive(message);
- case CONTROL_RADIO_BUTTON_CONTINUOUS_SAVING:
- return OnClickRadioContinuousSaving(message);
- case CONTROL_BUTTON_CLEAR_ACTIVE_MODES:
- return OnClickClearActiveModes(message);
- case CONTROL_BUTTON_APPLY_CHANGES:
- return OnClickApplyChanges(message);
- default:
- return false;
- }
-}
-
-bool CGUIDialogAudioDSPManager::OnMessage(CGUIMessage& message)
-{
- unsigned int iMessage = message.GetMessage();
-
- switch (iMessage)
- {
- case GUI_MSG_CLICKED:
- return OnMessageClick(message);
-
- case GUI_MSG_ITEM_SELECT:
- {
- int focusedControl = GetFocusedControlID();
- if (focusedControl == CONTROL_LIST_MODE_SELECTION)
- {
- CGUIListContainer *modeListPtr = dynamic_cast<CGUIListContainer*>(GetControl(CONTROL_LIST_MODE_SELECTION));
-
- if (modeListPtr)
- {
- CGUIListItemPtr modeListItem = modeListPtr->GetListItem(0); // get current selected list item
- if (modeListItem)
- {
- std::string currentModeString = modeListItem->GetProperty("currentMode").asString();
- int newModeType = helper_TranslateModeType(currentModeString);
-
- if (m_iCurrentType != newModeType)
- {
- m_iCurrentType = newModeType;
- SetSelectedModeType();
- }
- }
- }
- }
- }
- }
-
- return CGUIDialog::OnMessage(message);
-}
-
-void CGUIDialogAudioDSPManager::OnWindowLoaded(void)
-{
- m_availableViewControl.Reset();
- m_availableViewControl.SetParentWindow(GetID());
- m_availableViewControl.AddView(GetControl(CONTROL_LIST_AVAILABLE));
-
- m_activeViewControl.Reset();
- m_activeViewControl.SetParentWindow(GetID());
- m_activeViewControl.AddView(GetControl(CONTROL_LIST_ACTIVE));
-
- CGUIDialog::OnWindowLoaded();
-}
-
-void CGUIDialogAudioDSPManager::OnWindowUnload(void)
-{
- CGUIDialog::OnWindowUnload();
-
- m_availableViewControl.Reset();
- m_activeViewControl.Reset();
-}
-
-bool CGUIDialogAudioDSPManager::OnPopupMenu(int iItem, int listType)
-{
- // popup the context menu
- // grab our context menu
- CContextButtons buttons;
- int listSize = 0;
- CFileItemPtr pItem;
-
- if (listType == LIST_ACTIVE)
- {
- listSize = m_activeItems[m_iCurrentType]->Size();
- pItem = m_activeItems[m_iCurrentType]->Get(iItem);
- }
- else if (listType == LIST_AVAILABLE)
- {
- listSize = m_availableItems[m_iCurrentType]->Size();
- pItem = m_availableItems[m_iCurrentType]->Get(iItem);
- }
-
- if (!pItem)
- {
- return false;
- }
-
- // mark the item
- if (iItem >= 0 && iItem < listSize)
- {
- pItem->Select(true);
- }
- else
- {
- return false;
- }
-
- if (listType == LIST_ACTIVE)
- {
- if (listSize > 1)
- {
- buttons.Add(CONTEXT_BUTTON_MOVE, 116); /* Move mode up or down */
- }
- buttons.Add(CONTEXT_BUTTON_ACTIVATE, 24021); /* Used to deactivate addon process type */
- }
- else if (listType == LIST_AVAILABLE)
- {
- if (m_activeItems[m_iCurrentType]->Size() > 0 && (m_iCurrentType == AE_DSP_MODE_TYPE_INPUT_RESAMPLE || m_iCurrentType == AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE))
- {
- buttons.Add(CONTEXT_BUTTON_ACTIVATE, 15080); /* Used to swap addon resampling process type */
- }
- else
- {
- buttons.Add(CONTEXT_BUTTON_ACTIVATE, 24022); /* Used to activate addon process type */
- }
- }
-
- if (pItem->GetProperty("SettingsDialog").asInteger() != 0)
- {
- buttons.Add(CONTEXT_BUTTON_SETTINGS, 15078); /* Used to activate addon process type help description*/
- }
-
- if (pItem->GetProperty("Help").asInteger() > 0)
- {
- buttons.Add(CONTEXT_BUTTON_HELP, 15062); /* Used to activate addon process type help description*/
- }
-
- int choice = CGUIDialogContextMenu::ShowAndGetChoice(buttons);
-
- // deselect our item
- if (iItem >= 0 && iItem < listSize)
- {
- pItem->Select(false);
- }
-
- if (choice < 0)
- {
- return false;
- }
-
- return OnContextButton(iItem, (CONTEXT_BUTTON)choice, listType);
-}
-
-bool CGUIDialogAudioDSPManager::OnContextButton(int itemNumber, CONTEXT_BUTTON button, int listType)
-{
- CFileItemPtr pItem;
- int listSize = 0;
- if (listType == LIST_ACTIVE)
- {
- pItem = m_activeItems[m_iCurrentType]->Get(itemNumber);
- listSize = m_activeItems[m_iCurrentType]->Size();
- }
- else if (listType == LIST_AVAILABLE)
- {
- pItem = m_availableItems[m_iCurrentType]->Get(itemNumber);
- listSize = m_availableItems[m_iCurrentType]->Size();
- }
-
- /* Check file item is in list range and get his pointer */
- if (!pItem || itemNumber < 0 || itemNumber >= listSize)
- {
- return false;
- }
-
- if (button == CONTEXT_BUTTON_ACTIVATE)
- {
- /*!
- * Deactivate selected processing mode
- */
- if (pItem->GetProperty("ActiveMode").asBoolean())
- {
- // remove mode from active mode list and add it to available mode list
- CFileItemPtr newItem(dynamic_cast<CFileItem*>(pItem->Clone()));
- newItem->SetProperty("ActiveMode", false);
- newItem->SetProperty("Changed", true);
- m_activeItems[m_iCurrentType]->Remove(itemNumber);
- m_availableItems[m_iCurrentType]->Add(newItem);
- }
- else
- {
- /*!
- * Activate selected processing mode
- */
- if ((m_iCurrentType == AE_DSP_MODE_TYPE_INPUT_RESAMPLE || m_iCurrentType == AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE) && m_activeItems[m_iCurrentType]->Size() > 0)
- { // if there is already an active resampler, now we remove it
- CFileItemPtr activeResampler = m_activeItems[m_iCurrentType]->Get(0);
- if (activeResampler)
- {
- CFileItemPtr newItem(dynamic_cast<CFileItem*>(activeResampler->Clone()));
- newItem->SetProperty("ActiveMode", false);
- newItem->SetProperty("Changed", true);
-
- m_availableItems[m_iCurrentType]->Add(newItem);
- // clear active list, because only one active resampling mode is supported by ActiveAEDSP
- m_activeItems[m_iCurrentType]->Clear();
- }
- }
-
- // remove mode from available mode list and add it to active mode list
- CFileItemPtr newItem(dynamic_cast<CFileItem*>(pItem->Clone()));
-
- newItem->SetProperty("Number", (int)m_activeItems[m_iCurrentType]->Size() +1);
- newItem->SetProperty("Changed", true);
- newItem->SetProperty("ActiveMode", true);
-
- m_availableItems[m_iCurrentType]->Remove(itemNumber);
- m_activeItems[m_iCurrentType]->Add(newItem);
- }
-
- m_bContainsChanges = true;
- if (m_bContinuousSaving)
- {
- SaveList();
- }
-
- // reorder available mode list, so that the mode order is always consistent
- m_availableItems[m_iCurrentType]->ClearSortState();
- m_availableItems[m_iCurrentType]->Sort(SortByLabel, SortOrderAscending);
-
- // update active and available mode list
- Renumber();
- m_availableViewControl.SetItems(*m_availableItems[m_iCurrentType]);
- m_activeViewControl.SetItems(*m_activeItems[m_iCurrentType]);
- }
- else if (button == CONTEXT_BUTTON_MOVE)
- {
- m_bMovingMode = true;
- pItem->Select(true);
-
- CGUIListContainer *modeList = dynamic_cast<CGUIListContainer*>(GetControl(CONTROL_LIST_MODE_SELECTION));
- CGUIButtonControl *applyButton = dynamic_cast<CGUIButtonControl*>(GetControl(CONTROL_BUTTON_APPLY_CHANGES));
- CGUIButtonControl *clearActiveModesButton = dynamic_cast<CGUIButtonControl*>(GetControl(CONTROL_BUTTON_CLEAR_ACTIVE_MODES));
- if (!modeList || !applyButton || !clearActiveModesButton)
- {
- helper_LogError(__FUNCTION__);
- return false;
- }
-
- // if we are in MovingMode all buttons and mode selection list will be disabled!
- modeList->SetEnabled(false);
- clearActiveModesButton->SetEnabled(false);
- if (!m_bContinuousSaving)
- {
- applyButton->SetEnabled(false);
- }
- }
- else if (button == CONTEXT_BUTTON_SETTINGS)
- {
- HELPERS::ShowOKDialogLines(CVariant{19033}, CVariant{0}, CVariant{15040}, CVariant{0});
- }
-
- return true;
-}
-
-void CGUIDialogAudioDSPManager::Update()
-{
- CGUIDialogBusy* pDlgBusy = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogBusy>(WINDOW_DIALOG_BUSY);
- if (!pDlgBusy)
- {
- helper_LogError(__FUNCTION__);
- return;
- }
- pDlgBusy->Open();
-
- Clear();
-
- AE_DSP_MODELIST modes;
- CActiveAEDSPDatabase db;
- if (!db.Open())
- {
- pDlgBusy->Close();
- CLog::Log(LOGERROR, "DSP Manager - %s - Could not open DSP database for update!", __FUNCTION__);
- return;
- }
-
- // construct a CFileItemList to pass 'em on to the list
- CFileItemList items;
- for (int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i)
- {
- int iModeType = dsp_mode_types[i].iModeType;
-
- modes.clear();
- db.GetModes(modes, iModeType);
-
- // No modes available, nothing to do.
- if (!modes.empty())
- {
- CFileItemPtr item(new CFileItem());
- item->SetLabel(g_localizeStrings.Get(dsp_mode_types[i].iName));
- item->SetLabel2(g_localizeStrings.Get(dsp_mode_types[i].iDescription));
- item->SetProperty("currentMode", dsp_mode_types[i].sModeType);
- items.Add(item);
-
- AE_DSP_MENUHOOK_CAT menuHook = helper_GetMenuHookCategory(iModeType);
- int continuesNo = 1;
- for (unsigned int iModePtr = 0; iModePtr < modes.size(); iModePtr++)
- {
- CFileItem *listItem = helper_CreateModeListItem(modes[iModePtr].first, menuHook, &continuesNo);
- if (listItem)
- {
- CFileItemPtr pItem(listItem);
-
- if (pItem->GetProperty("ActiveMode").asBoolean())
- {
- m_activeItems[iModeType]->Add(pItem);
- }
- else
- {
- m_availableItems[iModeType]->Add(pItem);
- }
- }
- ProcessRenderLoop(false);
- }
-
- m_availableItems[iModeType]->Sort(SortByLabel, SortOrderAscending);
- if (iModeType == AE_DSP_MODE_TYPE_MASTER_PROCESS)
- {
- m_activeItems[iModeType]->Sort(SortByLabel, SortOrderAscending);
- }
-
- }
- }
-
- CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST_MODE_SELECTION, 0, 0, &items);
- OnMessage(msg);
-
- db.Close();
-
- pDlgBusy->Close();
-}
-
-void CGUIDialogAudioDSPManager::SetSelectedModeType(void)
-{
- if (m_iCurrentType > AE_DSP_MODE_TYPE_UNDEFINED && m_iCurrentType < AE_DSP_MODE_TYPE_MAX && !m_bMovingMode)
- {
- m_availableViewControl.SetCurrentView(CONTROL_LIST_AVAILABLE);
- m_activeViewControl.SetCurrentView(CONTROL_LIST_ACTIVE);
-
- m_availableViewControl.SetItems(*m_availableItems[m_iCurrentType]);
- m_activeViewControl.SetItems(*m_activeItems[m_iCurrentType]);
- }
-}
-
-void CGUIDialogAudioDSPManager::Clear(void)
-{
- m_availableViewControl.Clear();
- m_activeViewControl.Clear();
-
- for (int ii = 0; ii < AE_DSP_MODE_TYPE_MAX; ii++)
- {
- m_activeItems[ii]->Clear();
- m_availableItems[ii]->Clear();
- }
-}
-
-void CGUIDialogAudioDSPManager::SaveList(void)
-{
- if (!m_bContainsChanges)
- return;
-
- /* display the progress dialog */
- CGUIDialogBusy* pDlgBusy = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogBusy>(WINDOW_DIALOG_BUSY);
- if (!pDlgBusy)
- {
- helper_LogError(__FUNCTION__);
- return;
- }
- pDlgBusy->Open();
-
-
- pDlgBusy->Close();
-}
-
-bool CGUIDialogAudioDSPManager::UpdateDatabase(CGUIDialogBusy* pDlgBusy)
-{
- CActiveAEDSPDatabase db;
- if (!db.Open())
- {
- CLog::Log(LOGERROR, "DSP Manager - %s - Could not open DSP database for update!", __FUNCTION__);
- return false;
- }
-
- // calculate available items
- int maxItems = 0;
- for (int i = 0; i < AE_DSP_MODE_TYPE_MAX; i++)
- {
- maxItems += m_activeItems[i]->Size() + m_availableItems[i]->Size();
- }
-
- int processedItems = 0;
- for (int i = 0; i < AE_DSP_MODE_TYPE_MAX; i++)
- {
- for (int iListPtr = 0; iListPtr < m_activeItems[i]->Size(); iListPtr++)
- {
- CFileItemPtr pItem = m_activeItems[i]->Get(iListPtr);
- if (pItem->GetProperty("Changed").asBoolean())
- {
- bool success = db.UpdateMode( i,
- pItem->GetProperty("ActiveMode").asBoolean(),
- (int)pItem->GetProperty("AddonId").asInteger(),
- (int)pItem->GetProperty("AddonModeNumber").asInteger(),
- (int)pItem->GetProperty("Number").asInteger());
-
- if (!success)
- {
- CLog::Log(LOGERROR, "DSP Manager - Could not update DSP database for active mode %i - %s!",
- (int)pItem->GetProperty("AddonModeNumber").asInteger(),
- pItem->GetProperty("Name").asString().c_str());
- }
- }
-
- processedItems++;
- if (pDlgBusy)
- {
- pDlgBusy->SetProgress((float)(processedItems * 100 / maxItems));
-
- if (pDlgBusy->IsCanceled())
- {
- return false;
- }
- }
-
- ProcessRenderLoop(false);
- }
-
- for (int iListPtr = 0; iListPtr < m_availableItems[i]->Size(); iListPtr++)
- {
- CFileItemPtr pItem = m_availableItems[i]->Get(iListPtr);
- if (pItem && pItem->GetProperty("Changed").asBoolean())
- {
- bool success = db.UpdateMode( i,
- pItem->GetProperty("ActiveMode").asBoolean(),
- (int)pItem->GetProperty("AddonId").asInteger(),
- (int)pItem->GetProperty("AddonModeNumber").asInteger(),
- (int)pItem->GetProperty("Number").asInteger());
-
- if (!success)
- {
- CLog::Log(LOGERROR, "DSP Manager - Could not update DSP database for available mode %i - %s!",
- (int)pItem->GetProperty("AddonModeNumber").asInteger(),
- pItem->GetProperty("Name").asString().c_str());
- }
- }
-
- processedItems++;
- if (pDlgBusy)
- {
- pDlgBusy->SetProgress((float)(processedItems * 100 / maxItems));
-
- if (pDlgBusy->IsCanceled())
- {
- return false;
- }
- }
-
- ProcessRenderLoop(false);
- }
- }
- db.Close();
- return true;
-}
-
-void CGUIDialogAudioDSPManager::SetItemsUnchanged()
-{
- for (int i = 0; i < AE_DSP_MODE_TYPE_MAX; i++)
- {
- for (int iItemPtr = 0; iItemPtr < m_activeItems[i]->Size(); iItemPtr++)
- {
- CFileItemPtr pItem = m_activeItems[i]->Get(iItemPtr);
- if (pItem)
- pItem->SetProperty("Changed", false);
- }
-
- for (int iItemPtr = 0; iItemPtr < m_availableItems[i]->Size(); iItemPtr++)
- {
- CFileItemPtr pItem = m_availableItems[i]->Get(iItemPtr);
- if (pItem)
- pItem->SetProperty("Changed", false);
- }
- }
-}
-
-void CGUIDialogAudioDSPManager::Renumber(void)
-{
- int iNextModeNumber(0);
- std::string strNumber;
- CFileItemPtr pItem;
-
- for (int iModePtr = 0; iModePtr < m_activeItems[m_iCurrentType]->Size(); iModePtr++)
- {
- pItem = m_activeItems[m_iCurrentType]->Get(iModePtr);
- strNumber = StringUtils::Format("%i", ++iNextModeNumber);
- pItem->SetProperty("Number", strNumber);
- }
-}
-
-
-//! ---- Helper functions ----
-
-void CGUIDialogAudioDSPManager::helper_LogError(const char *function)
-{
- CLog::Log(LOGERROR, "DSP Manager - %s - GUI value error", function);
-}
-
-int CGUIDialogAudioDSPManager::helper_TranslateModeType(std::string ModeString)
-{
- int iType = AE_DSP_MODE_TYPE_UNDEFINED;
- for (unsigned int ii = 0; ii < ARRAY_SIZE(dsp_mode_types) && iType == AE_DSP_MODE_TYPE_UNDEFINED; ii++)
- {
- if (StringUtils::EqualsNoCase(ModeString, dsp_mode_types[ii].sModeType))
- {
- iType = dsp_mode_types[ii].iModeType;
- }
- }
-
- return iType;
-}
-
-CFileItem *CGUIDialogAudioDSPManager::helper_CreateModeListItem(CActiveAEDSPModePtr &ModePointer, AE_DSP_MENUHOOK_CAT &MenuHook, int *ContinuesNo)
-{
- CFileItem *pItem = NULL;
- return pItem;
-
- if (!ContinuesNo)
- {
- return pItem;
- }
-
- // start to get Addon and Mode properties
- const int AddonID = ModePointer->AddonID();
-
- std::string addonName;
- AE_DSP_ADDON addon;
- std::string modeName = g_localizeStrings.GetAddonString(addon->ID(), ModePointer->ModeName());
-
- std::string description;
- if (ModePointer->ModeDescription() > -1)
- {
- description = g_localizeStrings.GetAddonString(addon->ID(), ModePointer->ModeDescription());
- }
- else
- {
- description = g_localizeStrings.Get(15063);
- }
-
- bool isActive = ModePointer->IsEnabled();
- int number = ModePointer->ModePosition();
- int dialogId = helper_GetDialogId(ModePointer, MenuHook, addon, addonName);
- // end to get Addon and Mode properties
-
- if (isActive)
- {
- if (number <= 0)
- {
- number = *ContinuesNo;
- (*ContinuesNo)++;
- }
-
- std::string str = StringUtils::Format("%i:%i:%i:%s",
- number,
- AddonID,
- ModePointer->AddonModeNumber(),
- ModePointer->AddonModeName().c_str());
-
- pItem = new CFileItem(str);
- }
- else
- {
- pItem = new CFileItem(modeName);
- }
-
- // set list item properties
- pItem->SetProperty("ActiveMode", isActive);
- pItem->SetProperty("Number", number);
- pItem->SetLabel(modeName);
- pItem->SetProperty("Description", description);
- pItem->SetProperty("Help", ModePointer->ModeHelp());
- if (ModePointer->IconOwnModePath().empty())
- pItem->SetIconImage("DefaultAddonAudioDSP.png");
- else
- pItem->SetIconImage(ModePointer->IconOwnModePath());
- pItem->SetProperty("SettingsDialog", dialogId);
- pItem->SetProperty("AddonId", AddonID);
- pItem->SetProperty("AddonModeNumber", ModePointer->AddonModeNumber());
- pItem->SetLabel2(addonName);
- pItem->SetProperty("Changed", false);
-
- return pItem;
-}
-
-int CGUIDialogAudioDSPManager::helper_GetDialogId(CActiveAEDSPModePtr &ModePointer, AE_DSP_MENUHOOK_CAT &MenuHook, AE_DSP_ADDON &Addon, std::string AddonName)
-{
- int dialogId = 0;
-
- if (ModePointer->HasSettingsDialog())
- {
- AE_DSP_MENUHOOKS hooks;
-
- if (dialogId == 0)
- CLog::Log(LOGERROR, "DSP Dialog Manager - %s - Present marked settings dialog of mode %s on addon %s not found",
- __FUNCTION__,
- g_localizeStrings.GetAddonString(Addon->ID(), ModePointer->ModeName()).c_str(),
- AddonName.c_str());
- }
-
- return dialogId;
-}
-
-AE_DSP_MENUHOOK_CAT CGUIDialogAudioDSPManager::helper_GetMenuHookCategory(int CurrentType)
-{
- AE_DSP_MENUHOOK_CAT menuHook = AE_DSP_MENUHOOK_ALL;
- switch (CurrentType)
- {
- case AE_DSP_MODE_TYPE_PRE_PROCESS:
- menuHook = AE_DSP_MENUHOOK_PRE_PROCESS;
- break;
- case AE_DSP_MODE_TYPE_MASTER_PROCESS:
- menuHook = AE_DSP_MENUHOOK_MASTER_PROCESS;
- break;
- case AE_DSP_MODE_TYPE_POST_PROCESS:
- menuHook = AE_DSP_MENUHOOK_POST_PROCESS;
- break;
- case AE_DSP_MODE_TYPE_INPUT_RESAMPLE:
- case AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE:
- menuHook = AE_DSP_MENUHOOK_RESAMPLE;
- break;
- default:
- menuHook = AE_DSP_MENUHOOK_ALL;
- break;
- };
-
- return menuHook;
-}
diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.h b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.h
deleted file mode 100644
index 713e9bde08..0000000000
--- a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2012-2015 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h"
-#include "dialogs/GUIDialogContextMenu.h"
-#include "guilib/GUIDialog.h"
-#include "view/GUIViewControl.h"
-
-class CGUIDialogBusy;
-
-namespace ActiveAE
-{
- class CGUIDialogAudioDSPManager : public CGUIDialog
- {
- public:
- CGUIDialogAudioDSPManager(void);
- ~CGUIDialogAudioDSPManager(void) override;
- bool OnMessage(CGUIMessage& message) override;
- bool OnAction(const CAction& action) override;
- void OnWindowLoaded(void) override;
- void OnWindowUnload(void) override;
- bool HasListItems() const override { return true; };
-
- protected:
- void OnInitWindow() override;
- void OnDeinitWindow(int nextWindowID) override;
-
- virtual bool OnPopupMenu(int iItem, int listType);
- virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button, int listType);
-
- virtual bool OnActionMove(const CAction &action);
-
- virtual bool OnMessageClick(CGUIMessage &message);
-
- bool OnClickListAvailable(CGUIMessage &message);
- bool OnClickListActive(CGUIMessage &message);
- bool OnClickRadioContinuousSaving(CGUIMessage &message);
- bool OnClickApplyChanges(CGUIMessage &message);
- bool OnClickClearActiveModes(CGUIMessage &message);
-
- void SetItemsUnchanged(void);
-
- private:
- void Clear(void);
- void Update(void);
- void SaveList(void);
- void Renumber(void);
- bool UpdateDatabase(CGUIDialogBusy* pDlgBusy);
- void SetSelectedModeType(void);
-
- //! helper function prototypes
- static void helper_LogError(const char *function);
- static int helper_TranslateModeType(std::string ModeString);
- static CFileItem *helper_CreateModeListItem(CActiveAEDSPModePtr &ModePointer, AE_DSP_MENUHOOK_CAT &MenuHook, int *ContinuesNo);
- static int helper_GetDialogId(CActiveAEDSPModePtr &ModePointer, AE_DSP_MENUHOOK_CAT &MenuHook, AE_DSP_ADDON &Addon, std::string AddonName);
- static AE_DSP_MENUHOOK_CAT helper_GetMenuHookCategory(int CurrentType);
-
- bool m_bMovingMode;
- bool m_bContainsChanges;
- bool m_bContinuousSaving; // if true, all settings are directly saved
-
- int m_iCurrentType;
- int m_iSelected[AE_DSP_MODE_TYPE_MAX];
-
- CFileItemList* m_activeItems[AE_DSP_MODE_TYPE_MAX];
- CFileItemList* m_availableItems[AE_DSP_MODE_TYPE_MAX];
-
- CGUIViewControl m_availableViewControl;
- CGUIViewControl m_activeViewControl;
- };
-}
diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp
deleted file mode 100644
index 1c743b81c2..0000000000
--- a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp
+++ /dev/null
@@ -1,1015 +0,0 @@
-/*
- * Copyright (C) 2005-2015 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogAudioDSPSettings.h"
-#include "Application.h"
-#include "ServiceBroker.h"
-#include "addons/Skin.h"
-#include "cores/IPlayer.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPDatabase.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPMode.h"
-#include "cores/AudioEngine/Utils/AEUtil.h"
-#include "dialogs/GUIDialogKaiToast.h"
-#include "dialogs/GUIDialogYesNo.h"
-#include "guilib/GUIMessage.h"
-#include "guilib/GUIWindowManager.h"
-#include "guilib/LocalizeStrings.h"
-#include "profiles/ProfilesManager.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/MediaSettings.h"
-#include "settings/MediaSourceSettings.h"
-#include "settings/Settings.h"
-#include "settings/lib/SettingSection.h"
-#include "settings/lib/Setting.h"
-#include "settings/lib/SettingsManager.h"
-#include "settings/windows/GUIControlSettings.h"
-#include "utils/log.h"
-#include "utils/StringUtils.h"
-
-#define SETTING_AUDIO_CAT_MAIN "audiodspmainsettings"
-#define SETTING_AUDIO_CAT_MASTER "audiodspmastersettings"
-#define SETTING_AUDIO_CAT_POST_PROCESS "audiodsppostsettings"
-#define SETTING_AUDIO_CAT_RESAMPLING "audiodspresamplesettings"
-#define SETTING_AUDIO_CAT_PRE_PROCESS "audiodsppresettings"
-#define SETTING_AUDIO_CAT_MISC "audiodspmiscsettings"
-#define SETTING_AUDIO_CAT_PROC_INFO "audiodspprocinfo"
-
-#define SETTING_AUDIO_MAIN_STREAMTYPE "audiodsp.main.streamtype"
-#define SETTING_AUDIO_MAIN_MODETYPE "audiodsp.main.modetype"
-#define SETTING_AUDIO_MAIN_VOLUME "audiodsp.main.volume"
-#define SETTING_AUDIO_MAIN_VOLUME_AMPLIFICATION "audiodsp.main.volumeamplification"
-#define SETTING_AUDIO_MAIN_BUTTON_MASTER "audiodsp.main.menumaster"
-#define SETTING_AUDIO_MAIN_BUTTON_OUTPUT "audiodsp.main.menupostproc"
-#define SETTING_AUDIO_MAIN_BUTTON_RESAMPLE "audiodsp.main.menuresample"
-#define SETTING_AUDIO_MAIN_BUTTON_PRE_PROC "audiodsp.main.menupreproc"
-#define SETTING_AUDIO_MAIN_BUTTON_MISC "audiodsp.main.menumisc"
-#define SETTING_AUDIO_MAIN_BUTTON_INFO "audiodsp.main.menuinfo"
-#define SETTING_AUDIO_MAIN_MAKE_DEFAULT "audiodsp.main.makedefault"
-#define SETTING_AUDIO_MASTER_SETTINGS_MENUS "audiodsp.master.menu_"
-#define SETTING_AUDIO_POST_PROC_AUDIO_DELAY "audiodsp.postproc.delay"
-#define SETTING_AUDIO_PROC_SETTINGS_MENUS "audiodsp.proc.menu_"
-
-#define SETTING_STREAM_INFO_INPUT_CHANNELS "audiodsp.info.inputchannels"
-#define SETTING_STREAM_INFO_INPUT_CHANNEL_NAMES "audiodsp.info.inputchannelnames"
-#define SETTING_STREAM_INFO_INPUT_SAMPLERATE "audiodsp.info.inputsamplerate"
-#define SETTING_STREAM_INFO_OUTPUT_CHANNELS "audiodsp.info.outputchannels"
-#define SETTING_STREAM_INFO_OUTPUT_CHANNEL_NAMES "audiodsp.info.outputchannelnames"
-#define SETTING_STREAM_INFO_OUTPUT_SAMPLERATE "audiodsp.info.outputsamplerate"
-#define SETTING_STREAM_INFO_CPU_USAGE "audiodsp.info.cpuusage"
-#define SETTING_STREAM_INFO_TYPE_INPUT "audiodsp.info.typeinput"
-#define SETTING_STREAM_INFO_TYPE_PREPROC "audiodsp.info.typepreproc"
-#define SETTING_STREAM_INFO_TYPE_MASTER "audiodsp.info.typemaster"
-#define SETTING_STREAM_INFO_TYPE_POSTPROC "audiodsp.info.typepostproc"
-#define SETTING_STREAM_INFO_TYPE_OUTPUT "audiodsp.info.typeoutput"
-#define SETTING_STREAM_INFO_MODE_CPU_USAGE "audiodsp.info.modecpuusage_"
-
-using namespace ActiveAE;
-
-CGUIDialogAudioDSPSettings::CGUIDialogAudioDSPSettings()
- : CGUIDialogSettingsManualBase(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS, "DialogSettings.xml")
-{
- m_ActiveStreamId = 0;
- m_GetCPUUsage = false;
- m_MenuPositions[SETTING_AUDIO_CAT_MAIN] = CONTROL_SETTINGS_START_CONTROL;
- m_MenuPositions[SETTING_AUDIO_CAT_MASTER] = CONTROL_SETTINGS_START_CONTROL;
- m_MenuPositions[SETTING_AUDIO_CAT_POST_PROCESS] = CONTROL_SETTINGS_START_CONTROL;
- m_MenuPositions[SETTING_AUDIO_CAT_RESAMPLING] = CONTROL_SETTINGS_START_CONTROL;
- m_MenuPositions[SETTING_AUDIO_CAT_PRE_PROCESS] = CONTROL_SETTINGS_START_CONTROL;
- m_MenuPositions[SETTING_AUDIO_CAT_MISC] = CONTROL_SETTINGS_START_CONTROL;
- m_MenuPositions[SETTING_AUDIO_CAT_PROC_INFO] = CONTROL_SETTINGS_START_CONTROL+2;
-}
-
-CGUIDialogAudioDSPSettings::~CGUIDialogAudioDSPSettings(void)
-{ }
-
-int CGUIDialogAudioDSPSettings::FindCategoryIndex(const std::string &catId)
-{
- for (unsigned int i = 0; i < m_categories.size(); i++)
- {
- if (m_categories[i]->GetId() == catId)
- return i;
- }
- return 0;
-}
-
-void CGUIDialogAudioDSPSettings::OpenMenu(const std::string &id)
-{
- m_GetCPUUsage = false;
- m_MenuPositions[m_categories[m_iCategory]->GetId()] = GetFocusedControlID();
- m_MenuHierarchy.push_back(m_iCategory);
- m_iCategory = FindCategoryIndex(id);
-
- /* Get menu name */
- m_MenuName = -1;
- if (id == SETTING_AUDIO_CAT_MAIN)
- m_MenuName = 15028;
- else if (id == SETTING_AUDIO_CAT_MASTER)
- m_MenuName = 15029;
- else if (id == SETTING_AUDIO_CAT_POST_PROCESS)
- m_MenuName = 15030;
- else if (id == SETTING_AUDIO_CAT_RESAMPLING)
- m_MenuName = 15035;
- else if (id == SETTING_AUDIO_CAT_PRE_PROCESS)
- m_MenuName = 15037;
- else if (id == SETTING_AUDIO_CAT_MISC)
- m_MenuName = 15038;
- else if (id == SETTING_AUDIO_CAT_PROC_INFO)
- m_MenuName = 15031;
-
- SetHeading(g_localizeStrings.Get(m_MenuName));
- CreateSettings();
- SET_CONTROL_FOCUS(m_MenuPositions[id], 0);
-}
-
-bool CGUIDialogAudioDSPSettings::OnMessage(CGUIMessage &message)
-{
- switch (message.GetMessage())
- {
- case GUI_MSG_CLICKED:
- {
- int iControl = message.GetSenderId();
- if (iControl >= CONTROL_SETTINGS_START_CONTROL && iControl < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size()))
- {
- std::shared_ptr<CSetting> setting = GetSettingControl(iControl)->GetSetting();
- if (setting != NULL)
- {
- if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_MASTER)
- OpenMenu(SETTING_AUDIO_CAT_MASTER);
- else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_OUTPUT)
- OpenMenu(SETTING_AUDIO_CAT_POST_PROCESS);
- else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_RESAMPLE)
- OpenMenu(SETTING_AUDIO_CAT_RESAMPLING);
- else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_PRE_PROC)
- OpenMenu(SETTING_AUDIO_CAT_PRE_PROCESS);
- else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_MISC)
- OpenMenu(SETTING_AUDIO_CAT_MISC);
- else if (setting->GetId() == SETTING_AUDIO_MAIN_BUTTON_INFO)
- {
- SetupView();
- OpenMenu(SETTING_AUDIO_CAT_PROC_INFO);
- m_GetCPUUsage = true;
- }
- else
- {
- if (setting->GetId().substr(0, 19) == SETTING_AUDIO_PROC_SETTINGS_MENUS)
- OpenAudioDSPMenu(strtol(setting->GetId().substr(19).c_str(), NULL, 0));
- else if (setting->GetId().substr(0, 21) == SETTING_AUDIO_MASTER_SETTINGS_MENUS)
- OpenAudioDSPMenu(strtol(setting->GetId().substr(21).c_str(), NULL, 0));
- else if (setting->GetId().substr(0, 27) == SETTING_STREAM_INFO_MODE_CPU_USAGE)
- {
- if (!OpenAudioDSPMenu(m_ActiveModesData[strtol(setting->GetId().substr(27).c_str(), NULL, 0)].MenuListPtr))
- CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(15031), g_localizeStrings.Get(416));
- }
- }
- }
- }
- break;
- }
- default:
- break;
- }
-
- return CGUIDialogSettingsManualBase::OnMessage(message);
-}
-
-bool CGUIDialogAudioDSPSettings::OnBack(int actionID)
-{
- // if the setting dialog is not a window but a dialog we need to close differently
- int mainCategory = FindCategoryIndex(SETTING_AUDIO_CAT_MAIN);
- if (m_iCategory == mainCategory)
- return CGUIDialogSettingsManualBase::OnBack(actionID);
-
- m_MenuPositions[m_categories[m_iCategory]->GetId()] = GetFocusedControlID();
- if (!m_MenuHierarchy.empty())
- {
- m_iCategory = m_MenuHierarchy.back();
- m_MenuHierarchy.pop_back();
- }
- else
- m_iCategory = mainCategory;
-
- if (m_iCategory == mainCategory)
- SetHeading(15028);
-
- CreateSettings();
- SET_CONTROL_FOCUS(m_MenuPositions[m_categories[m_iCategory]->GetId()], 0);
-
- return true;
-}
-
-void CGUIDialogAudioDSPSettings::FrameMove()
-{
- // update the volume setting if necessary
- float newVolume = g_application.GetVolume(false);
- if (newVolume != m_volume)
- GetSettingsManager()->SetNumber(SETTING_AUDIO_MAIN_VOLUME, newVolume);
-
- if (g_application.GetAppPlayer().HasPlayer())
- {
- const CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
-
- // these settings can change on the fly
- if (SupportsAudioFeature(IPC_AUD_OFFSET))
- GetSettingsManager()->SetNumber(SETTING_AUDIO_POST_PROC_AUDIO_DELAY, videoSettings.m_AudioDelay);
-
- bool forceReload = false;
- unsigned int streamId = CServiceBroker::GetADSP().GetActiveStreamId();
- if (m_ActiveStreamId != streamId)
- {
- m_ActiveStreamId = streamId;
- m_ActiveStreamProcess = CServiceBroker::GetADSP().GetDSPProcess(m_ActiveStreamId);
- if (m_ActiveStreamId == (unsigned int)-1 || !m_ActiveStreamProcess)
- {
- Close(true);
- return;
- }
- forceReload = true;
- }
-
- int modeUniqueId;
- AE_DSP_BASETYPE usedBaseType;
- AE_DSP_STREAMTYPE streamTypeUsed;
- m_ActiveStreamProcess->GetMasterModeTypeInformation(streamTypeUsed, usedBaseType, modeUniqueId);
- if (forceReload || m_baseTypeUsed != usedBaseType || m_streamTypeUsed != streamTypeUsed)
- {
- m_baseTypeUsed = usedBaseType;
- m_streamTypeUsed = streamTypeUsed;
-
- /*!
- * Update settings
- */
- int selType = CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterStreamTypeSel;
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[streamTypeUsed][usedBaseType] = modeUniqueId;
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[selType][usedBaseType] = modeUniqueId;
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterStreamBase = usedBaseType;
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterStreamType = streamTypeUsed;
-
- GetSettingsManager()->SetInt(SETTING_AUDIO_MAIN_MODETYPE, modeUniqueId);
- }
-
- // these settings can change on the fly
- if (m_GetCPUUsage)
- {
- m_CPUUsage = StringUtils::Format("%.02f %%", m_ActiveStreamProcess->GetCPUUsage());
- GetSettingsManager()->SetString(SETTING_STREAM_INFO_CPU_USAGE, m_CPUUsage);
- for (unsigned int i = 0; i < m_ActiveModes.size(); i++)
- {
- std::string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i);
- m_ActiveModesData[i].CPUUsage = StringUtils::Format("%.02f %%", m_ActiveModes[i]->CPUUsage());
- GetSettingsManager()->SetString(settingId, m_ActiveModesData[i].CPUUsage);
- }
- }
- }
-
- CGUIDialogSettingsManualBase::FrameMove();
-}
-
-std::string CGUIDialogAudioDSPSettings::FormatDelay(float value, float interval)
-{
- if (fabs(value) < 0.5f * interval)
- return StringUtils::Format(g_localizeStrings.Get(22003).c_str(), 0.0);
- if (value < 0)
- return StringUtils::Format(g_localizeStrings.Get(22004).c_str(), fabs(value));
-
- return StringUtils::Format(g_localizeStrings.Get(22005).c_str(), value);
-}
-
-std::string CGUIDialogAudioDSPSettings::FormatDecibel(float value)
-{
- return StringUtils::Format(g_localizeStrings.Get(14054).c_str(), value);
-}
-
-std::string CGUIDialogAudioDSPSettings::FormatPercentAsDecibel(float value)
-{
- return StringUtils::Format(g_localizeStrings.Get(14054).c_str(), CAEUtil::PercentToGain(value));
-}
-
-void CGUIDialogAudioDSPSettings::OnSettingChanged(std::shared_ptr<const CSetting> setting)
-{
- if (setting == NULL)
- return;
-
- CGUIDialogSettingsManualBase::OnSettingChanged(setting);
-
- CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
- const std::string &settingId = setting->GetId();
- if (settingId == SETTING_AUDIO_MAIN_STREAMTYPE)
- {
- int type = (AE_DSP_STREAMTYPE)std::static_pointer_cast<const CSettingInt>(setting)->GetValue();
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterStreamTypeSel = type;
- if (type == AE_DSP_ASTREAM_AUTO)
- type = m_ActiveStreamProcess->GetDetectedStreamType();
-
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterStreamType = type;
-
- /* Set the input stream type if any modes are available for this type */
- if (type >= AE_DSP_ASTREAM_BASIC && type < AE_DSP_ASTREAM_AUTO && !m_MasterModes[type].empty())
- {
- /* Find the master mode id for the selected stream type if it was not known before */
- if (CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[type][m_baseTypeUsed] < 0)
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[type][m_baseTypeUsed] = m_MasterModes[type][0]->ModeID();
-
- /* Switch now the master mode and stream type for audio dsp processing */
- m_ActiveStreamProcess->SetMasterMode((AE_DSP_STREAMTYPE)type,
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[type][m_baseTypeUsed],
- true);
- }
- else
- {
- CLog::Log(LOGERROR, "ActiveAE DSP Settings - %s - Change of audio stream type failed (type = %i)", __FUNCTION__, type);
- }
- }
- else if (settingId == SETTING_AUDIO_MAIN_MODETYPE)
- {
- m_modeTypeUsed = std::static_pointer_cast<const CSettingInt>(setting)->GetValue();
- if (m_ActiveStreamProcess->SetMasterMode(m_streamTypeUsed, m_modeTypeUsed))
- CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[m_streamTypeUsed][m_baseTypeUsed] = m_modeTypeUsed;
- }
- else if (settingId == SETTING_AUDIO_MAIN_VOLUME)
- {
- m_volume = static_cast<float>(std::static_pointer_cast<const CSettingNumber>(setting)->GetValue());
- g_application.SetVolume(m_volume, false); // false - value is not in percent
- }
- else if (settingId == SETTING_AUDIO_MAIN_VOLUME_AMPLIFICATION)
- {
- videoSettings.m_VolumeAmplification = static_cast<float>(std::static_pointer_cast<const CSettingNumber>(setting)->GetValue());
- g_application.GetAppPlayer().SetDynamicRangeCompression((long)(videoSettings.m_VolumeAmplification * 100));
- }
- else if (settingId == SETTING_AUDIO_POST_PROC_AUDIO_DELAY)
- {
- videoSettings.m_AudioDelay = static_cast<float>(std::static_pointer_cast<const CSettingNumber>(setting)->GetValue());
- g_application.GetAppPlayer().SetAVDelay(videoSettings.m_AudioDelay);
- }
-}
-
-void CGUIDialogAudioDSPSettings::OnSettingAction(std::shared_ptr<const CSetting> setting)
-{
- if (setting == NULL)
- return;
-
- CGUIDialogSettingsManualBase::OnSettingAction(setting);
-
- const std::string &settingId = setting->GetId();
- if (settingId == SETTING_AUDIO_MAIN_MAKE_DEFAULT)
- Save();
-}
-
-void CGUIDialogAudioDSPSettings::Save()
-{
- const CProfilesManager &profileManager = CServiceBroker::GetProfileManager();
-
- if (!g_passwordManager.CheckSettingLevelLock(SettingLevel::Expert) &&
- profileManager.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
- return;
-
- // prompt user if they are sure
- if (!CGUIDialogYesNo::ShowAndGetInput(CVariant{12376}, CVariant{12377}))
- return;
-
- // reset the settings
- CActiveAEDSPDatabase db;
- if (!db.Open())
- return;
-
- db.EraseActiveDSPSettings();
- db.Close();
-
- CMediaSettings::GetInstance().GetDefaultAudioSettings() = CMediaSettings::GetInstance().GetCurrentAudioSettings();
- CMediaSettings::GetInstance().GetDefaultAudioSettings().m_MasterStreamType = AE_DSP_ASTREAM_AUTO;
- CServiceBroker::GetSettings().Save();
-}
-
-void CGUIDialogAudioDSPSettings::SetupView()
-{
- CGUIDialogSettingsManualBase::SetupView();
- SetHeading(15028);
- SET_CONTROL_HIDDEN(CONTROL_SETTINGS_OKAY_BUTTON);
- SET_CONTROL_HIDDEN(CONTROL_SETTINGS_CUSTOM_BUTTON);
- SET_CONTROL_LABEL(CONTROL_SETTINGS_CANCEL_BUTTON, 15067);
-}
-
-void CGUIDialogAudioDSPSettings::InitializeSettings()
-{
- CGUIDialogSettingsManualBase::InitializeSettings();
-
- const std::shared_ptr<CSettingCategory> category = AddCategory(SETTING_AUDIO_CAT_MAIN, -1);
- if (category == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmainsettings'");
- return;
- }
-
- // get all necessary setting groups
- const std::shared_ptr<CSettingGroup> groupAudioModeSel = AddGroup(category);
- if (groupAudioModeSel == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioModeSel'");
- return;
- }
- const std::shared_ptr<CSettingGroup> groupAudioVolumeSel = AddGroup(category);
- if (groupAudioVolumeSel == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioVolumeSel'");
- return;
- }
- const std::shared_ptr<CSettingGroup> groupAudioSubmenuSel = AddGroup(category);
- if (groupAudioSubmenuSel == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAudioSubmenuSel'");
- return;
- }
- const std::shared_ptr<CSettingGroup> groupSaveAsDefault = AddGroup(category);
- if (groupSaveAsDefault == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupSaveAsDefault'");
- return;
- }
-
- bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");
-
- CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
-
- m_audioCaps.clear();
- if (g_application.GetAppPlayer().HasPlayer())
- g_application.GetAppPlayer().GetAudioCapabilities(m_audioCaps);
-
- m_ActiveStreamId = CServiceBroker::GetADSP().GetActiveStreamId();
- m_ActiveStreamProcess = CServiceBroker::GetADSP().GetDSPProcess(m_ActiveStreamId);
- if (m_ActiveStreamId == (unsigned int)-1 || !m_ActiveStreamProcess)
- {
- m_iCategory = FindCategoryIndex(SETTING_AUDIO_CAT_MAIN);
- Close(true);
- return;
- }
-
- int modeUniqueId;
- m_ActiveStreamProcess->GetMasterModeTypeInformation(m_streamTypeUsed, m_baseTypeUsed, modeUniqueId);
-
- int modesAvailable = 0;
- for (int i = 0; i < AE_DSP_ASTREAM_AUTO; i++)
- {
- m_MasterModes[i].clear();
- m_ActiveStreamProcess->GetAvailableMasterModes((AE_DSP_STREAMTYPE)i, m_MasterModes[i]);
- if (!m_MasterModes[i].empty()) modesAvailable++;
- }
-
- if (modesAvailable > 0)
- {
- /* about size() > 1, it is always the fallback (ignore of master processing) present. */
- TranslatableIntegerSettingOptions modeEntries;
- if (m_MasterModes[AE_DSP_ASTREAM_BASIC].size() > 1)
- modeEntries.push_back(std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_BASIC), AE_DSP_ASTREAM_BASIC));
- if (m_MasterModes[AE_DSP_ASTREAM_MUSIC].size() > 1)
- modeEntries.push_back(std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_MUSIC), AE_DSP_ASTREAM_MUSIC));
- if (m_MasterModes[AE_DSP_ASTREAM_MOVIE].size() > 1)
- modeEntries.push_back(std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_MOVIE), AE_DSP_ASTREAM_MOVIE));
- if (m_MasterModes[AE_DSP_ASTREAM_GAME].size() > 1)
- modeEntries.push_back(std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_GAME), AE_DSP_ASTREAM_GAME));
- if (m_MasterModes[AE_DSP_ASTREAM_APP].size() > 1)
- modeEntries.push_back(std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_APP), AE_DSP_ASTREAM_APP));
- if (m_MasterModes[AE_DSP_ASTREAM_MESSAGE].size() > 1)
- modeEntries.push_back(std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_MESSAGE), AE_DSP_ASTREAM_MESSAGE));
- if (m_MasterModes[AE_DSP_ASTREAM_PHONE].size() > 1)
- modeEntries.push_back(std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_PHONE), AE_DSP_ASTREAM_PHONE));
- if (modesAvailable > 1 && m_MasterModes[m_streamTypeUsed].size() > 1)
- modeEntries.insert(modeEntries.begin(), std::pair<int, int>(CServiceBroker::GetADSP().GetStreamTypeName(AE_DSP_ASTREAM_AUTO), AE_DSP_ASTREAM_AUTO));
-
- AddSpinner(groupAudioModeSel,
- SETTING_AUDIO_MAIN_STREAMTYPE, 15021, 0,
- (AE_DSP_STREAMTYPE)CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterStreamTypeSel,
- modeEntries);
- }
-
- bool AddonMasterModeSetupPresent = false;
- m_ModeList.clear();
- for (unsigned int i = 0; i < m_MasterModes[m_streamTypeUsed].size(); i++)
- {
- if (m_MasterModes[m_streamTypeUsed][i])
- {
- AE_DSP_ADDON addon;
- int modeId = m_MasterModes[m_streamTypeUsed][i]->ModeID();
- if (modeId == AE_DSP_MASTER_MODE_ID_PASSOVER || modeId >= AE_DSP_MASTER_MODE_ID_INTERNAL_TYPES)
- {
- m_ModeList.push_back(make_pair(g_localizeStrings.Get(m_MasterModes[m_streamTypeUsed][i]->ModeName()), modeId));
- }
- else if (CServiceBroker::GetADSP().GetAudioDSPAddon(m_MasterModes[m_streamTypeUsed][i]->AddonID(), addon))
- {
- m_ModeList.push_back(make_pair(g_localizeStrings.GetAddonString(addon->ID(), m_MasterModes[m_streamTypeUsed][i]->ModeName()), modeId));
- if (!AddonMasterModeSetupPresent)
- AddonMasterModeSetupPresent = m_MasterModes[m_streamTypeUsed][i]->HasSettingsDialog();
- }
- }
- }
-
- m_modeTypeUsed = CMediaSettings::GetInstance().GetCurrentAudioSettings().m_MasterModes[m_streamTypeUsed][m_baseTypeUsed];
- std::shared_ptr<CSettingInt> spinner = AddSpinner(groupAudioModeSel, SETTING_AUDIO_MAIN_MODETYPE, 15022, 0, m_modeTypeUsed, AudioModeOptionFiller);
- spinner->SetOptionsFiller(AudioModeOptionFiller, this);
-
- ///-----------------------
-
- // audio settings
- // audio volume setting
- m_volume = g_application.GetVolume(false);
- if (!CServiceBroker::GetGUI()->GetWindowManager().IsWindowActive(WINDOW_DIALOG_AUDIO_OSD_SETTINGS))
- {
- std::shared_ptr<CSettingNumber> settingAudioVolume = AddSlider(groupAudioVolumeSel, SETTING_AUDIO_MAIN_VOLUME, 13376, 0, m_volume, 14054, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM);
- std::static_pointer_cast<CSettingControlSlider>(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel);
- }
-
- // audio volume amplification setting
- if (SupportsAudioFeature(IPC_AUD_AMP))
- AddSlider(groupAudioVolumeSel, SETTING_AUDIO_MAIN_VOLUME_AMPLIFICATION, 660, 0, videoSettings.m_VolumeAmplification, 14054, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f);
-
- ///-----------------------
-
- AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_MASTER, 15025, 0, "", false, AddonMasterModeSetupPresent, -1);
- AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_OUTPUT, 15026, 0, "", false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_POST_PROCESS) || SupportsAudioFeature(IPC_AUD_OFFSET), -1);
- AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_RESAMPLE, 15033, 0, "", false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_RESAMPLE), -1);
- AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_PRE_PROC, 15039, 0, "", false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_PRE_PROCESS), -1);
- AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_MISC, 15034, 0, "", false, HaveActiveMenuHooks(AE_DSP_MENUHOOK_MISCELLANEOUS), -1);
- AddButton(groupAudioSubmenuSel, SETTING_AUDIO_MAIN_BUTTON_INFO, 15027, 0, "", false, true, -1);
-
- ///-----------------------
-
- AddButton(groupSaveAsDefault, SETTING_AUDIO_MAIN_MAKE_DEFAULT, 12376, 0);
-
- m_Menus.clear();
-
- /**
- * Audio Master mode settings Dialog init
- */
- {
- const std::shared_ptr<CSettingCategory> categoryMaster = AddCategory(SETTING_AUDIO_CAT_MASTER, -1);
- if (categoryMaster == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmastersettings'");
- return;
- }
-
- const std::shared_ptr<CSettingGroup> groupMasterMode = AddGroup(categoryMaster);
- if (groupMasterMode == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupMasterMode'");
- return;
- }
-
- for (unsigned int i = 0; i < m_MasterModes[m_streamTypeUsed].size(); i++)
- {
- if (m_MasterModes[m_streamTypeUsed][i]->HasSettingsDialog())
- {
- AE_DSP_ADDON addon;
- if (CServiceBroker::GetADSP().GetAudioDSPAddon(m_MasterModes[m_streamTypeUsed][i]->AddonID(), addon))
- {
- AE_DSP_MENUHOOKS hooks;
- if (CServiceBroker::GetADSP().GetMenuHooks(m_MasterModes[m_streamTypeUsed][i]->AddonID(), AE_DSP_MENUHOOK_MASTER_PROCESS, hooks))
- {
- for (unsigned int j = 0; j < hooks.size(); j++)
- {
- if (hooks[j].iRelevantModeId != m_MasterModes[m_streamTypeUsed][i]->AddonModeNumber())
- continue;
-
- MenuHookMember menu;
- menu.addonId = m_MasterModes[m_streamTypeUsed][i]->AddonID();
- menu.hook.category = hooks[j].category;
- menu.hook.iHookId = hooks[j].iHookId;
- menu.hook.iLocalizedStringId = hooks[j].iLocalizedStringId;
- menu.hook.iRelevantModeId = hooks[j].iRelevantModeId;
- m_Menus.push_back(menu);
-
- std::string setting = StringUtils::Format("%s%i", SETTING_AUDIO_MASTER_SETTINGS_MENUS, (int)m_Menus.size()-1);
- AddButton(groupMasterMode, setting, 15041, 0);
- break;
- }
- }
- }
- }
- }
- }
-
- /**
- * Audio post processing settings Dialog init
- */
- {
- const std::shared_ptr<CSettingCategory> category = AddCategory(SETTING_AUDIO_CAT_POST_PROCESS, -1);
- if (category == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodsppostsettings'");
- return;
- }
-
- const std::shared_ptr<CSettingGroup> groupInternal = AddGroup(category);
- if (groupInternal == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupInternal'");
- return;
- }
-
- const std::shared_ptr<CSettingGroup> groupAddon = AddGroup(category);
- if (groupAddon == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'groupAddon'");
- return;
- }
-
- // audio delay setting
- if (SupportsAudioFeature(IPC_AUD_OFFSET))
- {
- std::shared_ptr<CSettingNumber> settingAudioDelay = AddSlider(groupInternal, SETTING_AUDIO_POST_PROC_AUDIO_DELAY, 297, 0, videoSettings.m_AudioDelay, 0, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, 297, usePopup);
- std::static_pointer_cast<CSettingControlSlider>(settingAudioDelay->GetControl())->SetFormatter(SettingFormatterDelay);
- }
- GetAudioDSPMenus(groupAddon, AE_DSP_MENUHOOK_POST_PROCESS);
- }
-
- /**
- * Audio add-on resampling setting dialog's
- */
- {
- const std::shared_ptr<CSettingCategory> category = AddCategory(SETTING_AUDIO_CAT_RESAMPLING, -1);
- if (category == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspresamplesettings'");
- return;
- }
- const std::shared_ptr<CSettingGroup> group = AddGroup(category);
- if (group == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'");
- return;
- }
- GetAudioDSPMenus(group, AE_DSP_MENUHOOK_RESAMPLE);
- }
-
- /**
- * Audio add-on's pre processing setting dialog's
- */
- {
- const std::shared_ptr<CSettingCategory> category = AddCategory(SETTING_AUDIO_CAT_PRE_PROCESS, -1);
- if (category == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodsppresettings'");
- return;
- }
- const std::shared_ptr<CSettingGroup> group = AddGroup(category);
- if (group == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'");
- return;
- }
- GetAudioDSPMenus(group, AE_DSP_MENUHOOK_PRE_PROCESS);
- }
-
- /**
- * Audio add-on's miscellaneous setting dialog's
- */
- {
- const std::shared_ptr<CSettingCategory> category = AddCategory(SETTING_AUDIO_CAT_MISC, -1);
- if (category == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspmiscsettings'");
- return;
- }
- const std::shared_ptr<CSettingGroup> group = AddGroup(category);
- if (group == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group 'group'");
- return;
- }
- GetAudioDSPMenus(group, AE_DSP_MENUHOOK_MISCELLANEOUS);
- }
-
- /**
- * Audio Information Dialog init
- */
- {
- std::shared_ptr<CSettingGroup> group;
- const std::shared_ptr<CSettingCategory> category = AddCategory(SETTING_AUDIO_CAT_PROC_INFO, -1);
- if (category == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings category 'audiodspprocinfo'");
- return;
- }
-
- m_ActiveModes.clear();
- m_ActiveStreamProcess->GetActiveModes(AE_DSP_MODE_TYPE_UNDEFINED, m_ActiveModes);
- m_ActiveModesData.resize(m_ActiveModes.size());
-
- group = AddGroup(category, 15089);
- if (group == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15089).c_str());
- return;
- }
-//! @todo reimplement this with AudioDSP V2.0
-// m_InputChannels = StringUtils::Format("%i", m_ActiveStreamProcess->GetInputChannels());
-// AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_CHANNELS, 21444, 0, m_InputChannels);
-// m_InputChannelNames = m_ActiveStreamProcess->GetInputChannelNames();
-// AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_CHANNEL_NAMES, 15091, 0, m_InputChannelNames);
-// m_InputSamplerate = StringUtils::Format("%i Hz", (int)m_ActiveStreamProcess->GetInputSamplerate());
-// AddInfoLabelButton(group, SETTING_STREAM_INFO_INPUT_SAMPLERATE, 613, 0, m_InputSamplerate);
-
- group = AddGroup(category, 15090);
- if (group == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15090).c_str());
- return;
- }
-//! @todo reimplement this with AudioDSP V2.0
-// m_OutputChannels = StringUtils::Format("%i", m_ActiveStreamProcess->GetOutputChannels());
-// AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_CHANNELS, 21444, 0, m_OutputChannels);
-// m_OutputChannelNames = m_ActiveStreamProcess->GetOutputChannelNames();
-// AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_CHANNEL_NAMES, 15091, 0, m_OutputChannelNames);
-// m_OutputSamplerate = StringUtils::Format("%i Hz", (int)m_ActiveStreamProcess->GetOutputSamplerate());
-// AddInfoLabelButton(group, SETTING_STREAM_INFO_OUTPUT_SAMPLERATE, 613, 0, m_OutputSamplerate);
-
- group = AddGroup(category, 15081);
- if (group == NULL)
- {
- CLog::Log(LOGERROR, "CGUIDialogAudioDSPSettings: unable to setup settings group for '%s'", g_localizeStrings.Get(15081).c_str());
- return;
- }
- m_CPUUsage = StringUtils::Format("%.02f %%", m_ActiveStreamProcess->GetCPUUsage());
- AddInfoLabelButton(group, SETTING_STREAM_INFO_CPU_USAGE, 15092, 0, m_CPUUsage);
-
- bool foundPreProcess = false, foundPostProcess = false;
- for (unsigned int i = 0; i < m_ActiveModes.size(); i++)
- {
- AE_DSP_ADDON addon;
- if (CServiceBroker::GetADSP().GetAudioDSPAddon(m_ActiveModes[i]->AddonID(), addon))
- {
- std::string label;
- switch (m_ActiveModes[i]->ModeType())
- {
- case AE_DSP_MODE_TYPE_INPUT_RESAMPLE:
- group = AddGroup(category, 15087, -1, true, true);
- label = StringUtils::Format(g_localizeStrings.Get(15082).c_str(), m_ActiveStreamProcess->GetProcessSamplerate());
- break;
- case AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE:
- group = AddGroup(category, 15088, -1, true, true);
-// label = StringUtils::Format(g_localizeStrings.Get(15083).c_str(), m_ActiveStreamProcess->GetOutputSamplerate());
- break;
- case AE_DSP_MODE_TYPE_MASTER_PROCESS:
- group = AddGroup(category, 15084, -1, true, true);
- label = g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName());
- break;
- case AE_DSP_MODE_TYPE_PRE_PROCESS:
- if (!foundPreProcess)
- {
- foundPreProcess = true;
- group = AddGroup(category, 15085, -1, true, true);
- }
- label = g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName());
- break;
- case AE_DSP_MODE_TYPE_POST_PROCESS:
- if (!foundPostProcess)
- {
- foundPostProcess = true;
- group = AddGroup(category, 15086, -1, true, true);
- }
- label = g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName());
- break;
- default:
- {
- label += g_localizeStrings.GetAddonString(addon->ID(), m_ActiveModes[i]->ModeName());
- label += " - ";
- label += addon->GetFriendlyName();
- }
- };
- m_ActiveModesData[i].CPUUsage = StringUtils::Format("%.02f %%", m_ActiveModes[i]->CPUUsage());
-
- MenuHookMember menu;
- menu.addonId = -1;
-
- AE_DSP_MENUHOOKS hooks;
- m_ActiveModesData[i].MenuListPtr = -1;
- if (CServiceBroker::GetADSP().GetMenuHooks(m_ActiveModes[i]->AddonID(), AE_DSP_MENUHOOK_INFORMATION, hooks))
- {
- for (unsigned int j = 0; j < hooks.size(); j++)
- {
- if (hooks[j].iRelevantModeId != m_ActiveModes[i]->AddonModeNumber())
- continue;
-
- menu.addonId = m_ActiveModes[i]->AddonID();
- menu.hook.category = hooks[j].category;
- menu.hook.iHookId = hooks[j].iHookId;
- menu.hook.iLocalizedStringId = hooks[j].iLocalizedStringId;
- menu.hook.iRelevantModeId = hooks[j].iRelevantModeId;
- m_Menus.push_back(menu);
- m_ActiveModesData[i].MenuListPtr = m_Menus.size()-1;
- label += " ...";
- break;
- }
- }
- m_ActiveModesData[i].MenuName = label;
-
- std::string settingId = StringUtils::Format("%s%i", SETTING_STREAM_INFO_MODE_CPU_USAGE, i);
- AddInfoLabelButton(group, settingId, 15041, 0, m_ActiveModesData[i].CPUUsage);
- }
- }
- }
-}
-
-bool CGUIDialogAudioDSPSettings::SupportsAudioFeature(int feature)
-{
- for (Features::iterator itr = m_audioCaps.begin(); itr != m_audioCaps.end(); ++itr)
- {
- if (*itr == feature || *itr == IPC_AUD_ALL)
- return true;
- }
-
- return false;
-}
-
-void CGUIDialogAudioDSPSettings::AudioModeOptionFiller(std::shared_ptr<const CSetting> setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data)
-{
- CGUIDialogAudioDSPSettings *dialog = (CGUIDialogAudioDSPSettings *)data;
- list = dialog->m_ModeList;
-
- if (list.empty())
- {
- list.push_back(make_pair(g_localizeStrings.Get(231), -1));
- current = -1;
- }
-}
-
-std::string CGUIDialogAudioDSPSettings::SettingFormatterDelay(std::shared_ptr<const CSettingControlSlider> control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum)
-{
- if (!value.isDouble())
- return "";
-
- float fValue = value.asFloat();
- float fStep = step.asFloat();
-
- if (fabs(fValue) < 0.5f * fStep)
- return StringUtils::Format(g_localizeStrings.Get(22003).c_str(), 0.0);
- if (fValue < 0)
- return StringUtils::Format(g_localizeStrings.Get(22004).c_str(), fabs(fValue));
-
- return StringUtils::Format(g_localizeStrings.Get(22005).c_str(), fValue);
-}
-
-std::string CGUIDialogAudioDSPSettings::SettingFormatterPercentAsDecibel(std::shared_ptr<const CSettingControlSlider> control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum)
-{
- if (control == NULL || !value.isDouble())
- return "";
-
- std::string formatString = control->GetFormatString();
- if (control->GetFormatLabel() > -1)
- formatString = g_localizeStrings.Get(control->GetFormatLabel());
-
- return StringUtils::Format(formatString.c_str(), CAEUtil::PercentToGain(value.asFloat()));
-}
-
-bool CGUIDialogAudioDSPSettings::HaveActiveMenuHooks(AE_DSP_MENUHOOK_CAT category)
-{
- /*!> Check menus are active on current stream */
- AE_DSP_ADDONMAP addonMap;
- if (CServiceBroker::GetADSP().HaveMenuHooks(category) &&
- CServiceBroker::GetADSP().GetEnabledAudioDSPAddons(addonMap) > 0)
- {
- for (AE_DSP_ADDONMAP_ITR itr = addonMap.begin(); itr != addonMap.end(); itr++)
- {
- AE_DSP_MENUHOOKS hooks;
- if (CServiceBroker::GetADSP().GetMenuHooks(itr->second->GetID(), category, hooks))
- {
- for (unsigned int i = 0; i < hooks.size(); i++)
- {
- if (category != AE_DSP_MENUHOOK_MISCELLANEOUS &&
- !m_ActiveStreamProcess->IsMenuHookModeActive(hooks[i].category, itr->second->GetID(), hooks[i].iRelevantModeId))
- continue;
-
- return true;
- }
- }
- }
- }
-
- return false;
-}
-
-std::string CGUIDialogAudioDSPSettings::GetSettingsLabel(std::shared_ptr<CSetting> pSetting)
-{
- if (pSetting->GetLabel() == 15041)
- {
- const std::string &settingId = pSetting->GetId();
-
- int ptr = -1;
- AE_DSP_ADDON addon;
- if (settingId.substr(0, 27) == SETTING_STREAM_INFO_MODE_CPU_USAGE)
- {
- ptr = strtol(settingId.substr(27).c_str(), NULL, 0);
- if (ptr >= 0 && CServiceBroker::GetADSP().GetAudioDSPAddon(m_ActiveModes[ptr]->AddonID(), addon))
- return m_ActiveModesData[ptr].MenuName;
- }
- else
- {
- if (settingId.substr(0, 21) == SETTING_AUDIO_MASTER_SETTINGS_MENUS)
- ptr = strtol(settingId.substr(21).c_str(), NULL, 0);
- else if (settingId.substr(0, 19) == SETTING_AUDIO_PROC_SETTINGS_MENUS)
- ptr = strtol(settingId.substr(19).c_str(), NULL, 0);
-
- if (ptr >= 0 && CServiceBroker::GetADSP().GetAudioDSPAddon(m_Menus[ptr].addonId, addon))
- return g_localizeStrings.GetAddonString(addon->ID(), m_Menus[ptr].hook.iLocalizedStringId);
- }
- }
-
- return GetLocalizedString(pSetting->GetLabel());
-}
-
-void CGUIDialogAudioDSPSettings::GetAudioDSPMenus(std::shared_ptr<CSettingGroup> group, AE_DSP_MENUHOOK_CAT category)
-{
- AE_DSP_ADDONMAP addonMap;
- if (CServiceBroker::GetADSP().GetEnabledAudioDSPAddons(addonMap) > 0)
- {
- for (AE_DSP_ADDONMAP_ITR itr = addonMap.begin(); itr != addonMap.end(); itr++)
- {
- AE_DSP_MENUHOOKS hooks;
- if (CServiceBroker::GetADSP().GetMenuHooks(itr->second->GetID(), category, hooks))
- {
- for (unsigned int i = 0; i < hooks.size(); i++)
- {
- if (category != hooks[i].category || (category != AE_DSP_MENUHOOK_MISCELLANEOUS &&
- !m_ActiveStreamProcess->IsMenuHookModeActive(hooks[i].category, itr->second->GetID(), hooks[i].iRelevantModeId)))
- continue;
-
- MenuHookMember menu;
- menu.addonId = itr->second->GetID();
- menu.hook.category = hooks[i].category;
- menu.hook.iHookId = hooks[i].iHookId;
- menu.hook.iLocalizedStringId = hooks[i].iLocalizedStringId;
- menu.hook.iRelevantModeId = hooks[i].iRelevantModeId;
- m_Menus.push_back(menu);
- }
- }
- }
- }
-
- for (unsigned int i = 0; i < m_Menus.size(); i++)
- {
- AE_DSP_ADDON addon;
- if (CServiceBroker::GetADSP().GetAudioDSPAddon(m_Menus[i].addonId, addon) && category == m_Menus[i].hook.category)
- {
- std::string modeName = g_localizeStrings.GetAddonString(addon->ID(), m_Menus[i].hook.iLocalizedStringId);
- if (modeName.empty())
- modeName = g_localizeStrings.Get(15041);
-
- std::string setting = StringUtils::Format("%s%i", SETTING_AUDIO_PROC_SETTINGS_MENUS, i);
- AddButton(group, setting, 15041, 0);
- }
- }
-}
-
-bool CGUIDialogAudioDSPSettings::OpenAudioDSPMenu(unsigned int setupEntry)
-{
- if (setupEntry >= m_Menus.size())
- return false;
-
- AE_DSP_ADDON addon;
- if (!CServiceBroker::GetADSP().GetAudioDSPAddon(m_Menus[setupEntry].addonId, addon))
- return false;
-
- AE_DSP_MENUHOOK hook;
- AE_DSP_MENUHOOK_DATA hookData;
-
- hook.category = m_Menus[setupEntry].hook.category;
- hook.iHookId = m_Menus[setupEntry].hook.iHookId;
- hook.iLocalizedStringId = m_Menus[setupEntry].hook.iLocalizedStringId;
- hook.iRelevantModeId = m_Menus[setupEntry].hook.iRelevantModeId;
- hookData.category = m_Menus[setupEntry].hook.category;
- switch (hookData.category)
- {
- case AE_DSP_MENUHOOK_PRE_PROCESS:
- case AE_DSP_MENUHOOK_MASTER_PROCESS:
- case AE_DSP_MENUHOOK_RESAMPLE:
- case AE_DSP_MENUHOOK_POST_PROCESS:
- hookData.data.iStreamId = m_ActiveStreamId;
- break;
- default:
- break;
- }
-
- /*!
- * @note the addon dialog becomes always opened on the back of Kodi ones for this reason a
- * "<animation effect="fade" start="100" end="0" time="400" condition="Window.IsVisible(Addon)">Conditional</animation>"
- * on skin is needed to hide dialog.
- */
- addon->CallMenuHook(hook, hookData);
-
- return true;
-}
diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h b/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h
deleted file mode 100644
index 64c520005a..0000000000
--- a/xbmc/settings/dialogs/GUIDialogAudioDSPSettings.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2005-2015 Team KODI
- * http://kodi.tv
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with KODI; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <utility>
-#include <vector>
-
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSPProcess.h"
-#include "settings/dialogs/GUIDialogSettingsManualBase.h"
-
-namespace ActiveAE
-{
- class CGUIDialogAudioDSPSettings : public CGUIDialogSettingsManualBase
- {
- public:
- CGUIDialogAudioDSPSettings();
- virtual ~CGUIDialogAudioDSPSettings();
-
- // specializations of CGUIControl
- virtual bool OnMessage(CGUIMessage &message);
- virtual bool OnBack(int actionID);
-
- // specialization of CGUIWindow
- virtual void FrameMove();
-
- static std::string FormatDelay(float value, float interval);
- static std::string FormatDecibel(float value);
- static std::string FormatPercentAsDecibel(float value);
-
- protected:
- // implementations of ISettingCallback
- virtual void OnSettingChanged(std::shared_ptr<const CSetting> setting);
- virtual void OnSettingAction(std::shared_ptr<const CSetting> setting);
-
- // specialization of CGUIDialogSettingsBase
- virtual bool AllowResettingSettings() const { return false; }
- virtual void Save();
- virtual void SetupView();
-
- // specialization of CGUIDialogSettingsManualBase
- virtual void InitializeSettings();
-
- bool SupportsAudioFeature(int feature);
-
- static void AudioModeOptionFiller(std::shared_ptr<const CSetting> setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data);
-
- static std::string SettingFormatterDelay(std::shared_ptr<const CSettingControlSlider> control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum);
- static std::string SettingFormatterPercentAsDecibel(std::shared_ptr<const CSettingControlSlider> control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum);
-
- std::string GetSettingsLabel(std::shared_ptr<CSetting> pSetting);
-
- private:
- typedef struct
- {
- int addonId;
- AE_DSP_MENUHOOK hook;
- } MenuHookMember;
- typedef struct
- {
- std::string MenuName;
- int MenuListPtr;
- std::string CPUUsage;
- } ActiveModeData;
- typedef std::vector<int> Features;
-
- void OpenMenu(const std::string &id);
- bool HaveActiveMenuHooks(AE_DSP_MENUHOOK_CAT category);
- void GetAudioDSPMenus(std::shared_ptr<CSettingGroup> group, AE_DSP_MENUHOOK_CAT category);
- bool OpenAudioDSPMenu(unsigned int setupEntry);
- int FindCategoryIndex(const std::string &catId);
-
- AE_DSP_STREAM_ID m_ActiveStreamId; /*!< The on dialog selectable stream identifier */
- ActiveAE::CActiveAEDSPProcessPtr m_ActiveStreamProcess; /*!< On dialog adjustable dsp processing class */
- AE_DSP_STREAMTYPE m_streamTypeUsed; /*!< The currently available stream type */
- AE_DSP_BASETYPE m_baseTypeUsed; /*!< The currently detected and used base type */
- int m_modeTypeUsed; /*!< The currently selected mode type */
- std::vector<ActiveAE::CActiveAEDSPModePtr> m_ActiveModes; /*!< The process modes currently active on dsp processing stream */
- std::vector<ActiveModeData> m_ActiveModesData; /*!< The process modes currently active on dsp processing stream info*/
- std::vector<ActiveAE::CActiveAEDSPModePtr> m_MasterModes[AE_DSP_ASTREAM_MAX]; /*!< table about selectable and usable master processing modes */
- std::map<std::string, int> m_MenuPositions; /*!< The different menu selection positions */
- std::vector<int> m_MenuHierarchy; /*!< Menu selection flow hierarchy */
- std::vector<MenuHookMember> m_Menus; /*!< storage about present addon menus on currently selected submenu */
- std::vector< std::pair<std::string, int> > m_ModeList; /*!< currently present modes */
- bool m_GetCPUUsage; /*!< if true cpu usage detection is active */
- Features m_audioCaps; /*!< the on current playback on KODI supported audio features */
- int m_MenuName; /*!< current menu name, needed to get after the dialog was closed for addon */
-
- /*! Settings control selection and information data */
- std::string m_InputChannels;
- std::string m_InputChannelNames;
- std::string m_InputSamplerate;
- std::string m_OutputChannels;
- std::string m_OutputChannelNames;
- std::string m_OutputSamplerate;
- std::string m_CPUUsage;
- float m_volume;
- };
-}
diff --git a/xbmc/windows/GUIWindowLoginScreen.cpp b/xbmc/windows/GUIWindowLoginScreen.cpp
index 7fddb93f76..3fe74c027b 100644
--- a/xbmc/windows/GUIWindowLoginScreen.cpp
+++ b/xbmc/windows/GUIWindowLoginScreen.cpp
@@ -27,7 +27,6 @@
#include "ServiceBroker.h"
#include "addons/AddonManager.h"
#include "addons/Skin.h"
-#include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h"
#include "dialogs/GUIDialogContextMenu.h"
#include "favourites/FavouritesService.h"
#include "guilib/GUIMessage.h"