From 081c4f566955e2db46a317f867e2c27aa34df5ad Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Fri, 1 Nov 2013 21:14:57 +0200 Subject: [PATCH] xbmc: update to xbmc-13.alpha-2975e4a --- .../mediacenter/xbmc-theme-Confluence/meta | 2 +- packages/mediacenter/xbmc/package.mk | 5 +- ...HONOPTIMIZE_with_external_Python-0.1.patch | 0 ...bmc-453-add_openelec.tv_RSS_news-0.1.patch | 0 ...add_as.xml_busy_dialog_delay_control.patch | 0 ...s-mark_our_wrapped_functions_as_used.patch | 0 ...bmc-995.01-fernetmenta-fixes-b17818b.patch | 6710 ++--------------- .../xbmc-995.10-disable-minimize.patch | 0 ...context-menu-remove-safely-selection.patch | 0 ...e-udevil-to-umount.-escape-mountpath.patch | 0 10 files changed, 624 insertions(+), 6093 deletions(-) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch (100%) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-453-add_openelec.tv_RSS_news-0.1.patch (100%) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-602-add_as.xml_busy_dialog_delay_control.patch (100%) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch (100%) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-995.01-fernetmenta-fixes-b17818b.patch (56%) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-995.10-disable-minimize.patch (100%) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-AML-XB9295c3f-04-fixed-context-menu-remove-safely-selection.patch (100%) rename packages/mediacenter/xbmc/patches/{13.alpha-9f8682d => 13.alpha-2975e4a}/xbmc-AML-XB9295c3f-05-use-udevil-to-umount.-escape-mountpath.patch (100%) diff --git a/packages/mediacenter/xbmc-theme-Confluence/meta b/packages/mediacenter/xbmc-theme-Confluence/meta index 016cfe00fa..e8b6f2c30c 100644 --- a/packages/mediacenter/xbmc-theme-Confluence/meta +++ b/packages/mediacenter/xbmc-theme-Confluence/meta @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc-theme-Confluence" -PKG_VERSION="13.alpha-9f8682d" +PKG_VERSION="13.alpha-2975e4a" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/xbmc/package.mk b/packages/mediacenter/xbmc/package.mk index 9bd7a77574..4570f420bb 100644 --- a/packages/mediacenter/xbmc/package.mk +++ b/packages/mediacenter/xbmc/package.mk @@ -19,7 +19,7 @@ ################################################################################ PKG_NAME="xbmc" -PKG_VERSION="13.alpha-9f8682d" +PKG_VERSION="13.alpha-2975e4a" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" @@ -239,7 +239,8 @@ if [ "$SAMBA_SUPPORT" = yes ]; then PKG_BUILD_DEPENDS_TARGET="$PKG_BUILD_DEPENDS_TARGET samba" PKG_DEPENDS="$PKG_DEPENDS samba" XBMC_SAMBA="--enable-samba" - XBMC_LIBS="$XBMC_LIBS -ltalloc -ltdb -ltevent -lwbclient" + # TODO: remove this? + #XBMC_LIBS="$XBMC_LIBS -ltalloc -ltdb -ltevent -lwbclient" else XBMC_SAMBA="--disable-samba" fi diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-453-add_openelec.tv_RSS_news-0.1.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-453-add_openelec.tv_RSS_news-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-453-add_openelec.tv_RSS_news-0.1.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-453-add_openelec.tv_RSS_news-0.1.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-602-add_as.xml_busy_dialog_delay_control.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-602-add_as.xml_busy_dialog_delay_control.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-602-add_as.xml_busy_dialog_delay_control.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-602-add_as.xml_busy_dialog_delay_control.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-995.01-fernetmenta-fixes-b17818b.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-995.01-fernetmenta-fixes-b17818b.patch similarity index 56% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-995.01-fernetmenta-fixes-b17818b.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-995.01-fernetmenta-fixes-b17818b.patch index a9930e93e2..360cd8ff7b 100644 --- a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-995.01-fernetmenta-fixes-b17818b.patch +++ b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-995.01-fernetmenta-fixes-b17818b.patch @@ -1,5938 +1,7 @@ -From 71e5e9d6ff27305f9b4d7b0d2edacacdcd1a29dc Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 12:59:07 +0200 -Subject: [PATCH 01/94] [AE] refactor audio settings page - ---- - language/English/strings.po | 72 +++++++--- - system/settings/settings.xml | 231 +++++++++++++++++++-------------- - system/settings/win32.xml | 20 +-- - xbmc/cores/AudioEngine/AEFactory.cpp | 44 +++++-- - xbmc/cores/AudioEngine/AEFactory.h | 4 +- - xbmc/cores/AudioEngine/Interfaces/AE.h | 13 +- - xbmc/cores/AudioEngine/Utils/AEUtil.h | 9 -- - xbmc/settings/Settings.cpp | 8 +- - 8 files changed, 251 insertions(+), 150 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index 4d3e6ff..a403c5d 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -1393,17 +1393,17 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#337" --msgid "Audio output" -+msgid "Output configuration" - msgstr "" - - #: system/settings/settings.xml - msgctxt "#338" --msgid "Analogue" -+msgid "Fixed" - msgstr "" - - #: system/settings/settings.xml - msgctxt "#339" --msgid "Optical/Coax" -+msgid "Optimized" - msgstr "" - - msgctxt "#340" -@@ -1447,7 +1447,7 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#348" --msgid "Multichannel LPCM capable receiver" -+msgid "Enable passthrough" - msgstr "" - - #: system/settings/settings.xml -@@ -1780,12 +1780,12 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#420" --msgid "HDMI" -+msgid "Best Match" - msgstr "" - - #: system/settings/settings.xml - msgctxt "#421" --msgid "Stream silence when idle" -+msgid "Keep audio device alive" - msgstr "" - - msgctxt "#422" -@@ -1937,7 +1937,10 @@ msgctxt "#457" - msgid "Switch view" - msgstr "" - --#empty string with id 458 -+#: system/settings/settings.xml -+msgctxt "#458" -+msgid "Limit sampling rate (kHz)" -+msgstr "" - - msgctxt "#459" - msgid "Subs" -@@ -12442,7 +12445,7 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#34111" --msgid "When activated silence is output in order to keep alive receiver, otherwise sink is drained in idle state" -+msgid "When enabled very quiet noise is sent (for a given period of time) to the audio output device when XBMC is idle, this keeps the receiving device alive ensuring any new sounds are not missed. This might block concurrent applications from outputting sound." - msgstr "" - - #empty strings from id 34112 to 34119 -@@ -12471,8 +12474,38 @@ msgctxt "#34123" - msgid "Never" - msgstr "" - --#empty strings from id 34124 to 34200 --#34124-34200 reserved for future use -+#. SPDIF max sampling rate -+#: system/settings/settings.xml -+msgctxt "#34124" -+msgid "44.1" -+msgstr "" -+ -+#. SPDIF max sampling rate -+#: system/settings/settings.xml -+msgctxt "#34125" -+msgid "48.0" -+msgstr "" -+ -+#. SPDIF max sampling rate -+#: system/settings/settings.xml -+msgctxt "#34126" -+msgid "88.2" -+msgstr "" -+ -+#. SPDIF max sampling rate -+#: system/settings/settings.xml -+msgctxt "#34127" -+msgid "96.0" -+msgstr "" -+ -+#. SPDIF max sampling rate -+#: system/settings/settings.xml -+msgctxt "#34128" -+msgid "192.0" -+msgstr "" -+ -+#empty strings from id 34129 to 34200 -+#34129-34200 reserved for future use - - #: xbmc\PlayListPlayer.cpp - msgctxt "#34201" -@@ -13215,7 +13248,7 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#36169" --msgid "Resampling and other sound processing quality. Low quality is fast, higher quality will consume more CPU." -+msgid "Select the quality of resampling when audio output needs to be at a different sampling rate from that used by the source. Low quality is fast and will have minimal impact on system resources such as the use of the CPU, Medium & High will use progressively more system resources." - msgstr "" - - #: system/settings/settings.xml -@@ -14175,12 +14208,12 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#36361" --msgid "Type of connection to the audio equipment." -+msgid "Select how audio is output. Fixed - the properties of the audio output are fixed to the specified sampling rate & speaker configuration; Best Match - the properties of the audio output are set to match the properties of the audio source where possible if not the closest match is chosen; Optimized - the properties of the audio output are not changed during playback." - msgstr "" - - #: system/settings/settings.xml - msgctxt "#36362" --msgid "Select your physical speaker layout." -+msgid "Select the maximum number of audio channels/speakers available for audio decoded. On OS-X systems where optical/coax digital outputs are used this must be set to 2.0" - msgstr "" - - #: system/settings/settings.xml -@@ -14190,7 +14223,7 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#36364" --msgid "Upmix 2 channel stereo sources so the number of audio channels matches the number of speakers." -+msgid "When enabled upmix 2 channel stereo sources to the number of audio channels specified by the Speaker Configuration." - msgstr "" - - #: system/settings/settings.xml -@@ -14210,7 +14243,7 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#36368" --msgid "Select this option if your receiver is capable of decoding LPCM streams." -+msgid "Select to enable the passthrough audio options for playback of encoded audio such as Dolby Digital." - msgstr "" - - #: system/settings/settings.xml -@@ -14225,12 +14258,12 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#36371" --msgid "Select the device you use to play audio decoded by XBMC such as mp3's and FLAC." -+msgid "Select the device to be used for playback of audio that has been decoded such as mp3" - msgstr "" - - #: system/settings/settings.xml - msgctxt "#36372" --msgid "Select the device you use to play encoded formats, these are any of the formats checked above in the 'capable receiver' options." -+msgid "Select the device to be used for playback of encoded formats, these are any of the formats below in the 'capable receiver' options." - msgstr "" - - #: system/settings/settings.xml -@@ -14556,7 +14589,10 @@ msgctxt "#36522" - msgid "Use preferred mode" - msgstr "" - --#empty string with id 36523 -+#: system/settings/settings.xml -+msgctxt "#36523" -+msgid "Maximum sampling rate for spdif or sampling rate for fixed output configuration" -+msgstr "" - - #: system/settings/settings.xml - msgctxt "#36524" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 528c090..f310b96 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -1972,17 +1972,20 @@ - - - -- -- 1 -- 0 -+ -+ 0 -+ Default - -- audiooutputmodes -+ audiodevices - -- -+ - - - 0 - 1 -+ -+ audiooutput.channels -+ - - - -@@ -1997,14 +2000,48 @@ - - - -- -- audiooutput.channellayout -- - - -- -+ - 2 -- true -+ 2 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ 2 -+ 48000 -+ -+ -+ -+ audiooutput.samplerate -+ audiooutput.samplerate -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ 2 -+ false -+ -+ 1 -+ - - - HAS_AE_QUALITY_LEVELS -@@ -2015,128 +2052,130 @@ - - - -- -- 2 -- false -+ -+ 1 -+ audiosupportsdrain -+ true -+ -+ -+ -+ -+ 0 -+ 1 -+ -+ -+ -+ -+ -+ -+ -+ - -- -+ -+ -+ - 2 -- true -+ false - -- -- -- 1 -- 2 -- -+ -+ -+ audiooutput.passthrough -+ audiooutput.passthrough -+ - - - -- -+ - 2 -- true -+ Default - -- -- -- 1 -- 2 -- -+ -+ -+ true -+ audiooutput.passthrough -+ audiooutput.passthrough -+ - - -- -- -+ -+ audiodevicespassthrough -+ -+ -+ -+ - 2 - true - -- -- -- 1 -- 2 -- -+ -+ -+ true -+ audiooutput.passthrough -+ - - - -- -+ - 2 - false - -- -- -- 1 -- 2 -- -+ -+ -+ true -+ audiooutput.passthrough -+ - -- -+ - -- -+ - 2 -- true -+ false - -- 2 -- -+ -+ -+ true -+ audiooutput.passthrough -+ -+ -+ - -- -+ - 2 -- true -+ false - -- 2 -- -+ -+ -+ true -+ audiooutput.passthrough -+ audiooutput.passthrough -+ -+ -+ - -- -+ - 2 -- true -+ false - -- -+ - -- true -- 2 -+ true -+ audiooutput.truehdpassthrough -+ audiooutput.truehdpassthrough - - -- -+ - -- -+ - 2 -- audiosupportsdrain -- true -- -- -- -- -- 2 -- Default -- -- audiodevices -- -- -- -- -- 2 -- Default -- -- audiodevicespassthrough -- -+ false - -- -- -- 1 -- 2 -- -+ -+ -+ true -+ audiooutput.dtshdpassthrough -+ audiooutput.dtshdpassthrough -+ - -- -- -- -- -- -- -- 0 -- 1 -- -- -- -- -- -- -- -- -+ - - - -diff --git a/system/settings/win32.xml b/system/settings/win32.xml -index bb716a2..acf63d1 100644 ---- a/system/settings/win32.xml -+++ b/system/settings/win32.xml -@@ -40,15 +40,17 @@ - - - -- -+ - -- 2 -+ 1 - DirectSound:default - - audiodevices - -- -+ - -+ -+ - - 2 - DirectSound:default -@@ -56,14 +58,14 @@ - audiodevicespassthrough - - -- -- -- 1 -- 2 -- -+ -+ -+ audiooutput.passthrough -+ audiooutput.passthrough -+ - - -- -+ - - - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 16fc708..3092898 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -40,6 +40,7 @@ - - #include "guilib/LocalizeStrings.h" - #include "settings/Setting.h" -+#include "settings/Settings.h" - #include "utils/StringUtils.h" - - IAE* CAEFactory::AE = NULL; -@@ -238,10 +239,32 @@ void CAEFactory::VerifyOutputDevice(std::string &device, bool passthrough) - return "default"; - } - --bool CAEFactory::SupportsRaw() -+bool CAEFactory::SupportsRaw(AEDataFormat format) - { -+ // check if passthrough is enabled -+ if (!CSettings::Get().GetBool("audiooutput.passthrough")) -+ return false; -+ -+ // fixed config disabled passthrough -+ if (CSettings::Get().GetInt("audiooutput.config") == AE_CONFIG_FIXED) -+ return false; -+ -+ // check if the format is enabled in settings -+ if (format == AE_FMT_AC3 && !CSettings::Get().GetBool("audiooutput.ac3passthrough")) -+ return false; -+ if (format == AE_FMT_DTS && !CSettings::Get().GetBool("audiooutput.dtspassthrough")) -+ return false; -+ if (format == AE_FMT_EAC3 && !CSettings::Get().GetBool("audiooutput.eac3passthrough")) -+ return false; -+ if (format == AE_FMT_AAC && !CSettings::Get().GetBool("audiooutput.passthroughaac")) -+ return false; -+ if (format == AE_FMT_TRUEHD && !CSettings::Get().GetBool("audiooutput.truehdpassthrough")) -+ return false; -+ if (format == AE_FMT_DTSHD && !CSettings::Get().GetBool("audiooutput.dtshdpassthrough")) -+ return false; -+ - if(AE) -- return AE->SupportsRaw(); -+ return AE->SupportsRaw(format); - - return false; - } -@@ -339,15 +362,6 @@ void CAEFactory::SettingOptionsAudioDevicesPassthroughFiller(const CSetting *set - SettingOptionsAudioDevicesFillerGeneral(setting, list, current, true); - } - --void CAEFactory::SettingOptionsAudioOutputModesFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t) --{ -- list.push_back(std::make_pair(g_localizeStrings.Get(338), AUDIO_ANALOG)); --#if !defined(TARGET_RASPBERRY_PI) -- list.push_back(std::make_pair(g_localizeStrings.Get(339), AUDIO_IEC958)); --#endif -- list.push_back(std::make_pair(g_localizeStrings.Get(420), AUDIO_HDMI)); --} -- - void CAEFactory::SettingOptionsAudioQualityLevelsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t) - { - if (!AE) -@@ -410,3 +424,11 @@ void CAEFactory::UnregisterAudioCallback() - if (AE) - AE->UnregisterAudioCallback(); - } -+ -+bool CAEFactory::IsSettingVisible(const std::string &condition, const std::string &value, const std::string &settingId) -+{ -+ if (settingId.empty() || value.empty() || !AE) -+ return false; -+ -+ return AE->IsSettingVisible(value); -+} -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index e3e8a3a..b007627 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -54,7 +54,7 @@ class CAEFactory - static void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); - static void VerifyOutputDevice(std::string &device, bool passthrough); - static std::string GetDefaultDevice(bool passthrough); -- static bool SupportsRaw(); -+ static bool SupportsRaw(AEDataFormat format); - static bool SupportsDrain(); - - /** -@@ -74,8 +74,8 @@ class CAEFactory - - static void SettingOptionsAudioDevicesFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t); - static void SettingOptionsAudioDevicesPassthroughFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t); -- static void SettingOptionsAudioOutputModesFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); - static void SettingOptionsAudioQualityLevelsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); -+ static bool IsSettingVisible(const std::string &condition, const std::string &value, const std::string &settingId); - - static void RegisterAudioCallback(IAudioCallback* pCallback); - static void UnregisterAudioCallback(); -diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h -index b1f3008..e60aa66 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AE.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AE.h -@@ -41,6 +41,11 @@ - #define AE_SOUND_IDLE 1 /* only play sounds while no streams are running */ - #define AE_SOUND_ALWAYS 2 /* always play sounds */ - -+/* config options */ -+#define AE_CONFIG_FIXED 1 -+#define AE_CONFIG_AUTO 2 -+#define AE_CONFIG_MATCH 3 -+ - enum AEQuality - { - AE_QUALITY_UNKNOWN = -1, /* Unset, unknown or incorrect quality level */ -@@ -198,7 +203,7 @@ class IAE - * @see CAEPackIEC61937::CAEPackIEC61937() - * @returns true if the AudioEngine is capable of RAW output - */ -- virtual bool SupportsRaw() { return false; } -+ virtual bool SupportsRaw(AEDataFormat format) { return false; } - - /** - * Returns true if the AudioEngine supports drain mode which is not streaming silence when idle -@@ -215,5 +220,11 @@ class IAE - * @return true if specified quality level is supported, otherwise false - */ - virtual bool SupportsQualityLevel(enum AEQuality level) { return false; } -+ -+ /** -+ * AE decides whether this settings should be displayed -+ * @return true if AudioEngine wants to display this setting -+ */ -+ virtual bool IsSettingVisible(const std::string &settingId) {return false; } - }; - -diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.h b/xbmc/cores/AudioEngine/Utils/AEUtil.h -index ef67b34..c6a3184 100644 ---- a/xbmc/cores/AudioEngine/Utils/AEUtil.h -+++ b/xbmc/cores/AudioEngine/Utils/AEUtil.h -@@ -49,15 +49,6 @@ - #define MEMALIGN(b, x) __declspec(align(b)) x - #endif - --#define AUDIO_IS_BITSTREAM(x) ((x) == AUDIO_IEC958 || (x) == AUDIO_HDMI) -- --enum AudioOutputs --{ -- AUDIO_ANALOG = 0, -- AUDIO_IEC958, -- AUDIO_HDMI --}; -- - // AV sync options - enum AVSync - { -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index a8d82af..41e5d04 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -372,7 +372,6 @@ void CSettings::Uninitialize() - m_settingsManager->UnregisterSettingOptionsFiller("aequalitylevels"); - m_settingsManager->UnregisterSettingOptionsFiller("audiodevices"); - m_settingsManager->UnregisterSettingOptionsFiller("audiodevicespassthrough"); -- m_settingsManager->UnregisterSettingOptionsFiller("audiooutputmodes"); - m_settingsManager->UnregisterSettingOptionsFiller("charsets"); - m_settingsManager->UnregisterSettingOptionsFiller("epgguideviews"); - m_settingsManager->UnregisterSettingOptionsFiller("fontheights"); -@@ -687,7 +686,6 @@ void CSettings::InitializeOptionFillers() - m_settingsManager->RegisterSettingOptionsFiller("aequalitylevels", CAEFactory::SettingOptionsAudioQualityLevelsFiller); - m_settingsManager->RegisterSettingOptionsFiller("audiodevices", CAEFactory::SettingOptionsAudioDevicesFiller); - m_settingsManager->RegisterSettingOptionsFiller("audiodevicespassthrough", CAEFactory::SettingOptionsAudioDevicesPassthroughFiller); -- m_settingsManager->RegisterSettingOptionsFiller("audiooutputmodes", CAEFactory::SettingOptionsAudioOutputModesFiller); - m_settingsManager->RegisterSettingOptionsFiller("charsets", CCharsetConverter::SettingOptionsCharsetsFiller); - m_settingsManager->RegisterSettingOptionsFiller("epgguideviews", PVR::CGUIWindowPVRGuide::SettingOptionsEpgGuideViewFiller); - m_settingsManager->RegisterSettingOptionsFiller("fonts", GUIFontManager::SettingOptionsFontsFiller); -@@ -824,6 +822,7 @@ void CSettings::InitializeConditions() - m_settingsManager->AddCondition("profilehassettingslocked", ProfileHasSettingsLocked); - m_settingsManager->AddCondition("profilehasvideoslocked", ProfileHasVideosLocked); - m_settingsManager->AddCondition("profilelockmode", ProfileLockMode); -+ m_settingsManager->AddCondition("aesettingvisible", CAEFactory::IsSettingVisible); - } - - void CSettings::InitializeISettingsHandlers() -@@ -887,7 +886,9 @@ void CSettings::InitializeISettingCallbacks() - m_settingsManager->RegisterCallback(&CStereoscopicsManager::Get(), settingSet); - - settingSet.clear(); -- settingSet.insert("audiooutput.mode"); -+ settingSet.insert("audiooutput.config"); -+ settingSet.insert("audiooutput.samplerate"); -+ settingSet.insert("audiooutput.passthrough"); - settingSet.insert("audiooutput.channels"); - settingSet.insert("audiooutput.processquality"); - settingSet.insert("audiooutput.guisoundmode"); -@@ -898,7 +899,6 @@ void CSettings::InitializeISettingCallbacks() - settingSet.insert("audiooutput.passthroughaac"); - settingSet.insert("audiooutput.truehdpassthrough"); - settingSet.insert("audiooutput.dtshdpassthrough"); -- settingSet.insert("audiooutput.multichannellpcm"); - settingSet.insert("audiooutput.audiodevice"); - settingSet.insert("audiooutput.passthroughdevice"); - settingSet.insert("audiooutput.streamsilence"); --- -1.8.4 - - -From c3991e9b717f2e140d26f9d981ce19572c41091b Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 13:01:14 +0200 -Subject: [PATCH 02/94] dvdplayer: adapt to changes in audio settings - ---- - .../DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp | 28 ++++---------------- - .../Audio/DVDAudioCodecPassthroughFFmpeg.cpp | 17 ++++++------ - xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 30 ++++++++++------------ - xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.h | 2 +- - xbmc/cores/dvdplayer/DVDPlayerAudio.cpp | 10 ++------ - 5 files changed, 31 insertions(+), 56 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp -index ebb8138..5338c71 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp -@@ -40,29 +40,11 @@ - - bool CDVDAudioCodecPassthrough::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - { -- /* dont open if AE doesnt support RAW */ -- if (!CAEFactory::SupportsRaw()) -- return false; -- -- bool bSupportsAC3Out = false; -- bool bSupportsEAC3Out = false; -- bool bSupportsDTSOut = false; -- bool bSupportsTrueHDOut = false; -- bool bSupportsDTSHDOut = false; -- -- int audioMode = CSettings::Get().GetInt("audiooutput.mode"); -- if (AUDIO_IS_BITSTREAM(audioMode)) -- { -- bSupportsAC3Out = CSettings::Get().GetBool("audiooutput.ac3passthrough"); -- bSupportsEAC3Out = CSettings::Get().GetBool("audiooutput.eac3passthrough"); -- bSupportsDTSOut = CSettings::Get().GetBool("audiooutput.dtspassthrough"); -- } -- -- if (audioMode == AUDIO_HDMI) -- { -- bSupportsTrueHDOut = CSettings::Get().GetBool("audiooutput.truehdpassthrough"); -- bSupportsDTSHDOut = CSettings::Get().GetBool("audiooutput.dtshdpassthrough" ) && bSupportsDTSOut; -- } -+ bool bSupportsAC3Out = CAEFactory::SupportsRaw(AE_FMT_AC3); -+ bool bSupportsEAC3Out = CAEFactory::SupportsRaw(AE_FMT_EAC3); -+ bool bSupportsDTSOut = CAEFactory::SupportsRaw(AE_FMT_DTS); -+ bool bSupportsTrueHDOut = CAEFactory::SupportsRaw(AE_FMT_TRUEHD); -+ bool bSupportsDTSHDOut = CAEFactory::SupportsRaw(AE_FMT_DTSHD); - - /* only get the dts core from the parser if we don't support dtsHD */ - m_info.SetCoreOnly(!bSupportsDTSHDOut); -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp -index a9f3d40..f49b5b5 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp -@@ -25,6 +25,7 @@ - #include "settings/MediaSettings.h" - #include "settings/Settings.h" - #include "utils/log.h" -+#include "cores/AudioEngine/AEFactory.h" - - //These values are forced to allow spdif out - #define OUT_SAMPLESIZE 16 -@@ -293,17 +294,17 @@ bool CDVDAudioCodecPassthroughFFmpeg::SupportsFormat(CDVDStreamInfo &hints) - - bool CDVDAudioCodecPassthroughFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - { -- int audioMode = CSettings::Get().GetInt("audiooutput.mode"); -- - // TODO - move this stuff somewhere else -- if (AUDIO_IS_BITSTREAM(audioMode)) -+ bool m_bSupportsAC3Out = CAEFactory::SupportsRaw(AE_FMT_AC3); -+ bool m_bSupportsEAC3Out = CAEFactory::SupportsRaw(AE_FMT_EAC3); -+ bool m_bSupportsDTSOut = CAEFactory::SupportsRaw(AE_FMT_DTS); -+ -+ if ((hints.codec == AV_CODEC_ID_AC3 && !m_bSupportsAC3Out) || -+ (hints.codec == AV_CODEC_ID_EAC3 && !m_bSupportsEAC3Out) || -+ (hints.codec == AV_CODEC_ID_DTS && !m_bSupportsDTSOut)) - { -- m_bSupportsAC3Out = CSettings::Get().GetBool("audiooutput.ac3passthrough"); -- m_bSupportsDTSOut = CSettings::Get().GetBool("audiooutput.dtspassthrough"); -- m_bSupportsAACOut = CSettings::Get().GetBool("audiooutput.passthroughaac"); -- } -- else - return false; -+ } - - // TODO - this is only valid for video files, and should be moved somewhere else - if( hints.channels == 2 && CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers ) -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index 183e2c5..4864e47 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -325,28 +325,26 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne - return NULL; - } - --CDVDAudioCodec* CDVDFactoryCodec::CreateAudioCodec( CDVDStreamInfo &hint, bool passthrough /* = true */) -+CDVDAudioCodec* CDVDFactoryCodec::CreateAudioCodec( CDVDStreamInfo &hint) - { - CDVDAudioCodec* pCodec = NULL; - CDVDCodecOptions options; - -- if (passthrough) -- { -+ // try passthrough first - #if defined(TARGET_DARWIN_OSX) || defined(TARGET_DARWIN_IOS) -- switch(hint.codec) -- { -- case AV_CODEC_ID_AC3: -- case AV_CODEC_ID_DTS: -- pCodec = OpenCodec( new CDVDAudioCodecPassthroughFFmpeg(), hint, options ); -- if( pCodec ) return pCodec; -- break; -- default: -- break; -- } --#endif -- pCodec = OpenCodec( new CDVDAudioCodecPassthrough(), hint, options ); -- if( pCodec ) return pCodec; -+ switch(hint.codec) -+ { -+ case AV_CODEC_ID_AC3: -+ case AV_CODEC_ID_DTS: -+ pCodec = OpenCodec( new CDVDAudioCodecPassthroughFFmpeg(), hint, options ); -+ if( pCodec ) return pCodec; -+ break; -+ default: -+ break; - } -+#endif -+ pCodec = OpenCodec( new CDVDAudioCodecPassthrough(), hint, options ); -+ if( pCodec ) return pCodec; - - switch (hint.codec) - { -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.h -index f7c03da..f7ce44c 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.h -@@ -36,7 +36,7 @@ class CDVDFactoryCodec - { - public: - static CDVDVideoCodec* CreateVideoCodec(CDVDStreamInfo &hint, unsigned int surfaces = 0, const std::vector& formats = std::vector()); -- static CDVDAudioCodec* CreateAudioCodec(CDVDStreamInfo &hint, bool passthrough = true ); -+ static CDVDAudioCodec* CreateAudioCodec(CDVDStreamInfo &hint ); - static CDVDOverlayCodec* CreateOverlayCodec(CDVDStreamInfo &hint ); - - static CDVDAudioCodec* OpenCodec(CDVDAudioCodec* pCodec, CDVDStreamInfo &hint, CDVDCodecOptions &options ); -diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -index 38a53e7..df3df14 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp -@@ -145,10 +145,8 @@ class CDVDMsgAudioCodecChange : public CDVDMsg - - bool CDVDPlayerAudio::OpenStream( CDVDStreamInfo &hints ) - { -- bool passthrough = AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode")); -- - CLog::Log(LOGNOTICE, "Finding audio codec for: %i", hints.codec); -- CDVDAudioCodec* codec = CDVDFactoryCodec::CreateAudioCodec(hints, passthrough); -+ CDVDAudioCodec* codec = CDVDFactoryCodec::CreateAudioCodec(hints); - if( !codec ) - { - CLog::Log(LOGERROR, "Unsupported audio codec"); -@@ -868,12 +866,8 @@ void CDVDPlayerAudio::WaitForBuffers() - - bool CDVDPlayerAudio::SwitchCodecIfNeeded() - { -- // check if passthrough is disabled -- if (!AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode"))) -- return false; -- - CLog::Log(LOGDEBUG, "CDVDPlayerAudio: Sample rate changed, checking for passthrough"); -- CDVDAudioCodec *codec = CDVDFactoryCodec::CreateAudioCodec(m_streaminfo, true); -+ CDVDAudioCodec *codec = CDVDFactoryCodec::CreateAudioCodec(m_streaminfo); - if (!codec || codec->NeedPassthrough() == m_pAudioCodec->NeedPassthrough()) { - // passthrough state has not changed - delete codec; --- -1.8.4 - - -From d6d239ed48ad69644fc267c3d57b4937498b2fd0 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 13:02:24 +0200 -Subject: [PATCH 03/94] paplayer: adapt to changes in audio settings - ---- - xbmc/cores/paplayer/DVDPlayerCodec.cpp | 3 +-- - xbmc/cores/playercorefactory/PlayerCoreFactory.cpp | 10 +++------- - 2 files changed, 4 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.cpp b/xbmc/cores/paplayer/DVDPlayerCodec.cpp -index 355589f..5bd7ec1 100644 ---- a/xbmc/cores/paplayer/DVDPlayerCodec.cpp -+++ b/xbmc/cores/paplayer/DVDPlayerCodec.cpp -@@ -145,8 +145,7 @@ bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache) - - CDVDStreamInfo hint(*pStream, true); - -- bool passthrough = AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode")); -- m_pAudioCodec = CDVDFactoryCodec::CreateAudioCodec(hint, passthrough); -+ m_pAudioCodec = CDVDFactoryCodec::CreateAudioCodec(hint); - if (!m_pAudioCodec) - { - CLog::Log(LOGERROR, "%s: Could not create audio codec", __FUNCTION__); -diff --git a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp -index 8e7a0f5..16319b9 100644 ---- a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp -+++ b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp -@@ -37,6 +37,7 @@ - #include "PlayerCoreConfig.h" - #include "PlayerSelectionRule.h" - #include "guilib/LocalizeStrings.h" -+#include "cores/AudioEngine/AEFactory.h" - - #define PLAYERCOREFACTORY_XML "playercorefactory.xml" - -@@ -189,13 +190,8 @@ void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecC - - if (bAdd) - { -- if( CSettings::Get().GetInt("audiooutput.mode") == AUDIO_ANALOG ) -- { -- CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding PAPlayer (%d)", EPC_PAPLAYER); -- vecCores.push_back(EPC_PAPLAYER); -- } -- else if (url.GetFileType().Equals("ac3") -- || url.GetFileType().Equals("dts")) -+ if ((url.GetFileType().Equals("ac3") && !CAEFactory::SupportsRaw(AE_FMT_AC3)) -+ || (url.GetFileType().Equals("dts") && !CAEFactory::SupportsRaw(AE_FMT_DTS))) - { - CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding DVDPlayer (%d)", EPC_DVDPLAYER); - vecCores.push_back(EPC_DVDPLAYER); --- -1.8.4 - - -From 2c9ebb2d3888527e2bccaee7fa0b1d956b8f8109 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 13:03:27 +0200 -Subject: [PATCH 04/94] GUIDialogAudioSettings: adapt to changes in audio - settings - ---- - .../video/dialogs/GUIDialogAudioSubtitleSettings.cpp | 20 ++++++-------------- - xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h | 2 +- - 2 files changed, 7 insertions(+), 15 deletions(-) - -diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -index 0dd0075..5d0f2ef 100644 ---- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -+++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -@@ -96,14 +96,13 @@ void CGUIDialogAudioSubtitleSettings::CreateSettings() - if (SupportsAudioFeature(IPC_AUD_SELECT_STREAM)) - AddAudioStreams(AUDIO_SETTINGS_STREAM); - -- // only show stuff available in digital mode if we have digital output -+ // TODO: remove this setting - if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO)) -- AddBool(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, 252, &CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers, AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode"))); -+ AddBool(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, 252, &CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers, true); - -- int settings[3] = { 338, 339, 420 }; //ANALOG, IEC958, HDMI -- m_outputmode = CSettings::Get().GetInt("audiooutput.mode"); -+ m_outputmode = CSettings::Get().GetBool("audiooutput.passthrough"); - if (SupportsAudioFeature(IPC_AUD_SELECT_OUTPUT)) -- AddSpin(AUDIO_SETTINGS_DIGITAL_ANALOG, 337, &m_outputmode, 3, settings); -+ AddBool(AUDIO_SETTINGS_DIGITAL_ANALOG, 348, &m_outputmode); - - AddSeparator(7); - m_subtitleVisible = g_application.m_pPlayer->GetSubtitleVisible(); -@@ -275,16 +274,9 @@ void CGUIDialogAudioSubtitleSettings::OnSettingChanged(SettingInfo &setting) - } - else if (setting.id == AUDIO_SETTINGS_DIGITAL_ANALOG) - { -- bool bitstream = false; -+ CSettings::Get().SetBool("audiooutput.passthrough", !m_outputmode); - -- switch(m_outputmode) -- { -- case 0: CSettings::Get().SetInt("audiooutput.mode", AUDIO_ANALOG ); break; -- case 1: CSettings::Get().SetInt("audiooutput.mode", AUDIO_IEC958 ); bitstream = true; break; -- case 2: CSettings::Get().SetInt("audiooutput.mode", AUDIO_HDMI ); bitstream = true; break; -- } -- -- EnableSettings(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, bitstream); -+ EnableSettings(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, true); - EnableSettings(AUDIO_SETTINGS_VOLUME, !g_application.m_pPlayer->IsPassthrough()); - } - else if (setting.id == SUBTITLE_SETTINGS_ENABLE) -diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h -index ad5f3f1..f8c578e 100644 ---- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h -+++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h -@@ -47,7 +47,7 @@ class CGUIDialogAudioSubtitleSettings : - float m_volume; - int m_audioStream; - int m_subtitleStream; -- int m_outputmode; -+ bool m_outputmode; - bool m_subtitleVisible; - Features m_audioCaps; - Features m_subCaps; --- -1.8.4 - - -From 0939d32581423915e83eba8435f82d32011fdef6 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 13:05:07 +0200 -Subject: [PATCH 05/94] ActiveAE: adapt to changes in audio settings - ---- - .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 96 ++++++++++++++++------ - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 8 +- - .../AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 31 +++++++ - .../AudioEngine/Engines/ActiveAE/ActiveAESink.h | 2 + - 4 files changed, 110 insertions(+), 27 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 71e4687..cc9fd75 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -411,7 +411,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - m_extDeferData = true; - return; - case CActiveAEControlProtocol::DISPLAYLOST: -- if (m_settings.mode == AUDIO_HDMI) -+ if (m_sink.GetDeviceType(m_mode == MODE_PCM ? m_settings.device : m_settings.passthoughdevice) == AE_DEVTYPE_HDMI) - { - UnconfigureSink(); - m_stats.SetSuspended(true); -@@ -1242,7 +1242,7 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett - *mode = MODE_PCM; - - // raw pass through -- if (m_settings.mode != AUDIO_ANALOG && AE_IS_RAW(format.m_dataFormat)) -+ if (AE_IS_RAW(format.m_dataFormat)) - { - if ((format.m_dataFormat == AE_FMT_AC3 && !settings.ac3passthrough) || - (format.m_dataFormat == AE_FMT_EAC3 && !settings.eac3passthrough) || -@@ -1256,9 +1256,8 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett - *mode = MODE_RAW; - } - // transcode -- else if (m_settings.mode != AUDIO_ANALOG && -+ else if (settings.passthrough && - settings.ac3passthrough && -- (!settings.multichannellpcm || (m_settings.mode != AUDIO_HDMI)) && - !m_streams.empty() && - (format.m_channelLayout.Count() > 2 || settings.stereoupmix)) - { -@@ -1279,7 +1278,8 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett - // which would cause a short audio drop-out if we changed the sink - if ((format.m_channelLayout.Count() > 2) || - settings.stereoupmix || -- (m_stats.GetWaterLevel() > 0 && m_internalFormat.m_channelLayout.Count() > 2 && !g_advancedSettings.m_audioAudiophile)) -+ (settings.config == AE_CONFIG_FIXED) || -+ (m_stats.GetWaterLevel() > 0 && m_internalFormat.m_channelLayout.Count() > 2 && (settings.config != AE_CONFIG_MATCH))) - { - CAEChannelInfo stdLayout; - switch (settings.channels) -@@ -1298,30 +1298,28 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett - case 10: stdLayout = AE_CH_LAYOUT_7_1; break; - } - -- if (g_advancedSettings.m_audioAudiophile) -+ if (m_settings.config == AE_CONFIG_MATCH) - format.m_channelLayout.ResolveChannels(stdLayout); - else - format.m_channelLayout = stdLayout; - } - -- if (m_settings.mode == AUDIO_IEC958 && format.m_sampleRate > 48000) -+ if (m_sink.GetDeviceType(m_settings.device) == AE_DEVTYPE_IEC958) - { -- format.m_sampleRate = 48000; -- CLog::Log(LOGINFO, "CActiveAE::ApplySettings - limit samplerate for SPDIF to %d", format.m_sampleRate); -+ if (format.m_sampleRate > m_settings.samplerate) -+ { -+ format.m_sampleRate = m_settings.samplerate; -+ CLog::Log(LOGINFO, "CActiveAE::ApplySettings - limit samplerate for SPDIF to %d", format.m_sampleRate); -+ } -+ format.m_channelLayout = AE_CH_LAYOUT_2_0; - } - -- if (g_advancedSettings.m_audioResample) -+ if (m_settings.config == AE_CONFIG_FIXED) - { -- format.m_sampleRate = g_advancedSettings.m_audioResample; -+ format.m_sampleRate = m_settings.samplerate; - CLog::Log(LOGINFO, "CActiveAE::ApplySettings - Forcing samplerate to %d", format.m_sampleRate); - } - -- // for IEC958 limit to 2 channels -- if (m_settings.mode == AUDIO_IEC958) -- { -- format.m_channelLayout = AE_CH_LAYOUT_2_0; -- } -- - // sinks may not support mono - if (format.m_channelLayout.Count() == 1) - { -@@ -1540,7 +1538,7 @@ bool CActiveAE::RunStages() - - // TODO: find better solution for this - // gapless bites audiophile -- if (g_advancedSettings.m_audioAudiophile) -+ if (m_settings.config == AE_CONFIG_MATCH) - Configure(&slave->m_format); - - (*it)->m_streamSlave = NULL; -@@ -1968,17 +1966,19 @@ void CActiveAE::LoadSettings() - m_settings.device = CSettings::Get().GetString("audiooutput.audiodevice"); - m_settings.passthoughdevice = CSettings::Get().GetString("audiooutput.passthroughdevice"); - -- m_settings.mode = CSettings::Get().GetInt("audiooutput.mode"); -+ m_settings.config = CSettings::Get().GetInt("audiooutput.config"); - m_settings.channels = CSettings::Get().GetInt("audiooutput.channels"); -+ m_settings.samplerate = CSettings::Get().GetInt("audiooutput.samplerate"); - - m_settings.stereoupmix = CSettings::Get().GetBool("audiooutput.stereoupmix"); -+ -+ m_settings.passthrough = m_settings.config == AE_CONFIG_FIXED ? false : CSettings::Get().GetBool("audiooutput.passthrough"); - m_settings.ac3passthrough = CSettings::Get().GetBool("audiooutput.ac3passthrough"); - m_settings.eac3passthrough = CSettings::Get().GetBool("audiooutput.eac3passthrough"); - m_settings.truehdpassthrough = CSettings::Get().GetBool("audiooutput.truehdpassthrough"); - m_settings.dtspassthrough = CSettings::Get().GetBool("audiooutput.dtspassthrough"); - m_settings.dtshdpassthrough = CSettings::Get().GetBool("audiooutput.dtshdpassthrough"); - m_settings.aacpassthrough = CSettings::Get().GetBool("audiooutput.passthroughaac"); -- m_settings.multichannellpcm = CSettings::Get().GetBool("audiooutput.multichannellpcm"); - - m_settings.resampleQuality = static_cast(CSettings::Get().GetInt("audiooutput.processquality")); - } -@@ -2037,7 +2037,7 @@ void CActiveAE::OnSettingsChange(const std::string& setting) - { - if (setting == "audiooutput.passthroughdevice" || - setting == "audiooutput.audiodevice" || -- setting == "audiooutput.mode" || -+ setting == "audiooutput.config" || - setting == "audiooutput.ac3passthrough" || - setting == "audiooutput.eac3passthrough" || - setting == "audiooutput.dtspassthrough" || -@@ -2045,17 +2045,29 @@ void CActiveAE::OnSettingsChange(const std::string& setting) - setting == "audiooutput.truehdpassthrough" || - setting == "audiooutput.dtshdpassthrough" || - setting == "audiooutput.channels" || -- setting == "audiooutput.multichannellpcm" || - setting == "audiooutput.stereoupmix" || - setting == "audiooutput.streamsilence" || -- setting == "audiooutput.processquality") -+ setting == "audiooutput.processquality" || -+ setting == "audiooutput.passthrough" || -+ setting == "audiooutput.samplerate") - { - m_controlPort.SendOutMessage(CActiveAEControlProtocol::RECONFIGURE); - } - } - --bool CActiveAE::SupportsRaw() -+bool CActiveAE::SupportsRaw(AEDataFormat format) - { -+ if (!m_sink.HasPassthroughDevice()) -+ return false; -+ -+ // those formats require HDMI -+ if (format == AE_FMT_DTSHD || format == AE_FMT_TRUEHD) -+ { -+ if(m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.passthroughdevice")) != AE_DEVTYPE_HDMI) -+ return false; -+ } -+ -+ // TODO: check ELD? - return true; - } - -@@ -2072,6 +2084,42 @@ bool CActiveAE::SupportsQualityLevel(enum AEQuality level) - return false; - } - -+bool CActiveAE::IsSettingVisible(const std::string &settingId) -+{ -+ if (settingId == "audiooutput.samplerate") -+ { -+ if (m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.audiodevice")) == AE_DEVTYPE_IEC958) -+ return true; -+ if (CSettings::Get().GetInt("audiooutput.config") == AE_CONFIG_FIXED) -+ return true; -+ } -+ else if (settingId == "audiooutput.channels") -+ { -+ if (m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.audiodevice")) != AE_DEVTYPE_IEC958) -+ return true; -+ } -+ else if (settingId == "audiooutput.passthrough") -+ { -+ if (m_sink.HasPassthroughDevice() && CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED) -+ return true; -+ } -+ else if (settingId == "audiooutput.truehdpassthrough") -+ { -+ if (m_sink.HasPassthroughDevice() && -+ CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED && -+ m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.passthroughdevice")) == AE_DEVTYPE_HDMI) -+ return true; -+ } -+ else if (settingId == "audiooutput.dtshdpassthrough") -+ { -+ if (m_sink.HasPassthroughDevice() && -+ CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED && -+ m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.passthroughdevice")) == AE_DEVTYPE_HDMI) -+ return true; -+ } -+ return false; -+} -+ - void CActiveAE::Shutdown() - { - Dispose(); -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index d684a44..2ae0476 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -48,7 +48,6 @@ struct AudioSettings - std::string device; - std::string driver; - std::string passthoughdevice; -- int mode; - int channels; - bool ac3passthrough; - bool eac3passthrough; -@@ -56,8 +55,10 @@ struct AudioSettings - bool aacpassthrough; - bool truehdpassthrough; - bool dtshdpassthrough; -- bool multichannellpcm; - bool stereoupmix; -+ bool passthrough; -+ int config; -+ unsigned int samplerate; - AEQuality resampleQuality; - }; - -@@ -214,9 +215,10 @@ class CActiveAE : public IAE, private CThread - - virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); - virtual std::string GetDefaultDevice(bool passthrough); -- virtual bool SupportsRaw(); -+ virtual bool SupportsRaw(AEDataFormat format); - virtual bool SupportsDrain(); - virtual bool SupportsQualityLevel(enum AEQuality level); -+ virtual bool IsSettingVisible(const std::string &settingId); - - virtual void RegisterAudioCallback(IAudioCallback* pCallback); - virtual void UnregisterAudioCallback(); -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -index 1dec4f5..966b446 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -@@ -90,6 +90,37 @@ bool CActiveAESink::HasVolume() - return m_sink->HasVolume(); - } - -+AEDeviceType CActiveAESink::GetDeviceType(const std::string &device) -+{ -+ std::string dev = device; -+ std::string dri; -+ CAESinkFactory::ParseDevice(dev, dri); -+ for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -+ { -+ for (AEDeviceInfoList::iterator itt2 = itt->m_deviceInfoList.begin(); itt2 != itt->m_deviceInfoList.end(); ++itt2) -+ { -+ CAEDeviceInfo& info = *itt2; -+ if (info.m_deviceName == dev) -+ return info.m_deviceType; -+ } -+ } -+ return AE_DEVTYPE_PCM; -+} -+ -+bool CActiveAESink::HasPassthroughDevice() -+{ -+ for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -+ { -+ for (AEDeviceInfoList::iterator itt2 = itt->m_deviceInfoList.begin(); itt2 != itt->m_deviceInfoList.end(); ++itt2) -+ { -+ CAEDeviceInfo& info = *itt2; -+ if (info.m_deviceType != AE_DEVTYPE_PCM) -+ return true; -+ } -+ } -+ return false; -+} -+ - enum SINK_STATES - { - S_TOP = 0, // 0 -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -index 59bad57..2aebbf6 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -@@ -89,6 +89,8 @@ class CActiveAESink : private CThread - void Start(); - void Dispose(); - bool HasVolume(); -+ AEDeviceType GetDeviceType(const std::string &device); -+ bool HasPassthroughDevice(); - CSinkControlProtocol m_controlPort; - CSinkDataProtocol m_dataPort; - --- -1.8.4 - - -From 1eba1ed4d2997d88ef8d8d29783aa307d8d7cae2 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 13:12:01 +0200 -Subject: [PATCH 06/94] SoftAE: farewell! - ---- - xbmc/cores/AudioEngine/AEFactory.cpp | 5 - - xbmc/cores/AudioEngine/AEFactory.h | 1 - - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp | 1548 -------------------- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h | 253 ---- - .../AudioEngine/Engines/SoftAE/SoftAESound.cpp | 114 -- - .../cores/AudioEngine/Engines/SoftAE/SoftAESound.h | 57 - - .../AudioEngine/Engines/SoftAE/SoftAEStream.cpp | 687 --------- - .../AudioEngine/Engines/SoftAE/SoftAEStream.h | 161 -- - xbmc/cores/AudioEngine/Makefile.in | 4 - - 9 files changed, 2830 deletions(-) - delete mode 100644 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp - delete mode 100644 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h - delete mode 100644 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.cpp - delete mode 100644 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.h - delete mode 100644 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp - delete mode 100644 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 3092898..ba97a6b 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -26,7 +26,6 @@ - #include "Engines/CoreAudio/CoreAudioAE.h" - #include "settings/SettingsManager.h" - #else -- #include "Engines/SoftAE/SoftAE.h" - #include "Engines/ActiveAE/ActiveAE.h" - #endif - -@@ -73,9 +72,6 @@ bool CAEFactory::LoadEngine() - loaded = CAEFactory::LoadEngine(AE_ENGINE_PULSE); - #endif - -- if (!loaded && engine == "SOFT" ) -- loaded = CAEFactory::LoadEngine(AE_ENGINE_SOFT); -- - if (!loaded && engine == "ACTIVE") - loaded = CAEFactory::LoadEngine(AE_ENGINE_ACTIVE); - } -@@ -103,7 +99,6 @@ bool CAEFactory::LoadEngine(enum AEEngine engine) - #if defined(TARGET_DARWIN) - case AE_ENGINE_COREAUDIO: AE = new CCoreAudioAE(); break; - #else -- case AE_ENGINE_SOFT : AE = new CSoftAE(); break; - case AE_ENGINE_ACTIVE : AE = new ActiveAE::CActiveAE(); break; - #endif - #if defined(HAS_PULSEAUDIO) -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index b007627..20e67a3 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -29,7 +29,6 @@ - enum AEEngine - { - AE_ENGINE_NULL, -- AE_ENGINE_SOFT, - AE_ENGINE_COREAUDIO, - AE_ENGINE_PULSE, - AE_ENGINE_ACTIVE, -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -deleted file mode 100644 -index 555ba2d..0000000 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp -+++ /dev/null -@@ -1,1548 +0,0 @@ --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include --#include --#include -- --#include "system.h" --#include "utils/log.h" --#include "utils/TimeUtils.h" --#include "utils/MathUtils.h" --#include "utils/EndianSwap.h" --#include "threads/SingleLock.h" --#include "settings/AdvancedSettings.h" --#include "settings/Settings.h" -- --#include "SoftAE.h" --#include "SoftAESound.h" --#include "SoftAEStream.h" --#include "AESinkFactory.h" --#include "Interfaces/AESink.h" --#include "Utils/AEUtil.h" --#include "Encoders/AEEncoderFFmpeg.h" -- --using namespace std; -- --/* Define idle wait time based on platform in milliseconds */ --/* Higher wait times reduce thread CPU overhead when in */ --/* idle or Suspend() modes */ --#if defined (TARGET_WINDOWS) || defined (TARGET_LINUX) || \ -- defined (TARGET_DARWIN_OSX) || defined (TARGET_FREEBSD) --#define SOFTAE_IDLE_WAIT_MSEC 50 // shorter sleep for HTPC's --#elif defined (TARGET_RASPBERRY_PI) || defined (TARGET_ANDROID) --#define SOFTAE_IDLE_WAIT_MSEC 100 // longer for R_PI and Android --#else --#define SOFTAE_IDLE_WAIT_MSEC 100 // catchall for undefined platforms --#endif -- --CSoftAE::CSoftAE(): -- m_thread (NULL ), -- m_audiophile (true ), -- m_running (false ), -- m_reOpen (false ), -- m_sinkIsSuspended (false ), -- m_isSuspended (false ), -- m_softSuspend (false ), -- m_softSuspendTimeout (XbmcThreads::EndTime::InfiniteValue), -- m_volume (1.0 ), -- m_sink (NULL ), -- m_sinkBlockTime (0 ), -- m_transcode (false ), -- m_rawPassthrough (false ), -- m_soundMode (AE_SOUND_OFF), -- m_streamsPlaying (false ), -- m_encoder (NULL ), -- m_converted (NULL ), -- m_convertedSize (0 ), -- m_masterStream (NULL ), -- m_outputStageFn (NULL ), -- m_streamStageFn (NULL ) --{ -- unsigned int c_retry = 5; -- CAESinkFactory::EnumerateEx(m_sinkInfoList); -- while(m_sinkInfoList.size() == 0 && c_retry > 0) -- { -- CLog::Log(LOGNOTICE, "No Devices found - retry: %d", c_retry); -- Sleep(2000); -- c_retry--; -- // retry the enumeration -- CAESinkFactory::EnumerateEx(m_sinkInfoList, true); -- } -- CLog::Log(LOGNOTICE, "Found %lu Lists of Devices", m_sinkInfoList.size()); -- PrintSinks(); --} -- --CSoftAE::~CSoftAE() --{ -- Deinitialize(); -- -- /* free the streams */ -- CSingleLock streamLock(m_streamLock); -- while (!m_streams.empty()) -- { -- CSoftAEStream *s = m_streams.front(); -- delete s; -- } -- -- /* free the sounds */ -- CSingleLock soundLock(m_soundLock); -- while (!m_sounds.empty()) -- { -- CSoftAESound *s = m_sounds.front(); -- m_sounds.pop_front(); -- delete s; -- } --} -- --IAESink *CSoftAE::GetSink(AEAudioFormat &newFormat, bool passthrough, std::string &device) --{ -- device = passthrough ? m_passthroughDevice : m_device; -- -- /* if we are raw, force the sample rate */ -- if (AE_IS_RAW(newFormat.m_dataFormat)) -- { -- switch (newFormat.m_dataFormat) -- { -- case AE_FMT_AC3: -- case AE_FMT_DTS: -- break; -- -- case AE_FMT_EAC3: -- newFormat.m_sampleRate = 192000; -- break; -- -- case AE_FMT_TRUEHD: -- case AE_FMT_DTSHD: -- newFormat.m_sampleRate = 192000; -- break; -- -- default: -- break; -- } -- } -- -- IAESink *sink = CAESinkFactory::Create(device, newFormat, passthrough); -- return sink; --} -- --/* this method MUST be called while holding m_streamLock */ --inline CSoftAEStream *CSoftAE::GetMasterStream() --{ -- /* remove any destroyed streams first */ -- for (StreamList::iterator itt = m_streams.begin(); itt != m_streams.end();) -- { -- CSoftAEStream *stream = *itt; -- if (stream->IsDestroyed()) -- { -- RemoveStream(m_playingStreams, stream); -- RemoveStream(m_streams , stream); -- delete stream; -- continue; -- } -- ++itt; -- } -- -- if (!m_newStreams.empty()) -- return m_newStreams.back(); -- -- if (!m_streams.empty()) -- return m_streams.back(); -- -- return NULL; --} -- --/* save method to call outside of the main thread, use this one */ --void CSoftAE::OpenSink() --{ -- m_reOpenEvent.Reset(); -- m_reOpen = true; -- m_reOpenEvent.Wait(); -- m_wake.Set(); --} -- --void CSoftAE::InternalCloseSink() --{ -- /* close the old sink if it was open */ -- if (m_sink) -- { -- CExclusiveLock sinkLock(m_sinkLock); -- m_sink->Drain(); -- m_sink->Deinitialize(); -- delete m_sink; -- m_sink = NULL; -- } --} --/* this must NEVER be called from outside the main thread or Initialization */ --void CSoftAE::InternalOpenSink() --{ -- /* save off our raw/passthrough mode for checking */ -- bool wasTranscode = m_transcode; -- bool wasRawPassthrough = m_rawPassthrough; -- bool reInit = false; -- -- LoadSettings(); -- -- /* initialize for analog output */ -- m_rawPassthrough = false; -- m_streamStageFn = &CSoftAE::RunStreamStage; -- m_outputStageFn = &CSoftAE::RunOutputStage; -- -- /* initialize the new format for basic 2.0 output */ -- AEAudioFormat newFormat; -- newFormat.m_dataFormat = AE_FMT_FLOAT; -- newFormat.m_sampleRate = 44100; -- newFormat.m_encodedRate = 0; -- newFormat.m_channelLayout = m_stereoUpmix ? m_stdChLayout : AE_CH_LAYOUT_2_0; -- newFormat.m_frames = 0; -- newFormat.m_frameSamples = 0; -- newFormat.m_frameSize = 0; -- -- CSingleLock streamLock(m_streamLock); -- -- m_masterStream = GetMasterStream(); -- if (m_masterStream) -- { -- /* choose the sample rate & channel layout based on the master stream */ -- newFormat.m_sampleRate = m_masterStream->GetSampleRate(); -- if (!m_stereoUpmix) -- newFormat.m_channelLayout = m_masterStream->m_initChannelLayout; -- -- if (m_masterStream->IsRaw()) -- { -- newFormat.m_sampleRate = m_masterStream->GetSampleRate(); -- newFormat.m_encodedRate = m_masterStream->GetEncodedSampleRate(); -- newFormat.m_dataFormat = m_masterStream->GetDataFormat(); -- newFormat.m_channelLayout = m_masterStream->m_initChannelLayout; -- m_rawPassthrough = true; -- m_streamStageFn = &CSoftAE::RunRawStreamStage; -- m_outputStageFn = &CSoftAE::RunRawOutputStage; -- } -- else -- { -- if (!m_transcode) -- newFormat.m_channelLayout.ResolveChannels(m_stdChLayout); -- else -- { -- if (m_masterStream->m_initChannelLayout == AE_CH_LAYOUT_2_0) -- m_transcode = false; -- m_encoderInitSampleRateMul = 1.0 / newFormat.m_sampleRate; -- } -- } -- -- /* if the stream is paused we cant use it for anything else */ -- if (m_masterStream->m_paused) -- m_masterStream = NULL; -- } -- else -- m_transcode = false; -- -- if (!m_rawPassthrough && m_transcode) -- newFormat.m_dataFormat = AE_FMT_AC3; -- -- streamLock.Leave(); -- -- std::string device, driver; -- if (m_transcode || m_rawPassthrough) -- device = m_passthroughDevice; -- else -- device = m_device; -- -- CAESinkFactory::ParseDevice(device, driver); -- if (driver.empty() && m_sink) -- driver = m_sink->GetName(); -- -- if (m_rawPassthrough) -- CLog::Log(LOGINFO, "CSoftAE::InternalOpenSink - RAW passthrough enabled"); -- else if (m_transcode) -- CLog::Log(LOGINFO, "CSoftAE::InternalOpenSink - Transcode passthrough enabled"); -- -- /* -- try to use 48000hz if we are going to transcode, this prevents the sink -- from being re-opened repeatedly when switching sources, which locks up -- some receivers & crappy integrated sound drivers. Check for as.xml override -- */ -- if (m_transcode && !m_rawPassthrough) -- { -- enum AEChannel ac3Layout[3] = {AE_CH_RAW, AE_CH_RAW, AE_CH_NULL}; -- newFormat.m_channelLayout = ac3Layout; -- m_outputStageFn = &CSoftAE::RunTranscodeStage; -- if (!g_advancedSettings.m_allowTranscode44100) -- newFormat.m_sampleRate = 48000; -- } -- -- /* -- if there is an audio resample rate set, use it, this MAY NOT be honoured as -- the audio sink may not support the requested format, and may change it. -- */ -- if (g_advancedSettings.m_audioResample) -- { -- newFormat.m_sampleRate = g_advancedSettings.m_audioResample; -- CLog::Log(LOGINFO, "CSoftAE::InternalOpenSink - Forcing samplerate to %d", newFormat.m_sampleRate); -- } -- -- /* only re-open the sink if its not compatible with what we need */ -- std::string sinkName; -- if (m_sink) -- { -- sinkName = m_sink->GetName(); -- std::transform(sinkName.begin(), sinkName.end(), sinkName.begin(), ::toupper); -- } -- -- if (!m_sink || sinkName != driver || !m_sink->IsCompatible(newFormat, device)) -- { -- CLog::Log(LOGINFO, "CSoftAE::InternalOpenSink - sink incompatible, re-starting"); -- -- /* take the sink lock */ -- CExclusiveLock sinkLock(m_sinkLock); -- -- reInit = true; -- //close the sink cause it gets reinited -- InternalCloseSink(); -- -- /* get the display name of the device */ -- GetDeviceFriendlyName(device); -- -- /* if we already have a driver, prepend it to the device string */ -- if (!driver.empty()) -- device = driver + ":" + device; -- -- /* create the new sink */ -- m_sink = GetSink(newFormat, m_transcode || m_rawPassthrough, device); -- -- /* perform basic sanity checks on the format returned by the sink */ -- ASSERT(newFormat.m_channelLayout.Count() > 0); -- ASSERT(newFormat.m_dataFormat <= AE_FMT_FLOAT); -- ASSERT(newFormat.m_frames > 0); -- ASSERT(newFormat.m_frameSamples > 0); -- ASSERT(newFormat.m_frameSize == (CAEUtil::DataFormatToBits(newFormat.m_dataFormat) >> 3) * newFormat.m_channelLayout.Count()); -- ASSERT(newFormat.m_sampleRate > 0); -- -- CLog::Log(LOGDEBUG, "CSoftAE::InternalOpenSink - %s Initialized:", m_sink->GetName()); -- CLog::Log(LOGDEBUG, " Output Device : %s", m_deviceFriendlyName.c_str()); -- CLog::Log(LOGDEBUG, " Sample Rate : %d", newFormat.m_sampleRate); -- CLog::Log(LOGDEBUG, " Sample Format : %s", CAEUtil::DataFormatToStr(newFormat.m_dataFormat)); -- CLog::Log(LOGDEBUG, " Channel Count : %d", newFormat.m_channelLayout.Count()); -- CLog::Log(LOGDEBUG, " Channel Layout: %s", ((std::string)newFormat.m_channelLayout).c_str()); -- CLog::Log(LOGDEBUG, " Frames : %d", newFormat.m_frames); -- CLog::Log(LOGDEBUG, " Frame Samples : %d", newFormat.m_frameSamples); -- CLog::Log(LOGDEBUG, " Frame Size : %d", newFormat.m_frameSize); -- -- m_sinkFormat = newFormat; -- m_sinkFormatSampleRateMul = 1.0 / (double)newFormat.m_sampleRate; -- m_sinkBlockSize = newFormat.m_frames * newFormat.m_frameSize; -- m_sinkBlockTime = 1000 * newFormat.m_frames / newFormat.m_sampleRate; -- // check if sink controls volume, if so, init the volume. -- m_sinkHandlesVolume = m_sink->HasVolume(); -- if (m_sinkHandlesVolume) -- m_sink->SetVolume(m_volume); -- -- /* invalidate the buffer */ -- m_buffer.Empty(); -- } -- else -- CLog::Log(LOGINFO, "CSoftAE::InternalOpenSink - keeping old sink with : %s, %s, %dhz", -- CAEUtil::DataFormatToStr(newFormat.m_dataFormat), -- ((std::string)newFormat.m_channelLayout).c_str(), -- newFormat.m_sampleRate); -- -- reInit = (reInit || m_chLayout != m_sinkFormat.m_channelLayout); -- m_chLayout = m_sinkFormat.m_channelLayout; -- -- size_t neededBufferSize = 0; -- if (m_rawPassthrough) -- { -- if (!wasRawPassthrough) -- m_buffer.Empty(); -- -- m_convertFn = NULL; -- m_bytesPerSample = CAEUtil::DataFormatToBits(m_sinkFormat.m_dataFormat) >> 3; -- m_frameSize = m_sinkFormat.m_frameSize; -- m_frameSizeMul = 1.0 / (double)m_frameSize; -- neededBufferSize = m_sinkFormat.m_frames * m_sinkFormat.m_frameSize; -- } -- else -- { -- /* if we are transcoding */ -- if (m_transcode) -- { -- if (!wasTranscode || wasRawPassthrough) -- { -- /* invalidate the buffer */ -- m_buffer.Empty(); -- if (m_encoder) -- m_encoder->Reset(); -- } -- -- /* configure the encoder */ -- AEAudioFormat encoderFormat; -- encoderFormat.m_dataFormat = AE_FMT_FLOAT; -- encoderFormat.m_sampleRate = m_sinkFormat.m_sampleRate; -- encoderFormat.m_encodedRate = 0; -- encoderFormat.m_channelLayout = m_chLayout; -- encoderFormat.m_frames = 0; -- encoderFormat.m_frameSamples = 0; -- encoderFormat.m_frameSize = 0; -- -- if (!m_encoder || !m_encoder->IsCompatible(encoderFormat)) -- { -- m_buffer.Empty(); -- SetupEncoder(encoderFormat); -- m_encoderFormat = encoderFormat; -- if (encoderFormat.m_frameSize > 0) -- m_encoderFrameSizeMul = 1.0 / (double)m_sinkFormat.m_frameSize; -- else -- m_encoderFrameSizeMul = 1.0; -- } -- -- /* remap directly to the format we need for encode */ -- reInit = (reInit || m_chLayout != m_encoderFormat.m_channelLayout); -- m_chLayout = m_encoderFormat.m_channelLayout; -- m_convertFn = CAEConvert::FrFloat(m_encoderFormat.m_dataFormat); -- neededBufferSize = m_encoderFormat.m_frames * sizeof(float) * m_chLayout.Count(); -- CLog::Log(LOGDEBUG, "CSoftAE::InternalOpenSink - Encoding using layout: %s", ((std::string)m_chLayout).c_str()); -- } -- else -- { -- m_convertFn = CAEConvert::FrFloat(m_sinkFormat.m_dataFormat); -- neededBufferSize = m_sinkFormat.m_frames * sizeof(float) * m_chLayout.Count(); -- CLog::Log(LOGDEBUG, "CSoftAE::InternalOpenSink - Using speaker layout: %s", CAEUtil::GetStdChLayoutName(m_stdChLayout)); -- } -- -- m_bytesPerSample = CAEUtil::DataFormatToBits(AE_FMT_FLOAT) >> 3; -- m_frameSize = m_bytesPerSample * m_chLayout.Count(); -- m_frameSizeMul = 1.0 / (double)m_frameSize; -- } -- -- CLog::Log(LOGDEBUG, "CSoftAE::InternalOpenSink - Internal Buffer Size: %d", (int)neededBufferSize); -- if (m_buffer.Size() < neededBufferSize) -- m_buffer.Alloc(neededBufferSize); -- -- if (reInit) -- { -- if (!m_rawPassthrough) -- { -- /* re-init incompatible sounds */ -- CSingleLock soundLock(m_soundLock); -- for (SoundList::iterator itt = m_sounds.begin(); itt != m_sounds.end(); ++itt) -- { -- CSoftAESound *sound = *itt; -- if (!sound->IsCompatible()) -- { -- StopSound(sound); -- sound->Initialize(); -- } -- } -- } -- -- /* re-init streams */ -- streamLock.Enter(); -- for (StreamList::iterator itt = m_streams.begin(); itt != m_streams.end(); ++itt) -- (*itt)->Initialize(); -- streamLock.Leave(); -- } -- -- /* any new streams need to be initialized */ -- for (StreamList::iterator itt = m_newStreams.begin(); itt != m_newStreams.end(); ++itt) -- { -- (*itt)->Initialize(); -- m_streams.push_back(*itt); -- if (!(*itt)->m_paused) -- m_playingStreams.push_back(*itt); -- } -- m_newStreams.clear(); -- m_streamsPlaying = !m_playingStreams.empty(); -- -- m_softSuspend = false; -- -- /* notify any event listeners that we are done */ -- m_reOpen = false; -- m_reOpenEvent.Set(); -- m_wake.Set(); --} -- --void CSoftAE::ResetEncoder() --{ -- if (m_encoder) -- m_encoder->Reset(); -- m_encodedBuffer.Empty(); --} -- --bool CSoftAE::SetupEncoder(AEAudioFormat &format) --{ -- ResetEncoder(); -- delete m_encoder; -- m_encoder = NULL; -- -- if (!m_transcode) -- return false; -- -- m_encoder = new CAEEncoderFFmpeg(); -- if (m_encoder->Initialize(format)) -- return true; -- -- delete m_encoder; -- m_encoder = NULL; -- return false; --} -- --void CSoftAE::Shutdown() --{ -- Deinitialize(); --} -- --bool CSoftAE::Initialize() --{ -- CSingleLock lock(m_threadLock); -- InternalOpenSink(); -- m_running = true; -- m_thread = new CThread(this, "SoftAE"); -- m_thread->Create(); -- m_thread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL); -- return true; --} -- --void CSoftAE::OnSettingsChange(const std::string& setting) --{ -- if (setting == "audiooutput.passthroughdevice" || -- setting == "audiooutput.audiodevice" || -- setting == "audiooutput.mode" || -- setting == "audiooutput.ac3passthrough" || -- setting == "audiooutput.dtspassthrough" || -- setting == "audiooutput.passthroughaac" || -- setting == "audiooutput.truehdpassthrough" || -- setting == "audiooutput.dtshdpassthrough" || -- setting == "audiooutput.channels" || -- setting == "audiooutput.multichannellpcm" || -- setting == "audiooutput.stereoupmix") -- { -- OpenSink(); -- } -- -- if (setting == "audiooutput.normalizelevels" || setting == "audiooutput.stereoupmix") -- { -- /* re-init stream reamppers */ -- CSingleLock streamLock(m_streamLock); -- for (StreamList::iterator itt = m_streams.begin(); itt != m_streams.end(); ++itt) -- (*itt)->InitializeRemap(); -- } --} -- --void CSoftAE::LoadSettings() --{ -- m_audiophile = g_advancedSettings.m_audioAudiophile; -- if (m_audiophile) -- CLog::Log(LOGINFO, "CSoftAE::LoadSettings - Audiophile switch enabled"); -- -- m_stereoUpmix = CSettings::Get().GetBool("audiooutput.stereoupmix"); -- if (m_stereoUpmix) -- CLog::Log(LOGINFO, "CSoftAE::LoadSettings - Stereo upmix is enabled"); -- -- /* load the configuration */ -- m_stdChLayout = AE_CH_LAYOUT_2_0; -- switch (CSettings::Get().GetInt("audiooutput.channels")) -- { -- default: -- case 0: m_stdChLayout = AE_CH_LAYOUT_2_0; break; /* dont alow 1_0 output */ -- case 1: m_stdChLayout = AE_CH_LAYOUT_2_0; break; -- case 2: m_stdChLayout = AE_CH_LAYOUT_2_1; break; -- case 3: m_stdChLayout = AE_CH_LAYOUT_3_0; break; -- case 4: m_stdChLayout = AE_CH_LAYOUT_3_1; break; -- case 5: m_stdChLayout = AE_CH_LAYOUT_4_0; break; -- case 6: m_stdChLayout = AE_CH_LAYOUT_4_1; break; -- case 7: m_stdChLayout = AE_CH_LAYOUT_5_0; break; -- case 8: m_stdChLayout = AE_CH_LAYOUT_5_1; break; -- case 9: m_stdChLayout = AE_CH_LAYOUT_7_0; break; -- case 10: m_stdChLayout = AE_CH_LAYOUT_7_1; break; -- } -- -- // force optical/coax to 2.0 output channels -- if (!m_rawPassthrough && CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958) -- m_stdChLayout = AE_CH_LAYOUT_2_0; -- -- /* get the output devices and ensure they exist */ -- m_device = CSettings::Get().GetString("audiooutput.audiodevice"); -- m_passthroughDevice = CSettings::Get().GetString("audiooutput.passthroughdevice"); -- VerifySoundDevice(m_device , false); -- VerifySoundDevice(m_passthroughDevice, true ); -- -- m_transcode = ( -- CSettings::Get().GetBool("audiooutput.ac3passthrough") /*|| -- CSettings::Get().GetBool("audiooutput.dtspassthrough") */ -- ) && ( -- (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958) || -- (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI && !CSettings::Get().GetBool("audiooutput.multichannellpcm")) -- ); --} -- --void CSoftAE::VerifySoundDevice(std::string& device, bool passthrough) --{ -- /* check that the specified device exists */ -- std::string firstDevice; -- for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -- { -- AESinkInfo sinkInfo = *itt; -- for (AEDeviceInfoList::iterator itt2 = sinkInfo.m_deviceInfoList.begin(); itt2 != sinkInfo.m_deviceInfoList.end(); ++itt2) -- { -- CAEDeviceInfo& devInfo = *itt2; -- if (passthrough && devInfo.m_deviceType == AE_DEVTYPE_PCM) -- continue; -- std::string deviceName = sinkInfo.m_sinkName + ":" + devInfo.m_deviceName; -- -- /* remember the first device so we can default to it if required */ -- if (firstDevice.empty()) -- firstDevice = deviceName; -- -- if (device == deviceName) -- return; -- } -- } -- -- /* if the device wasnt found, set it to the first viable output */ -- device = firstDevice; --} -- --inline void CSoftAE::GetDeviceFriendlyName(std::string &device) --{ -- m_deviceFriendlyName = "Device not found"; -- /* Match the device and find its friendly name */ -- for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -- { -- AESinkInfo sinkInfo = *itt; -- for (AEDeviceInfoList::iterator itt2 = sinkInfo.m_deviceInfoList.begin(); itt2 != sinkInfo.m_deviceInfoList.end(); ++itt2) -- { -- CAEDeviceInfo& devInfo = *itt2; -- if (devInfo.m_deviceName == device) -- { -- m_deviceFriendlyName = devInfo.m_displayName; -- break; -- } -- } -- } -- return; --} -- --void CSoftAE::Deinitialize() --{ -- CSingleLock lock(m_threadLock); -- if (m_thread) -- { -- Stop(); -- m_thread->StopThread(true); -- delete m_thread; -- m_thread = NULL; -- } -- lock.Leave(); -- -- CExclusiveLock sinkLock(m_sinkLock); -- if (m_sink) -- { -- /* shutdown the sink */ -- m_sink->Deinitialize(); -- delete m_sink; -- m_sink = NULL; -- } -- -- delete m_encoder; -- m_encoder = NULL; -- ResetEncoder(); -- m_buffer.DeAlloc(); -- -- _aligned_free(m_converted); -- m_converted = NULL; -- m_convertedSize = 0; -- -- m_sinkInfoList.clear(); --} -- --void CSoftAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough) --{ -- for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -- { -- AESinkInfo sinkInfo = *itt; -- for (AEDeviceInfoList::iterator itt2 = sinkInfo.m_deviceInfoList.begin(); itt2 != sinkInfo.m_deviceInfoList.end(); ++itt2) -- { -- CAEDeviceInfo devInfo = *itt2; -- if (passthrough && devInfo.m_deviceType == AE_DEVTYPE_PCM) -- continue; -- -- std::string device = sinkInfo.m_sinkName + ":" + devInfo.m_deviceName; -- -- std::stringstream ss; -- -- /* add the sink name if we have more then one sink type */ -- if (m_sinkInfoList.size() > 1) -- ss << sinkInfo.m_sinkName << ": "; -- -- ss << devInfo.m_displayName; -- if (!devInfo.m_displayNameExtra.empty()) -- ss << ", " << devInfo.m_displayNameExtra; -- -- devices.push_back(AEDevice(ss.str(), device)); -- } -- } --} -- --std::string CSoftAE::GetDefaultDevice(bool passthrough) --{ -- for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -- { -- AESinkInfo sinkInfo = *itt; -- for (AEDeviceInfoList::iterator itt2 = sinkInfo.m_deviceInfoList.begin(); itt2 != sinkInfo.m_deviceInfoList.end(); ++itt2) -- { -- CAEDeviceInfo devInfo = *itt2; -- if (passthrough && devInfo.m_deviceType == AE_DEVTYPE_PCM) -- continue; -- -- std::string device = sinkInfo.m_sinkName + ":" + devInfo.m_deviceName; -- return device; -- } -- } -- return "default"; --} -- --bool CSoftAE::SupportsRaw() --{ -- /* CSoftAE supports raw formats */ -- return true; --} -- --void CSoftAE::PauseStream(CSoftAEStream *stream) --{ -- CSingleLock streamLock(m_streamLock); -- RemoveStream(m_playingStreams, stream); -- stream->m_paused = true; -- -- m_reOpen = true; -- m_wake.Set(); --} -- --void CSoftAE::ResumeStream(CSoftAEStream *stream) --{ -- CSingleLock streamLock(m_streamLock); -- m_playingStreams.push_back(stream); -- stream->m_paused = false; -- streamLock.Leave(); -- -- m_streamsPlaying = true; -- m_reOpen = true; -- m_wake.Set(); --} -- --void CSoftAE::Stop() --{ -- m_running = false; -- m_isSuspended = false; -- m_wake.Set(); -- -- /* wait for the thread to stop */ -- CSingleLock lock(m_runningLock); --} -- --void CSoftAE::SetSoundMode(const int mode) --{ -- m_soundMode = mode; -- -- /* stop all currently playing sounds if they are being turned off */ -- if (mode == AE_SOUND_OFF || (mode == AE_SOUND_IDLE && m_streamsPlaying)) -- StopAllSounds(); --} -- --IAEStream *CSoftAE::MakeStream(enum AEDataFormat dataFormat, unsigned int sampleRate, unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options/* = 0 */) --{ -- CAEChannelInfo channelInfo(channelLayout); -- CLog::Log(LOGINFO, "CSoftAE::MakeStream - %s, %u, %s", -- CAEUtil::DataFormatToStr(dataFormat), -- sampleRate, ((std::string)channelInfo).c_str()); -- -- /* ensure we have the encoded sample rate if the format is RAW */ -- if (AE_IS_RAW(dataFormat)) -- ASSERT(encodedSampleRate); -- -- CSingleLock streamLock(m_streamLock); -- CSoftAEStream *stream = new CSoftAEStream(dataFormat, sampleRate, encodedSampleRate, channelLayout, options, m_streamLock); -- m_newStreams.push_back(stream); -- streamLock.Leave(); -- // this is really needed here -- OpenSink(); -- return stream; --} -- --IAESound *CSoftAE::MakeSound(const std::string& file) --{ -- CSingleLock soundLock(m_soundLock); -- -- CSoftAESound *sound = new CSoftAESound(file); -- if (!sound->Initialize()) -- { -- delete sound; -- return NULL; -- } -- -- m_sounds.push_back(sound); -- return sound; --} -- --void CSoftAE::PlaySound(IAESound *sound) --{ -- if (m_soundMode == AE_SOUND_OFF || (m_soundMode == AE_SOUND_IDLE && m_streamsPlaying)) -- return; -- -- float *samples = ((CSoftAESound*)sound)->GetSamples(); -- if (!samples) -- return; -- -- /* add the sound to the play list */ -- CSingleLock soundSampleLock(m_soundSampleLock); -- SoundState ss = { -- ((CSoftAESound*)sound), -- samples, -- ((CSoftAESound*)sound)->GetSampleCount() -- }; -- m_playing_sounds.push_back(ss); -- -- /* wake to play the sound */ -- m_softSuspend = false; -- m_wake.Set(); --} -- --void CSoftAE::FreeSound(IAESound *sound) --{ -- if (!sound) -- return; -- -- sound->Stop(); -- CSingleLock soundLock(m_soundLock); -- for (SoundList::iterator itt = m_sounds.begin(); itt != m_sounds.end(); ++itt) -- if (*itt == sound) -- { -- m_sounds.erase(itt); -- break; -- } -- -- delete (CSoftAESound*)sound; --} -- --void CSoftAE::GarbageCollect() --{ --} -- --unsigned int CSoftAE::GetSampleRate() --{ -- if (m_transcode && m_encoder && !m_rawPassthrough) -- return m_encoderFormat.m_sampleRate; -- -- return m_sinkFormat.m_sampleRate; --} -- --void CSoftAE::StopSound(IAESound *sound) --{ -- CSingleLock lock(m_soundSampleLock); -- for (SoundStateList::iterator itt = m_playing_sounds.begin(); itt != m_playing_sounds.end(); ) -- { -- if ((*itt).owner == sound) -- { -- (*itt).owner->ReleaseSamples(); -- itt = m_playing_sounds.erase(itt); -- } -- else -- ++itt; -- } --} -- --IAEStream *CSoftAE::FreeStream(IAEStream *stream) --{ -- CSingleLock lock(m_streamLock); -- RemoveStream(m_playingStreams, (CSoftAEStream*)stream); -- RemoveStream(m_streams , (CSoftAEStream*)stream); -- // Reopen is old behaviour. Not opening when masterstream stops means clipping on S/PDIF. -- if(!m_isSuspended && (m_masterStream == stream)) -- { -- m_reOpen = true; -- m_masterStream = NULL; -- } -- -- delete (CSoftAEStream*)stream; -- return NULL; --} -- --double CSoftAE::GetDelay() --{ -- double delayBuffer = 0.0, delaySink = 0.0, delayTranscoder = 0.0; -- -- CSharedLock sinkLock(m_sinkLock); -- if (m_sink) -- delaySink = m_sink->GetDelay(); -- -- if (m_transcode && m_encoder && !m_rawPassthrough) -- { -- delayBuffer = (double)m_buffer.Used() * m_frameSizeMul * m_encoderInitSampleRateMul; -- delayTranscoder = m_encoder->GetDelay((double)m_encodedBuffer.Used() * m_encoderFrameSizeMul); -- } -- else -- delayBuffer = (double)m_buffer.Used() * m_frameSizeMul *m_sinkFormatSampleRateMul; -- -- return delayBuffer + delaySink + delayTranscoder; --} -- --double CSoftAE::GetCacheTime() --{ -- double timeBuffer = 0.0, timeSink = 0.0, timeTranscoder = 0.0; -- -- CSharedLock sinkLock(m_sinkLock); -- if (m_sink) -- timeSink = m_sink->GetCacheTime(); -- -- if (m_transcode && m_encoder && !m_rawPassthrough) -- { -- timeBuffer = (double)m_buffer.Used() * m_frameSizeMul * m_encoderInitSampleRateMul; -- timeTranscoder = m_encoder->GetDelay((double)m_encodedBuffer.Used() * m_encoderFrameSizeMul); -- } -- else -- timeBuffer = (double)m_buffer.Used() * m_frameSizeMul *m_sinkFormatSampleRateMul; -- -- return timeBuffer + timeSink + timeTranscoder; --} -- --double CSoftAE::GetCacheTotal() --{ -- double timeBuffer = 0.0, timeSink = 0.0, timeTranscoder = 0.0; -- -- CSharedLock sinkLock(m_sinkLock); -- if (m_sink) -- timeSink = m_sink->GetCacheTotal(); -- -- if (m_transcode && m_encoder && !m_rawPassthrough) -- { -- timeBuffer = (double)m_buffer.Size() * m_frameSizeMul * m_encoderInitSampleRateMul; -- timeTranscoder = m_encoder->GetDelay((double)m_encodedBuffer.Size() * m_encoderFrameSizeMul); -- } -- else -- timeBuffer = (double)m_buffer.Size() * m_frameSizeMul *m_sinkFormatSampleRateMul; -- -- return timeBuffer + timeSink + timeTranscoder; --} -- --bool CSoftAE::IsSuspended() --{ -- return m_isSuspended; --} -- --float CSoftAE::GetVolume() --{ -- return m_volume; --} -- --void CSoftAE::SetVolume(float volume) --{ -- m_volume = volume; -- if (!m_sinkHandlesVolume) -- return; -- -- CSharedLock sinkLock(m_sinkLock); -- if (m_sink) -- m_sink->SetVolume(m_volume); --} -- --void CSoftAE::StopAllSounds() --{ -- CSingleLock lock(m_soundSampleLock); -- while (!m_playing_sounds.empty()) -- { -- SoundState *ss = &(*m_playing_sounds.begin()); -- ss->owner->ReleaseSamples(); -- m_playing_sounds.pop_front(); -- } --} -- --bool CSoftAE::Suspend() --{ -- CLog::Log(LOGDEBUG, "CSoftAE::Suspend - Suspending AE processing"); -- m_isSuspended = true; -- -- StopAllSounds(); -- -- CSingleLock streamLock(m_streamLock); -- for (StreamList::iterator itt = m_playingStreams.begin(); itt != m_playingStreams.end(); ++itt) -- { -- CSoftAEStream *stream = *itt; -- stream->Flush(); -- } -- streamLock.Leave(); -- #if defined(TARGET_LINUX) -- /*workaround sinks not playing sound after resume */ -- bool ret = true; -- if(m_sink) -- { -- /* Deinitialize and delete current m_sink */ -- // we don't want that Run reopens our device, so we wait. -- m_saveSuspend.Reset(); -- // wait until we are looping in ProcessSuspend() -- // this is more save to not come up unclean -- // we cannot wait forever -- ret = m_saveSuspend.WaitMSec(500); -- if(ret) -- { -- CLog::Log(LOGDEBUG, "CSoftAE::Suspend - After Event"); -- CExclusiveLock sinkLock(m_sinkLock); -- // remove all the sinks -- for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -- { -- itt->m_deviceInfoList.pop_back(); -- } -- InternalCloseSink(); -- } -- else -- { -- CLog::Log(LOGDEBUG, "CSoftAE::Suspend - Unload failed will continue"); -- m_saveSuspend.Reset(); -- } -- } -- // The device list is now empty and must be reenumerated afterwards. -- if(ret) -- m_sinkInfoList.clear(); -- -- // signal anybody, that we are gone now (beware of deadlocks) -- // we don't unset the fields here, to care for reinit after resume -- if(m_reOpen) -- m_reOpenEvent.Set(); -- #endif -- -- return true; --} -- --bool CSoftAE::Resume() --{ --#if defined(TARGET_LINUX) -- // We must make sure, that we don't return empty. -- if(m_sinkInfoList.empty()) -- { -- CLog::Log(LOGDEBUG, "CSoftAE::Resume - Re Enumerating Sinks"); -- CExclusiveLock sinkLock(m_sinkLock); -- // Forced enumeration - we are sure that we start completely fresh. -- CAESinkFactory::EnumerateEx(m_sinkInfoList, true); -- sinkLock.Leave(); // we leave here explicitly to not lock while printing new sinks -- PrintSinks(); -- } --#endif -- CLog::Log(LOGDEBUG, "CSoftAE::Resume - Resuming AE processing"); -- m_isSuspended = false; -- // we flag reopen -- m_reOpen = true; -- -- return true; --} -- --void CSoftAE::Run() --{ -- /* we release this when we exit the thread unblocking anyone waiting on "Stop" */ -- CSingleLock runningLock(m_runningLock); -- CLog::Log(LOGINFO, "CSoftAE::Run - Thread Started"); -- -- bool hasAudio = false; -- while (m_running) -- { -- bool restart = false; -- -- /* with the new non blocking implementation - we just reOpen here, when it tells reOpen */ -- if ((this->*m_outputStageFn)(hasAudio) > 0) -- hasAudio = false; /* taken some audio - reset our silence flag */ -- -- /* if we have enough room in the buffer */ -- if (m_buffer.Free() >= m_frameSize) -- { -- /* take some data for our use from the buffer */ -- uint8_t *out = (uint8_t*)m_buffer.Take(m_frameSize); -- memset(out, 0, m_frameSize); -- -- /* run the stream stage */ -- CSoftAEStream *oldMaster = m_masterStream; -- if ((this->*m_streamStageFn)(m_chLayout.Count(), out, restart) > 0) -- hasAudio = true; /* have some audio */ -- -- /* if in audiophile mode and the master stream has changed, flag for restart */ -- if (m_audiophile && oldMaster != m_masterStream) -- restart = true; -- } -- -- /* Handle idle or forced suspend */ -- ProcessSuspend(); -- -- /* if we are told to restart */ -- if (m_reOpen || restart || !m_sink) -- { -- if(m_sinkIsSuspended && m_sink) -- { -- // hint for fritsch: remember lazy evaluation -- m_reOpen = !m_sink->SoftResume() || m_reOpen; -- m_sinkIsSuspended = false; -- CLog::Log(LOGDEBUG, "CSoftAE::Run - Sink was forgotten"); -- } -- CLog::Log(LOGDEBUG, "CSoftAE::Run - Sink restart flagged"); -- InternalOpenSink(); -- } -- --#if defined(TARGET_ANDROID) -- else if (m_playingStreams.empty() -- && m_playing_sounds.empty() -- && !g_advancedSettings.m_streamSilence) -- { -- // if we have nothing to do, take a dirt nap. -- // we do not have to take a lock just to check empty. -- // this keeps AE from sucking CPU if nothing is going on. -- m_wake.WaitMSec(SOFTAE_IDLE_WAIT_MSEC); -- } --#endif -- } --} -- --void CSoftAE::AllocateConvIfNeeded(size_t convertedSize, bool prezero) --{ -- if (m_convertedSize < convertedSize) -- { -- _aligned_free(m_converted); -- m_converted = (uint8_t *)_aligned_malloc(convertedSize, 16); -- m_convertedSize = convertedSize; -- } -- if (prezero) -- memset(m_converted, 0x00, convertedSize); --} -- --unsigned int CSoftAE::MixSounds(float *buffer, unsigned int samples) --{ -- // no point doing anything if we have no sounds, -- // we do not have to take a lock just to check empty -- if (m_playing_sounds.empty()) -- return 0; -- -- SoundStateList::iterator itt; -- unsigned int mixed = 0; -- CSingleLock lock(m_soundSampleLock); -- for (itt = m_playing_sounds.begin(); itt != m_playing_sounds.end(); ) -- { -- SoundState *ss = &(*itt); -- float *out = buffer; -- -- /* no more frames, so remove it from the list */ -- if (ss->sampleCount == 0) -- { -- ss->owner->ReleaseSamples(); -- itt = m_playing_sounds.erase(itt); -- continue; -- } -- -- float volume = ss->owner->GetVolume(); -- unsigned int mixSamples = std::min(ss->sampleCount, samples); -- #ifdef __SSE__ -- CAEUtil::SSEMulAddArray(out, ss->samples, volume, mixSamples); -- #else -- float *sample_buffer = ss->samples; -- for (unsigned int i = 0; i < mixSamples; ++i) -- *out++ += *sample_buffer++ * volume; -- #endif -- -- ss->sampleCount -= mixSamples; -- ss->samples += mixSamples; -- -- ++itt; -- ++mixed; -- } -- return mixed; --} -- --bool CSoftAE::FinalizeSamples(float *buffer, unsigned int samples, bool hasAudio) --{ -- if (m_soundMode != AE_SOUND_OFF) -- hasAudio |= (MixSounds(buffer, samples) > 0); -- -- /* no need to process if we don't have audio (buffer is memset to 0) */ -- if (!hasAudio) -- return false; -- -- if (m_muted) -- { -- memset(buffer, 0, samples * sizeof(float)); -- return false; -- } -- -- /* deamplify */ -- if (!m_sinkHandlesVolume && m_volume < 1.0) -- { -- #ifdef __SSE__ -- CAEUtil::SSEMulArray(buffer, m_volume, samples); -- #else -- float *fbuffer = buffer; -- for (unsigned int i = 0; i < samples; i++) -- *fbuffer++ *= m_volume; -- #endif -- } -- -- /* check if we need to clamp */ -- bool clamp = false; -- float *fbuffer = buffer; -- for (unsigned int i = 0; i < samples; i++, fbuffer++) -- { -- if (*fbuffer < -1.0f || *fbuffer > 1.0f) -- { -- clamp = true; -- break; -- } -- } -- -- /* if there were no samples outside of the range, dont clamp the buffer */ -- if (!clamp) -- return true; -- -- CLog::Log(LOGDEBUG, "CSoftAE::FinalizeSamples - Clamping buffer of %d samples", samples); -- CAEUtil::ClampArray(buffer, samples); -- return true; --} -- --unsigned int CSoftAE::WriteSink(CAEBuffer& src, unsigned int src_len, uint8_t *data, bool hasAudio) --{ -- CExclusiveLock lock(m_sinkLock); /* lock to maintain delay consistency */ -- -- XbmcThreads::EndTime timeout(m_sinkBlockTime * 2); -- while(m_sink && src.Used() >= src_len) -- { -- int frames = m_sink->AddPackets(data, m_sinkFormat.m_frames, hasAudio); -- -- /* Return value of INT_MAX signals error in sink - restart */ -- if (frames == INT_MAX) -- { -- CLog::Log(LOGERROR, "CSoftAE::WriteSink - sink error - reinit flagged"); -- m_reOpen = true; -- break; -- } -- -- if (frames) -- { -- src.Shift(NULL, src_len); -- return frames; -- } -- -- if(timeout.IsTimePast()) -- { -- CLog::Log(LOGERROR, "CSoftAE::WriteSink - sink blocked- reinit flagged"); -- m_reOpen = true; -- break; -- } -- -- lock.Leave(); -- Sleep(m_sinkBlockTime / 4); -- lock.Enter(); -- } -- return 0; --} -- --int CSoftAE::RunOutputStage(bool hasAudio) --{ -- const unsigned int needSamples = m_sinkFormat.m_frames * m_sinkFormat.m_channelLayout.Count(); -- const size_t needBytes = needSamples * sizeof(float); -- if (m_buffer.Used() < needBytes) -- return 0; -- -- void *data = m_buffer.Raw(needBytes); -- hasAudio = FinalizeSamples((float*)data, needSamples, hasAudio); -- -- if (m_convertFn) -- { -- const unsigned int convertedBytes = m_sinkFormat.m_frames * m_sinkFormat.m_frameSize; -- AllocateConvIfNeeded(convertedBytes, !hasAudio); -- if (hasAudio) -- m_convertFn((float*)data, needSamples, m_converted); -- data = m_converted; -- } -- -- return WriteSink(m_buffer, needBytes, (uint8_t*)data, hasAudio); --} -- --int CSoftAE::RunRawOutputStage(bool hasAudio) --{ -- if(m_buffer.Used() < m_sinkBlockSize) -- return 0; -- -- void *data = m_buffer.Raw(m_sinkBlockSize); -- -- if (CAEUtil::S16NeedsByteSwap(AE_FMT_S16NE, m_sinkFormat.m_dataFormat)) -- { -- /* -- * It would really be preferable to handle this at packing stage, so that -- * it could byteswap the data efficiently without wasting CPU time on -- * swapping the huge IEC 61937 zero padding between frames (or not -- * byteswap at all, if there are two byteswaps). -- * -- * Unfortunately packing is done on a higher level and we can't easily -- * tell it the needed format from here, so do it here for now (better than -- * nothing)... -- */ -- AllocateConvIfNeeded(m_sinkBlockSize, !hasAudio); -- if (hasAudio) -- Endian_Swap16_buf((uint16_t *)m_converted, (uint16_t *)data, m_sinkBlockSize / 2); -- data = m_converted; -- } -- -- return WriteSink(m_buffer, m_sinkBlockSize, (uint8_t*)data, hasAudio); --} -- --int CSoftAE::RunTranscodeStage(bool hasAudio) --{ -- if (!m_encoder) return 0; -- -- /* if we dont have enough samples to encode yet, return */ -- unsigned int block = m_encoderFormat.m_frames * m_encoderFormat.m_frameSize; -- unsigned int sinkBlock = m_sinkFormat.m_frames * m_sinkFormat.m_frameSize; -- -- int encodedFrames = 0; -- if (m_buffer.Used() >= block && m_encodedBuffer.Used() < sinkBlock * 2) -- { -- hasAudio = FinalizeSamples((float*)m_buffer.Raw(block), m_encoderFormat.m_frameSamples, hasAudio); -- -- void *buffer; -- if (m_convertFn) -- { -- unsigned int newsize = m_encoderFormat.m_frames * m_encoderFormat.m_frameSize; -- AllocateConvIfNeeded(newsize, !hasAudio); -- if (hasAudio) -- m_convertFn((float*)m_buffer.Raw(block), -- m_encoderFormat.m_frames * m_encoderFormat.m_channelLayout.Count(), m_converted); -- buffer = m_converted; -- } -- else -- buffer = m_buffer.Raw(block); -- -- encodedFrames = m_encoder->Encode((float*)buffer, m_encoderFormat.m_frames); -- -- uint8_t *packet; -- unsigned int size = m_encoder->GetData(&packet); -- -- CExclusiveLock sinkLock(m_sinkLock); /* lock to maintain delay consistency */ -- -- /* if there is not enough space for another encoded packet enlarge the buffer */ -- if (m_encodedBuffer.Free() < size) -- m_encodedBuffer.ReAlloc(m_encodedBuffer.Used() + size); -- -- m_buffer.Shift(NULL, encodedFrames * m_encoderFormat.m_frameSize); -- m_encodedBuffer.Push(packet, size); -- } -- -- /* if we have enough data to write */ -- if (m_encodedBuffer.Used() >= sinkBlock) -- WriteSink(m_encodedBuffer, sinkBlock, (uint8_t*)m_encodedBuffer.Raw(sinkBlock), hasAudio); -- -- return encodedFrames; --} -- --void CSoftAE::PrintSinks() --{ -- for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt) -- { -- CLog::Log(LOGNOTICE, "Enumerated %s devices:", itt->m_sinkName.c_str()); -- int count = 0; -- for (AEDeviceInfoList::iterator itt2 = itt->m_deviceInfoList.begin(); itt2 != itt->m_deviceInfoList.end(); ++itt2) -- { -- CLog::Log(LOGNOTICE, " Device %d", ++count); -- CAEDeviceInfo& info = *itt2; -- std::stringstream ss((std::string)info); -- std::string line; -- while(std::getline(ss, line, '\n')) -- CLog::Log(LOGNOTICE, " %s", line.c_str()); -- } -- } --} -- --unsigned int CSoftAE::RunRawStreamStage(unsigned int channelCount, void *out, bool &restart) --{ -- StreamList resumeStreams; -- static StreamList::iterator itt; -- CSingleLock streamLock(m_streamLock); -- /* handle playing streams */ -- for (itt = m_playingStreams.begin(); itt != m_playingStreams.end(); ++itt) -- { -- CSoftAEStream *sitt = *itt; -- if (sitt == m_masterStream) -- continue; -- -- /* consume data from streams even though we cant use it */ -- uint8_t *frame = sitt->GetFrame(); -- -- /* flag the stream's slave to be resumed if it has drained */ -- if (!frame && sitt->IsDrained() && sitt->m_slave && sitt->m_slave->IsPaused()) -- resumeStreams.push_back(sitt); -- } -- -- /* nothing to do if we dont have a master stream */ -- if (!m_masterStream) -- return 0; -- -- /* get the frame and append it to the output */ -- uint8_t *frame = m_masterStream->GetFrame(); -- unsigned int mixed; -- if (frame) -- { -- mixed = 1; -- memcpy(out, frame, m_sinkFormat.m_frameSize); -- } -- else -- { -- mixed = 0; -- if (m_masterStream->IsDrained() && m_masterStream->m_slave && m_masterStream->m_slave->IsPaused()) -- resumeStreams.push_back(m_masterStream); -- } -- -- ResumeSlaveStreams(resumeStreams); -- return mixed; --} -- --unsigned int CSoftAE::RunStreamStage(unsigned int channelCount, void *out, bool &restart) --{ -- // no point doing anything if we have no streams, -- // we do not have to take a lock just to check empty -- if (m_playingStreams.empty()) -- return 0; -- -- float *dst = (float*)out; -- unsigned int mixed = 0; -- -- /* identify the master stream */ -- CSingleLock streamLock(m_streamLock); -- -- /* mix in any running streams */ -- StreamList resumeStreams; -- for (StreamList::iterator itt = m_playingStreams.begin(); itt != m_playingStreams.end(); ++itt) -- { -- CSoftAEStream *stream = *itt; -- -- float *frame = (float*)stream->GetFrame(); -- if (!frame && stream->IsDrained() && stream->m_slave && stream->m_slave->IsPaused()) -- resumeStreams.push_back(stream); -- -- if (!frame) -- continue; -- -- float volume = stream->GetVolume() * stream->GetReplayGain() * stream->RunLimiter(frame, channelCount); -- #ifdef __SSE__ -- if (channelCount > 1) -- CAEUtil::SSEMulAddArray(dst, frame, volume, channelCount); -- else -- #endif -- { -- for (unsigned int i = 0; i < channelCount; ++i) -- *dst++ += *frame++ * volume; -- } -- -- ++mixed; -- } -- -- ResumeSlaveStreams(resumeStreams); -- return mixed; --} -- --inline void CSoftAE::ResumeSlaveStreams(const StreamList &streams) --{ -- if (streams.empty()) -- return; -- -- /* resume any streams that need to be */ -- for (StreamList::const_iterator itt = streams.begin(); itt != streams.end(); ++itt) -- { -- CSoftAEStream *stream = *itt; -- m_playingStreams.push_back(stream->m_slave); -- stream->m_slave->m_paused = false; -- stream->m_slave = NULL; -- } --} -- --inline void CSoftAE::RemoveStream(StreamList &streams, CSoftAEStream *stream) --{ -- StreamList::iterator f = std::find(streams.begin(), streams.end(), stream); -- if (f != streams.end()) -- streams.erase(f); -- -- if (streams == m_playingStreams) -- m_streamsPlaying = !m_playingStreams.empty(); --} -- --inline void CSoftAE::ProcessSuspend() --{ --#if defined(TARGET_WINDOWS) || defined(TARGET_LINUX) -- if (!m_softSuspend && m_playingStreams.empty() && m_playing_sounds.empty() && -- !g_advancedSettings.m_streamSilence) -- { -- m_softSuspend = true; -- m_softSuspendTimeout.Set(10000); //10.0 second delay for softSuspend -- Sleep(10); -- } -- --#endif -- /* idle while in Suspend() state until Resume() called */ -- /* idle if nothing to play and user hasn't enabled */ -- /* continuous streaming (silent stream) in as.xml */ -- /* In case of Suspend stay in there until Resume is called from outer thread */ -- while (m_isSuspended || ((m_softSuspend && m_softSuspendTimeout.IsTimePast()) && -- m_running && !m_reOpen)) -- { -- if (!m_isSuspended && m_sink && !m_sinkIsSuspended) -- { -- /* put the sink in Suspend mode */ -- CExclusiveLock sinkLock(m_sinkLock); -- if (m_sink && !m_sink->SoftSuspend()) -- { -- m_sinkIsSuspended = false; //sink cannot be suspended -- m_softSuspend = false; //break suspend loop -- break; -- } -- else -- { -- CLog::Log(LOGDEBUG, "Suspended the Sink"); -- m_sinkIsSuspended = true; //sink has suspended processing -- } -- sinkLock.Leave(); -- } -- // Signal that the Suspend can go on now. -- // Idea: Outer thread calls Suspend() - but -- // because of AddPackets does not care about locks, we must make -- // sure, that our school bus (AE::Run) is currently driving through -- // some gas station, before we move away the sink. -- if(m_isSuspended) -- m_saveSuspend.Set(); -- -- /* idle for platform-defined time */ -- m_wake.WaitMSec(SOFTAE_IDLE_WAIT_MSEC); -- -- /* check if we need to resume for stream or sound or somebody wants to open us -- * the suspend checks are only there to: -- * a) not run out of softSuspend directly when we are sleeping -- * b) nail(!) the thread during real Suspend into this method -- * Note: It is not enough to check the streams buffer, cause it might not be filled yet -- * We have to check after ProcessSuspending() if the sink is still in softsleep and resume it -- */ -- if (!m_isSuspended && (!m_playingStreams.empty() || !m_playing_sounds.empty())) -- { -- // the sink might still be not initialized after Resume of real suspend -- m_reOpen = m_sink && (!m_sink->SoftResume() || m_reOpen); // sink returns false if it requires reinit (worthless with current implementation) -- m_sinkIsSuspended = false; //sink processing data -- m_softSuspend = false; //break suspend loop (under some conditions) -- CLog::Log(LOGDEBUG, "Resumed the Sink"); -- break; -- } -- } --} -- -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -deleted file mode 100644 -index 4415f76..0000000 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h -+++ /dev/null -@@ -1,253 +0,0 @@ --#pragma once --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include --#include --#include -- --#include "system.h" --#include "threads/Thread.h" --#include "threads/CriticalSection.h" --#include "threads/SharedSection.h" --#include "threads/SystemClock.h" -- --#include "Interfaces/ThreadedAE.h" --#include "Utils/AEBuffer.h" --#include "Utils/AEAudioFormat.h" --#include "AESinkFactory.h" -- --#include "SoftAEStream.h" --#include "SoftAESound.h" -- --#include "cores/IAudioCallback.h" -- --/* forward declarations */ --class IAESink; --class IAEEncoder; -- --class CSoftAE : public IThreadedAE --{ --protected: -- friend class CAEFactory; -- CSoftAE(); -- virtual ~CSoftAE(); -- --public: -- virtual void Shutdown(); -- virtual bool Initialize(); -- virtual void OnSettingsChange(const std::string& setting); -- -- virtual void Run(); -- virtual void Stop(); -- virtual bool Suspend(); -- virtual bool Resume(); -- virtual bool IsSuspended(); -- virtual double GetDelay(); -- -- virtual float GetVolume(); -- virtual void SetVolume(const float volume); -- virtual void SetMute(const bool enabled) { m_muted = enabled; } -- virtual bool IsMuted() { return m_muted; } -- virtual void SetSoundMode(const int mode); -- -- /* returns a new stream for data in the specified format */ -- virtual IAEStream *MakeStream(enum AEDataFormat dataFormat, unsigned int sampleRate, unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options = 0); -- virtual IAEStream *FreeStream(IAEStream *stream); -- -- /* returns a new sound object */ -- virtual IAESound *MakeSound(const std::string& file); -- virtual void FreeSound(IAESound *sound); -- void PlaySound(IAESound *sound); -- void StopSound(IAESound *sound); -- -- /* free's sounds that have expired */ -- virtual void GarbageCollect(); -- -- /* these are for the streams so they can provide compatible data */ -- unsigned int GetSampleRate (); -- unsigned int GetChannelCount () {return m_chLayout.Count() ;} -- CAEChannelInfo& GetChannelLayout() {return m_chLayout ;} -- enum AEStdChLayout GetStdChLayout () {return m_stdChLayout ;} -- unsigned int GetFrames () {return m_sinkFormat.m_frames ;} -- unsigned int GetFrameSize () {return m_frameSize ;} -- -- /* these are for streams that are in RAW mode */ -- const AEAudioFormat* GetSinkAudioFormat() {return &m_sinkFormat ;} -- enum AEDataFormat GetSinkDataFormat () {return m_sinkFormat.m_dataFormat ;} -- CAEChannelInfo& GetSinkChLayout () {return m_sinkFormat.m_channelLayout;} -- unsigned int GetSinkFrameSize () {return m_sinkFormat.m_frameSize ;} -- -- /* for streams so they can calc cachetimes correct */ -- double GetCacheTime(); -- double GetCacheTotal(); -- -- virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); -- virtual std::string GetDefaultDevice(bool passthrough); -- virtual bool SupportsRaw(); -- -- /* internal stream methods */ -- void PauseStream (CSoftAEStream *stream); -- void ResumeStream(CSoftAEStream *stream); -- --private: -- CThread *m_thread; -- -- CSoftAEStream *GetMasterStream(); -- -- void LoadSettings(); -- void VerifySoundDevice(std::string &device, bool passthrough); -- void OpenSink(); -- -- void InternalOpenSink(); -- void InternalCloseSink(); -- void ResetEncoder(); -- bool SetupEncoder(AEAudioFormat &format); -- void Deinitialize(); -- -- inline void ProcessSuspend(); /* enter suspend state if nothing to play and sink allows */ -- -- inline void GetDeviceFriendlyName(std::string &device); -- -- IAESink *GetSink(AEAudioFormat &desiredFormat, bool passthrough, std::string &device); -- void StopAllSounds(); -- -- enum AEStdChLayout m_stdChLayout; -- std::string m_device; -- std::string m_passthroughDevice; -- std::string m_deviceFriendlyName; -- bool m_audiophile; -- bool m_stereoUpmix; -- -- /* internal vars */ -- bool m_running, m_reOpen; -- bool m_sinkIsSuspended; /* The sink is in unusable state, e.g. SoftSuspended */ -- bool m_isSuspended; /* engine suspended by external function to release audio context */ -- bool m_softSuspend; /* latches after last stream or sound played for timer below for idle */ -- XbmcThreads::EndTime m_softSuspendTimeout; /* timer to hold sink open before soft suspend for idle */ -- CEvent m_reOpenEvent; -- CEvent m_wake; -- CEvent m_saveSuspend; -- -- CCriticalSection m_runningLock; /* released when the thread exits */ -- CCriticalSection m_streamLock; /* m_streams lock */ -- CCriticalSection m_soundLock; /* m_sounds lock */ -- CCriticalSection m_soundSampleLock; /* m_playing_sounds lock */ -- CSharedSection m_sinkLock; /* lock for m_sink on re-open */ -- CCriticalSection m_threadLock; /* locked while starting/stopping the thread */ -- -- /* the current configuration */ -- float m_volume; -- bool m_muted; -- CAEChannelInfo m_chLayout; -- unsigned int m_frameSize; -- double m_frameSizeMul; -- -- /* the sink, its format information, and conversion function */ -- AESinkInfoList m_sinkInfoList; -- IAESink *m_sink; -- AEAudioFormat m_sinkFormat; -- double m_sinkFormatSampleRateMul; -- unsigned int m_sinkBlockSize; -- unsigned int m_sinkBlockTime; -- bool m_sinkHandlesVolume; -- AEAudioFormat m_encoderFormat; -- double m_encoderFrameSizeMul; -- double m_encoderInitSampleRateMul; -- unsigned int m_bytesPerSample; -- CAEConvert::AEConvertFrFn m_convertFn; -- -- /* currently playing sounds */ -- typedef struct { -- CSoftAESound *owner; -- float *samples; -- unsigned int sampleCount; -- } SoundState; -- -- typedef std::vector StreamList; -- typedef std::list SoundList; -- typedef std::list SoundStateList; -- -- /* the streams, sounds, output buffer and output buffer fill size */ -- bool m_transcode; -- bool m_rawPassthrough; -- StreamList m_newStreams, m_streams, m_playingStreams; -- SoundList m_sounds; -- SoundStateList m_playing_sounds; -- int m_soundMode; -- bool m_streamsPlaying; -- -- /* this will contain either float, or uint8_t depending on if we are in raw mode or not */ -- CAEBuffer m_buffer; -- -- /* the encoder */ -- IAEEncoder *m_encoder; -- CAEBuffer m_encodedBuffer; -- -- /* the output conversion buffer */ -- uint8_t *m_converted; -- size_t m_convertedSize; -- -- void AllocateConvIfNeeded(size_t convertedSize, bool prezero = false); -- -- /* thread run stages */ -- -- /*! \brief Mix UI sounds into the current stream. -- \param buffer the buffer to mix into. -- \param samples the number of samples in the buffer. -- \return the number of sounds mixed into the buffer. -- */ -- unsigned int MixSounds (float *buffer, unsigned int samples); -- -- /*! \brief Finalize samples ready for sending to the output device. -- Mixes in any UI sounds, applies volume adjustment, and clamps to [-1,1]. -- \param buffer the audio data. -- \param samples the number of samples in the buffer. -- \param hasAudio whether we have audio from a stream (true) or silence (false) -- \return true if we have audio to output, false if we have only silence. -- */ -- bool FinalizeSamples (float *buffer, unsigned int samples, bool hasAudio); -- -- CSoftAEStream *m_masterStream; -- -- /*! \brief Run the output stage on the audio. -- Prepares streamed data, mixes in any UI sounds, converts to a format suitable -- for the sink, then outputs to the sink. -- \param hasAudio whether or not we have audio (true) or silence (false). -- \return the number of samples sent to the sink. -- */ -- int (CSoftAE::*m_outputStageFn)(bool); -- int RunOutputStage (bool hasAudio); -- int RunRawOutputStage(bool hasAudio); -- int RunTranscodeStage(bool hasAudio); -- -- unsigned int (CSoftAE::*m_streamStageFn)(unsigned int channelCount, void *out, bool &restart); -- unsigned int RunRawStreamStage (unsigned int channelCount, void *out, bool &restart); -- unsigned int RunStreamStage (unsigned int channelCount, void *out, bool &restart); -- -- void ResumeSlaveStreams(const StreamList &streams); -- void RunNormalizeStage (unsigned int channelCount, void *out, unsigned int mixed); -- -- void RemoveStream(StreamList &streams, CSoftAEStream *stream); -- void PrintSinks(); -- -- unsigned int WriteSink(CAEBuffer& src, unsigned int src_len, uint8_t *data, bool hasAudio); --}; -- -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.cpp -deleted file mode 100644 -index 5fcaccf..0000000 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.cpp -+++ /dev/null -@@ -1,114 +0,0 @@ --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include "Interfaces/AESound.h" -- --#include --#include "threads/SingleLock.h" --#include "utils/log.h" --#include "utils/EndianSwap.h" -- --#include "AEFactory.h" --#include "Utils/AEAudioFormat.h" -- --#include "SoftAE.h" --#include "SoftAESound.h" -- --/* typecast AE to CSoftAE */ --#define AE (*((CSoftAE*)CAEFactory::GetEngine())) -- --CSoftAESound::CSoftAESound(const std::string &filename) : -- IAESound (filename), -- m_filename (filename), -- m_volume (1.0f ), -- m_inUse (0 ) --{ -- m_wavLoader.Load(filename); --} -- --CSoftAESound::~CSoftAESound() --{ --} -- --void CSoftAESound::DeInitialize() --{ --} -- --bool CSoftAESound::IsCompatible() --{ -- if (!m_wavLoader.IsValid()) -- return false; -- -- return m_wavLoader.IsCompatible(AE.GetSampleRate(), AE.GetChannelLayout()); --} -- --bool CSoftAESound::Initialize() --{ -- if (!m_wavLoader.IsValid()) -- return false; -- -- return m_wavLoader.Initialize( -- AE.GetSampleRate (), -- AE.GetChannelLayout(), -- AE.GetStdChLayout () -- ); --} -- --unsigned int CSoftAESound::GetSampleCount() --{ -- CSingleLock cs(m_critSection); -- if (m_wavLoader.IsValid()) -- return m_wavLoader.GetSampleCount(); -- return 0; --} -- --float* CSoftAESound::GetSamples() --{ -- CSingleLock cs(m_critSection); -- if (!m_wavLoader.IsValid()) -- return NULL; -- -- ++m_inUse; -- return m_wavLoader.GetSamples(); --} -- --void CSoftAESound::ReleaseSamples() --{ -- CSingleLock cs(m_critSection); -- ASSERT(m_inUse > 0); -- --m_inUse; --} -- --bool CSoftAESound::IsPlaying() --{ -- CSingleLock cs(m_critSection); -- return (m_inUse > 0); --} -- --void CSoftAESound::Play() --{ -- AE.PlaySound(this); --} -- --void CSoftAESound::Stop() --{ -- AE.StopSound(this); --} -- -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.h -deleted file mode 100644 -index cd50c0b..0000000 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.h -+++ /dev/null -@@ -1,57 +0,0 @@ --#pragma once --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include "utils/StdString.h" --#include "threads/CriticalSection.h" --#include "threads/SharedSection.h" --#include "Interfaces/AESound.h" --#include "Utils/AEWAVLoader.h" -- --class CSoftAESound : public IAESound --{ --public: -- CSoftAESound (const std::string &filename); -- virtual ~CSoftAESound(); -- -- virtual void DeInitialize(); -- virtual bool Initialize(); -- -- virtual void Play(); -- virtual void Stop(); -- virtual bool IsPlaying(); -- -- virtual void SetVolume(float volume) { m_volume = std::max(0.0f, std::min(1.0f, volume)); } -- virtual float GetVolume() { return m_volume ; } -- -- bool IsCompatible(); -- unsigned int GetSampleCount(); -- -- /* ReleaseSamples must be called for each time GetSamples has been called */ -- virtual float* GetSamples (); -- void ReleaseSamples(); --private: -- CCriticalSection m_critSection; -- std::string m_filename; -- CAEWAVLoader m_wavLoader; -- float m_volume; -- int m_inUse; --}; -- -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -deleted file mode 100644 -index b5c2da3..0000000 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -+++ /dev/null -@@ -1,687 +0,0 @@ --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include "system.h" --#include "threads/SingleLock.h" --#include "utils/log.h" --#include "utils/MathUtils.h" -- --#include "AEFactory.h" --#include "Utils/AEUtil.h" -- --#include "SoftAE.h" --#include "SoftAEStream.h" -- --#ifdef TARGET_WINDOWS --#pragma comment(lib, "libsamplerate-0.lib") --#endif -- --/* typecast AE to CSoftAE */ --#define AE (*((CSoftAE*)CAEFactory::GetEngine())) -- --using namespace std; -- --CSoftAEStream::CSoftAEStream(enum AEDataFormat dataFormat, unsigned int sampleRate, unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options, CCriticalSection& lock) : -- m_lock (lock ), -- m_resampleRatio (1.0 ), -- m_internalRatio (1.0 ), -- m_convertBuffer (NULL ), -- m_valid (false), -- m_delete (false), -- m_volume (1.0f ), -- m_rgain (1.0f ), -- m_refillBuffer (0 ), -- m_convertFn (NULL ), -- m_ssrc (NULL ), -- m_framesBuffered (0 ), -- m_newPacket (NULL ), -- m_packet (NULL ), -- m_vizPacketPos (NULL ), -- m_draining (false), -- m_vizBufferSamples(0 ), -- m_audioCallback (NULL ), -- m_fadeRunning (false), -- m_slave (NULL ) --{ -- m_ssrcData.data_out = NULL; -- -- m_initDataFormat = dataFormat; -- m_initSampleRate = sampleRate; -- m_initEncodedSampleRate = encodedSampleRate; -- m_initChannelLayout = channelLayout; -- m_chLayoutCount = channelLayout.Count(); -- m_forceResample = (options & AESTREAM_FORCE_RESAMPLE) != 0; -- m_paused = (options & AESTREAM_PAUSED) != 0; -- m_autoStart = (options & AESTREAM_AUTOSTART) != 0; -- -- if (m_autoStart) -- m_paused = true; -- -- ASSERT(m_initChannelLayout.Count()); --} -- --void CSoftAEStream::InitializeRemap() --{ -- CSingleLock lock(m_lock); -- -- if (!AE_IS_RAW(m_initDataFormat)) -- { -- /* re-init the remappers */ -- m_remap .Initialize(m_initChannelLayout, AE.GetChannelLayout() , false, false, AE.GetStdChLayout()); -- m_vizRemap.Initialize(m_initChannelLayout, CAEChannelInfo(AE_CH_LAYOUT_2_0), false, true); -- -- /* -- if the layout has changed we need to drop data that was already remapped -- */ -- if (AE.GetChannelLayout() != m_aeChannelLayout) -- { -- InternalFlush(); -- m_aeChannelLayout = AE.GetChannelLayout(); -- m_samplesPerFrame = AE.GetChannelLayout().Count(); -- m_aeBytesPerFrame = AE_IS_RAW(m_initDataFormat) ? m_bytesPerFrame : (m_samplesPerFrame * sizeof(float)); -- } -- } --} -- --void CSoftAEStream::Initialize() --{ -- CSingleLock lock(m_lock); -- -- if (m_valid) -- { -- InternalFlush(); -- delete m_newPacket; -- -- if (m_convert) -- _aligned_free(m_convertBuffer); -- -- if (m_resample) -- { -- _aligned_free(m_ssrcData.data_out); -- m_ssrcData.data_out = NULL; -- } -- } -- -- enum AEDataFormat useDataFormat = m_initDataFormat; -- if (AE_IS_RAW(m_initDataFormat)) -- { -- /* we are raw, which means we need to work in the output format */ -- useDataFormat = AE.GetSinkDataFormat(); -- m_initChannelLayout = AE.GetSinkChLayout (); -- m_samplesPerFrame = m_initChannelLayout.Count(); -- } -- else -- { -- if (!m_initChannelLayout.Count()) -- { -- m_valid = false; -- return; -- } -- m_samplesPerFrame = AE.GetChannelLayout().Count(); -- } -- -- m_bytesPerSample = (CAEUtil::DataFormatToBits(useDataFormat) >> 3); -- m_bytesPerFrame = m_bytesPerSample * m_initChannelLayout.Count(); -- -- m_aeChannelLayout = AE.GetChannelLayout(); -- m_aeBytesPerFrame = AE_IS_RAW(m_initDataFormat) ? m_bytesPerFrame : (m_samplesPerFrame * sizeof(float)); -- // set the waterlevel to 75 percent of the number of frames per second. -- // this lets us drain the main buffer down futher before flagging an underrun. -- m_waterLevel = AE.GetSampleRate() - (AE.GetSampleRate() / 4); -- m_refillBuffer = m_waterLevel; -- -- m_format.m_dataFormat = useDataFormat; -- m_format.m_sampleRate = m_initSampleRate; -- m_format.m_encodedRate = m_initEncodedSampleRate; -- m_format.m_channelLayout = m_initChannelLayout; -- m_format.m_frames = m_initSampleRate / 8; -- m_format.m_frameSamples = m_format.m_frames * m_initChannelLayout.Count(); -- m_format.m_frameSize = m_bytesPerFrame; -- -- m_newPacket = new PPacket(); -- if (AE_IS_RAW(m_initDataFormat)) -- m_newPacket->data.Alloc(m_format.m_frames * m_format.m_frameSize); -- else -- { -- if ( -- !m_remap .Initialize(m_initChannelLayout, m_aeChannelLayout , false, false, AE.GetStdChLayout()) || -- !m_vizRemap.Initialize(m_initChannelLayout, CAEChannelInfo(AE_CH_LAYOUT_2_0), false, true)) -- { -- m_valid = false; -- return; -- } -- -- m_newPacket->data.Alloc(m_format.m_frameSamples * sizeof(float)); -- } -- -- m_packet = NULL; -- -- m_inputBuffer.Alloc(m_format.m_frames * m_format.m_frameSize); -- -- m_resample = (m_forceResample || m_initSampleRate != AE.GetSampleRate()) && !AE_IS_RAW(m_initDataFormat); -- m_convert = m_initDataFormat != AE_FMT_FLOAT && !AE_IS_RAW(m_initDataFormat); -- -- /* if we need to convert, set it up */ -- if (m_convert) -- { -- /* get the conversion function and allocate a buffer for the data */ -- CLog::Log(LOGDEBUG, "CSoftAEStream::CSoftAEStream - Converting from %s to AE_FMT_FLOAT", CAEUtil::DataFormatToStr(m_initDataFormat)); -- m_convertFn = CAEConvert::ToFloat(m_initDataFormat); -- if (m_convertFn) -- m_convertBuffer = (float*)_aligned_malloc(m_format.m_frameSamples * sizeof(float), 16); -- else -- m_valid = false; -- } -- else -- m_convertBuffer = (float*)m_inputBuffer.Raw(m_format.m_frames * m_format.m_frameSize); -- -- /* if we need to resample, set it up */ -- if (m_resample) -- { -- int err; -- m_ssrc = src_new(SRC_SINC_MEDIUM_QUALITY, m_initChannelLayout.Count(), &err); -- m_ssrcData.data_in = m_convertBuffer; -- m_internalRatio = (double)AE.GetSampleRate() / (double)m_initSampleRate; -- m_ssrcData.src_ratio = m_internalRatio; -- m_ssrcData.data_out = (float*)_aligned_malloc(m_format.m_frameSamples * (int)std::ceil(m_ssrcData.src_ratio) * sizeof(float), 16); -- m_ssrcData.output_frames = m_format.m_frames * (long)std::ceil(m_ssrcData.src_ratio); -- m_ssrcData.end_of_input = 0; -- // we must buffer the same amount as before but taking the source sample rate into account -- // there is no reason to decrease the buffer for upsampling -- if (m_internalRatio < 1) -- { -- m_waterLevel *= (1.0 / m_internalRatio); -- m_refillBuffer = m_waterLevel; -- } -- } -- -- m_limiter.SetSamplerate(AE.GetSampleRate()); -- -- m_chLayoutCount = m_format.m_channelLayout.Count(); -- m_valid = true; --} -- --void CSoftAEStream::Destroy() --{ -- CSingleLock lock(m_lock); -- -- m_valid = false; -- m_delete = true; --} -- --CSoftAEStream::~CSoftAEStream() --{ -- CSingleLock lock(m_lock); -- -- InternalFlush(); -- if (m_convert) -- _aligned_free(m_convertBuffer); -- -- if (m_resample) -- { -- _aligned_free(m_ssrcData.data_out); -- src_delete(m_ssrc); -- m_ssrc = NULL; -- } -- -- delete m_newPacket; -- delete m_packet; -- -- CLog::Log(LOGDEBUG, "CSoftAEStream::~CSoftAEStream - Destructed"); --} -- --unsigned int CSoftAEStream::GetSpace() --{ -- CSingleLock lock(m_lock); -- -- if (!m_valid || m_draining) -- return 0; -- -- if (m_framesBuffered >= m_waterLevel) -- return 0; -- -- return m_inputBuffer.Free() + (std::max(0U, (m_waterLevel - m_framesBuffered)) * m_format.m_frameSize); --} -- --unsigned int CSoftAEStream::AddData(void *data, unsigned int size) --{ -- CSingleLock lock(m_lock); -- -- if (!m_valid || size == 0 || data == NULL) -- return 0; -- -- /* if the stream is draining */ -- if (m_draining) -- { -- /* if the stream has finished draining, cork it */ -- if (m_packet && !m_packet->data.Used() && m_outBuffer.empty()) -- m_draining = false; -- else -- return 0; -- } -- -- /* dont ever take more then GetSpace advertises */ -- size = std::min(size, GetSpace()); -- if (size == 0) -- return 0; -- -- unsigned int taken = 0; -- while(size) -- { -- unsigned int copy = std::min((unsigned int)m_inputBuffer.Free(), size); -- if (copy > 0) -- { -- m_inputBuffer.Push(data, copy); -- size -= copy; -- taken += copy; -- data = (uint8_t*)data + copy; -- } -- -- if (m_inputBuffer.Free() == 0) -- { -- unsigned int consumed = ProcessFrameBuffer(); -- m_inputBuffer.Shift(NULL, consumed); -- } -- } -- -- lock.Leave(); -- -- /* if the stream is flagged to autoStart when the buffer is full, then do it */ -- if (m_autoStart && m_framesBuffered >= m_waterLevel) -- Resume(); -- -- return taken; --} -- --unsigned int CSoftAEStream::ProcessFrameBuffer() --{ -- uint8_t *data; -- unsigned int frames, consumed, sampleSize; -- -- /* convert the data if we need to */ -- unsigned int samples; -- if (m_convert) -- { -- data = (uint8_t*)m_convertBuffer; -- samples = m_convertFn( -- (uint8_t*)m_inputBuffer.Raw(m_inputBuffer.Used()), -- m_inputBuffer.Used() / m_bytesPerSample, -- m_convertBuffer -- ); -- sampleSize = sizeof(float); -- } -- else -- { -- data = (uint8_t*)m_inputBuffer.Raw(m_inputBuffer.Used()); -- samples = m_inputBuffer.Used() / m_bytesPerSample; -- sampleSize = m_bytesPerSample; -- } -- -- if (samples == 0) -- return 0; -- -- /* resample it if we need to */ -- if (m_resample) -- { -- m_ssrcData.input_frames = samples / m_chLayoutCount; -- if (src_process(m_ssrc, &m_ssrcData) != 0) -- return 0; -- data = (uint8_t*)m_ssrcData.data_out; -- frames = m_ssrcData.output_frames_gen; -- consumed = m_ssrcData.input_frames_used * m_bytesPerFrame; -- if (!frames) -- return consumed; -- -- samples = frames * m_chLayoutCount; -- } -- else -- { -- data = (uint8_t*)m_convertBuffer; -- frames = samples / m_chLayoutCount; -- consumed = frames * m_bytesPerFrame; -- } -- -- if (m_refillBuffer) -- { -- if (frames > m_refillBuffer) -- m_refillBuffer = 0; -- else -- m_refillBuffer -= frames; -- } -- -- /* buffer the data */ -- m_framesBuffered += frames; -- const unsigned int inputBlockSize = m_format.m_frames * m_format.m_channelLayout.Count() * sampleSize; -- -- size_t remaining = samples * sampleSize; -- while (remaining) -- { -- size_t copy = std::min(m_newPacket->data.Free(), remaining); -- m_newPacket->data.Push(data, copy); -- data += copy; -- remaining -= copy; -- -- /* wait till we have a full packet, or no more data before processing the packet */ -- if ((!m_draining || remaining) && m_newPacket->data.Free() > 0) -- continue; -- -- /* if we have a full block of data */ -- if (AE_IS_RAW(m_initDataFormat)) -- { -- m_outBuffer.push_back(m_newPacket); -- m_newPacket = new PPacket(); -- m_newPacket->data.Alloc(inputBlockSize); -- continue; -- } -- -- /* make a new packet for downmix/remap */ -- PPacket *pkt = new PPacket(); -- -- /* downmix/remap the data */ -- size_t frames = m_newPacket->data.Used() / m_format.m_channelLayout.Count() / sizeof(float); -- size_t used = frames * m_aeChannelLayout.Count() * sizeof(float); -- pkt->data.Alloc(used); -- m_remap.Remap( -- (float*)m_newPacket->data.Raw (m_newPacket->data.Used()), -- (float*)pkt ->data.Take(used), -- frames -- ); -- -- /* downmix for the viz if we have one */ -- if (m_audioCallback) -- { -- size_t vizUsed = frames * 2 * sizeof(float); -- pkt->vizData.Alloc(vizUsed); -- m_vizRemap.Remap( -- (float*)m_newPacket->data .Raw (m_newPacket->data.Used()), -- (float*)pkt ->vizData.Take(vizUsed), -- frames -- ); -- } -- -- /* add the packet to the output */ -- m_outBuffer.push_back(pkt); -- m_newPacket->data.Empty(); -- } -- -- return consumed; --} -- --uint8_t* CSoftAEStream::GetFrame() --{ -- CSingleLock lock(m_lock); -- -- /* if we are fading, this runs even if we have underrun as it is time based */ -- if (m_fadeRunning) -- { -- m_volume += m_fadeStep; -- m_volume = std::min(1.0f, std::max(0.0f, m_volume)); -- if (m_fadeDirUp) -- { -- if (m_volume >= m_fadeTarget) -- m_fadeRunning = false; -- } -- else -- { -- if (m_volume <= m_fadeTarget) -- m_fadeRunning = false; -- } -- } -- -- /* if we have been deleted or are refilling but not draining */ -- if (!m_valid || m_delete || (m_refillBuffer && !m_draining)) -- return NULL; -- -- /* if the packet is empty, advance to the next one */ -- if (!m_packet || m_packet->data.CursorEnd()) -- { -- delete m_packet; -- m_packet = NULL; -- -- /* no more packets, return null */ -- if (m_outBuffer.empty()) -- { -- if (m_draining) -- return NULL; -- else -- { -- /* underrun, we need to refill our buffers */ -- CLog::Log(LOGDEBUG, "CSoftAEStream::GetFrame - Underrun"); -- ASSERT(m_waterLevel > m_framesBuffered); -- m_refillBuffer = m_waterLevel - m_framesBuffered; -- return NULL; -- } -- } -- -- /* get the next packet */ -- m_packet = m_outBuffer.front(); -- m_outBuffer.pop_front(); -- } -- -- /* fetch one frame of data */ -- uint8_t *ret = (uint8_t*)m_packet->data.CursorRead(m_aeBytesPerFrame); -- -- /* we have a frame, if we have a viz we need to hand the data to it */ -- if (m_audioCallback && !m_packet->vizData.CursorEnd()) -- { -- float *vizData = (float*)m_packet->vizData.CursorRead(2 * sizeof(float)); -- memcpy(m_vizBuffer + m_vizBufferSamples, vizData, 2 * sizeof(float)); -- m_vizBufferSamples += 2; -- if (m_vizBufferSamples == 512) -- { -- m_audioCallback->OnAudioData(m_vizBuffer, 512); -- m_vizBufferSamples = 0; -- } -- } -- -- --m_framesBuffered; -- return ret; --} -- --double CSoftAEStream::GetDelay() --{ -- CSingleLock lock(m_lock); -- -- if (m_delete) -- return 0.0; -- -- double delay = AE.GetDelay(); -- delay += (double)(m_inputBuffer.Used() / m_format.m_frameSize) / (double)m_format.m_sampleRate; -- delay += (double)m_framesBuffered / (double)AE.GetSampleRate(); -- return delay; --} -- --double CSoftAEStream::GetCacheTime() --{ -- CSingleLock lock(m_lock); -- -- if (m_delete) -- return 0.0; -- -- double time = AE.GetCacheTime(); -- time += (double)(m_inputBuffer.Used() / m_format.m_frameSize) / (double)m_format.m_sampleRate; -- time += (double)m_framesBuffered / (double)AE.GetSampleRate(); -- return time; --} -- --double CSoftAEStream::GetCacheTotal() --{ -- CSingleLock lock(m_lock); -- -- if (m_delete) -- return 0.0; -- -- double total = AE.GetCacheTotal(); -- total += (double)(m_inputBuffer.Size() / m_format.m_frameSize) / (double)m_format.m_sampleRate; -- total += (double)m_waterLevel / (double)AE.GetSampleRate(); -- return total; --} -- --void CSoftAEStream::Pause() --{ -- CSingleLock lock(m_lock); -- -- if (m_paused) -- return; -- m_paused = true; -- AE.PauseStream(this); --} -- --void CSoftAEStream::Resume() --{ -- CSingleLock lock(m_lock); -- -- if (!m_paused) -- return; -- m_paused = false; -- m_autoStart = false; -- AE.ResumeStream(this); --} -- --void CSoftAEStream::Drain(bool wait) --{ -- CSingleLock lock(m_lock); -- m_draining = true; --} -- --bool CSoftAEStream::IsDrained() --{ -- CSingleLock lock(m_lock); -- return (m_draining && !m_packet && m_outBuffer.empty()); --} -- --void CSoftAEStream::Flush() --{ -- CLog::Log(LOGDEBUG, "CSoftAEStream::Flush"); -- CSingleLock lock(m_lock); -- InternalFlush(); -- -- /* internal flush does not do this as these samples are still valid if we are re-initializing */ -- m_inputBuffer.Empty(); --} -- --void CSoftAEStream::InternalFlush() --{ -- /* reset the resampler */ -- if (m_resample) -- { -- m_ssrcData.end_of_input = 0; -- src_reset(m_ssrc); -- } -- -- /* invalidate any incoming samples */ -- m_newPacket->data.Empty(); -- -- /* -- clear the current buffered packet, we cant delete the data as it may be -- in use by the AE thread, so we just seek to the end of the buffer -- */ -- if (m_packet) -- m_packet->data.CursorSeek(m_packet->data.Size()); -- -- /* clear any other buffered packets */ -- while (!m_outBuffer.empty()) -- { -- PPacket *p = m_outBuffer.front(); -- m_outBuffer.pop_front(); -- delete p; -- } -- -- /* reset our counts */ -- m_framesBuffered = 0; -- m_refillBuffer = m_waterLevel; -- m_draining = false; --} -- --double CSoftAEStream::GetResampleRatio() --{ -- CSingleLock lock(m_lock); -- if (!m_resample) -- return 1.0f; -- -- return m_ssrcData.src_ratio; --} -- --bool CSoftAEStream::SetResampleRatio(double ratio) --{ -- if (!m_resample) -- return false; -- -- CSingleLock lock(m_lock); -- -- int oldRatioInt = (int)std::ceil(m_ssrcData.src_ratio); -- -- m_resampleRatio = ratio; -- -- src_set_ratio(m_ssrc, m_resampleRatio * m_internalRatio); -- m_ssrcData.src_ratio = m_resampleRatio * m_internalRatio; -- -- //Check the resample buffer size and resize if necessary. -- if (oldRatioInt < std::ceil(m_ssrcData.src_ratio)) -- { -- _aligned_free(m_ssrcData.data_out); -- m_ssrcData.data_out = (float*)_aligned_malloc(m_format.m_frameSamples * (int)std::ceil(m_ssrcData.src_ratio) * sizeof(float), 16); -- m_ssrcData.output_frames = m_format.m_frames * (long)std::ceil(m_ssrcData.src_ratio); -- } -- return true; --} -- --void CSoftAEStream::RegisterAudioCallback(IAudioCallback* pCallback) --{ -- CSingleLock lock(m_lock); -- m_vizBufferSamples = 0; -- m_audioCallback = pCallback; -- if (m_audioCallback) -- m_audioCallback->OnInitialize(2, m_initSampleRate, 32); --} -- --void CSoftAEStream::UnRegisterAudioCallback() --{ -- CSingleLock lock(m_lock); -- m_audioCallback = NULL; -- m_vizBufferSamples = 0; --} -- --void CSoftAEStream::FadeVolume(float from, float target, unsigned int time) --{ -- /* can't fade a RAW stream */ -- if (AE_IS_RAW(m_initDataFormat)) -- return; -- -- CSingleLock lock(m_lock); -- float delta = target - from; -- m_fadeDirUp = target > from; -- m_fadeTarget = target; -- m_fadeStep = delta / (((float)AE.GetSampleRate() / 1000.0f) * (float)time); -- m_fadeRunning = true; --} -- --bool CSoftAEStream::IsFading() --{ -- CSingleLock lock(m_lock); -- return m_fadeRunning; --} -- --void CSoftAEStream::RegisterSlave(IAEStream *slave) --{ -- CSingleLock lock(m_lock); -- m_slave = (CSoftAEStream*)slave; --} -- -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -deleted file mode 100644 -index 9ee607c..0000000 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -+++ /dev/null -@@ -1,161 +0,0 @@ --#pragma once --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#include --#include -- --#include "threads/SharedSection.h" -- --#include "Utils/AEAudioFormat.h" --#include "Interfaces/AEStream.h" --#include "Utils/AEConvert.h" --#include "Utils/AERemap.h" --#include "Utils/AEBuffer.h" --#include "Utils/AELimiter.h" -- --class IAEPostProc; --class CSoftAEStream : public IAEStream --{ --protected: -- friend class CSoftAE; -- CSoftAEStream(enum AEDataFormat format, unsigned int sampleRate, unsigned int encodedSamplerate, CAEChannelInfo channelLayout, unsigned int options, CCriticalSection& lock); -- virtual ~CSoftAEStream(); -- -- void Initialize(); -- void InitializeRemap(); -- void Destroy(); -- uint8_t* GetFrame(); -- -- bool IsPaused () { return m_paused; } -- bool IsDestroyed() { return m_delete; } -- bool IsValid () { return m_valid; } -- const bool IsRaw() const { return AE_IS_RAW(m_initDataFormat); } -- --public: -- virtual unsigned int GetSpace (); -- virtual unsigned int AddData (void *data, unsigned int size); -- virtual double GetDelay (); -- virtual bool IsBuffering () { return m_refillBuffer > 0; } -- virtual double GetCacheTime (); -- virtual double GetCacheTotal (); -- -- virtual void Pause (); -- virtual void Resume (); -- virtual void Drain (bool wait); -- virtual bool IsDraining () { return m_draining; } -- virtual bool IsDrained (); -- virtual void Flush (); -- -- virtual float GetVolume () { return m_volume; } -- virtual float GetReplayGain () { return m_rgain ; } -- virtual float GetAmplification() { return m_limiter.GetAmplification(); } -- virtual void SetVolume (float volume) { m_volume = std::max( 0.0f, std::min(1.0f, volume)); } -- virtual void SetReplayGain (float factor) { m_rgain = std::max( 0.0f, factor); } -- virtual void SetAmplification(float amplify){ m_limiter.SetAmplification(amplify); } -- -- virtual float RunLimiter(float* frame, int channels) { return m_limiter.Run(&frame, channels); } -- -- virtual const unsigned int GetFrameSize () const { return m_format.m_frameSize; } -- virtual const unsigned int GetChannelCount() const { return m_initChannelLayout.Count(); } -- -- virtual const unsigned int GetSampleRate () const { return m_initSampleRate; } -- virtual const unsigned int GetEncodedSampleRate() const { return m_initEncodedSampleRate; } -- virtual const enum AEDataFormat GetDataFormat () const { return m_initDataFormat; } -- -- virtual double GetResampleRatio(); -- virtual bool SetResampleRatio(double ratio); -- virtual void RegisterAudioCallback(IAudioCallback* pCallback); -- virtual void UnRegisterAudioCallback(); -- virtual void FadeVolume(float from, float to, unsigned int time); -- virtual bool IsFading(); -- virtual void RegisterSlave(IAEStream *stream); --private: -- void InternalFlush(); -- void CheckResampleBuffers(); -- -- CCriticalSection& m_lock; -- enum AEDataFormat m_initDataFormat; -- unsigned int m_initSampleRate; -- unsigned int m_initEncodedSampleRate; -- CAEChannelInfo m_initChannelLayout; -- unsigned int m_chLayoutCount; -- -- typedef struct -- { -- CAEBuffer data; -- CAEBuffer vizData; -- } PPacket; -- -- AEAudioFormat m_format; -- -- bool m_forceResample; /* true if we are to force resample even when the rates match */ -- bool m_resample; /* true if the audio needs to be resampled */ -- double m_resampleRatio; /* user specified resample ratio */ -- double m_internalRatio; /* internal resample ratio */ -- bool m_convert; /* true if the bitspersample needs converting */ -- float *m_convertBuffer; /* buffer for converted data */ -- bool m_valid; /* true if the stream is valid */ -- bool m_delete; /* true if CSoftAE is to free this object */ -- CAERemap m_remap; /* the remapper */ -- float m_volume; /* the volume level */ -- float m_rgain; /* replay gain level */ -- unsigned int m_waterLevel; /* the fill level to fall below before calling the data callback */ -- unsigned int m_refillBuffer; /* how many frames that need to be buffered before we return any frames */ -- -- CAEConvert::AEConvertToFn m_convertFn; -- -- CAEBuffer m_inputBuffer; -- unsigned int m_bytesPerSample; -- unsigned int m_bytesPerFrame; -- unsigned int m_samplesPerFrame; -- CAEChannelInfo m_aeChannelLayout; -- unsigned int m_aeBytesPerFrame; -- SRC_STATE *m_ssrc; -- SRC_DATA m_ssrcData; -- unsigned int m_framesBuffered; -- std::list m_outBuffer; -- unsigned int ProcessFrameBuffer(); -- PPacket *m_newPacket; -- PPacket *m_packet; -- uint8_t *m_packetPos; -- float *m_vizPacketPos; -- bool m_paused; -- bool m_autoStart; -- bool m_draining; -- CAELimiter m_limiter; -- -- /* vizualization internals */ -- CAERemap m_vizRemap; -- float m_vizBuffer[512]; -- unsigned int m_vizBufferSamples; -- IAudioCallback *m_audioCallback; -- -- /* fade values */ -- bool m_fadeRunning; -- bool m_fadeDirUp; -- float m_fadeStep; -- float m_fadeTarget; -- unsigned int m_fadeTime; -- -- /* slave stream */ -- CSoftAEStream *m_slave; --}; -- -diff --git a/xbmc/cores/AudioEngine/Makefile.in b/xbmc/cores/AudioEngine/Makefile.in -index c2d7ffa..c1d53f5 100644 ---- a/xbmc/cores/AudioEngine/Makefile.in -+++ b/xbmc/cores/AudioEngine/Makefile.in -@@ -39,10 +39,6 @@ SRCS += AESinkFactory.cpp - SRCS += Sinks/AESinkNULL.cpp - SRCS += Sinks/AESinkProfiler.cpp - --SRCS += Engines/SoftAE/SoftAE.cpp --SRCS += Engines/SoftAE/SoftAEStream.cpp --SRCS += Engines/SoftAE/SoftAESound.cpp -- - SRCS += Engines/ActiveAE/ActiveAE.cpp - SRCS += Engines/ActiveAE/ActiveAESink.cpp - SRCS += Engines/ActiveAE/ActiveAEStream.cpp --- -1.8.4 - - -From 61495782102287088a98e4e72b5a575413ceb79f Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 13:25:23 +0200 -Subject: [PATCH 07/94] adapt toggle passthrough to change in audio settings - ---- - xbmc/Application.cpp | 11 +++-------- - 1 file changed, 3 insertions(+), 8 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index a4970a9..b27d49d 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -1610,7 +1610,7 @@ void CApplication::OnSettingChanged(const CSetting *setting) - } - // this tells player whether to open an audio stream passthrough or PCM - // if this is changed, audio stream has to be reopened -- else if (settingId == "audiooutput.mode") -+ else if (settingId == "audiooutput.passthrough") - { - CApplicationMessenger::Get().MediaRestart(false); - return; -@@ -2764,13 +2764,8 @@ bool CApplication::OnAction(const CAction &action) - - if (action.GetID() == ACTION_TOGGLE_DIGITAL_ANALOG) - { -- // TODO -- // revisit after new audio settings page have been implemented -- // makes no sense toggling a mode when you have three different settings -- int mode = CSettings::Get().GetInt("audiooutput.mode"); -- if (++mode == 3) -- mode = 0; -- CSettings::Get().SetInt("audiooutput.mode", mode); -+ bool passthrough = CSettings::Get().GetBool("audiooutput.passthrough"); -+ CSettings::Get().SetBool("audiooutput.passthrough", !passthrough); - - if (g_windowManager.GetActiveWindow() == WINDOW_SETTINGS_SYSTEM) - { --- -1.8.4 - - -From 1f202228ab5b17200b5c93fb2752b11ecb9e26ea Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 14:21:39 +0200 -Subject: [PATCH 08/94] update VS project after removal of SoftAE - ---- - project/VS2010Express/XBMC.vcxproj | 8 +------- - project/VS2010Express/XBMC.vcxproj.filters | 18 ------------------ - 2 files changed, 1 insertion(+), 25 deletions(-) - -diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj -index 65ec4a0..07d723e 100644 ---- a/project/VS2010Express/XBMC.vcxproj -+++ b/project/VS2010Express/XBMC.vcxproj -@@ -393,9 +393,6 @@ - - - -- -- -- - - - -@@ -1055,9 +1052,6 @@ - - - -- -- -- - - - -@@ -2985,4 +2979,4 @@ - - - -- -+ -\ No newline at end of file -diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters -index 570fb6f..74e82c4 100644 ---- a/project/VS2010Express/XBMC.vcxproj.filters -+++ b/project/VS2010Express/XBMC.vcxproj.filters -@@ -2316,15 +2316,6 @@ - - cores\AudioEngine - -- -- cores\AudioEngine\Engines -- -- -- cores\AudioEngine\Engines -- -- -- cores\AudioEngine\Engines -- - - cores\AudioEngine\Sinks - -@@ -5377,15 +5368,6 @@ - - cores\AudioEngine - -- -- cores\AudioEngine\Engines -- -- -- cores\AudioEngine\Engines -- -- -- cores\AudioEngine\Engines -- - - cores\AudioEngine\Interfaces - --- -1.8.4 - - -From 3babeb3bde293eb350bac816b59e2e97bac18077 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 18 Oct 2013 14:23:19 +0200 -Subject: [PATCH 09/94] fix linker error on Windows after removal of SoftAE - ---- - xbmc/cores/AudioEngine/Utils/AEWAVLoader.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Utils/AEWAVLoader.cpp b/xbmc/cores/AudioEngine/Utils/AEWAVLoader.cpp -index c8a521c..de9029b 100644 ---- a/xbmc/cores/AudioEngine/Utils/AEWAVLoader.cpp -+++ b/xbmc/cores/AudioEngine/Utils/AEWAVLoader.cpp -@@ -32,6 +32,10 @@ - #include "AEUtil.h" - #include "AERemap.h" - -+#ifdef TARGET_WINDOWS -+#pragma comment(lib, "libsamplerate-0.lib") -+#endif -+ - typedef struct - { - char chunk_id[4]; --- -1.8.4 - - -From dfe343b2691826ffd0f28cf72e40bdcaebd33539 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Fri, 18 Oct 2013 17:06:18 +0200 -Subject: [PATCH 10/94] AudioSettings: Remove AAC Setting for passthrough - ---- - language/English/strings.po | 10 ++-------- - system/settings/darwin.xml | 3 --- - system/settings/rbp.xml | 3 --- - system/settings/settings.xml | 13 ------------- - xbmc/cores/AudioEngine/AEFactory.cpp | 2 -- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 2 -- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 1 - - xbmc/settings/Settings.cpp | 1 - - 8 files changed, 2 insertions(+), 33 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index a403c5d..009e1c0 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -1242,10 +1242,7 @@ msgctxt "#298" - msgid "Bookmarks" - msgstr "" - --#: system/settings/settings.xml --msgctxt "#299" --msgid "AAC capable receiver" --msgstr "" -+#empty string with id 299 - - msgctxt "#300" - msgid "MP1 capable receiver" -@@ -14236,10 +14233,7 @@ msgctxt "#36366" - msgid "Select this option if your receiver is capable of decoding DTS streams." - msgstr "" - --#: system/settings/settings.xml --msgctxt "#36367" --msgid "Select this option if your receiver is capable of decoding AAC streams." --msgstr "" -+#empty string with id 36367 - - #: system/settings/settings.xml - msgctxt "#36368" -diff --git a/system/settings/darwin.xml b/system/settings/darwin.xml -index 817a990..2cf4df6 100644 ---- a/system/settings/darwin.xml -+++ b/system/settings/darwin.xml -@@ -8,9 +8,6 @@ - - - -- -- false -- - - false - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index ddd6635..b890555 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -41,9 +41,6 @@ - - false - -- -- false -- - - false - -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index f310b96..2215f70 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2138,19 +2138,6 @@ - - - -- -- 2 -- false -- -- -- -- true -- audiooutput.passthrough -- audiooutput.passthrough -- -- -- -- - - 2 - false -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index ba97a6b..4c1dc86 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -251,8 +251,6 @@ bool CAEFactory::SupportsRaw(AEDataFormat format) - return false; - if (format == AE_FMT_EAC3 && !CSettings::Get().GetBool("audiooutput.eac3passthrough")) - return false; -- if (format == AE_FMT_AAC && !CSettings::Get().GetBool("audiooutput.passthroughaac")) -- return false; - if (format == AE_FMT_TRUEHD && !CSettings::Get().GetBool("audiooutput.truehdpassthrough")) - return false; - if (format == AE_FMT_DTSHD && !CSettings::Get().GetBool("audiooutput.dtshdpassthrough")) -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index cc9fd75..e5e4c5c 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -1978,7 +1978,6 @@ void CActiveAE::LoadSettings() - m_settings.truehdpassthrough = CSettings::Get().GetBool("audiooutput.truehdpassthrough"); - m_settings.dtspassthrough = CSettings::Get().GetBool("audiooutput.dtspassthrough"); - m_settings.dtshdpassthrough = CSettings::Get().GetBool("audiooutput.dtshdpassthrough"); -- m_settings.aacpassthrough = CSettings::Get().GetBool("audiooutput.passthroughaac"); - - m_settings.resampleQuality = static_cast(CSettings::Get().GetInt("audiooutput.processquality")); - } -@@ -2041,7 +2040,6 @@ void CActiveAE::OnSettingsChange(const std::string& setting) - setting == "audiooutput.ac3passthrough" || - setting == "audiooutput.eac3passthrough" || - setting == "audiooutput.dtspassthrough" || -- setting == "audiooutput.passthroughaac" || - setting == "audiooutput.truehdpassthrough" || - setting == "audiooutput.dtshdpassthrough" || - setting == "audiooutput.channels" || -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index 2ae0476..1ac7031 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -52,7 +52,6 @@ struct AudioSettings - bool ac3passthrough; - bool eac3passthrough; - bool dtspassthrough; -- bool aacpassthrough; - bool truehdpassthrough; - bool dtshdpassthrough; - bool stereoupmix; -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 41e5d04..e61bce4 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -896,7 +896,6 @@ void CSettings::InitializeISettingCallbacks() - settingSet.insert("audiooutput.ac3passthrough"); - settingSet.insert("audiooutput.eac3passthrough"); - settingSet.insert("audiooutput.dtspassthrough"); -- settingSet.insert("audiooutput.passthroughaac"); - settingSet.insert("audiooutput.truehdpassthrough"); - settingSet.insert("audiooutput.dtshdpassthrough"); - settingSet.insert("audiooutput.audiodevice"); --- -1.8.4 - - -From a97f2ae76ea180f5bd55376279fc7fad8ae270bc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 19 Oct 2013 19:20:40 +0100 -Subject: [PATCH 11/94] [rbp] Update to work with new audio settings - ---- - system/settings/rbp.xml | 94 +++++++++++++--------- - .../AudioEngine/Engines/PiAudio/PiAudioAE.cpp | 59 +++++++++++++- - xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h | 4 +- - xbmc/cores/omxplayer/OMXAudio.cpp | 6 +- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 35 +++----- - xbmc/cores/omxplayer/OMXPlayerAudio.h | 2 - - 6 files changed, 126 insertions(+), 74 deletions(-) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index b890555..866aed4 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -30,18 +30,64 @@ - - - -- -+ -+ - -- -- 2 -+ -+ 1 -+ HDMI -+ -+ audiodevices -+ -+ - -- -+ -+ 2 -+ false -+ -+ -+ audiooutput.passthrough -+ -+ -+ -+ -+ 2 -+ false -+ -+ - false - - - false - -- -+ -+ false -+ -+ -+ 2 -+ audiosupportsdrain -+ false -+ -+ -+ audiooutput.streamsilence -+ -+ -+ -+ -+ -+ false -+ -+ -+ -+ 2 -+ false -+ -+ -+ audiooutput.passthrough -+ -+ -+ -+ - false - - -@@ -54,49 +100,19 @@ - false - - -- true - -- -- -- -- 1 -- 2 -- -- false -- -+ -+ audiooutput.ac3passthrough - - - - -- true - -- -- -- -- 1 -- 2 -- -- false -- -+ -+ audiooutput.dtspassthrough - - - -- -- 2 -- false -- -- -- 2 -- false -- -- -- -- false -- -- -- -- false -- - - - -diff --git a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -index 6bcd69d..5daa1ff 100644 ---- a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -@@ -48,7 +48,8 @@ bool CPiAudioAE::Initialize() - void CPiAudioAE::UpdateStreamSilence() - { - #if defined(TARGET_RASPBERRY_PI) -- bool enable = CSettings::Get().GetBool("audiooutput.streamsilence"); -+ bool enable = CSettings::Get().GetString("audiooutput.audiodevice") == "HDMI" && -+ CSettings::Get().GetBool("audiooutput.streamsilence"); - char response[80] = ""; - char command[80] = ""; - sprintf(command, "force_audio hdmi %d", enable); -@@ -105,9 +106,27 @@ void CPiAudioAE::FreeSound(IAESound *sound) - { - } - --bool CPiAudioAE::SupportsRaw() -+bool CPiAudioAE::SupportsRaw(AEDataFormat format) - { -- return true; -+ bool supported = false; -+#if defined(TARGET_RASPBERRY_PI) -+ if (CSettings::Get().GetString("audiooutput.audiodevice") == "HDMI") -+ { -+ if (!CSettings::Get().GetBool("audiooutput.dualaudio")) -+ { -+ DllBcmHost m_DllBcmHost; -+ m_DllBcmHost.Load(); -+ if (format == AE_FMT_AC3 && CSettings::Get().GetBool("audiooutput.ac3passthrough") && -+ m_DllBcmHost.vc_tv_hdmi_audio_supported(EDID_AudioFormat_eAC3, 2, EDID_AudioSampleRate_e44KHz, EDID_AudioSampleSize_16bit ) == 0) -+ supported = true; -+ if (format == AE_FMT_DTS && CSettings::Get().GetBool("audiooutput.dtspassthrough") && -+ m_DllBcmHost.vc_tv_hdmi_audio_supported(EDID_AudioFormat_eDTS, 2, EDID_AudioSampleRate_e44KHz, EDID_AudioSampleSize_16bit ) == 0) -+ supported = true; -+ m_DllBcmHost.Unload(); -+ } -+ } -+#endif -+ return supported; - } - - bool CPiAudioAE::SupportsDrain() -@@ -117,11 +136,43 @@ bool CPiAudioAE::SupportsDrain() - - void CPiAudioAE::OnSettingsChange(const std::string& setting) - { -- if (setting == "audiooutput.streamsilence") -+ if (setting == "audiooutput.streamsilence" || setting == "audiooutput.audiodevice") - UpdateStreamSilence(); - } - - void CPiAudioAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough) - { -+ if (!passthrough) -+ { -+ devices.push_back(AEDevice("Analogue", "Analogue")); -+ devices.push_back(AEDevice("HDMI", "HDMI")); -+ } - } - -+std::string CPiAudioAE::GetDefaultDevice(bool passthrough) -+{ -+ return "HDMI"; -+} -+ -+bool CPiAudioAE::IsSettingVisible(const std::string &settingId) -+{ -+ if (settingId == "audiooutput.samplerate") -+ return true; -+ -+ if (CSettings::Get().GetString("audiooutput.audiodevice") == "HDMI") -+ { -+ if (settingId == "audiooutput.passthrough") -+ return true; -+ if (settingId == "audiooutput.dtspassthrough") -+ return true; -+ if (settingId == "audiooutput.ac3passthrough") -+ return true; -+ if (settingId == "audiooutput.channels") -+ return true; -+ if (settingId == "audiooutput.dualaudio") -+ return true; -+ if (settingId == "audiooutput.streamsilence") -+ return true; -+ } -+ return false; -+} -diff --git a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -index 419241b..5eefdd8 100644 ---- a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -+++ b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -@@ -58,8 +58,10 @@ class CPiAudioAE : public IAE - - virtual void GarbageCollect() {}; - virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); -+ virtual std::string GetDefaultDevice(bool passthrough); -+ virtual bool IsSettingVisible(const std::string &settingId); - -- virtual bool SupportsRaw(); -+ virtual bool SupportsRaw(AEDataFormat format); - virtual bool SupportsDrain(); - - virtual void OnLostDevice() {} -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index c6ab3b9..74ac027 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -205,12 +205,12 @@ bool COMXAudio::PortSettingsChanged() - if(!m_omx_splitter.Initialize("OMX.broadcom.audio_splitter", OMX_IndexParamAudioInit)) - return false; - } -- if (CSettings::Get().GetBool("audiooutput.dualaudio") || CSettings::Get().GetInt("audiooutput.mode") == AUDIO_ANALOG) -+ if (CSettings::Get().GetBool("audiooutput.dualaudio") || CSettings::Get().GetString("audiooutput.audiodevice") == "Analogue") - { - if(!m_omx_render_analog.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - return false; - } -- if (CSettings::Get().GetBool("audiooutput.dualaudio") || CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI) -+ if (CSettings::Get().GetBool("audiooutput.dualaudio") || CSettings::Get().GetString("audiooutput.audiodevice") == "HDMI") - { - if(!m_omx_render_hdmi.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit)) - return false; -@@ -235,6 +235,8 @@ bool COMXAudio::PortSettingsChanged() - m_pcm_output.eChannelMapping[0] = OMX_AUDIO_ChannelLF; - m_pcm_output.eChannelMapping[1] = OMX_AUDIO_ChannelRF; - m_pcm_output.nChannels = 2; -+ /* limit samplerate (through resampling) if requested */ -+ m_pcm_output.nSamplingRate = std::min((int)m_pcm_output.nSamplingRate, CSettings::Get().GetInt("audiooutput.samplerate")); - - m_pcm_output.nPortIndex = m_omx_mixer.GetOutputPort(); - omx_err = m_omx_mixer.SetParameter(OMX_IndexParamAudioPcm, &m_pcm_output); -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index 08b432f..999ce40 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -42,6 +42,7 @@ - - #include "OMXPlayer.h" - #include "linux/RBP.h" -+#include "cores/AudioEngine/AEFactory.h" - - #include - #include -@@ -83,7 +84,6 @@ class COMXMsgAudioCodecChange : public CDVDMsg - m_messageQueue.SetMaxDataSize((small_mem ? 3:6) * 1024 * 1024); - - m_messageQueue.SetMaxTimeSize(8.0); -- m_use_passthrough = false; - m_passthrough = false; - m_use_hw_decode = false; - m_hw_decode = false; -@@ -95,15 +95,10 @@ class COMXMsgAudioCodecChange : public CDVDMsg - OMXPlayerAudio::~OMXPlayerAudio() - { - CloseStream(false); -- -- m_DllBcmHost.Unload(); - } - - bool OMXPlayerAudio::OpenStream(CDVDStreamInfo &hints) - { -- if(!m_DllBcmHost.Load()) -- return false; -- - m_bad_state = false; - - COMXAudioCodecOMX *codec = new COMXAudioCodecOMX(); -@@ -146,8 +141,6 @@ void OMXPlayerAudio::OpenStream(CDVDStreamInfo &hints, COMXAudioCodecOMX *codec) - m_flush = false; - m_nChannels = 0; - m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0; -- m_use_passthrough = (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI && -- !CSettings::Get().GetBool("audiooutput.dualaudio")) ? true : false ; - m_use_hw_decode = g_advancedSettings.m_omxHWAudioDecode; - m_format.m_dataFormat = GetDataFormat(m_hints); - m_format.m_sampleRate = 0; -@@ -511,13 +504,6 @@ bool OMXPlayerAudio::Passthrough() const - AEDataFormat OMXPlayerAudio::GetDataFormat(CDVDStreamInfo hints) - { - AEDataFormat dataFormat = AE_FMT_S16NE; -- bool hdmi_passthrough_dts = false; -- bool hdmi_passthrough_ac3 = false; -- -- if (m_DllBcmHost.vc_tv_hdmi_audio_supported(EDID_AudioFormat_eAC3, 2, EDID_AudioSampleRate_e44KHz, EDID_AudioSampleSize_16bit ) == 0) -- hdmi_passthrough_ac3 = true; -- if (m_DllBcmHost.vc_tv_hdmi_audio_supported(EDID_AudioFormat_eDTS, 2, EDID_AudioSampleRate_e44KHz, EDID_AudioSampleSize_16bit ) == 0) -- hdmi_passthrough_dts = true; - - m_passthrough = false; - m_hw_decode = false; -@@ -525,18 +511,15 @@ AEDataFormat OMXPlayerAudio::GetDataFormat(CDVDStreamInfo hints) - /* check our audio capabilties */ - - /* pathrought is overriding hw decode*/ -- if(AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode")) && m_use_passthrough) -+ if(hints.codec == AV_CODEC_ID_AC3 && CAEFactory::SupportsRaw(AE_FMT_AC3)) - { -- if(hints.codec == AV_CODEC_ID_AC3 && CSettings::Get().GetBool("audiooutput.ac3passthrough") && hdmi_passthrough_ac3) -- { -- dataFormat = AE_FMT_AC3; -- m_passthrough = true; -- } -- if(hints.codec == AV_CODEC_ID_DTS && CSettings::Get().GetBool("audiooutput.dtspassthrough") && hdmi_passthrough_dts) -- { -- dataFormat = AE_FMT_DTS; -- m_passthrough = true; -- } -+ dataFormat = AE_FMT_AC3; -+ m_passthrough = true; -+ } -+ if(hints.codec == AV_CODEC_ID_DTS && CAEFactory::SupportsRaw(AE_FMT_DTS)) -+ { -+ dataFormat = AE_FMT_DTS; -+ m_passthrough = true; - } - - /* hw decode */ -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.h b/xbmc/cores/omxplayer/OMXPlayerAudio.h -index 394f309..685a686 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.h -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.h -@@ -50,7 +50,6 @@ class OMXPlayerAudio : public CThread - OMXClock *m_av_clock; - COMXAudio m_omxAudio; - std::string m_codec_name; -- bool m_use_passthrough; - bool m_passthrough; - bool m_use_hw_decode; - bool m_hw_decode; -@@ -70,7 +69,6 @@ class OMXPlayerAudio : public CThread - int m_nChannels; - bool m_DecoderOpen; - -- DllBcmHost m_DllBcmHost; - bool m_bad_state; - - virtual void OnStartup(); --- -1.8.4 - - -From 3c40f55253326fbe0017b65369d3389dd2c95d33 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sun, 20 Oct 2013 13:54:45 +0200 -Subject: [PATCH 12/94] remove a bunch of obsolete advanced settings related to - audio - ---- - xbmc/cores/AudioEngine/AESinkFactory.cpp | 6 ++---- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 18 +++--------------- - xbmc/settings/AdvancedSettings.cpp | 14 -------------- - xbmc/settings/AdvancedSettings.h | 7 ------- - 4 files changed, 5 insertions(+), 40 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/AESinkFactory.cpp b/xbmc/cores/AudioEngine/AESinkFactory.cpp -index 906a824..e7fb9a3 100644 ---- a/xbmc/cores/AudioEngine/AESinkFactory.cpp -+++ b/xbmc/cores/AudioEngine/AESinkFactory.cpp -@@ -101,8 +101,7 @@ IAESink *CAESinkFactory::Create(std::string &device, AEAudioFormat &desiredForma - - - #if defined(TARGET_WINDOWS) -- if ((driver.empty() || -- driver == "WASAPI") && !g_advancedSettings.m_audioForceDirectSound) -+ if (driver == "WASAPI") - TRY_SINK(WASAPI) - else - TRY_SINK(DirectSound) // always fall back to DirectSound -@@ -141,8 +140,7 @@ void CAESinkFactory::EnumerateEx(AESinkInfoList &list, bool force) - { - #if defined(TARGET_WINDOWS) - ENUMERATE_SINK(DirectSound, force); -- if (!g_advancedSettings.m_audioForceDirectSound) -- ENUMERATE_SINK(WASAPI, force); -+ ENUMERATE_SINK(WASAPI, force); - #elif defined(TARGET_ANDROID) - ENUMERATE_SINK(AUDIOTRACK, force); - #elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD) -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index 623c035..94e2c5b 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -500,12 +500,7 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - return INT_MAX; - } - -- /* Inject one buffer of silence if sink has just opened */ -- /* to avoid losing start of stream or GUI sound */ -- if (g_advancedSettings.m_streamSilence) -- memcpy(buf, data, NumFramesRequested * m_format.m_frameSize); //fill buffer with audio -- else -- memset(buf, 0, NumFramesRequested * m_format.m_frameSize); //fill buffer with silence -+ memset(buf, 0, NumFramesRequested * m_format.m_frameSize); //fill buffer with silence - - hr = m_pRenderClient->ReleaseBuffer(NumFramesRequested, flags); //pass back to audio driver - if (FAILED(hr)) -@@ -520,7 +515,7 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - if (FAILED(hr)) - CLog::Log(LOGERROR, __FUNCTION__": AudioClient Start Failed"); - m_running = true; //signal that we're processing frames -- return g_advancedSettings.m_streamSilence ? NumFramesRequested : 0U; -+ return 0U; - } - - #ifndef _DEBUG -@@ -545,15 +540,8 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - { - if(eventAudioCallback != WAIT_OBJECT_0 || !&buf) - { -- /* Event handle timed out - flag sink as dirty for re-initializing */ - CLog::Log(LOGERROR, __FUNCTION__": Endpoint Buffer timed out"); -- if (g_advancedSettings.m_streamSilence) -- { -- m_isDirty = true; //flag new device or re-init needed -- Deinitialize(); -- m_running = false; -- return INT_MAX; -- } -+ return INT_MAX; - } - } - -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 0f30d84..619490d 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -115,12 +115,6 @@ void CAdvancedSettings::Initialize() - m_ac3Gain = 12.0f; - m_audioApplyDrc = true; - m_dvdplayerIgnoreDTSinWAV = false; -- m_audioResample = 0; -- m_allowTranscode44100 = false; -- m_audioForceDirectSound = false; -- m_audioAudiophile = false; -- m_allChannelStereo = false; -- m_streamSilence = false; - - //default hold time of 25 ms, this allows a 20 hertz sine to pass undistorted - m_limiterHold = 0.025f; -@@ -502,14 +496,6 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) - XMLUtils::GetInt(pElement, "percentseekforwardbig", m_musicPercentSeekForwardBig, 0, 100); - XMLUtils::GetInt(pElement, "percentseekbackwardbig", m_musicPercentSeekBackwardBig, -100, 0); - -- XMLUtils::GetInt(pElement, "resample", m_audioResample, 0, 192000); -- XMLUtils::GetBoolean(pElement, "allowtranscode44100", m_allowTranscode44100); -- XMLUtils::GetBoolean(pElement, "forceDirectSound", m_audioForceDirectSound); -- XMLUtils::GetBoolean(pElement, "audiophile", m_audioAudiophile); -- XMLUtils::GetBoolean(pElement, "allchannelstereo", m_allChannelStereo); -- XMLUtils::GetBoolean(pElement, "streamsilence", m_streamSilence); -- XMLUtils::GetString(pElement, "transcodeto", m_audioTranscodeTo); -- - TiXmlElement* pAudioExcludes = pElement->FirstChildElement("excludefromlisting"); - if (pAudioExcludes) - GetCustomRegexps(pAudioExcludes, m_audioExcludeFromListingRegExps); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index e6e02ad..d46ee0b 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -138,13 +138,6 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - CStdString m_audioDefaultPlayer; - float m_audioPlayCountMinimumPercent; - bool m_dvdplayerIgnoreDTSinWAV; -- int m_audioResample; -- bool m_allowTranscode44100; -- bool m_audioForceDirectSound; -- bool m_audioAudiophile; -- bool m_allChannelStereo; -- bool m_streamSilence; -- CStdString m_audioTranscodeTo; - float m_limiterHold; - float m_limiterRelease; - --- -1.8.4 - - -From 3ce36187bf19d85445b154389c5e4a60548c8520 Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Fri, 18 Oct 2013 22:01:55 +0200 -Subject: [PATCH 13/94] [osx/ios/atv2] - sync xcode project - ---- - XBMC.xcodeproj/project.pbxproj | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj -index 044538c..c5c4be5 100644 ---- a/XBMC.xcodeproj/project.pbxproj -+++ b/XBMC.xcodeproj/project.pbxproj -@@ -4180,7 +4180,6 @@ - DFB0F471161B747500D744F4 /* AddonsOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddonsOperations.h; sourceTree = ""; }; - DFB15B2015F8FB8100CDF0DE /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = ""; }; - DFB15B2115F8FB8100CDF0DE /* SDLMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SDLMain.mm; sourceTree = ""; }; -- DFB65F6415373AE7006B8FF1 /* AEAudioFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEAudioFormat.h; sourceTree = ""; }; - DFB65F6515373AE7006B8FF1 /* AEFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AEFactory.cpp; sourceTree = ""; }; - DFB65F6615373AE7006B8FF1 /* AEFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFactory.h; sourceTree = ""; }; - DFB65F6A15373AE7006B8FF1 /* AEEncoderFFmpeg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AEEncoderFFmpeg.cpp; sourceTree = ""; }; -@@ -7015,7 +7014,6 @@ - DFB65F6C15373AE7006B8FF1 /* Engines */, - DFB65F8815373AE7006B8FF1 /* Interfaces */, - DFB65FA215373AE7006B8FF1 /* Utils */, -- DFB65F6415373AE7006B8FF1 /* AEAudioFormat.h */, - DFB65F6515373AE7006B8FF1 /* AEFactory.cpp */, - DFB65F6615373AE7006B8FF1 /* AEFactory.h */, - ); --- -1.8.4 - - -From 5fc72477e52eb243fe3a3d94e3813b0714114000 Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Sun, 20 Oct 2013 13:37:37 +0200 -Subject: [PATCH 14/94] [AE/CA] - fix hidden settings for darwin - ---- - system/settings/darwin.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/system/settings/darwin.xml b/system/settings/darwin.xml -index 2cf4df6..ba56a25 100644 ---- a/system/settings/darwin.xml -+++ b/system/settings/darwin.xml -@@ -7,7 +7,7 @@ - - - -- -+ - - false - --- -1.8.4 - - -From c9bc851e8d5202bd985c85621c3e4dd8b3772a09 Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Fri, 18 Oct 2013 22:11:31 +0200 -Subject: [PATCH 15/94] [AE/CA] - adapt to new audiosettings page - ---- - .../AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp | 58 ++++++++++++++-------- - .../AudioEngine/Engines/CoreAudio/CoreAudioAE.h | 6 +-- - .../Engines/CoreAudio/CoreAudioAEHALOSX.cpp | 2 +- - .../DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp | 7 ++- - 4 files changed, 45 insertions(+), 28 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp -index 990163c..f067343 100644 ---- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp -@@ -240,17 +240,14 @@ bool CCoreAudioAE::OpenCoreAudio(unsigned int sampleRate, bool forceRaw, - case 10: m_stdChLayout = AE_CH_LAYOUT_7_1; break; - } - #endif -- // force optical/coax to 2.0 output channels -- if (!m_rawPassthrough && !m_transcode && CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958) -- m_stdChLayout = AE_CH_LAYOUT_2_0; - - // setup the desired format - m_format.m_channelLayout = CAEChannelInfo(m_stdChLayout); - - // if there is an audio resample rate set, use it. -- if (g_advancedSettings.m_audioResample && !m_rawPassthrough) -+ if (CSettings::Get().GetInt("audiooutput.config") == AE_CONFIG_FIXED && !m_rawPassthrough) - { -- sampleRate = g_advancedSettings.m_audioResample; -+ sampleRate = CSettings::Get().GetInt("audiooutput.samplerate"); - CLog::Log(LOGINFO, "CCoreAudioAE::passthrough - Forcing samplerate to %d", sampleRate); - } - -@@ -406,11 +403,13 @@ void CCoreAudioAE::OnSettingsChange(const std::string& setting) - setting == "audiooutput.custompassthrough" || - setting == "audiooutput.audiodevice" || - setting == "audiooutput.customdevice" || -- setting == "audiooutput.mode" || - setting == "audiooutput.ac3passthrough" || -+ setting == "audiooutput.eac3passthrough" || - setting == "audiooutput.dtspassthrough" || -- setting == "audiooutput.channels" || -- setting == "audiooutput.multichannellpcm") -+ setting == "audiooutput.channels" || -+ setting == "audiooutput.samplerate" || -+ setting == "audiooutput.config" || -+ setting == "audiooutput.passthrough" ) - { - // only reinit the engine if we not - // suspended (resume will initialize -@@ -508,8 +507,30 @@ void CCoreAudioAE::SetSoundMode(const int mode) - StopAllSounds(); - } - --bool CCoreAudioAE::SupportsRaw() -+bool CCoreAudioAE::SupportsRaw(AEDataFormat format) - { -+ switch(format) -+ { -+ case AE_FMT_AC3: -+ case AE_FMT_DTS: -+ case AE_FMT_EAC3: -+ case AE_FMT_LPCM: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+bool CCoreAudioAE::IsSettingVisible(const std::string &settingId) -+{ -+ if (settingId == "audiooutput.samplerate") -+ { -+ if (CSettings::Get().GetInt("audiooutput.config") == AE_CONFIG_FIXED) -+ return true; -+ else -+ return false; -+ } -+ - return true; - } - -@@ -534,20 +555,17 @@ IAEStream* CCoreAudioAE::MakeStream(enum AEDataFormat dataFormat, - CLog::Log(LOGINFO, "CCoreAudioAE::MakeStream - %s, %u, %u, %s", - CAEUtil::DataFormatToStr(dataFormat), sampleRate, encodedSamplerate, ((std::string)channelInfo).c_str()); - -+ bool multichannelpcm = CSettings::Get().GetInt("audiooutput.channels") > AE_CH_LAYOUT_2_0; //if more then 2 channels are set - assume lpcm capability -+#if defined(TARGET_DARWIN_IOS) -+ multichannelpcm = false; -+#endif - // determine if we need to transcode this audio - // when we're called, we'll either get the audio in an encoded form (COREAUDIO_IS_RAW==true) - // that we can passthrough based on user options, or we'll get it unencoded - // if it's unencoded, and is 5.1, we'll transcode it to AC3 if possible -- bool transcode = CSettings::Get().GetBool("audiooutput.ac3passthrough") && -- ( -- (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958) || -- ( -- (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI) && -- !CSettings::Get().GetBool("audiooutput.multichannellpcm") -- ) -- ) && -- !COREAUDIO_IS_RAW(dataFormat) && -- (channelInfo.Count() == 6); -+ bool transcode = CSettings::Get().GetBool("audiooutput.passthrough") && CSettings::Get().GetBool("audiooutput.ac3passthrough") && !multichannelpcm && -+ !COREAUDIO_IS_RAW(dataFormat) && -+ (channelInfo.Count() == 6); - - CCoreAudioAEStream *stream = new CCoreAudioAEStream(dataFormat, sampleRate, encodedSamplerate, channelLayout, options, transcode); - CSingleLock streamLock(m_streamLock); -@@ -748,7 +766,7 @@ void CCoreAudioAE::MixSounds(float *buffer, unsigned int samples) - void CCoreAudioAE::GarbageCollect() - { - #if defined(TARGET_DARWIN_OSX) -- if (g_advancedSettings.m_streamSilence) -+ if (CSettings::Get().GetBool("audiooutput.streamsilence")) - return; - - if (!m_streamsPlaying && m_playing_sounds.empty()) -diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.h b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.h -index 5e9d694..f31dada 100644 ---- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.h -+++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.h -@@ -91,9 +91,9 @@ class CCoreAudioAE : public IAE, public ICoreAudioSource - virtual void SetMute(const bool enabled); - virtual bool IsMuted(); - virtual void SetSoundMode(const int mode); -- -- -- virtual bool SupportsRaw(); -+ virtual bool SupportsRaw(AEDataFormat format); -+ virtual bool IsSettingVisible(const std::string &settingId); -+ virtual bool SupportsDrain() { return true; } - - CCoreAudioAEHAL* GetHAL(); - -diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHALOSX.cpp b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHALOSX.cpp -index 52b2272..3728d5f 100644 ---- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHALOSX.cpp -+++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEHALOSX.cpp -@@ -95,7 +95,7 @@ bool CCoreAudioAEHALOSX::InitializePCM(ICoreAudioSource *pSource, AEAudioFormat - - AudioChannelLayoutTag layout = g_LayoutMap[ CSettings::Get().GetInt("audiooutput.channels") ]; - // force optical/coax to 2.0 output channels -- if (!m_Passthrough && CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958) -+ if (!m_Passthrough && CSettings::Get().GetInt("audiooutput.channels") == AE_CH_LAYOUT_2_0) - layout = g_LayoutMap[1]; - - if (!m_audioGraph->Open(pSource, format, outputDevice, allowMixing, layout, m_initVolume )) -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp -index ae3916b..69992cc 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp -@@ -74,10 +74,9 @@ bool CDVDAudioCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options - return false; - } - --#if defined(TARGET_DARWIN) -- int audioMode = CSettings::Get().GetInt("audiooutput.mode"); -- if (audioMode == AUDIO_HDMI) -- m_bLpcmMode = CSettings::Get().GetBool("audiooutput.multichannellpcm"); -+#if defined(TARGET_DARWIN_OSX) -+ if (CSettings::Get().GetInt("audiooutput.channels") > AE_CH_LAYOUT_2_0) -+ m_bLpcmMode = true; - #endif - - m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec); --- -1.8.4 - - -From 2923fd724e61dcda1ad0a689e378546d50296885 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Tue, 22 Oct 2013 20:48:11 +0200 -Subject: [PATCH 16/94] AE: make streamsilence an integer so it can define a - timeout after which the mode is disabled - ---- - language/English/strings.po | 10 +++++++++- - system/settings/settings.xml | 8 ++++++-- - xbmc/cores/AudioEngine/AEFactory.cpp | 14 ++++++++++++++ - xbmc/cores/AudioEngine/AEFactory.h | 1 + - xbmc/settings/Settings.cpp | 2 ++ - 5 files changed, 32 insertions(+), 3 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index 009e1c0..74a5e59 100755 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -6080,7 +6080,15 @@ msgctxt "#13553" - msgid "%.1f Seconds" - msgstr "" - --#empty strings from id 13554 to 13599 -+msgctxt "#13554" -+msgid "%d Minute" -+msgstr "" -+ -+msgctxt "#13555" -+msgid "%d Minutes" -+msgstr "" -+ -+#empty strings from id 13556 to 13599 - - #: system/settings/darwin.xml - msgctxt "#13600" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 2215f70..f13b4d4 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2052,10 +2052,14 @@ - - - -- -+ - 1 - audiosupportsdrain -- true -+ 1 -+ -+ audiostreamsilence -+ -+ - - - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 4c1dc86..a5fc6e1 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -370,6 +370,20 @@ void CAEFactory::SettingOptionsAudioQualityLevelsFiller(const CSetting *setting, - list.push_back(std::make_pair(g_localizeStrings.Get(13509), AE_QUALITY_REALLYHIGH)); - } - -+void CAEFactory::SettingOptionsAudioStreamsilenceFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t) -+{ -+ if (!AE) -+ return; -+ -+ list.push_back(std::make_pair(g_localizeStrings.Get(20422), XbmcThreads::EndTime::InfiniteValue)); -+ list.push_back(std::make_pair(g_localizeStrings.Get(13551), 0)); -+ list.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(13554).c_str(), 1), 1)); -+ for (int i = 2; i <= 10; i++) -+ { -+ list.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(13555).c_str(), i), i)); -+ } -+} -+ - void CAEFactory::SettingOptionsAudioDevicesFillerGeneral(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t, bool passthrough) - { - current = ((const CSettingString*)setting)->GetValue(); -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index 20e67a3..ccf57c1 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -74,6 +74,7 @@ class CAEFactory - static void SettingOptionsAudioDevicesFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t); - static void SettingOptionsAudioDevicesPassthroughFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t); - static void SettingOptionsAudioQualityLevelsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); -+ static void SettingOptionsAudioStreamsilenceFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); - static bool IsSettingVisible(const std::string &condition, const std::string &value, const std::string &settingId); - - static void RegisterAudioCallback(IAudioCallback* pCallback); -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index e61bce4..b73bdda 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -372,6 +372,7 @@ void CSettings::Uninitialize() - m_settingsManager->UnregisterSettingOptionsFiller("aequalitylevels"); - m_settingsManager->UnregisterSettingOptionsFiller("audiodevices"); - m_settingsManager->UnregisterSettingOptionsFiller("audiodevicespassthrough"); -+ m_settingsManager->UnregisterSettingOptionsFiller("audiostreamsilence"); - m_settingsManager->UnregisterSettingOptionsFiller("charsets"); - m_settingsManager->UnregisterSettingOptionsFiller("epgguideviews"); - m_settingsManager->UnregisterSettingOptionsFiller("fontheights"); -@@ -686,6 +687,7 @@ void CSettings::InitializeOptionFillers() - m_settingsManager->RegisterSettingOptionsFiller("aequalitylevels", CAEFactory::SettingOptionsAudioQualityLevelsFiller); - m_settingsManager->RegisterSettingOptionsFiller("audiodevices", CAEFactory::SettingOptionsAudioDevicesFiller); - m_settingsManager->RegisterSettingOptionsFiller("audiodevicespassthrough", CAEFactory::SettingOptionsAudioDevicesPassthroughFiller); -+ m_settingsManager->RegisterSettingOptionsFiller("audiostreamsilence", CAEFactory::SettingOptionsAudioStreamsilenceFiller); - m_settingsManager->RegisterSettingOptionsFiller("charsets", CCharsetConverter::SettingOptionsCharsetsFiller); - m_settingsManager->RegisterSettingOptionsFiller("epgguideviews", PVR::CGUIWindowPVRGuide::SettingOptionsEpgGuideViewFiller); - m_settingsManager->RegisterSettingOptionsFiller("fonts", GUIFontManager::SettingOptionsFontsFiller); --- -1.8.4 - - -From a996bfc6a403ce9b91eb438734b2df8fa50825c9 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Tue, 22 Oct 2013 20:48:44 +0200 -Subject: [PATCH 17/94] ActiveAE: implement timeout for streamsilence - ---- - .../AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 19 +++++++++++++------ - .../cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h | 3 ++- - 2 files changed, 15 insertions(+), 7 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -index 966b446..d2a8d12 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -@@ -163,7 +163,7 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg) - m_device = *(data->device); - } - m_extError = false; -- m_extSilence = false; -+ m_extSilenceTimer = 0; - ReturnBuffers(); - OpenSink(); - -@@ -266,10 +266,14 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg) - switch (signal) - { - case CSinkControlProtocol::SILENCEMODE: -- m_extSilence = *(bool*)msg->data; -- if (CSettings::Get().GetBool("audiooutput.streamsilence")) -- m_extSilence = true; -- if (m_extSilence) -+ bool silencemode; -+ silencemode = *(bool*)msg->data; -+ if (silencemode) -+ m_extSilenceTimeout = XbmcThreads::EndTime::InfiniteValue; -+ else -+ m_extSilenceTimeout = CSettings::Get().GetInt("audiooutput.streamsilence") * 60000; -+ m_extSilenceTimer.Set(m_extSilenceTimeout); -+ if (!m_extSilenceTimer.IsTimePast()) - { - m_state = S_TOP_CONFIGURED_SILENCE; - m_extTimeout = 0; -@@ -311,6 +315,7 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg) - { - m_state = S_TOP_CONFIGURED_PLAY; - m_extTimeout = delay / 2; -+ m_extSilenceTimer.Set(m_extSilenceTimeout); - } - return; - default: -@@ -403,7 +408,7 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg) - switch (signal) - { - case CSinkControlProtocol::TIMEOUT: -- if (m_extSilence) -+ if (!m_extSilenceTimer.IsTimePast()) - { - m_state = S_TOP_CONFIGURED_SILENCE; - m_extTimeout = 0; -@@ -435,6 +440,8 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg) - m_sink = NULL; - m_state = S_TOP_CONFIGURED_SUSPEND; - } -+ else -+ m_state = S_TOP_CONFIGURED_PLAY; - m_extTimeout = 0; - return; - default: -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -index 2aebbf6..52f4a17 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -@@ -116,7 +116,8 @@ class CActiveAESink : private CThread - bool m_bStateMachineSelfTrigger; - int m_extTimeout; - bool m_extError; -- bool m_extSilence; -+ int m_extSilenceTimeout; -+ XbmcThreads::EndTime m_extSilenceTimer; - - CSampleBuffer m_sampleOfSilence; - uint8_t *m_convertBuffer; --- -1.8.4 - - -From 6c6e2e46d2f207eb28361caffa23633efd838f6c Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Wed, 23 Oct 2013 20:49:12 +0200 -Subject: [PATCH 18/94] AE: rework streamsilence - ---- - system/settings/rbp.xml | 7 +++++-- - system/settings/settings.xml | 1 - - xbmc/cores/AudioEngine/AEFactory.cpp | 14 +++++++++----- - xbmc/cores/AudioEngine/AEFactory.h | 2 +- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 2 +- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 2 +- - xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp | 2 +- - xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp | 6 +++--- - xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h | 2 +- - xbmc/cores/AudioEngine/Interfaces/AE.h | 2 +- - xbmc/settings/Settings.cpp | 3 --- - 11 files changed, 23 insertions(+), 20 deletions(-) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 866aed4..166314a 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -65,13 +65,16 @@ - - - 2 -- audiosupportsdrain -- false -+ 0 - - - audiooutput.streamsilence - - -+ -+ audiostreamsilence -+ -+ - - - -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index f13b4d4..d25dd72 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2054,7 +2054,6 @@ - - - 1 -- audiosupportsdrain - 1 - - audiostreamsilence -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index a5fc6e1..18288bc 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -262,10 +262,10 @@ bool CAEFactory::SupportsRaw(AEDataFormat format) - return false; - } - --bool CAEFactory::SupportsDrain() -+bool CAEFactory::SupportsSilenceTimeout() - { - if(AE) -- return AE->SupportsDrain(); -+ return AE->SupportsSilenceTimeout(); - - return false; - } -@@ -377,10 +377,14 @@ void CAEFactory::SettingOptionsAudioStreamsilenceFiller(const CSetting *setting, - - list.push_back(std::make_pair(g_localizeStrings.Get(20422), XbmcThreads::EndTime::InfiniteValue)); - list.push_back(std::make_pair(g_localizeStrings.Get(13551), 0)); -- list.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(13554).c_str(), 1), 1)); -- for (int i = 2; i <= 10; i++) -+ -+ if (AE->SupportsSilenceTimeout()) - { -- list.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(13555).c_str(), i), i)); -+ list.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(13554).c_str(), 1), 1)); -+ for (int i = 2; i <= 10; i++) -+ { -+ list.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(13555).c_str(), i), i)); -+ } - } - } - -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index ccf57c1..745ddc1 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -54,7 +54,7 @@ class CAEFactory - static void VerifyOutputDevice(std::string &device, bool passthrough); - static std::string GetDefaultDevice(bool passthrough); - static bool SupportsRaw(AEDataFormat format); -- static bool SupportsDrain(); -+ static bool SupportsSilenceTimeout(); - - /** - * Returns true if current AudioEngine supports at lest two basic quality levels -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index e5e4c5c..0837b7c 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -2069,7 +2069,7 @@ bool CActiveAE::SupportsRaw(AEDataFormat format) - return true; - } - --bool CActiveAE::SupportsDrain() -+bool CActiveAE::SupportsSilenceTimeout() - { - return true; - } -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index 1ac7031..e3e772a 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -215,7 +215,7 @@ class CActiveAE : public IAE, private CThread - virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); - virtual std::string GetDefaultDevice(bool passthrough); - virtual bool SupportsRaw(AEDataFormat format); -- virtual bool SupportsDrain(); -+ virtual bool SupportsSilenceTimeout(); - virtual bool SupportsQualityLevel(enum AEQuality level); - virtual bool IsSettingVisible(const std::string &settingId); - -diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp -index f067343..d57dd5a 100644 ---- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp -@@ -766,7 +766,7 @@ void CCoreAudioAE::MixSounds(float *buffer, unsigned int samples) - void CCoreAudioAE::GarbageCollect() - { - #if defined(TARGET_DARWIN_OSX) -- if (CSettings::Get().GetBool("audiooutput.streamsilence")) -+ if (CSettings::Get().GetInt("audiooutput.streamsilence") != 0) - return; - - if (!m_streamsPlaying && m_playing_sounds.empty()) -diff --git a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -index 5daa1ff..9eb46b7 100644 ---- a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -@@ -49,7 +49,7 @@ void CPiAudioAE::UpdateStreamSilence() - { - #if defined(TARGET_RASPBERRY_PI) - bool enable = CSettings::Get().GetString("audiooutput.audiodevice") == "HDMI" && -- CSettings::Get().GetBool("audiooutput.streamsilence"); -+ CSettings::Get().GetInt("audiooutput.streamsilence") != 0; - char response[80] = ""; - char command[80] = ""; - sprintf(command, "force_audio hdmi %d", enable); -@@ -129,9 +129,9 @@ bool CPiAudioAE::SupportsRaw(AEDataFormat format) - return supported; - } - --bool CPiAudioAE::SupportsDrain() -+bool CPiAudioAE::SupportsSilenceTimeout() - { -- return true; -+ return false; - } - - void CPiAudioAE::OnSettingsChange(const std::string& setting) -diff --git a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -index 5eefdd8..4836ed6 100644 ---- a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -+++ b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -@@ -62,7 +62,7 @@ class CPiAudioAE : public IAE - virtual bool IsSettingVisible(const std::string &settingId); - - virtual bool SupportsRaw(AEDataFormat format); -- virtual bool SupportsDrain(); -+ virtual bool SupportsSilenceTimeout(); - - virtual void OnLostDevice() {} - virtual void OnResetDevice() {} -diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h -index e60aa66..d2f895c 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AE.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AE.h -@@ -209,7 +209,7 @@ class IAE - * Returns true if the AudioEngine supports drain mode which is not streaming silence when idle - * @returns true if the AudioEngine is capable of drain mode - */ -- virtual bool SupportsDrain() { return false; } -+ virtual bool SupportsSilenceTimeout() { return false; } - - virtual void RegisterAudioCallback(IAudioCallback* pCallback) {} - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index b73bdda..72c8700 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -797,9 +797,6 @@ void CSettings::InitializeConditions() - if (g_application.IsStandAlone()) - m_settingsManager->AddCondition("isstandalone"); - -- if (CAEFactory::SupportsDrain()) -- m_settingsManager->AddCondition("audiosupportsdrain"); -- - if(CAEFactory::SupportsQualitySetting()) - m_settingsManager->AddCondition("has_ae_quality_levels"); - --- -1.8.4 - - -From f4ba9e63790c8b4f42efba267eb383961d0825ec Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Oct 2013 21:32:26 +0100 -Subject: [PATCH 19/94] [rbp/omxplayer] Support timeout value of streamsilence - ---- - .../AudioEngine/Engines/PiAudio/PiAudioAE.cpp | 34 ++++++++++++++++++++-- - xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h | 6 +++- - xbmc/cores/omxplayer/OMXAudio.cpp | 7 +++++ - 3 files changed, 43 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -index 9eb46b7..ccf40b0 100644 ---- a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.cpp -@@ -32,6 +32,7 @@ - #endif - - CPiAudioAE::CPiAudioAE() -+: CThread("CPiAudio") - { - } - -@@ -42,14 +43,39 @@ - bool CPiAudioAE::Initialize() - { - UpdateStreamSilence(); -+ Create(); - return true; - } - -+void CPiAudioAE::Process() -+{ -+ while(!m_bStop) -+ { -+ /* thread just currently checks once a second if it's time to disable streamsilence */ -+ Sleep(1000); -+ -+ if (m_extSilenceTimer.IsTimePast()) -+ { -+ UpdateStreamSilence(false); -+ m_extSilenceTimer.Set(XbmcThreads::EndTime::InfiniteValue); -+ } -+ } -+} -+ - void CPiAudioAE::UpdateStreamSilence() - { -+ if (CSettings::Get().GetInt("audiooutput.streamsilence") > 0) -+ m_extSilenceTimeout = CSettings::Get().GetInt("audiooutput.streamsilence") * 60000; -+ else -+ m_extSilenceTimeout = XbmcThreads::EndTime::InfiniteValue; -+ m_extSilenceTimer.Set(m_extSilenceTimeout); -+ UpdateStreamSilence(CSettings::Get().GetString("audiooutput.audiodevice") == "HDMI" && -+ CSettings::Get().GetInt("audiooutput.streamsilence") != 0); -+} -+ -+void CPiAudioAE::UpdateStreamSilence(bool enable) -+{ - #if defined(TARGET_RASPBERRY_PI) -- bool enable = CSettings::Get().GetString("audiooutput.audiodevice") == "HDMI" && -- CSettings::Get().GetInt("audiooutput.streamsilence") != 0; - char response[80] = ""; - char command[80] = ""; - sprintf(command, "force_audio hdmi %d", enable); -@@ -94,6 +120,8 @@ IAEStream *CPiAudioAE::MakeStream(enum AEDataFormat dataFormat, unsigned int sam - - IAEStream *CPiAudioAE::FreeStream(IAEStream *stream) - { -+ // will retrigger the streamsilence timer -+ UpdateStreamSilence(); - return NULL; - } - -@@ -131,7 +159,7 @@ bool CPiAudioAE::SupportsRaw(AEDataFormat format) - - bool CPiAudioAE::SupportsSilenceTimeout() - { -- return false; -+ return true; - } - - void CPiAudioAE::OnSettingsChange(const std::string& setting) -diff --git a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -index 4836ed6..944fba8 100644 ---- a/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -+++ b/xbmc/cores/AudioEngine/Engines/PiAudio/PiAudioAE.h -@@ -29,13 +29,14 @@ - namespace PiAudioAE - { - --class CPiAudioAE : public IAE -+class CPiAudioAE : public IAE, public CThread - { - protected: - friend class ::CAEFactory; - CPiAudioAE(); - virtual ~CPiAudioAE(); - virtual bool Initialize(); -+ virtual void Process(); - - public: - virtual bool Suspend(); -@@ -69,8 +70,11 @@ class CPiAudioAE : public IAE - - protected: - void UpdateStreamSilence(); -+ void UpdateStreamSilence(bool enable); - // polled via the interface - float m_aeVolume; - bool m_aeMuted; -+ int m_extSilenceTimeout; -+ XbmcThreads::EndTime m_extSilenceTimer; - }; - }; -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index 74ac027..764f26a 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -39,6 +39,7 @@ - #include "settings/Settings.h" - #include "guilib/LocalizeStrings.h" - #include "cores/AudioEngine/Utils/AEConvert.h" -+#include "cores/AudioEngine/AEFactory.h" - - using namespace std; - -@@ -776,6 +777,9 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - CLog::Log(LOGDEBUG, "COMXAudio::Initialize device passthrough %d hwdecode %d", - m_Passthrough, m_HWDecode); - -+ /* dummy call to inform PiAudioAE that audo is active */ -+ CAEFactory::MakeStream((enum AEDataFormat)0, 0, 0, (CAEChannelInfo)0, 0); -+ - return true; - } - -@@ -842,6 +846,9 @@ bool COMXAudio::Deinitialize() - - m_last_pts = DVD_NOPTS_VALUE; - -+ /* dummy call to inform PiAudioAE that audo is inactive */ -+ CAEFactory::FreeStream(0); -+ - return true; - } - --- -1.8.4 - - -From d65a5aaf22bf8a09747bd81025222c03c21859d4 Mon Sep 17 00:00:00 2001 +From 72cebd615a84986c340adba5b022fa5fef83adb0 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:34:39 +0200 -Subject: [PATCH 20/94] videoplayer: adapt lateness detection and dropping to +Subject: [PATCH 01/79] videoplayer: adapt lateness detection and dropping to buffering --- @@ -6513,10 +582,10 @@ index f8ad541..186e271 100644 1.8.4 -From 5289d4beab87e879b88723b3819a46cc35094aaf Mon Sep 17 00:00:00 2001 +From 69be147918746749346a6cc87deabf2589220c10 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 2 Sep 2012 16:05:21 +0200 -Subject: [PATCH 21/94] video player: present correct pts to user for a/v sync +Subject: [PATCH 02/79] video player: present correct pts to user for a/v sync (after buffering in renderer) --- @@ -6584,10 +653,10 @@ index 186e271..59c7f09 100644 1.8.4 -From 907ec7c3a090ca68f37368d5b756fc1a43f18b4a Mon Sep 17 00:00:00 2001 +From 47480f39ee7b9b7445d01bb6723268d842986392 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 16 Feb 2013 18:25:53 +0100 -Subject: [PATCH 22/94] videoplayer: some rework and documentation +Subject: [PATCH 03/79] videoplayer: some rework and documentation --- .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 29 ++++++++++++++++++++-- @@ -6698,10 +767,10 @@ index 752a291..0aef5ee 100644 1.8.4 -From f5599129105901cc261b722f2a1cd0e6c3122512 Mon Sep 17 00:00:00 2001 +From 3550ef4848a4eb170c31a5ec93c27516d03a9054 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 1 Jun 2013 11:21:19 +0200 -Subject: [PATCH 23/94] renderer: bump buffers to 5 +Subject: [PATCH 04/79] renderer: bump buffers to 5 --- xbmc/cores/VideoRenderers/BaseRenderer.h | 2 +- @@ -6724,10 +793,10 @@ index a61d3cf..df5fe0e 100644 1.8.4 -From 9c0f9254ed24df39d2abb5a70e9278e4fa55a69e Mon Sep 17 00:00:00 2001 +From 1090164aab0a333514c82091fd9b263928fa5832 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:41:31 +0200 -Subject: [PATCH 24/94] videoplayer: update frametime, it might change due to +Subject: [PATCH 05/79] videoplayer: update frametime, it might change due to fps detection --- @@ -6751,10 +820,10 @@ index 0aef5ee..e7e5097 100644 1.8.4 -From 49e298f72234250bcc6dcb4c2786721a8d1aee8b Mon Sep 17 00:00:00 2001 +From d4659b465903adff0cdf6a17b7c42e9bdec091ae Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:43:06 +0200 -Subject: [PATCH 25/94] videoplayer: give streams with invalid fps a chance for +Subject: [PATCH 06/79] videoplayer: give streams with invalid fps a chance for fps detection --- @@ -6778,10 +847,10 @@ index e7e5097..c40d193 100644 1.8.4 -From 1ecba467cbd4549060419f8824b1c23f5dea734f Mon Sep 17 00:00:00 2001 +From 532c0b2be73bfc2412540fd4123a9aebca6bc65e Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:49:05 +0200 -Subject: [PATCH 26/94] dvdplayer: allow rewinding at end of stream, do a seek +Subject: [PATCH 07/79] dvdplayer: allow rewinding at end of stream, do a seek after rewind --- @@ -6818,10 +887,10 @@ index c412b9f..437276b 100644 1.8.4 -From 870ce55e5db4bb5beeec820939baea4d3eee8aab Mon Sep 17 00:00:00 2001 +From 7bb9bb2605c142b1646dee8c1db62217ad86f005 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 15:22:05 +0200 -Subject: [PATCH 27/94] X11: ditch SDL for video and window events +Subject: [PATCH 08/79] X11: ditch SDL for video and window events --- xbmc/Application.cpp | 2 +- @@ -6837,7 +906,7 @@ Subject: [PATCH 27/94] X11: ditch SDL for video and window events create mode 100644 xbmc/windowing/WinEventsX11.h diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index b27d49d..a016050 100644 +index e1465df..4f639d0 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -856,7 +856,7 @@ bool CApplication::CreateGUI() @@ -8359,10 +2428,10 @@ index 2454fb1..f5e5731 100644 1.8.4 -From eaede54d5093cc43266763d09b72df7868cf1270 Mon Sep 17 00:00:00 2001 +From 976a956d41f93b1871adf2122dd5cf8d3d243c76 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 15:24:22 +0200 -Subject: [PATCH 28/94] X11: Add xbmc icon +Subject: [PATCH 09/79] X11: Add xbmc icon --- xbmc/windowing/X11/WinSystemX11.cpp | 126 +++++++++++++++++++++++++++++++++++- @@ -8552,10 +2621,10 @@ index f5e5731..6953b68 100644 1.8.4 -From 40f1403ac91fc653ef3f43def170dbe1201fa235 Mon Sep 17 00:00:00 2001 +From 340df543fec60cacca9bb6995f74c39d01b0cd96 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 20 May 2012 14:11:26 +0200 -Subject: [PATCH 29/94] X11: add SDL joystick until we have a better solution +Subject: [PATCH 10/79] X11: add SDL joystick until we have a better solution --- xbmc/windowing/WinEventsX11.cpp | 26 ++++++++++++++++++++++++++ @@ -8609,10 +2678,10 @@ index ad58aad..6f57a87 100644 1.8.4 -From 49d468cfd60c593b2e317665798454f24eebf381 Mon Sep 17 00:00:00 2001 +From 9c7a16c8ce5166f342bc3a6f3fc9334446f0f94f Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 5 Jul 2012 12:35:55 +0200 -Subject: [PATCH 30/94] X11: factor out code handling device reset notification +Subject: [PATCH 11/79] X11: factor out code handling device reset notification --- xbmc/windowing/X11/WinSystemX11.cpp | 22 ++++++++++++++-------- @@ -8675,10 +2744,10 @@ index 6953b68..d60d04a 100644 1.8.4 -From b4026e4e3a8ebcc9991aa3875d5245520d52c3af Mon Sep 17 00:00:00 2001 +From 8330470474c87a7d7ccba6eed88f31137535bcad Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 15:02:00 +0200 -Subject: [PATCH 31/94] X11: move xrandr events to WinEventsX11 +Subject: [PATCH 12/79] X11: move xrandr events to WinEventsX11 --- xbmc/windowing/WinEventsX11.cpp | 42 +++++++++++++++++++++++++++++++++++++ @@ -8822,10 +2891,10 @@ index b3be9fc..7259674 100644 1.8.4 -From 85c659d33c307c26e6890637f3aca60769c04ca5 Mon Sep 17 00:00:00 2001 +From 505060e9631082164b165e7c3b329b330521f88a Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 12 Apr 2012 15:43:56 +0200 -Subject: [PATCH 32/94] xrandr: remove method RestoreState +Subject: [PATCH 13/79] xrandr: remove method RestoreState --- xbmc/windowing/X11/WinSystemX11.cpp | 13 +++++++++++-- @@ -8904,10 +2973,10 @@ index 0aec487..00b49dc 100644 1.8.4 -From 422aa20387ad099a2e4cbcef2b1fa9868a3dcaec Mon Sep 17 00:00:00 2001 +From c07e98a91a5dd7f94991ff1f02d7ab58de58f95d Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 20 May 2012 13:17:10 +0200 -Subject: [PATCH 33/94] xrandr: observe orientation +Subject: [PATCH 14/79] xrandr: observe orientation --- xbmc/windowing/X11/WinSystemX11.cpp | 89 ++++++++++++++++++++++++++++++------- @@ -9122,10 +3191,10 @@ index 00b49dc..508604d 100644 1.8.4 -From cfee1ab0c2fee606b9568e7b97774fdd57924c30 Mon Sep 17 00:00:00 2001 +From 112eebd688325cbbd78dd738b1e7756c2da39a09 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:54:15 +0200 -Subject: [PATCH 34/94] xrandr: allow getting info for multiple screen's +Subject: [PATCH 15/79] xrandr: allow getting info for multiple screen's Refactored by: Joakim Plate --- @@ -9300,10 +3369,10 @@ index 508604d..d37838a 100644 1.8.4 -From e5b1cb349535a98dd20aabd10a3fe402ecef4605 Mon Sep 17 00:00:00 2001 +From cb51740435835f09ff776e2d02c07145542cd912 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:44:00 +0200 -Subject: [PATCH 35/94] X11: fix multi-head setups +Subject: [PATCH 16/79] X11: fix multi-head setups --- language/English/strings.po | 4 +- @@ -9318,7 +3387,7 @@ Subject: [PATCH 35/94] X11: fix multi-head setups 9 files changed, 229 insertions(+), 116 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 74a5e59..291932d 100755 +index 74be31c..e15ddc7 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -1019,7 +1019,9 @@ msgctxt "#245" @@ -9487,7 +3556,7 @@ index cc4002b..d80f1dc 100644 protected: CDisplaySettings(); diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 72c8700..8096883 100644 +index 57ba0c1..0d7c745 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -387,6 +387,7 @@ void CSettings::Uninitialize() @@ -9516,7 +3585,7 @@ index 72c8700..8096883 100644 #ifdef HAS_GLES m_settingsManager->AddCondition("has_gles"); #endif -@@ -878,6 +883,7 @@ void CSettings::InitializeISettingCallbacks() +@@ -880,6 +885,7 @@ void CSettings::InitializeISettingCallbacks() settingSet.insert("videoscreen.screen"); settingSet.insert("videoscreen.resolution"); settingSet.insert("videoscreen.screenmode"); @@ -10072,10 +4141,10 @@ index eb8005e..7d53d36 100644 1.8.4 -From 306a07f2e491d21e5b56a537e778dd45583ec08b Mon Sep 17 00:00:00 2001 +From 20c1a7aec3a58e3e5d18255b2e5a547dc5cfb579 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:36:32 +0200 -Subject: [PATCH 36/94] X11: remove all DefaultScreen and RootWindow macros +Subject: [PATCH 17/79] X11: remove all DefaultScreen and RootWindow macros --- xbmc/windowing/X11/WinSystemX11.cpp | 6 +++--- @@ -10143,10 +4212,10 @@ index 81c6800..8a8ff83 100644 1.8.4 -From 59938103c2fb554f1ac6f8fd84ea5a32e212b3ee Mon Sep 17 00:00:00 2001 +From be55daf273b57c315d5c74fa9556f9d8d61281d1 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:45:22 +0200 -Subject: [PATCH 37/94] X11: remove all DefaultScreen and RootWindow macros +Subject: [PATCH 18/79] X11: remove all DefaultScreen and RootWindow macros (VideoRefClock) Note this is on a separate display connection. @@ -10218,10 +4287,10 @@ index 3ba991a..7eecd40 100644 1.8.4 -From 93767fb106373fdf0fac8e443ab42adbfdf9fa4b Mon Sep 17 00:00:00 2001 +From 49d702ce61ef96c16d182ea752ec6c1688a46ee3 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 20 Jun 2012 17:37:11 +0200 -Subject: [PATCH 38/94] X11: recreate gl context after output has changed +Subject: [PATCH 19/79] X11: recreate gl context after output has changed --- xbmc/windowing/X11/WinSystemX11.cpp | 24 ++++++++++++++---------- @@ -10372,10 +4441,10 @@ index 8a8ff83..8707467 100644 1.8.4 -From 56b93b9ce67f8deaba618d2dc158a269ac1b232a Mon Sep 17 00:00:00 2001 +From 219dd9c3f50c761ab548b829711e944a637e5065 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 12:06:25 +0200 -Subject: [PATCH 39/94] X11: hook video reference clock in windowing +Subject: [PATCH 20/79] X11: hook video reference clock in windowing --- xbmc/video/VideoReferenceClock.cpp | 71 +++++++++++++++++++++++++++----------- @@ -10580,10 +4649,10 @@ index dd65a1b..afd71fc 100644 1.8.4 -From deedcea046c209e32e3215feceaa26066b462019 Mon Sep 17 00:00:00 2001 +From 736ff37156a94cc302083e0e34fe1d5c2abb9f15 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 21 Jun 2012 17:26:51 +0200 -Subject: [PATCH 40/94] X11: fix video calibrations +Subject: [PATCH 21/79] X11: fix video calibrations --- xbmc/windowing/WinSystem.h | 1 + @@ -10675,10 +4744,10 @@ index 2868707..282bb9a 100644 1.8.4 -From 764545b5d53396fc58b1af676e890ec63e02b699 Mon Sep 17 00:00:00 2001 +From 5f50bd5bc2ec1f4354c71ed1fa60913cde1d0d5b Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 12:00:26 +0200 -Subject: [PATCH 41/94] X11: deactivate screen saver on startup +Subject: [PATCH 22/79] X11: deactivate screen saver on startup --- xbmc/windowing/X11/WinSystemX11.cpp | 29 +++++++++++++++++++++++++++++ @@ -10748,10 +4817,10 @@ index 282bb9a..32f90da 100644 1.8.4 -From 0eaed044f37af68bed8715ba7c381d113314baca Mon Sep 17 00:00:00 2001 +From 0cba1040dc9a8837f789e5abb72ddf538de808f9 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 12:10:09 +0200 -Subject: [PATCH 42/94] X11: change method of going full-screen +Subject: [PATCH 23/79] X11: change method of going full-screen --- xbmc/windowing/X11/WinSystemX11.cpp | 9 ++++++++- @@ -10795,10 +4864,10 @@ index e1fd4e5..acd6497 100644 1.8.4 -From bf244e2092fbdc36b9d1fa37f48fff042f2bd8cb Mon Sep 17 00:00:00 2001 +From 381ecabb8ece719bf065496027313954bf1bbeb5 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 28 Jun 2012 19:12:39 +0200 -Subject: [PATCH 43/94] X11: reset key repeat and key modifier on focus lost +Subject: [PATCH 24/79] X11: reset key repeat and key modifier on focus lost and gain --- @@ -10830,10 +4899,10 @@ index d98f12f..743aca9 100644 1.8.4 -From 2b59df8b190005cbdf4040525561309ebc92e466 Mon Sep 17 00:00:00 2001 +From 6e4459b8807f6ed90c76941426d7071095903f54 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 5 Jul 2012 14:18:46 +0200 -Subject: [PATCH 44/94] X11: replace custom utf8 to unicode with charset +Subject: [PATCH 25/79] X11: replace custom utf8 to unicode with charset convertor (squash to x11 events) --- @@ -11050,10 +5119,10 @@ index a412f32..9a8a912 100644 1.8.4 -From c03a11cf30f3a6698f68d430b0b0febe376be32b Mon Sep 17 00:00:00 2001 +From b80952819085d013b524723be18b4f947783e9f8 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 5 Jul 2012 14:23:54 +0200 -Subject: [PATCH 45/94] X11: fixed invalid usage of sizeof() (squash into x11 +Subject: [PATCH 26/79] X11: fixed invalid usage of sizeof() (squash into x11 changes) --- @@ -11117,10 +5186,10 @@ index 9a8a912..c69169c 100644 1.8.4 -From 9e221e90b1d0ed4e0e81727155680dea2b94780e Mon Sep 17 00:00:00 2001 +From b2dfe9f398dd68f7cd788d51ebc6a2237860ae6f Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 9 Jun 2012 18:23:53 +0200 -Subject: [PATCH 46/94] add missing keys to xbmc keytable +Subject: [PATCH 27/79] add missing keys to xbmc keytable --- xbmc/input/XBMC_keytable.cpp | 2 ++ @@ -11143,10 +5212,10 @@ index b430f55..246164b 100644 1.8.4 -From 7237cbdd1c2b4ac29da8be37e81b6cb7adc2e916 Mon Sep 17 00:00:00 2001 +From 61736f65bbfe5f452f19b5546dedcc0fb2bcc945 Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 16 Mar 2012 15:57:51 +0100 -Subject: [PATCH 47/94] videorefclock: temp deactivate of nv settings +Subject: [PATCH 28/79] videorefclock: temp deactivate of nv settings --- xbmc/video/VideoReferenceClock.cpp | 2 +- @@ -11169,10 +5238,10 @@ index 4071ff0..b9afc09 100644 1.8.4 -From 798c8163713518df02dcec2f4787fd14493603bf Mon Sep 17 00:00:00 2001 +From ee9f26a32c661157a855aab1a46487850595b5c4 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 20 Aug 2012 09:09:09 +0200 -Subject: [PATCH 48/94] videorefclock: ask graphics context for refresh rate +Subject: [PATCH 29/79] videorefclock: ask graphics context for refresh rate --- xbmc/video/VideoReferenceClock.cpp | 3 ++- @@ -11203,10 +5272,10 @@ index b9afc09..2f6c7de 100644 1.8.4 -From 40336d30b29ec112c2c61d38b5fa995a0d46c3f0 Mon Sep 17 00:00:00 2001 +From 0bf1cac40bb27ba6e26ca1e97d8dcc158b9fe197 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 9 Jul 2012 14:00:18 +0200 -Subject: [PATCH 49/94] X11: fix icon texture after +Subject: [PATCH 30/79] X11: fix icon texture after cc5ed3c2474084ebc0373a3046410e6f766e03f4 --- @@ -11314,10 +5383,10 @@ index acd6497..805eed7 100644 1.8.4 -From a295172248fb2d3806d4c4c58a414558a52080df Mon Sep 17 00:00:00 2001 +From 09c9e82f6e88db8609dae7a9cac51ee9264f6d66 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 10 Jul 2012 11:14:12 +0200 -Subject: [PATCH 50/94] X11: check for window manager +Subject: [PATCH 31/79] X11: check for window manager --- xbmc/windowing/X11/WinSystemX11.cpp | 74 ++++++++++++++++++++++++++++++++++++- @@ -11438,10 +5507,10 @@ index 32f90da..28d9d03 100644 1.8.4 -From e8e3afe5fd99d284e3e3b2d272b3cf805541884e Mon Sep 17 00:00:00 2001 +From 92a868bbccc16fc16f7cd2bfc0c68af37d4d7bb2 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 12 Jul 2012 11:11:47 +0200 -Subject: [PATCH 51/94] X11: dont set window on xrandr if no mode available +Subject: [PATCH 32/79] X11: dont set window on xrandr if no mode available --- xbmc/windowing/X11/WinSystemX11.cpp | 11 ++++++----- @@ -11478,10 +5547,10 @@ index b103248..45741d7 100644 1.8.4 -From 6a7ae49b1715d001b3185d20b3712ef164049b02 Mon Sep 17 00:00:00 2001 +From d6c60654e348e63a83c5fe199d880c3813a6801f Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 26 Jul 2012 09:34:28 +0200 -Subject: [PATCH 52/94] X11: fix crash after a resolution change on startup +Subject: [PATCH 33/79] X11: fix crash after a resolution change on startup --- xbmc/windowing/X11/WinSystemX11.cpp | 3 ++- @@ -11505,10 +5574,10 @@ index 45741d7..a6cb67f 100644 1.8.4 -From 0825c709d1fd17bcb266792cf68be847c2796c4a Mon Sep 17 00:00:00 2001 +From 660d47a9a44fe579988d51098a70ca74cba31c17 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 15 Sep 2012 18:27:29 +0200 -Subject: [PATCH 53/94] X11: lock graphics context in NotifyXRREvent +Subject: [PATCH 34/79] X11: lock graphics context in NotifyXRREvent --- xbmc/windowing/X11/WinSystemX11.cpp | 2 ++ @@ -11531,10 +5600,10 @@ index a6cb67f..70b5f10 100644 1.8.4 -From b7b1c19dd0910f48d0b43b20c18274f7abc03d36 Mon Sep 17 00:00:00 2001 +From d7ef9c7fdd52024b77e68d8103bdae72cf52df93 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 23 Aug 2012 19:39:49 +0200 -Subject: [PATCH 54/94] ffmpeg: add av_find_default_stream_index to interface +Subject: [PATCH 35/79] ffmpeg: add av_find_default_stream_index to interface --- lib/DllAvFormat.h | 4 ++++ @@ -11580,10 +5649,10 @@ index 0016c0b..3514856 100644 1.8.4 -From e86f4098096c95c4bc7d455a05d92dfd5892cb5f Mon Sep 17 00:00:00 2001 +From b0a4bb7e9402c2e80ca8b3e98068e066733ce94b Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 20 Aug 2012 16:06:39 +0200 -Subject: [PATCH 55/94] dvdplayer: observe pts counter overflow +Subject: [PATCH 36/79] dvdplayer: observe pts counter overflow --- .../cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 198 ++++++++++++++++++++- @@ -11870,10 +5939,10 @@ index aef5ab1..35abbdf 100644 1.8.4 -From 317b2ca84d01f9ea3bd4fe92082f8f43942ea6b3 Mon Sep 17 00:00:00 2001 +From 5d8a1bcf25f178263df9a460954aaf31d7a62eb2 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 2 Oct 2012 13:02:10 +0200 -Subject: [PATCH 56/94] dvdplayer: avoid short screen flicker caused by +Subject: [PATCH 37/79] dvdplayer: avoid short screen flicker caused by unnecessary reconfigure of renderer --- @@ -11906,10 +5975,10 @@ index c40d193..6419951 100644 1.8.4 -From e6d397d6c00cd2e83c3bff1fe9c14e96a749d197 Mon Sep 17 00:00:00 2001 +From 320bc936ecbed09442f80d8a8ad8e2fce4c775b3 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 11 Oct 2012 12:05:50 +0200 -Subject: [PATCH 57/94] vdpau: advanced settings for auto deinterlacing +Subject: [PATCH 38/79] vdpau: advanced settings for auto deinterlacing --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++++---- @@ -11975,10 +6044,10 @@ index d46ee0b..8f031ba 100644 1.8.4 -From 36c84909aa9c49933c6f25026ccde1e08bf33c4a Mon Sep 17 00:00:00 2001 +From 6c3a8cf8003172665ec87946119e142cfb02e79b Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 2 Nov 2012 13:20:03 +0100 -Subject: [PATCH 58/94] player: fix rewind +Subject: [PATCH 39/79] player: fix rewind --- xbmc/cores/dvdplayer/DVDMessage.h | 5 ++++- @@ -12193,10 +6262,10 @@ index 59c7f09..65dea76 100644 1.8.4 -From b12ad5cbebd595aadec1d5463aa9ed78e027f513 Mon Sep 17 00:00:00 2001 +From d80ac0938668fcd7c89bef31ee23f351c8d468ad Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 23 Nov 2012 17:41:12 +0100 -Subject: [PATCH 59/94] xrandr: fix query for multiple screens +Subject: [PATCH 40/79] xrandr: fix query for multiple screens --- xbmc/windowing/X11/XRandR.cpp | 10 ++++++---- @@ -12237,10 +6306,10 @@ index 9e181f2..ce0a02b 100644 1.8.4 -From 5738609db3c76b6f0f1e08d4587c558c192085a7 Mon Sep 17 00:00:00 2001 +From 98c1b1d56eff376b2e254144542a765839c16c38 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 2 Dec 2012 15:46:55 +0100 -Subject: [PATCH 60/94] X11: add debug log to print out refresh after xrr event +Subject: [PATCH 41/79] X11: add debug log to print out refresh after xrr event --- xbmc/windowing/X11/WinSystemX11.cpp | 6 ++++++ @@ -12267,10 +6336,10 @@ index 70b5f10..64d5730 100644 1.8.4 -From 6d414cefe277209fad9078bfc58f0eabd737ce86 Mon Sep 17 00:00:00 2001 +From b8be44c2e84e218ed8a8d09de68c9b64b9b5445b Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 11 Dec 2012 11:08:13 +0100 -Subject: [PATCH 61/94] X11: dont call XCloseDisplay on shutdown, it crashes +Subject: [PATCH 42/79] X11: dont call XCloseDisplay on shutdown, it crashes when powered doen by cec on ATI --- @@ -12295,10 +6364,10 @@ index 64d5730..edc81c8 100644 1.8.4 -From 7395971e9da11654485c1f12f5ec0203188424d4 Mon Sep 17 00:00:00 2001 +From 6ec0065be773ec8b661ea35d9592c6dafa8ce00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Coutant?= Date: Wed, 12 Dec 2012 19:49:47 +0100 -Subject: [PATCH 62/94] x11: support for multiple x screens +Subject: [PATCH 43/79] x11: support for multiple x screens --- xbmc/windowing/X11/XRandR.cpp | 2 +- @@ -12321,10 +6390,10 @@ index ce0a02b..aa27d2b 100644 1.8.4 -From e4234031bf7f253c9ed3aa09766098c04166ad39 Mon Sep 17 00:00:00 2001 +From 5fcf035cdcd13c7928443ef74b8e657ca7b55bb9 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 24 Dec 2012 16:02:42 +0100 -Subject: [PATCH 63/94] pvr: increase changes counter of stream on stream +Subject: [PATCH 44/79] pvr: increase changes counter of stream on stream change, cosmetics after dd307930d39d92f145a01a16600cd00e01ec39be --- @@ -12358,10 +6427,10 @@ index b96d520..df89f6f 100644 1.8.4 -From 97f8f501c0997ea0e6c8acac8c2fa2de58f1480a Mon Sep 17 00:00:00 2001 +From 29594329f122b6991d61162ce5cb6f4e87967a36 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 17 Jan 2013 16:03:22 +0100 -Subject: [PATCH 64/94] X11: add keymapping for XF86XK_Sleep +Subject: [PATCH 45/79] X11: add keymapping for XF86XK_Sleep --- xbmc/windowing/WinEventsX11.cpp | 1 + @@ -12383,10 +6452,10 @@ index a62521f..263cb5a 100644 1.8.4 -From 4d9abc55c7e467fbcad18c44b0be1fe14808b335 Mon Sep 17 00:00:00 2001 +From d3fee0228ae7c89ae33099705fc31e4f822b8eb7 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 21 Jan 2013 09:00:19 +0100 -Subject: [PATCH 65/94] X11: remove toggle full screen after resume +Subject: [PATCH 46/79] X11: remove toggle full screen after resume --- xbmc/powermanagement/PowerManager.cpp | 5 ----- @@ -12412,10 +6481,10 @@ index 2033574..c79bbc1 100644 1.8.4 -From b31709094afcf5fdf223163d35488b21bac71298 Mon Sep 17 00:00:00 2001 +From 6c77dee351a2b096b2f5aab32aeeb84e5c781240 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 23 Jan 2013 17:03:02 +0100 -Subject: [PATCH 66/94] xrandr: set screen on mode change command +Subject: [PATCH 47/79] xrandr: set screen on mode change command --- xbmc/windowing/X11/XRandR.cpp | 2 +- @@ -12438,10 +6507,10 @@ index aa27d2b..67bf6ca 100644 1.8.4 -From acbf6280ffdeb86802c7393724b17f14e2018ef6 Mon Sep 17 00:00:00 2001 +From 70dcb516375ee30ff3f2e0d173799161139a24a5 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 23 Jan 2013 17:03:39 +0100 -Subject: [PATCH 67/94] X11: recreate glx context when output changes +Subject: [PATCH 48/79] X11: recreate glx context when output changes --- xbmc/windowing/X11/WinSystemX11.cpp | 6 +++--- @@ -12492,10 +6561,10 @@ index 28d9d03..5a21b00 100644 1.8.4 -From 114b99916a740e1bfc6b785d9087358a4037f186 Mon Sep 17 00:00:00 2001 +From 02977db461fbb19ab359a6fc458e0f71dca6d034 Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 14 Dec 2012 14:19:15 +0100 -Subject: [PATCH 68/94] pvr: do not show selection dialog for a single menu +Subject: [PATCH 49/79] pvr: do not show selection dialog for a single menu hook --- @@ -12533,10 +6602,10 @@ index 5aaf881..4c64877 100644 1.8.4 -From ff3584b94dc11925e9e4b5674b71f789d0b13596 Mon Sep 17 00:00:00 2001 +From a1c7e4fa455db38093952673207f38be66cba652 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 3 Feb 2013 08:17:16 +0100 -Subject: [PATCH 69/94] X11: use default screen parameters if no output +Subject: [PATCH 50/79] X11: use default screen parameters if no output connected --- @@ -12640,10 +6709,10 @@ index c6aa51a..f481ea4 100644 1.8.4 -From dfbe5c7902208bafa11fb46bb64e11062d006153 Mon Sep 17 00:00:00 2001 +From 2d7b852710eddd55e45c5641b976974defe1e749 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 23 Mar 2013 15:13:32 +0100 -Subject: [PATCH 70/94] X11: create parent window +Subject: [PATCH 51/79] X11: create parent window --- xbmc/windowing/X11/WinSystemX11.cpp | 69 +++++++++++++++++++++++-------------- @@ -12909,10 +6978,10 @@ index 5a21b00..b866d52 100644 1.8.4 -From 44f22446106846791e1ac491edc92849d897af80 Mon Sep 17 00:00:00 2001 +From 7b5f3ed1e2544c233b6ed19f02abc500e1b9fa95 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 24 Mar 2013 12:30:12 +0100 -Subject: [PATCH 71/94] X11: use system key repeat rate instead of hardcoded +Subject: [PATCH 52/79] X11: use system key repeat rate instead of hardcoded one, taken from 58fd64b194e38b73b5f3132744bab35e994e7441 --- @@ -13114,10 +7183,10 @@ index c69169c..6429291 100644 1.8.4 -From 2b21eda7d79ec97334aace0113b7c7e50151af1c Mon Sep 17 00:00:00 2001 +From 0aaa41de7be27361abdeee8f8dcb99d2ce13b560 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 24 Mar 2013 16:04:48 +0100 -Subject: [PATCH 72/94] linux: use CLOCK_MONOTONIC_RAW as this is not subject +Subject: [PATCH 53/79] linux: use CLOCK_MONOTONIC_RAW as this is not subject to NTP --- @@ -13155,10 +7224,10 @@ index c06b8c5..4390d2e 100644 1.8.4 -From 05f85dba031559f6b12bfb21f4e62c5379c9a25b Mon Sep 17 00:00:00 2001 +From b0067f736bf84f24b7ce7ba92bba6f28c7fe49da Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 28 Mar 2013 15:18:53 +0100 -Subject: [PATCH 73/94] OMXPlayer: some caching fixes for pvr +Subject: [PATCH 54/79] OMXPlayer: some caching fixes for pvr --- xbmc/cores/omxplayer/OMXPlayer.cpp | 3 ++- @@ -13182,20 +7251,20 @@ index 56099fe..fc1d725 100644 1.8.4 -From f5ab8b4d4c0efcbe30ef84f61da4f9fe72ec4a9d Mon Sep 17 00:00:00 2001 +From dfbc9afc4544d36ac7c67d79fe7c4a2b3b93300b Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 28 Mar 2013 20:50:59 +0100 -Subject: [PATCH 74/94] fix incorrect display of fps when dr kicks in +Subject: [PATCH 55/79] fix incorrect display of fps when dr kicks in --- xbmc/Application.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index a016050..980dd18 100644 +index 4f639d0..571a67e 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2226,10 +2226,11 @@ void CApplication::Render() +@@ -2224,10 +2224,11 @@ void CApplication::Render() if (frameTime < singleFrameTime) Sleep(singleFrameTime - frameTime); } @@ -13212,10 +7281,10 @@ index a016050..980dd18 100644 1.8.4 -From b2e0d2c1f92826eed6b78a20f838bf3e29f09669 Mon Sep 17 00:00:00 2001 +From f3f3a2a31352cc5bb9649f44384bc6a46936eb28 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 13 Apr 2013 08:32:06 +0200 -Subject: [PATCH 75/94] X11: fix mouse coverage +Subject: [PATCH 56/79] X11: fix mouse coverage --- xbmc/windowing/X11/WinSystemX11.cpp | 11 ++++++++--- @@ -13281,10 +7350,10 @@ index b866d52..3f1b5f8 100644 1.8.4 -From b67642e4b50c721bc6a9bbcacef45e587928fa9f Mon Sep 17 00:00:00 2001 +From 77460bf3afa3fec34e95bef131f6926525fdfcac Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 8 May 2013 13:14:58 +0200 -Subject: [PATCH 76/94] X11: fix incorrectly used screen num in desktop +Subject: [PATCH 57/79] X11: fix incorrectly used screen num in desktop resolution --- @@ -13319,10 +7388,10 @@ index 7987cc2..b13f1a5 100644 1.8.4 -From 4c88f1a2156120ac1b8f5c8aba9202ad76c27221 Mon Sep 17 00:00:00 2001 +From 88d254b466cad8eb42c7e60bed5bd0fd081c7ec1 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 9 May 2013 12:07:09 +0200 -Subject: [PATCH 77/94] X11: do not overwrite user selected monitor with +Subject: [PATCH 58/79] X11: do not overwrite user selected monitor with fallback --- @@ -13447,10 +7516,10 @@ index 3f1b5f8..ed70d9c 100644 1.8.4 -From bec06cd01c4d3b1ac30e1df579f6fc28d7ba2b49 Mon Sep 17 00:00:00 2001 +From de43cd6d84f77de06ac19a310a3302c354bf5715 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 12 May 2013 10:50:30 +0200 -Subject: [PATCH 78/94] xrandr: add turn on/off to wrapper +Subject: [PATCH 59/79] xrandr: add turn on/off to wrapper --- xbmc/windowing/X11/XRandR.cpp | 78 +++++++++++++++++++++++++++++++++++++++---- @@ -13616,10 +7685,10 @@ index d37838a..059062f 100644 1.8.4 -From 123286882dc36f7e331313c768315ecf3bb29f14 Mon Sep 17 00:00:00 2001 +From da89d4e60f92ea127a9e39dd2037c4d267e31e2e Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 19 May 2013 12:55:35 +0200 -Subject: [PATCH 79/94] xrandr: add GetPreferredMode to wrapper +Subject: [PATCH 60/79] xrandr: add GetPreferredMode to wrapper --- xbmc/windowing/X11/XRandR.cpp | 23 +++++++++++++++++++++++ @@ -13676,10 +7745,10 @@ index 059062f..ab7cc63 100644 1.8.4 -From 889fa4e42bb227d1a8973ccefab0bb94f660f952 Mon Sep 17 00:00:00 2001 +From e9d0cd6d39f65819d5c70a6a8621a8dbfcec0d7b Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 11 May 2013 17:12:12 +0200 -Subject: [PATCH 80/94] X11: multi-head improvement - poll for desired output +Subject: [PATCH 61/79] X11: multi-head improvement - poll for desired output if we do not get an xrr event --- @@ -13694,7 +7763,7 @@ Subject: [PATCH 80/94] X11: multi-head improvement - poll for desired output 8 files changed, 105 insertions(+), 12 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 291932d..2e84253 100755 +index e15ddc7..e99288e 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -6440,7 +6440,7 @@ msgctxt "#14071" @@ -13960,10 +8029,10 @@ index 4809821..1ad26b2 100644 1.8.4 -From d2817ab2f9ec608bd7446fa0b3eed9ea3e389fc2 Mon Sep 17 00:00:00 2001 +From ffe6d71032c479aa0474de824e3de795cbf0b2aa Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 15 May 2013 09:14:34 +0200 -Subject: [PATCH 81/94] X11: ignore mouse move event form other windows +Subject: [PATCH 62/79] X11: ignore mouse move event form other windows --- xbmc/windowing/WinEventsX11.cpp | 4 +++- @@ -13995,10 +8064,10 @@ index 908c8b6..938ad26 100644 1.8.4 -From 69045b17b4be1fcc9ab5f07f974064156bfa387c Mon Sep 17 00:00:00 2001 +From f241bbfa83ffaa1c68de1edc2d5dcb6283ed7023 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 11 Jun 2013 16:20:29 +0200 -Subject: [PATCH 82/94] renderer: allow some lateness within vblank interval +Subject: [PATCH 63/79] renderer: allow some lateness within vblank interval --- xbmc/cores/VideoRenderers/RenderManager.cpp | 12 ++++++++++-- @@ -14058,10 +8127,10 @@ index 949c652b..d84ff6c 100644 1.8.4 -From c6738ded4737ef2c4d2beeb0f2b3109921452a01 Mon Sep 17 00:00:00 2001 +From afdba8c930869a5fb9ceb7da14b09a139a4372c7 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 16 Jun 2013 13:22:58 +0200 -Subject: [PATCH 83/94] X11: another fix for mouse coverage +Subject: [PATCH 64/79] X11: another fix for mouse coverage --- xbmc/windowing/WinEventsX11.cpp | 6 ++++-- @@ -14094,10 +8163,10 @@ index 938ad26..e4ca56d 100644 1.8.4 -From a279e20ac527a5361d0ce03754de3d07bf23bd75 Mon Sep 17 00:00:00 2001 +From 2027815558b83a8ed0f93dcf7bedd6fb222d3b27 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 5 Jul 2013 12:14:00 +0200 -Subject: [PATCH 84/94] X11: set windows class name +Subject: [PATCH 65/79] X11: set windows class name --- xbmc/windowing/X11/WinSystemX11.cpp | 9 ++++++++- @@ -14139,17 +8208,17 @@ index cbb56bf..e74f2b0 100644 1.8.4 -From 5832f25877d457974bd21a4f51631cd04b1b2612 Mon Sep 17 00:00:00 2001 +From b602d69de5ac76897df92af813f2bc0e77dd9d93 Mon Sep 17 00:00:00 2001 From: spiff Date: Tue, 16 Jul 2013 14:34:04 +0200 -Subject: [PATCH 85/94] fixed: typo +Subject: [PATCH 66/79] fixed: typo --- language/English/strings.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 2e84253..f28c8f4 100755 +index e99288e..f464c3b 100755 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -6574,7 +6574,7 @@ msgstr "" @@ -14165,17 +8234,17 @@ index 2e84253..f28c8f4 100755 1.8.4 -From bb852857f121f7c9c3e3d6cd8c4e631ce6769ebe Mon Sep 17 00:00:00 2001 +From 1482ad00eac98e349ad0eee7d86219c37137739d Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 25 Jul 2013 17:18:13 +0200 -Subject: [PATCH 86/94] ActiveAE: slightly reduce buffer size +Subject: [PATCH 67/79] ActiveAE: slightly reduce buffer size --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 0837b7c..4d644ff 100644 +index 991c086..c872ee5 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -30,8 +30,8 @@ @@ -14193,10 +8262,10 @@ index 0837b7c..4d644ff 100644 1.8.4 -From 402e67de7ac962cd55c5b74b48ddcf6b294b5c06 Mon Sep 17 00:00:00 2001 +From 628115df2620a96df7852fe38d742798abebc872 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 4 Aug 2013 10:11:16 +0200 -Subject: [PATCH 87/94] Revert "vdpau: comment some features that will be added +Subject: [PATCH 68/79] Revert "vdpau: comment some features that will be added later" This reverts commit e00b4f65864d623ab4d2e9e5c06db138e661f1cf. @@ -14252,10 +8321,10 @@ index 73c9b50..1ac0978 100644 1.8.4 -From 8da2974a4cd01e9ef9a953fc830eb5ded528f063 Mon Sep 17 00:00:00 2001 +From 05bad776bb2d59fdd6e24cf88a71324289b497c0 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 9 Aug 2013 18:01:40 +0200 -Subject: [PATCH 88/94] X11: fix keysyms +Subject: [PATCH 69/79] X11: fix keysyms --- xbmc/windowing/WinEventsX11.cpp | 2 +- @@ -14278,10 +8347,10 @@ index e4ca56d..b20130c 100644 1.8.4 -From 2cdb5ef6a3fa248618d2a0aabd540692e15806b1 Mon Sep 17 00:00:00 2001 +From cb65e3c014355f19f5d68a3ed97f27b56eecd53e Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 9 Aug 2013 18:42:36 +0200 -Subject: [PATCH 89/94] X11: fix keysym for non-IM +Subject: [PATCH 70/79] X11: fix keysym for non-IM --- xbmc/windowing/WinEventsX11.cpp | 2 +- @@ -14304,10 +8373,10 @@ index b20130c..a38890c 100644 1.8.4 -From e7df97fcc3deb43d8af31148910ffc9dad715207 Mon Sep 17 00:00:00 2001 +From 078f78a11933f389180207eecece5a26d83a1dd7 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 10 Aug 2013 11:18:16 +0200 -Subject: [PATCH 90/94] add some missing multi media keys +Subject: [PATCH 71/79] add some missing multi media keys --- system/keymaps/keyboard.xml | 3 +++ @@ -14362,10 +8431,10 @@ index ee6bb69..364b45a 100644 1.8.4 -From 31876c03527f64d86eafdea64b249753668aecec Mon Sep 17 00:00:00 2001 +From 970099abff5809b3e192c4dfa9cf8c8b5edbeb87 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 10 Aug 2013 15:53:45 +0200 -Subject: [PATCH 91/94] X11: squash multi +Subject: [PATCH 72/79] X11: squash multi --- xbmc/windowing/X11/WinSystemX11.cpp | 2 +- @@ -14388,10 +8457,10 @@ index e74f2b0..480efb3 100644 1.8.4 -From 18ea3370bd51e8087d10d43473aa9fd3810f7cd6 Mon Sep 17 00:00:00 2001 +From 1f63425ed1b28df7e455c4ea6fde7e5d6433e3be Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 3 Sep 2013 20:46:17 +0200 -Subject: [PATCH 92/94] X11: do not poll default monitor +Subject: [PATCH 73/79] X11: do not poll default monitor --- xbmc/windowing/X11/WinSystemX11.cpp | 2 +- @@ -14414,10 +8483,10 @@ index 480efb3..dd04357 100644 1.8.4 -From 223d19ccd2ba02c9bbfc4ef87b0c839a0a4337b3 Mon Sep 17 00:00:00 2001 +From 08bc3bea62692b03f21e83819f470d36bdabd3e2 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 29 Oct 2013 20:57:28 +0100 -Subject: [PATCH 93/94] X11: fix broken monitor switching +Subject: [PATCH 74/79] X11: fix broken monitor switching --- system/settings/settings.xml | 1 - @@ -14520,10 +8589,10 @@ index 46895d2..c495bb0 100644 1.8.4 -From 56b2805fb0e7596ecebf9aed5486344e29bd593f Mon Sep 17 00:00:00 2001 +From dea4112356b810df7a21f837b4b940a3a8c9f365 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 29 Oct 2013 20:57:59 +0100 -Subject: [PATCH 94/94] X11: remove polling for connected outputs, use xrr +Subject: [PATCH 75/79] X11: remove polling for connected outputs, use xrr events --- @@ -14823,3 +8892,464 @@ index f0d22bb..03bccc9 100644 -- 1.8.4 + +From f96d27f5066fcfb0c45abd9789cdd11a4c6aa181 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Thu, 31 Oct 2013 09:37:13 +0100 +Subject: [PATCH 76/79] X11: remove grabbing of keyboard and mouse + +--- + xbmc/windowing/WinEventsX11.cpp | 4 ---- + xbmc/windowing/X11/WinSystemX11.cpp | 40 ------------------------------------- + xbmc/windowing/X11/WinSystemX11.h | 2 -- + 3 files changed, 46 deletions(-) + +diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp +index fe91a2b..550c84d 100644 +--- a/xbmc/windowing/WinEventsX11.cpp ++++ b/xbmc/windowing/WinEventsX11.cpp +@@ -538,16 +538,12 @@ bool CWinEventsX11Imp::MessagePump() + + case EnterNotify: + { +- if (xevent.xcrossing.mode == NotifyNormal) +- g_Windowing.NotifyMouseCoverage(true); + break; + } + + // lose mouse coverage + case LeaveNotify: + { +- if (xevent.xcrossing.mode == NotifyNormal) +- g_Windowing.NotifyMouseCoverage(false); + g_Mouse.SetActive(false); + break; + } +diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp +index b67f291..6b5aa09 100644 +--- a/xbmc/windowing/X11/WinSystemX11.cpp ++++ b/xbmc/windowing/X11/WinSystemX11.cpp +@@ -152,8 +152,6 @@ bool CWinSystemX11::DestroyWindow() + + XUnmapWindow(m_dpy, m_mainWindow); + XSync(m_dpy,TRUE); +- XUngrabKeyboard(m_dpy, CurrentTime); +- XUngrabPointer(m_dpy, CurrentTime); + XDestroyWindow(m_dpy, m_glWindow); + XDestroyWindow(m_dpy, m_mainWindow); + m_glWindow = 0; +@@ -627,30 +625,6 @@ void CWinSystemX11::NotifyAppFocusChange(bool bGaining) + m_bIgnoreNextFocusMessage = false; + } + +-void CWinSystemX11::NotifyMouseCoverage(bool covered) +-{ +- if (!m_bFullScreen || !m_mainWindow) +- return; +- +- if (covered && !m_bIsGrabbed) +- { +- int result = -1; +- while (result != GrabSuccess && result != AlreadyGrabbed) +- { +- result = XGrabPointer(m_dpy, m_mainWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); +- XbmcThreads::ThreadSleep(100); +- } +- XGrabKeyboard(m_dpy, m_mainWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); +- m_bIsGrabbed = true; +- } +- else if (!covered && m_bIsGrabbed) +- { +- XUngrabKeyboard(m_dpy, CurrentTime); +- XUngrabPointer(m_dpy, CurrentTime); +- m_bIsGrabbed = false; +- } +-} +- + bool CWinSystemX11::Minimize() + { + m_bWasFullScreenBeforeMinimize = m_bFullScreen; +@@ -1001,20 +975,6 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const std: + XWarpPointer(m_dpy, None, m_mainWindow, 0, 0, 0, 0, mouseX*width, mouseY*height); + } + +- if (fullscreen) +- { +- int result = -1; +- while (result != GrabSuccess && result != AlreadyGrabbed) +- { +- result = XGrabPointer(m_dpy, m_mainWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); +- XbmcThreads::ThreadSleep(100); +- } +- XGrabKeyboard(m_dpy, m_mainWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); +- m_bIsGrabbed = true; +- } +- else +- m_bIsGrabbed = false; +- + CDirtyRegionList dr; + RefreshGlxContext(m_currentOutput.compare(output) != 0); + XSync(m_dpy, FALSE); +diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h +index 03bccc9..1b8bbcb 100644 +--- a/xbmc/windowing/X11/WinSystemX11.h ++++ b/xbmc/windowing/X11/WinSystemX11.h +@@ -73,7 +73,6 @@ class CWinSystemX11 : public CWinSystemBase, public ISettingCallback + void NotifyXRREvent(); + void GetConnectedOutputs(std::vector *outputs); + bool IsCurrentOutput(CStdString output); +- void NotifyMouseCoverage(bool covered); + + protected: + bool RefreshGlxContext(bool force); +@@ -90,7 +89,6 @@ class CWinSystemX11 : public CWinSystemBase, public ISettingCallback + bool m_bWasFullScreenBeforeMinimize; + bool m_minimized; + bool m_bIgnoreNextFocusMessage; +- bool m_bIsGrabbed; + int m_RREventBase; + CCriticalSection m_resourceSection; + std::vector m_resources; +-- +1.8.4 + + +From 3fd61aa80d15da6df7bec507406e889334e21bde Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Thu, 31 Oct 2013 10:46:40 +0100 +Subject: [PATCH 77/79] X11: set ExposureMask on gl window, fixes not updated + areas + +--- + xbmc/windowing/X11/WinSystemX11.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp +index 6b5aa09..1a67943 100644 +--- a/xbmc/windowing/X11/WinSystemX11.cpp ++++ b/xbmc/windowing/X11/WinSystemX11.cpp +@@ -881,10 +881,12 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const std: + InputOutput, vi->visual, + mask, &swa); + ++ XSelectInput(m_dpy, m_mainWindow, swa.event_mask); ++ + swa.override_redirect = False; + swa.border_pixel = 0; +- swa.event_mask = 0; +- mask = CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWColormap; ++ swa.event_mask = ExposureMask; ++ mask = CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWColormap | CWEventMask; + + m_glWindow = XCreateWindow(m_dpy, m_mainWindow, + 0, 0, width, height, 0, vi->depth, +-- +1.8.4 + + +From c9bec76142838d9930e34890249a9aa38bae19bd Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Thu, 31 Oct 2013 11:25:19 +0100 +Subject: [PATCH 78/79] X11: drop shortcuts, have WM do this + +--- + xbmc/windowing/WinEventsX11.cpp | 21 --------------------- + xbmc/windowing/WinEventsX11.h | 1 - + 2 files changed, 22 deletions(-) + +diff --git a/xbmc/windowing/WinEventsX11.cpp b/xbmc/windowing/WinEventsX11.cpp +index 550c84d..a5b4ba2 100644 +--- a/xbmc/windowing/WinEventsX11.cpp ++++ b/xbmc/windowing/WinEventsX11.cpp +@@ -678,10 +678,6 @@ bool CWinEventsX11Imp::ProcessKey(XBMC_Event &event) + break; + } + event.key.keysym.mod = (XBMCMod)WinEvents->m_keymodState; +- +- bool ret = ProcessShortcuts(event); +- if (ret) +- return ret; + } + else if (event.type == XBMC_KEYUP) + { +@@ -723,23 +719,6 @@ bool CWinEventsX11Imp::ProcessKey(XBMC_Event &event) + return g_application.OnEvent(event); + } + +-bool CWinEventsX11Imp::ProcessShortcuts(XBMC_Event& event) +-{ +- if (event.key.keysym.mod & XBMCKMOD_ALT) +- { +- switch(event.key.keysym.sym) +- { +- case XBMCK_TAB: // ALT+TAB to minimize/hide +- g_application.Minimize(); +- return true; +- +- default: +- return false; +- } +- } +- return false; +-} +- + XBMCKey CWinEventsX11Imp::LookupXbmcKeySym(KeySym keysym) + { + // try direct mapping first +diff --git a/xbmc/windowing/WinEventsX11.h b/xbmc/windowing/WinEventsX11.h +index 6429291..4334d21 100644 +--- a/xbmc/windowing/WinEventsX11.h ++++ b/xbmc/windowing/WinEventsX11.h +@@ -48,7 +48,6 @@ class CWinEventsX11Imp + protected: + static XBMCKey LookupXbmcKeySym(KeySym keysym); + static bool ProcessKey(XBMC_Event &event); +- static bool ProcessShortcuts(XBMC_Event& event); + static CWinEventsX11Imp *WinEvents; + Display *m_display; + Window m_window; +-- +1.8.4 + + +From 354cb9c0713658dd3f38757f1b6d90224d85479d Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Fri, 1 Nov 2013 12:41:42 +0100 +Subject: [PATCH 79/79] ActiveAE: make viz not observe volume and mute + +--- + .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 124 ++++++++++++--------- + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 1 + + 2 files changed, 70 insertions(+), 55 deletions(-) + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +index c872ee5..6cdc9df 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +@@ -144,6 +144,7 @@ bool CEngineStats::IsSuspended() + m_silenceBuffers = NULL; + m_encoderBuffers = NULL; + m_vizBuffers = NULL; ++ m_vizBuffersInput = NULL; + m_volume = 1.0; + m_aeVolume = 1.0; + m_muted = false; +@@ -899,6 +900,11 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt) + m_discardBufferPools.push_back(m_vizBuffers); + m_vizBuffers = NULL; + } ++ if (m_vizBuffersInput) ++ { ++ m_discardBufferPools.push_back(m_vizBuffersInput); ++ m_vizBuffersInput = NULL; ++ } + } + // resample buffers for streams + else +@@ -1014,12 +1020,20 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt) + { + m_discardBufferPools.push_back(m_vizBuffers); + m_vizBuffers = NULL; ++ m_discardBufferPools.push_back(m_vizBuffersInput); ++ m_vizBuffersInput = NULL; + } + if (!m_vizBuffers) + { + AEAudioFormat vizFormat = m_internalFormat; + vizFormat.m_channelLayout = AE_CH_LAYOUT_2_0; + vizFormat.m_dataFormat = AE_FMT_FLOAT; ++ ++ // input buffers ++ m_vizBuffersInput = new CActiveAEBufferPool(m_internalFormat); ++ m_vizBuffersInput->Create(2000); ++ ++ // resample buffers + m_vizBuffers = new CActiveAEBufferPoolResample(m_internalFormat, vizFormat, m_settings.resampleQuality); + // TODO use cache of sync + water level + m_vizBuffers->Create(2000, false, false); +@@ -1650,12 +1664,12 @@ bool CActiveAE::RunStages() + for(int j=0; jpkt->planes; j++) + { + #ifdef __SSE__ +- CAEUtil::SSEMulArray((float*)out->pkt->data[j]+i*nb_floats, m_muted ? 0.0 : volume, nb_floats); ++ CAEUtil::SSEMulArray((float*)out->pkt->data[j]+i*nb_floats, volume, nb_floats); + #else + float* fbuffer = (float*) out->pkt->data[j]+i*nb_floats; + for (int k = 0; k < nb_floats; ++k) + { +- fbuffer[k] *= m_muted ? 0.0 : volume; ++ fbuffer[k] *= volume; + } + #endif + } +@@ -1718,7 +1732,7 @@ bool CActiveAE::RunStages() + float *dst = (float*)out->pkt->data[j]+i*nb_floats; + float *src = (float*)mix->pkt->data[j]+i*nb_floats; + #ifdef __SSE__ +- CAEUtil::SSEMulAddArray(dst, src, m_muted ? 0.0 : volume, nb_floats); ++ CAEUtil::SSEMulAddArray(dst, src, volume, nb_floats); + for (int k = 0; k < nb_floats; ++k) + { + if (fabs(dst[k]) > 1.0f) +@@ -1730,7 +1744,7 @@ bool CActiveAE::RunStages() + #else + for (int k = 0; k < nb_floats; ++k) + { +- dst[k] += src[k] * (m_muted ? 0.0 : volume); ++ dst[k] += src[k] * volume; + if (fabs(dst[k]) > 1.0f) + needClamp = true; + } +@@ -1754,78 +1768,78 @@ bool CActiveAE::RunStages() + } + + // process output buffer, gui sounds, encode, viz +- CSampleBuffer *viz = NULL; + if (out) + { ++ // viz ++ { ++ CSingleLock lock(m_vizLock); ++ if (m_audioCallback && m_vizBuffers && !m_streams.empty()) ++ { ++ if (!m_vizInitialized) ++ { ++ m_audioCallback->OnInitialize(2, m_vizBuffers->m_format.m_sampleRate, 32); ++ m_vizInitialized = true; ++ } ++ ++ if (!m_vizBuffersInput->m_freeSamples.empty()) ++ { ++ // copy the samples into the viz input buffer ++ CSampleBuffer *viz = m_vizBuffersInput->GetFreeBuffer(); ++ int samples = std::min(512, out->pkt->nb_samples); ++ int bytes = samples * out->pkt->config.channels / out->pkt->planes * out->pkt->bytes_per_sample; ++ for(int i= 0; i < out->pkt->planes; i++) ++ { ++ memcpy(viz->pkt->data[i], out->pkt->data[i], bytes); ++ } ++ viz->pkt->nb_samples = samples; ++ m_vizBuffers->m_inputSamples.push_back(viz); ++ } ++ else ++ CLog::Log(LOGWARNING,"ActiveAE::%s - viz ran out of free buffers", __FUNCTION__); ++ unsigned int now = XbmcThreads::SystemClockMillis(); ++ unsigned int timestamp = now + m_stats.GetDelay() * 1000; ++ busy |= m_vizBuffers->ResampleBuffers(timestamp); ++ while(!m_vizBuffers->m_outputSamples.empty()) ++ { ++ CSampleBuffer *buf = m_vizBuffers->m_outputSamples.front(); ++ if ((now - buf->timestamp) & 0x80000000) ++ break; ++ else ++ { ++ int samples; ++ samples = std::min(512, buf->pkt->nb_samples); ++ m_audioCallback->OnAudioData((float*)(buf->pkt->data[0]), samples); ++ buf->Return(); ++ m_vizBuffers->m_outputSamples.pop_front(); ++ } ++ } ++ } ++ else if (m_vizBuffers) ++ m_vizBuffers->Flush(); ++ } ++ + // mix gui sounds + MixSounds(*(out->pkt)); +- if (!m_sinkHasVolume) ++ if (!m_sinkHasVolume || m_muted) + Deamplify(*(out->pkt)); + +- // encode and backup out buffer for viz +- viz = out; + if (m_mode == MODE_TRANSCODE && m_encoder) + { + CSampleBuffer *buf = m_encoderBuffers->GetFreeBuffer(); + m_encoder->Encode(out->pkt->data[0], out->pkt->planes*out->pkt->linesize, + buf->pkt->data[0], buf->pkt->planes*buf->pkt->linesize); + buf->pkt->nb_samples = buf->pkt->max_nb_samples; ++ out->Return(); + out = buf; + } +- + busy = true; + } + +- // viz +- { +- CSingleLock lock(m_vizLock); +- if (m_audioCallback && m_vizBuffers && !m_streams.empty()) +- { +- if (!m_vizInitialized) +- { +- m_audioCallback->OnInitialize(2, m_vizBuffers->m_format.m_sampleRate, 32); +- m_vizInitialized = true; +- } +- +- // if viz has no free buffer, it won't return current buffer "viz" +- if (!m_vizBuffers->m_freeSamples.empty()) +- { +- if (viz) +- { +- viz->Acquire(); +- m_vizBuffers->m_inputSamples.push_back(viz); +- } +- } +- else +- CLog::Log(LOGWARNING,"ActiveAE::%s - viz ran out of free buffers", __FUNCTION__); +- unsigned int now = XbmcThreads::SystemClockMillis(); +- unsigned int timestamp = now + m_stats.GetDelay() * 1000; +- busy |= m_vizBuffers->ResampleBuffers(timestamp); +- while(!m_vizBuffers->m_outputSamples.empty()) +- { +- CSampleBuffer *buf = m_vizBuffers->m_outputSamples.front(); +- if ((now - buf->timestamp) & 0x80000000) +- break; +- else +- { +- int samples; +- samples = std::min(512, buf->pkt->nb_samples); +- m_audioCallback->OnAudioData((float*)(buf->pkt->data[0]), samples); +- buf->Return(); +- m_vizBuffers->m_outputSamples.pop_front(); +- } +- } +- } +- else if (m_vizBuffers) +- m_vizBuffers->Flush(); +- } + // update stats + if(out) + { + m_stats.AddSamples(out->pkt->nb_samples, m_streams); + m_sinkBuffers->m_inputSamples.push_back(out); +- if(viz && (viz != out)) +- viz->Return(); + } + } + // pass through +@@ -1934,7 +1948,7 @@ void CActiveAE::MixSounds(CSoundPacket &dstSample) + + void CActiveAE::Deamplify(CSoundPacket &dstSample) + { +- if (m_volume < 1.0) ++ if (m_volume < 1.0 || m_muted) + { + float *buffer; + int nb_floats = dstSample.nb_samples * dstSample.config.channels / dstSample.planes; +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h +index e3e772a..0156593 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h +@@ -307,6 +307,7 @@ class CActiveAE : public IAE, private CThread + // buffers + CActiveAEBufferPoolResample *m_sinkBuffers; + CActiveAEBufferPoolResample *m_vizBuffers; ++ CActiveAEBufferPool *m_vizBuffersInput; + CActiveAEBufferPool *m_silenceBuffers; // needed to drive gui sounds if we have no streams + CActiveAEBufferPool *m_encoderBuffers; + +-- +1.8.4 + diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-995.10-disable-minimize.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-995.10-disable-minimize.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-995.10-disable-minimize.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-995.10-disable-minimize.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-AML-XB9295c3f-04-fixed-context-menu-remove-safely-selection.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-AML-XB9295c3f-04-fixed-context-menu-remove-safely-selection.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-AML-XB9295c3f-04-fixed-context-menu-remove-safely-selection.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-AML-XB9295c3f-04-fixed-context-menu-remove-safely-selection.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-AML-XB9295c3f-05-use-udevil-to-umount.-escape-mountpath.patch b/packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-AML-XB9295c3f-05-use-udevil-to-umount.-escape-mountpath.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/13.alpha-9f8682d/xbmc-AML-XB9295c3f-05-use-udevil-to-umount.-escape-mountpath.patch rename to packages/mediacenter/xbmc/patches/13.alpha-2975e4a/xbmc-AML-XB9295c3f-05-use-udevil-to-umount.-escape-mountpath.patch