diff --git a/packages/mediacenter/xbmc-theme-Confluence/meta b/packages/mediacenter/xbmc-theme-Confluence/meta index 21be4b1a06..dda2ba3f0c 100644 --- a/packages/mediacenter/xbmc-theme-Confluence/meta +++ b/packages/mediacenter/xbmc-theme-Confluence/meta @@ -21,7 +21,7 @@ PKG_NAME="xbmc-theme-Confluence" PKG_VERSION="12.2-e40d13d" if [ "$XBMC" = "master" ]; then - PKG_VERSION="f68634b" + PKG_VERSION="13.alpha-6edea14" elif [ "$XBMC" = "xbmc-aml" ]; then PKG_VERSION="aml-frodo-d9119f2" fi diff --git a/packages/mediacenter/xbmc/package.mk b/packages/mediacenter/xbmc/package.mk index eae61d8fa0..76a23924a2 100644 --- a/packages/mediacenter/xbmc/package.mk +++ b/packages/mediacenter/xbmc/package.mk @@ -21,7 +21,7 @@ PKG_NAME="xbmc" PKG_VERSION="12.2-e40d13d" if [ "$XBMC" = "master" ]; then - PKG_VERSION="f68634b" + PKG_VERSION="13.alpha-6edea14" elif [ "$XBMC" = "xbmc-aml" ]; then PKG_VERSION="aml-frodo-d9119f2" fi diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-321-texturepacker-hostflags-and-rework.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-321-texturepacker-hostflags-and-rework.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/f68634b/xbmc-321-texturepacker-hostflags-and-rework.patch rename to packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-321-texturepacker-hostflags-and-rework.patch diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/f68634b/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch rename to packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-408-enable_PYTHONOPTIMIZE_with_external_Python-0.1.patch diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-453-add_openelec.tv_RSS_news-0.1.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-453-add_openelec.tv_RSS_news-0.1.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/f68634b/xbmc-453-add_openelec.tv_RSS_news-0.1.patch rename to packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-453-add_openelec.tv_RSS_news-0.1.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-602-add_as.xml_busy_dialog_delay_control.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-602-add_as.xml_busy_dialog_delay_control.patch new file mode 100644 index 0000000000..88807638f3 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-602-add_as.xml_busy_dialog_delay_control.patch @@ -0,0 +1,57 @@ +diff -Naur xbmc-13.alpha-6edea14/xbmc/cores/dvdplayer/DVDPlayer.cpp xbmc-13.alpha-6edea14.patch/xbmc/cores/dvdplayer/DVDPlayer.cpp +--- xbmc-13.alpha-6edea14/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-08-02 16:28:51.000000000 +0200 ++++ xbmc-13.alpha-6edea14.patch/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-08-02 17:19:34.162512140 +0200 +@@ -479,7 +479,7 @@ + #endif + + Create(); +- if(!m_ready.WaitMSec(100)) ++ if(!m_ready.WaitMSec(g_advancedSettings.m_videoBusyDialogDelay_ms)) + { + CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); + if(dialog) +diff -Naur xbmc-13.alpha-6edea14/xbmc/cores/omxplayer/OMXPlayer.cpp xbmc-13.alpha-6edea14.patch/xbmc/cores/omxplayer/OMXPlayer.cpp +--- xbmc-13.alpha-6edea14/xbmc/cores/omxplayer/OMXPlayer.cpp 2013-08-02 16:28:51.000000000 +0200 ++++ xbmc-13.alpha-6edea14.patch/xbmc/cores/omxplayer/OMXPlayer.cpp 2013-08-02 17:19:34.164512143 +0200 +@@ -522,7 +522,7 @@ + #endif + + Create(); +- if(!m_ready.WaitMSec(100)) ++ if(!m_ready.WaitMSec(g_advancedSettings.m_videoBusyDialogDelay_ms)) + { + CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); + if(dialog) +diff -Naur xbmc-13.alpha-6edea14/xbmc/settings/AdvancedSettings.cpp xbmc-13.alpha-6edea14.patch/xbmc/settings/AdvancedSettings.cpp +--- xbmc-13.alpha-6edea14/xbmc/settings/AdvancedSettings.cpp 2013-08-02 16:28:51.000000000 +0200 ++++ xbmc-13.alpha-6edea14.patch/xbmc/settings/AdvancedSettings.cpp 2013-08-02 17:21:43.772739525 +0200 +@@ -184,6 +184,7 @@ + + m_videoDefaultLatency = 0.0; + m_videoDisableHi10pMultithreading = false; ++ m_videoBusyDialogDelay_ms = 100; + + m_musicUseTimeSeeking = true; + m_musicTimeSeekForward = 10; +@@ -700,6 +701,10 @@ + //0 = disable fps detect, 1 = only detect on timestamps with uniform spacing, 2 detect on all timestamps + XMLUtils::GetInt(pElement, "fpsdetect", m_videoFpsDetect, 0, 2); + ++ // controls the delay, in milliseconds, until ++ // the busy dialog is shown when starting video playback. ++ XMLUtils::GetInt(pElement, "busydialogdelayms", m_videoBusyDialogDelay_ms, 0, 1000); ++ + // Store global display latency settings + TiXmlElement* pVideoLatency = pElement->FirstChildElement("latency"); + if (pVideoLatency) +diff -Naur xbmc-13.alpha-6edea14/xbmc/settings/AdvancedSettings.h xbmc-13.alpha-6edea14.patch/xbmc/settings/AdvancedSettings.h +--- xbmc-13.alpha-6edea14/xbmc/settings/AdvancedSettings.h 2013-08-02 16:28:51.000000000 +0200 ++++ xbmc-13.alpha-6edea14.patch/xbmc/settings/AdvancedSettings.h 2013-08-02 17:21:29.790714897 +0200 +@@ -190,6 +190,7 @@ + bool m_DXVANoDeintProcForProgressive; + int m_videoFpsDetect; + bool m_videoDisableHi10pMultithreading; ++ int m_videoBusyDialogDelay_ms; + StagefrightConfig m_stagefrightConfig; + + CStdString m_videoDefaultPlayer; diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/f68634b/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch rename to packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-990.15-depends-mark_our_wrapped_functions_as_used.patch diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-995.01-xvba_support-275709a.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-995.01-xvba_support-8fdcc86.patch similarity index 67% rename from packages/mediacenter/xbmc/patches/f68634b/xbmc-995.01-xvba_support-275709a.patch rename to packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-995.01-xvba_support-8fdcc86.patch index c74fde3051..24c5392f3c 100644 --- a/packages/mediacenter/xbmc/patches/f68634b/xbmc-995.01-xvba_support-275709a.patch +++ b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-995.01-xvba_support-8fdcc86.patch @@ -1,8625 +1,7 @@ -From d1437bb713c416176489385d0575281eb3f09ff2 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Mon, 15 Apr 2013 20:27:39 +0200 -Subject: [PATCH 001/136] AE: Start of planar format internally - ---- - xbmc/cores/AudioEngine/AEAudioFormat.h | 7 +++++++ - xbmc/cores/AudioEngine/Utils/AEUtil.cpp | 14 ++++++++++++++ - 2 files changed, 21 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/AEAudioFormat.h b/xbmc/cores/AudioEngine/AEAudioFormat.h -index 369811c..64be36f 100644 ---- a/xbmc/cores/AudioEngine/AEAudioFormat.h -+++ b/xbmc/cores/AudioEngine/AEAudioFormat.h -@@ -31,26 +31,33 @@ enum AEDataFormat - AE_FMT_INVALID = -1, - - AE_FMT_U8, -+ AE_FMT_U8P, - AE_FMT_S8, - - AE_FMT_S16BE, - AE_FMT_S16LE, - AE_FMT_S16NE, -+ AE_FMT_S16NEP, - - AE_FMT_S32BE, - AE_FMT_S32LE, - AE_FMT_S32NE, -+ AE_FMT_S32NEP, - - AE_FMT_S24BE4, - AE_FMT_S24LE4, - AE_FMT_S24NE4, /* S24 in 4 bytes */ -+ AE_FMT_S24NE4P, - - AE_FMT_S24BE3, - AE_FMT_S24LE3, - AE_FMT_S24NE3, /* S24 in 3 bytes */ -+ AE_FMT_S24NE3P, - - AE_FMT_DOUBLE, -+ AE_FMT_DOUBLEP, - AE_FMT_FLOAT, -+ AE_FMT_FLOATP, - - /* Bitstream formats */ - AE_FMT_AAC, -diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp -index 2b6e0cd..3a5c78f 100644 ---- a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp -+++ b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp -@@ -82,26 +82,33 @@ const unsigned int CAEUtil::DataFormatToBits(const enum AEDataFormat dataFormat) - static const unsigned int formats[AE_FMT_MAX] = - { - 8, /* U8 */ -+ 8, /* U8P */ - 8, /* S8 */ - - 16, /* S16BE */ - 16, /* S16LE */ - 16, /* S16NE */ -+ 16, /* S16NEP */ - - 32, /* S32BE */ - 32, /* S32LE */ - 32, /* S32NE */ -+ 32, /* S32NEP */ - - 32, /* S24BE */ - 32, /* S24LE */ - 32, /* S24NE */ -+ 32, /* S24NEP */ - - 24, /* S24BE3 */ - 24, /* S24LE3 */ - 24, /* S24NE3 */ -+ 24, /* S24NE3P*/ - - sizeof(double) << 3, /* DOUBLE */ -+ sizeof(double) << 3, /* DOUBLEP */ - sizeof(float ) << 3, /* FLOAT */ -+ sizeof(float ) << 3, /* FLOATP */ - - 16, /* AAC */ - 16, /* AC3 */ -@@ -123,26 +130,33 @@ const char* CAEUtil::DataFormatToStr(const enum AEDataFormat dataFormat) - static const char *formats[AE_FMT_MAX] = - { - "AE_FMT_U8", -+ "AE_FMT_U8P", - "AE_FMT_S8", - - "AE_FMT_S16BE", - "AE_FMT_S16LE", - "AE_FMT_S16NE", -+ "AE_FMT_S16NEP", - - "AE_FMT_S32BE", - "AE_FMT_S32LE", - "AE_FMT_S32NE", -+ "AE_FMT_S32NEP", - - "AE_FMT_S24BE4", - "AE_FMT_S24LE4", - "AE_FMT_S24NE4", /* S24 in 4 bytes */ -+ "AE_FMT_S24NE4P", - - "AE_FMT_S24BE3", - "AE_FMT_S24LE3", - "AE_FMT_S24NE3", /* S24 in 3 bytes */ -+ "AE_FMT_S24NE3P", - - "AE_FMT_DOUBLE", -+ "AE_FMT_DOUBLEP", - "AE_FMT_FLOAT", -+ "AE_FMT_FLOATP", - - /* for passthrough streams and the like */ - "AE_FMT_AAC", --- -1.8.1.6 - - -From 321beb78c4833da8de29c3aabd1a37f063a18202 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 31 May 2013 16:28:30 +0200 -Subject: [PATCH 002/136] AE: register callback for all audio settings - ---- - xbmc/settings/Settings.cpp | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index b5fd369..d8f6889 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -840,8 +840,18 @@ void CSettings::InitializeISettingCallbacks() - m_settingsManager->RegisterCallback(&CDisplaySettings::Get(), settingSet); - - settingSet.clear(); -+ settingSet.insert("audiooutput.mode"); - settingSet.insert("audiooutput.channels"); - settingSet.insert("audiooutput.guisoundmode"); -+ settingSet.insert("audiooutput.stereoupmix"); -+ settingSet.insert("audiooutput.ac3passthrough"); -+ settingSet.insert("audiooutput.dtspassthrough"); -+ 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("lookandfeel.skin"); - settingSet.insert("lookandfeel.skinsettings"); - settingSet.insert("lookandfeel.font"); --- -1.8.1.6 - - -From 1e4ee28403cc9af837352672fc1a3e7bbcc2b69c Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Thu, 23 May 2013 10:05:11 +0200 -Subject: [PATCH 003/136] AESinkALSA: drop unneeded member - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 11 ++++++----- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.h | 1 - - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 45028d6..decd0bd 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -131,19 +131,20 @@ void CAESinkALSA::GetAESParams(AEAudioFormat format, std::string& params) - - bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device) - { -+ CAEChannelInfo channelLayout; - m_initDevice = device; - m_initFormat = format; - - /* if we are raw, correct the data format */ - if (AE_IS_RAW(format.m_dataFormat)) - { -- m_channelLayout = GetChannelLayout(format); -+ channelLayout = GetChannelLayout(format); - format.m_dataFormat = AE_FMT_S16NE; - m_passthrough = true; - } - else - { -- m_channelLayout = GetChannelLayout(format); -+ channelLayout = GetChannelLayout(format); - m_passthrough = false; - } - #if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC) -@@ -154,13 +155,13 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device) - } - #endif - -- if (m_channelLayout.Count() == 0) -+ if (channelLayout.Count() == 0) - { - CLog::Log(LOGERROR, "CAESinkALSA::Initialize - Unable to open the requested channel layout"); - return false; - } - -- format.m_channelLayout = m_channelLayout; -+ format.m_channelLayout = channelLayout; - - AEDeviceType devType = AEDeviceTypeFromName(device); - -@@ -176,7 +177,7 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device) - snd_config_t *config; - snd_config_copy(&config, snd_config); - -- if (!OpenPCMDevice(device, AESParams, m_channelLayout.Count(), &m_pcm, config)) -+ if (!OpenPCMDevice(device, AESParams, channelLayout.Count(), &m_pcm, config)) - { - CLog::Log(LOGERROR, "CAESinkALSA::Initialize - failed to initialize device \"%s\"", device.c_str()); - snd_config_delete(config); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h -index 39e3719..90578b9 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h -@@ -64,7 +64,6 @@ class CAESinkALSA : public IAESink - unsigned int m_bufferSize; - double m_formatSampleRateMul; - bool m_passthrough; -- CAEChannelInfo m_channelLayout; - std::string m_device; - snd_pcm_t *m_pcm; - int m_timeout; --- -1.8.1.6 - - -From 8982a8ef935bec12899a07745bf4d049bc066499 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Sat, 27 Apr 2013 10:47:01 +0200 -Subject: [PATCH 004/136] ffmpeg: add methods to the interface needed for - resampling - ---- - lib/DllAvUtil.h | 14 ++++++++++++++ - lib/DllSwResample.h | 15 +++++++++++++++ - 2 files changed, 29 insertions(+) - -diff --git a/lib/DllAvUtil.h b/lib/DllAvUtil.h -index 1afee5e..bbe9be2 100644 ---- a/lib/DllAvUtil.h -+++ b/lib/DllAvUtil.h -@@ -95,6 +95,9 @@ class DllAvUtilInterface - virtual void av_dict_free(AVDictionary **pm) = 0; - virtual int av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) = 0; - virtual int64_t av_get_default_channel_layout(int nb_channels)=0; -+ virtual int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) = 0; -+ virtual int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt) = 0; -+ virtual int av_get_channel_layout_channel_index (uint64_t channel_layout, uint64_t channel) = 0; - }; - - #if defined (USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) -@@ -133,6 +136,10 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface - virtual int av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) - { return ::av_samples_get_buffer_size(linesize, nb_channels, nb_samples, sample_fmt, align); } - virtual int64_t av_get_default_channel_layout(int nb_channels) { return ::av_get_default_channel_layout(nb_channels); } -+ virtual int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) -+ { return ::av_samples_alloc(audio_data, linesize, nb_channels, nb_samples, sample_fmt, align); } -+ virtual int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt) { return ::av_sample_fmt_is_planar(sample_fmt); } -+ virtual int av_get_channel_layout_channel_index (uint64_t channel_layout, uint64_t channel) { return ::av_get_channel_layout_channel_index(channel_layout, channel); } - - // DLL faking. - virtual bool ResolveExports() { return true; } -@@ -178,6 +185,9 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface - DEFINE_METHOD1(void, av_dict_free, (AVDictionary **p1)); - DEFINE_METHOD5(int, av_samples_get_buffer_size, (int *p1, int p2, int p3, enum AVSampleFormat p4, int p5)) - DEFINE_METHOD1(int64_t, av_get_default_channel_layout, (int p1)) -+ DEFINE_METHOD6(int, av_samples_alloc, (uint8_t **p1, int *p2, int p3, int p4, enum AVSampleFormat p5, int p6)) -+ DEFINE_METHOD1(int, av_sample_fmt_is_planar, (enum AVSampleFormat p1)) -+ DEFINE_METHOD2(int, av_get_channel_layout_channel_index, (uint64_t p1, uint64_t p2)) - - public: - BEGIN_METHOD_RESOLVE() -@@ -206,6 +216,10 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface - RESOLVE_METHOD(av_dict_free) - RESOLVE_METHOD(av_samples_get_buffer_size) - RESOLVE_METHOD(av_get_default_channel_layout) -+ RESOLVE_METHOD(av_samples_alloc) -+ RESOLVE_METHOD(av_sample_fmt_is_planar) -+ RESOLVE_METHOD(av_get_channel_layout_channel_index) -+ - END_METHOD_RESOLVE() - }; - -diff --git a/lib/DllSwResample.h b/lib/DllSwResample.h -index e9613d3..320b3a7 100644 ---- a/lib/DllSwResample.h -+++ b/lib/DllSwResample.h -@@ -60,6 +60,9 @@ class DllSwResampleInterface - virtual int swr_init(struct SwrContext *s)=0; - virtual void swr_free(struct SwrContext **s)=0; - virtual int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, const uint8_t **in , int in_count)=0; -+ virtual int64_t swr_get_delay(struct SwrContext *s, int64_t base) = 0; -+ virtual int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map) = 0; -+ virtual int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride) = 0; - }; - - #if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) -@@ -84,6 +87,9 @@ class DllSwResample : public DllDynamic, DllSwResampleInterface - virtual int swr_init(struct SwrContext *s) { return ::swr_init(s); } - virtual void swr_free(struct SwrContext **s){ return ::swr_free(s); } - virtual int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, const uint8_t **in , int in_count){ return ::swr_convert(s, out, out_count, in, in_count); } -+ virtual int64_t swr_get_delay(struct SwrContext *s, int64_t base) { return ::swr_get_delay(s, base); } -+ virtual int swr_set_channel_mapping (struct SwrContext *s, const int *channel_map) { return ::swr_set_channel_mapping(s, channel_map); } -+ virtual int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride) { return ::swr_set_matrix(s, matrix, stride); } - }; - #else - // Wrap the same API through libavresample. -@@ -114,6 +120,9 @@ class DllSwResample : public DllDynamic, DllSwResampleInterface - virtual int swr_init(struct SwrContext *s) { return ::avresample_open(s); } - virtual void swr_free(struct SwrContext **s){ ::avresample_close(*s); *s = NULL; } - virtual int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, const uint8_t **in , int in_count){ return ::avresample_convert(s, out, 0, out_count, (uint8_t**)in, 0,in_count); } -+ virtual int64_t swr_get_delay(struct SwrContext *s, int64_t base){return ::swr_get_delay(s, base);} -+ virtual int swr_set_channel_mapping (struct SwrContext *s, const int *channel_map){return ::swr_set_channel_mapping(s, channel_map);} -+ virtual int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride) { return ::swr_set_matrix(s, matrix, stride);} - }; - #endif - -@@ -129,12 +138,18 @@ class DllSwResample : public DllDynamic, DllSwResampleInterface - DEFINE_METHOD1(int, swr_init, (struct SwrContext *p1)) - DEFINE_METHOD1(void, swr_free, (struct SwrContext **p1)) - DEFINE_METHOD5(int, swr_convert, (struct SwrContext *p1, uint8_t **p2, int p3, const uint8_t **p4, int p5)) -+ DEFINE_METHOD2(int64_t, swr_get_delay, (struct SwrContext *p1, int64_t p2)) -+ DEFINE_METHOD2(int, swr_set_channel_mapping, (struct SwrContext *p1, const int *p2)) -+ DEFINE_METHOD3(int, swr_set_matrix, (struct SwrContext *p1, const double *p2, int p3)) - - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD(swr_alloc_set_opts) - RESOLVE_METHOD(swr_init) - RESOLVE_METHOD(swr_free) - RESOLVE_METHOD(swr_convert) -+ RESOLVE_METHOD(swr_get_delay) -+ RESOLVE_METHOD(swr_set_channel_mapping) -+ RESOLVE_METHOD(swr_set_matrix) - END_METHOD_RESOLVE() - - /* dependencies of libavformat */ --- -1.8.1.6 - - -From 1e242da24efe796525a07a599dc2527742e400e2 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Thu, 25 Jul 2013 19:39:44 +0200 -Subject: [PATCH 005/136] ffmpeg: add av_opt_set_int and av_opt_set_double for - intrumenting swr - ---- - lib/DllAvUtil.h | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/lib/DllAvUtil.h b/lib/DllAvUtil.h -index bbe9be2..521263f 100644 ---- a/lib/DllAvUtil.h -+++ b/lib/DllAvUtil.h -@@ -82,6 +82,8 @@ class DllAvUtilInterface - virtual const AVCRC* av_crc_get_table(AVCRCId crc_id)=0; - virtual uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)=0; - virtual int av_opt_set(void *obj, const char *name, const char *val, int search_flags)=0; -+ virtual int av_opt_set_double(void *obj, const char *name, double val, int search_flags)=0; -+ virtual int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)=0; - virtual AVFifoBuffer *av_fifo_alloc(unsigned int size) = 0; - virtual void av_fifo_free(AVFifoBuffer *f) = 0; - virtual void av_fifo_reset(AVFifoBuffer *f) = 0; -@@ -119,6 +121,8 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface - virtual const AVCRC* av_crc_get_table(AVCRCId crc_id) { return ::av_crc_get_table(crc_id); } - virtual uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length) { return ::av_crc(ctx, crc, buffer, length); } - virtual int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { return ::av_opt_set(obj, name, val, search_flags); } -+ virtual int av_opt_set_double(void *obj, const char *name, double val, int search_flags) { return ::av_opt_set_double(obj, name, val, search_flags); } -+ virtual int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags) { return ::av_opt_set_int(obj, name, val, search_flags); } - virtual AVFifoBuffer *av_fifo_alloc(unsigned int size) {return ::av_fifo_alloc(size); } - virtual void av_fifo_free(AVFifoBuffer *f) { ::av_fifo_free(f); } - virtual void av_fifo_reset(AVFifoBuffer *f) { ::av_fifo_reset(f); } -@@ -172,6 +176,8 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface - DEFINE_METHOD5(int, av_crc_init, (AVCRC *p1, int p2, int p3, uint32_t p4, int p5)); - DEFINE_METHOD4(uint32_t, av_crc, (const AVCRC *p1, uint32_t p2, const uint8_t *p3, size_t p4)); - DEFINE_METHOD4(int, av_opt_set, (void *p1, const char *p2, const char *p3, int p4)); -+ DEFINE_METHOD4(int, av_opt_set_double, (void *p1, const char *p2, double p3, int p4)) -+ DEFINE_METHOD4(int, av_opt_set_int, (void *p1, const char *p2, int64_t p3, int p4)) - DEFINE_METHOD1(AVFifoBuffer*, av_fifo_alloc, (unsigned int p1)) - DEFINE_METHOD1(void, av_fifo_free, (AVFifoBuffer *p1)) - DEFINE_METHOD1(void, av_fifo_reset, (AVFifoBuffer *p1)) -@@ -203,6 +209,8 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface - RESOLVE_METHOD(av_crc_get_table) - RESOLVE_METHOD(av_crc) - RESOLVE_METHOD(av_opt_set) -+ RESOLVE_METHOD(av_opt_set_double) -+ RESOLVE_METHOD(av_opt_set_int) - RESOLVE_METHOD(av_fifo_alloc) - RESOLVE_METHOD(av_fifo_free) - RESOLVE_METHOD(av_fifo_reset) --- -1.8.1.6 - - -From f79f7713184ed00fb019dd00f755f1e182b2c601 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Wed, 26 Jun 2013 15:12:28 +0200 -Subject: [PATCH 006/136] AE: allow encoder to be fed with planar format - ---- - .../cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp | 66 +++++++++++++++++++++- - xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h | 3 +- - xbmc/cores/AudioEngine/Interfaces/AEEncoder.h | 13 ++++- - 3 files changed, 78 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp b/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp -index ba89868..2f305b1 100644 ---- a/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp -+++ b/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp -@@ -98,7 +98,7 @@ unsigned int CAEEncoderFFmpeg::BuildChannelLayout(const int64_t ffmap, CAEChanne - return layout.Count(); - } - --bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format) -+bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format, bool allow_planar_input) - { - Reset(); - -@@ -150,6 +150,7 @@ bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format) - bool hasS32 = false; - bool hasS16 = false; - bool hasU8 = false; -+ bool hasFloatP = false; - bool hasUnknownFormat = false; - - for(int i = 0; codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; ++i) -@@ -161,6 +162,12 @@ bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format) - case AV_SAMPLE_FMT_S32: hasS32 = true; break; - case AV_SAMPLE_FMT_S16: hasS16 = true; break; - case AV_SAMPLE_FMT_U8 : hasU8 = true; break; -+ case AV_SAMPLE_FMT_FLTP: -+ if (allow_planar_input) -+ hasFloatP = true; -+ else -+ hasUnknownFormat = true; -+ break; - case AV_SAMPLE_FMT_NONE: return false; - default: hasUnknownFormat = true; break; - } -@@ -171,6 +178,11 @@ bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format) - m_CodecCtx->sample_fmt = AV_SAMPLE_FMT_FLT; - format.m_dataFormat = AE_FMT_FLOAT; - } -+ else if (hasFloatP) -+ { -+ m_CodecCtx->sample_fmt = AV_SAMPLE_FMT_FLTP; -+ format.m_dataFormat = AE_FMT_FLOATP; -+ } - else if (hasDouble) - { - m_CodecCtx->sample_fmt = AV_SAMPLE_FMT_DBL; -@@ -214,7 +226,6 @@ bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format) - return false; - } - -- format.m_dataFormat = AE_FMT_FLOAT; - format.m_frames = m_CodecCtx->frame_size; - format.m_frameSamples = m_CodecCtx->frame_size * m_CodecCtx->channels; - format.m_frameSize = m_CodecCtx->channels * (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3); -@@ -351,6 +362,57 @@ int CAEEncoderFFmpeg::Encode(float *data, unsigned int frames) - return m_NeededFrames; - } - -+int CAEEncoderFFmpeg::Encode(uint8_t *in, int in_size, uint8_t *out, int out_size) -+{ -+ int got_output; -+ AVFrame *frame; -+ -+ if (!m_CodecCtx) -+ return 0; -+ -+ /* allocate the input frame -+ * sadly, we have to alloc/dealloc it everytime since we have no guarantee the -+ * data argument will be constant over iterated calls and the frame needs to -+ * setup pointers inside data */ -+ frame = m_dllAvCodec.avcodec_alloc_frame(); -+ if (!frame) -+ return 0; -+ -+ frame->nb_samples = m_CodecCtx->frame_size; -+ frame->format = m_CodecCtx->sample_fmt; -+ frame->channel_layout = m_CodecCtx->channel_layout; -+ -+ m_dllAvCodec.avcodec_fill_audio_frame(frame, m_CodecCtx->channels, m_CodecCtx->sample_fmt, -+ in, in_size, 0); -+ -+ /* initialize the output packet */ -+ m_dllAvCodec.av_init_packet(&m_Pkt); -+ m_Pkt.size = out_size - IEC61937_DATA_OFFSET; -+ m_Pkt.data = out + IEC61937_DATA_OFFSET; -+ -+ /* encode it */ -+ int ret = m_dllAvCodec.avcodec_encode_audio2(m_CodecCtx, &m_Pkt, frame, &got_output); -+ -+ /* free temporary data */ -+ m_dllAvCodec.avcodec_free_frame(&frame); -+ -+ if (ret < 0 || !got_output) -+ { -+ CLog::Log(LOGERROR, "CAEEncoderFFmpeg::Encode - Encoding failed"); -+ return 0; -+ } -+ -+ /* pack it into an IEC958 frame */ -+ m_PackFunc(NULL, m_Pkt.size, out); -+ -+ /* free the packet */ -+ m_dllAvCodec.av_free_packet(&m_Pkt); -+ -+ /* return the number of frames used */ -+ return m_NeededFrames; -+} -+ -+ - int CAEEncoderFFmpeg::GetData(uint8_t **data) - { - int size; -diff --git a/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h b/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h -index 4ecc9f2..4fb67c4 100644 ---- a/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h -+++ b/xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.h -@@ -36,7 +36,7 @@ class CAEEncoderFFmpeg: public IAEEncoder - virtual ~CAEEncoderFFmpeg(); - - virtual bool IsCompatible(AEAudioFormat format); -- virtual bool Initialize(AEAudioFormat &format); -+ virtual bool Initialize(AEAudioFormat &format, bool allow_planar_input = false); - virtual void Reset(); - - virtual unsigned int GetBitRate (); -@@ -44,6 +44,7 @@ class CAEEncoderFFmpeg: public IAEEncoder - virtual unsigned int GetFrames (); - - virtual int Encode (float *data, unsigned int frames); -+ virtual int Encode (uint8_t *in, int in_size, uint8_t *out, int out_size); - virtual int GetData(uint8_t **data); - virtual double GetDelay(unsigned int bufferSize); - private: -diff --git a/xbmc/cores/AudioEngine/Interfaces/AEEncoder.h b/xbmc/cores/AudioEngine/Interfaces/AEEncoder.h -index 8c50fb1..6e4c257 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AEEncoder.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AEEncoder.h -@@ -48,9 +48,10 @@ class IAEEncoder - /** - * Called to setup the encoder to accept data in the specified format - * @param format the desired audio format, may be changed to suit the encoder -+ * @param allow_planar_input allow engine to use with planar formats - * @return true on success, false on failure - */ -- virtual bool Initialize(AEAudioFormat &format) = 0; -+ virtual bool Initialize(AEAudioFormat &format, bool allow_planar_input = false) = 0; - - /** - * Reset the encoder for new data -@@ -84,6 +85,16 @@ class IAEEncoder - virtual int Encode(float *data, unsigned int frames) = 0; - - /** -+ * Encodes the supplied samples into a provided buffer -+ * @param in the PCM samples encoder requested format -+ * @param in_size input buffer size -+ * @param output buffer -+ * @param out_size output buffer size -+ * @return the number of samples consumed -+ */ -+ virtual int Encode (uint8_t *in, int in_size, uint8_t *out, int out_size) { return 0; }; -+ -+ /** - * Get the encoded data - * @param data return pointer to the buffer with the current encoded block - * @return the size in bytes of *data --- -1.8.1.6 - - -From 0ea994d9cc66de6db9e9b0bf239fb220ddabf9fb Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Wed, 26 Jun 2013 15:13:22 +0200 -Subject: [PATCH 007/136] AE: alsa - close device in blocking mode, fixes - device busy - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index decd0bd..06a949b 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -196,8 +196,8 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device) - if (!InitializeHW(format) || !InitializeSW(format)) - return false; - -- snd_pcm_nonblock(m_pcm, 1); - snd_pcm_prepare (m_pcm); -+ snd_pcm_nonblock(m_pcm, 1); - - m_format = format; - m_formatSampleRateMul = 1.0 / (double)m_format.m_sampleRate; -@@ -436,10 +436,10 @@ bool CAESinkALSA::InitializeSW(AEAudioFormat &format) - - void CAESinkALSA::Deinitialize() - { -- Stop(); -- - if (m_pcm) - { -+ snd_pcm_nonblock(m_pcm, 0); -+ Stop(); - snd_pcm_close(m_pcm); - m_pcm = NULL; - } --- -1.8.1.6 - - -From 47dc6f36326fafb8b1d7a8cbb61c83f4a5f4f19c Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Wed, 26 Jun 2013 18:48:30 +0200 -Subject: [PATCH 008/136] AE: alsa - set to prepared after drain - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 06a949b..630dd5d 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -196,8 +196,8 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device) - if (!InitializeHW(format) || !InitializeSW(format)) - return false; - -- snd_pcm_prepare (m_pcm); - snd_pcm_nonblock(m_pcm, 1); -+ snd_pcm_prepare (m_pcm); - - m_format = format; - m_formatSampleRateMul = 1.0 / (double)m_format.m_sampleRate; -@@ -574,6 +574,7 @@ void CAESinkALSA::Drain() - - snd_pcm_nonblock(m_pcm, 0); - snd_pcm_drain(m_pcm); -+ snd_pcm_prepare(m_pcm); - snd_pcm_nonblock(m_pcm, 1); - } - --- -1.8.1.6 - - -From a69c107e38624076463f2ad501cb13c3f84fe2fd Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Fri, 5 Jul 2013 21:02:00 +0200 -Subject: [PATCH 009/136] AE: Add blocking option to AddPackets, makes Sink - behaviour choosable after c2493d5bf6bc2be2fb45f563affdd214bf9862fb - ---- - xbmc/cores/AudioEngine/Interfaces/AESink.h | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 11 +++++++++-- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.h | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp | 4 ++-- - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkNULL.h | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkOSS.h | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkProfiler.h | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h | 2 +- - 15 files changed, 24 insertions(+), 17 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Interfaces/AESink.h b/xbmc/cores/AudioEngine/Interfaces/AESink.h -index d4fc3b9..520d6ef 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AESink.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AESink.h -@@ -71,7 +71,7 @@ class IAESink - /* - Adds packets to be sent out, this routine MUST block or sleep. - */ -- virtual unsigned int AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) = 0; -+ virtual unsigned int AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false) = 0; - - /* - Drain the sink -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 630dd5d..4e06031 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -497,7 +497,7 @@ double CAESinkALSA::GetCacheTotal() - return (double)m_bufferSize * m_formatSampleRateMul; - } - --unsigned int CAESinkALSA::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) -+unsigned int CAESinkALSA::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking) - { - if (!m_pcm) - { -@@ -518,7 +518,14 @@ unsigned int CAESinkALSA::AddPackets(uint8_t *data, unsigned int frames, bool ha - } - - if ((unsigned int)ret < frames) -- return 0; -+ if(blocking) -+ { -+ ret = snd_pcm_wait(m_pcm, m_timeout); -+ if (ret < 0) -+ HandleError("snd_pcm_wait", ret); -+ } -+ else -+ return 0; - - ret = snd_pcm_writei(m_pcm, (void*)data, frames); - if (ret < 0) -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h -index 90578b9..e43ea5e 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.h -@@ -47,7 +47,7 @@ class CAESinkALSA : public IAESink - virtual double GetDelay (); - virtual double GetCacheTime (); - virtual double GetCacheTotal (); -- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio); -+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual void Drain (); - virtual bool SoftSuspend(); - virtual bool SoftResume(); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -index 07a4bcc..7b9e205 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -@@ -212,7 +212,7 @@ double CAESinkAUDIOTRACK::GetCacheTotal() - return m_sinkbuffer_sec + m_audiotrackbuffer_sec; - } - --unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) -+unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking) - { - // write as many frames of audio as we can fit into our internal buffer. - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h -index 3d73d9fb..9600867 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h -@@ -40,7 +40,7 @@ class CAESinkAUDIOTRACK : public CThread, public IAESink - virtual double GetDelay (); - virtual double GetCacheTime (); - virtual double GetCacheTotal (); -- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio); -+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual void Drain (); - virtual bool HasVolume (); - virtual void SetVolume (float scale); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -index d46d551..cff916e 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -@@ -367,7 +367,7 @@ bool CAESinkDirectSound::IsCompatible(const AEAudioFormat format, const std::str - return false; - } - --unsigned int CAESinkDirectSound::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) -+unsigned int CAESinkDirectSound::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false) - { - if (!m_initialized) - return 0; -@@ -910,4 +910,4 @@ bool CAESinkDirectSound::SoftResume() - { - /* Return false to force re-init by engine */ - return false; --} -\ No newline at end of file -+} -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h -index b0149dd..8ff098d 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h -@@ -42,7 +42,7 @@ class CAESinkDirectSound : public IAESink - virtual double GetDelay (); - virtual double GetCacheTime (); - virtual double GetCacheTotal (); -- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio); -+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual bool SoftSuspend (); - virtual bool SoftResume (); - static std::string GetDefaultDevice (); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp -index 254b9c9..7d26017 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp -@@ -99,7 +99,7 @@ double CAESinkNULL::GetCacheTotal() - return m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer_size; - } - --unsigned int CAESinkNULL::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) -+unsigned int CAESinkNULL::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking) - { - unsigned int max_frames = (m_sinkbuffer_size - m_sinkbuffer_level) / m_sink_frameSize; - if (frames > max_frames) -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkNULL.h b/xbmc/cores/AudioEngine/Sinks/AESinkNULL.h -index ef77119..1e4a3b9 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkNULL.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkNULL.h -@@ -38,7 +38,7 @@ class CAESinkNULL : public CThread, public IAESink - virtual double GetDelay (); - virtual double GetCacheTime (); - virtual double GetCacheTotal (); -- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio); -+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual void Drain (); - - static void EnumerateDevices(AEDeviceList &devices, bool passthrough); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -index 281088d..3a6461b 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -@@ -408,7 +408,7 @@ double CAESinkOSS::GetDelay() - return (double)delay / (m_format.m_frameSize * m_format.m_sampleRate); - } - --unsigned int CAESinkOSS::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) -+unsigned int CAESinkOSS::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking) - { - int size = frames * m_format.m_frameSize; - if (m_fd == -1) -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.h b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.h -index f50f713..9e558d3 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.h -@@ -41,7 +41,7 @@ class CAESinkOSS : public IAESink - virtual double GetDelay (); - virtual double GetCacheTime () { return 0.0; } /* FIXME */ - virtual double GetCacheTotal () { return 0.0; } /* FIXME */ -- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio); -+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual void Drain (); - static void EnumerateDevicesEx(AEDeviceInfoList &list, bool force = false); - private: -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp -index 2cff0ed..aeceb6b 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp -@@ -71,7 +71,7 @@ double CAESinkProfiler::GetDelay() - return 0.0f; - } - --unsigned int CAESinkProfiler::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) -+unsigned int CAESinkProfiler::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking) - { - int64_t ts = CurrentHostCounter(); - CLog::Log(LOGDEBUG, "CAESinkProfiler::AddPackets - latency %f ms", (float)(ts - m_ts) / 1000000.0f); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.h b/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.h -index d9423fb..a0b955b 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.h -@@ -39,7 +39,7 @@ class CAESinkProfiler : public IAESink - virtual double GetDelay (); - virtual double GetCacheTime () { return 0.0; } - virtual double GetCacheTotal () { return 0.0; } -- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio); -+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual void Drain (); - static void EnumerateDevices(AEDeviceList &devices, bool passthrough); - private: -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index 9af3f2e..4cd95f0 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -423,7 +423,7 @@ double CAESinkWASAPI::GetCacheTotal() - return m_sinkLatency; - } - --unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio) -+unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking) - { - if (!m_initialized) - return 0; -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -index df16682..c4a5a51 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -@@ -42,7 +42,7 @@ class CAESinkWASAPI : public IAESink - virtual double GetDelay (); - virtual double GetCacheTime (); - virtual double GetCacheTotal (); -- virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio); -+ virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual bool SoftSuspend (); - virtual bool SoftResume (); - static void EnumerateDevicesEx (AEDeviceInfoList &deviceInfoList, bool force = false); --- -1.8.1.6 - - -From 21396738cd866d56a717c1f0999121739ea914d6 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sat, 6 Jul 2013 08:07:30 +0200 -Subject: [PATCH 010/136] AE: Give Sinks the possibility to be used in a - blocking way - ---- - xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp | 5 ++++ - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp | 11 +++++--- - xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp | 2 +- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 29 +++++++++++++++++++--- - 4 files changed, 40 insertions(+), 7 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -index 7b9e205..48e488b 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp -@@ -243,6 +243,11 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t *data, unsigned int frames, b - break; - } - } -+ // AddPackets runs under a non-idled AE thread we must block or sleep. -+ // Trying to calc the optimal sleep is tricky so just a minimal sleep. -+ if(blocking) -+ Sleep(10); -+ - return hasAudio ? write_frames:frames; - } - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -index cff916e..797d7f2 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -@@ -367,7 +367,7 @@ bool CAESinkDirectSound::IsCompatible(const AEAudioFormat format, const std::str - return false; - } - --unsigned int CAESinkDirectSound::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false) -+unsigned int CAESinkDirectSound::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking) - { - if (!m_initialized) - return 0; -@@ -386,10 +386,15 @@ unsigned int CAESinkDirectSound::AddPackets(uint8_t *data, unsigned int frames, - - while (GetSpace() < total) - { -- if (m_isDirtyDS) -+ if(m_isDirtyDS) - return INT_MAX; - else -- return 0; -+ { -+ if(blocking) -+ Sleep(total * 1000 / m_AvgBytesPerSec); -+ else -+ return 0; -+ } - } - - while (len) -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -index 3a6461b..b201b7b 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp -@@ -420,7 +420,7 @@ unsigned int CAESinkOSS::AddPackets(uint8_t *data, unsigned int frames, bool has - int wrote = write(m_fd, data, size); - if (wrote < 0) - { -- if(errno == EAGAIN || errno == EWOULDBLOCK) -+ if(!blocking && (errno == EAGAIN || errno == EWOULDBLOCK)) - return 0; - - CLog::Log(LOGERROR, "CAESinkOSS::AddPackets - Failed to write"); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index 4cd95f0..8a3d7ce 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -488,10 +488,33 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - #endif - - /* Wait for Audio Driver to tell us it's got a buffer available */ -- DWORD eventAudioCallback = WaitForSingleObject(m_needDataEvent, 0); -+ DWORD eventAudioCallback; -+ if(!blocking) -+ eventAudioCallback = WaitForSingleObject(m_needDataEvent, 0); -+ else -+ eventAudioCallback = WaitForSingleObject(m_needDataEvent, 1100); -+ -+ if (!blocking) -+ { -+ if(eventAudioCallback != WAIT_OBJECT_0) -+ return 0; -+ } -+ else -+ { -+ 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; -+ } -+ } -+ } - -- if (eventAudioCallback != WAIT_OBJECT_0) -- return 0; - - if (!m_running) - return 0; --- -1.8.1.6 - - -From 8700c98e54c57d48cb50584f1097bddad3fe3a5a Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sun, 7 Jul 2013 18:22:04 +0200 -Subject: [PATCH 011/136] AE: allow to register audio callback directly into - engine - ---- - xbmc/cores/AudioEngine/AEFactory.cpp | 12 ++++++++++++ - xbmc/cores/AudioEngine/AEFactory.h | 3 +++ - xbmc/cores/AudioEngine/Interfaces/AE.h | 5 +++++ - xbmc/cores/dvdplayer/DVDPlayer.h | 5 +++-- - xbmc/cores/paplayer/PAPlayer.cpp | 2 ++ - 5 files changed, 25 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 7141dd3..0befba9 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -358,3 +358,15 @@ void CAEFactory::SettingOptionsAudioDevicesFillerGeneral(const CSetting *setting - if (!foundValue) - current = firstDevice; - } -+ -+void CAEFactory::RegisterAudioCallback(IAudioCallback* pCallback) -+{ -+ if (AE) -+ AE->RegisterAudioCallback(pCallback); -+} -+ -+void CAEFactory::UnregisterAudioCallback() -+{ -+ if (AE) -+ AE->UnregisterAudioCallback(); -+} -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index 56a1e27..9e15f79 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -67,6 +67,9 @@ class CAEFactory - 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 RegisterAudioCallback(IAudioCallback* pCallback); -+ static void UnregisterAudioCallback(); -+ - private: - static bool LoadEngine(enum AEEngine engine); - static IAE *AE; -diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h -index cbfa8ed..5741cd8 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AE.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AE.h -@@ -34,6 +34,7 @@ - class IAEStream; - class IAESound; - class IAEPacketizer; -+class IAudioCallback; - - /* sound options */ - #define AE_SOUND_OFF 0 /* disable sounds */ -@@ -183,5 +184,9 @@ class IAE - * @returns true if the AudioEngine is capable of RAW output - */ - virtual bool SupportsRaw() { return false; } -+ -+ virtual void RegisterAudioCallback(IAudioCallback* pCallback) {} -+ -+ virtual void UnregisterAudioCallback() {} - }; - -diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index 237aba4d..c6b9ce3 100644 ---- a/xbmc/cores/dvdplayer/DVDPlayer.h -+++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -39,6 +39,7 @@ - #include "Edl.h" - #include "FileItem.h" - #include "threads/SingleLock.h" -+#include "cores/AudioEngine/AEFactory.h" - - - class CDVDInputStream; -@@ -185,8 +186,8 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer - virtual float GetPercentage(); - virtual float GetCachePercentage(); - -- virtual void RegisterAudioCallback(IAudioCallback* pCallback) { m_dvdPlayerAudio.RegisterAudioCallback(pCallback); } -- virtual void UnRegisterAudioCallback() { m_dvdPlayerAudio.UnRegisterAudioCallback(); } -+ virtual void RegisterAudioCallback(IAudioCallback* pCallback) { CAEFactory::RegisterAudioCallback(pCallback); m_dvdPlayerAudio.RegisterAudioCallback(pCallback); } -+ virtual void UnRegisterAudioCallback() { CAEFactory::UnregisterAudioCallback(); m_dvdPlayerAudio.UnRegisterAudioCallback(); } - virtual void SetVolume(float nVolume) { m_dvdPlayerAudio.SetVolume(nVolume); } - virtual void SetDynamicRangeCompression(long drc) { m_dvdPlayerAudio.SetDynamicRangeCompression(drc); } - virtual void GetAudioInfo(CStdString& strAudioInfo); -diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp -index e4ba610..fe77363 100644 ---- a/xbmc/cores/paplayer/PAPlayer.cpp -+++ b/xbmc/cores/paplayer/PAPlayer.cpp -@@ -759,6 +759,7 @@ void PAPlayer::OnExit() - void PAPlayer::RegisterAudioCallback(IAudioCallback* pCallback) - { - CSharedLock lock(m_streamsLock); -+ CAEFactory::RegisterAudioCallback(pCallback); - m_audioCallback = pCallback; - if (m_currentStream && m_currentStream->m_stream) - m_currentStream->m_stream->RegisterAudioCallback(pCallback); -@@ -767,6 +768,7 @@ void PAPlayer::RegisterAudioCallback(IAudioCallback* pCallback) - void PAPlayer::UnRegisterAudioCallback() - { - CSharedLock lock(m_streamsLock); -+ CAEFactory::UnregisterAudioCallback(); - /* only one stream should have the callback, but we do it to all just incase */ - for(StreamList::iterator itt = m_streams.begin(); itt != m_streams.end(); ++itt) - if ((*itt)->m_stream) --- -1.8.1.6 - - -From 8ae0ba4f8e2d00c3dbf7362bfb22b6a8ee0befd7 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Mon, 1 Jul 2013 13:52:29 +0200 -Subject: [PATCH 012/136] AE: add parameter wait to drain, dvdplayer wants to - wait for the stream to be drained, papayer does not - ---- - xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.cpp | 2 +- - xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.h | 2 +- - xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.cpp | 2 +- - xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.h | 2 +- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp | 2 +- - xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h | 2 +- - xbmc/cores/AudioEngine/Interfaces/AEStream.h | 2 +- - xbmc/cores/dvdplayer/DVDAudio.cpp | 2 +- - xbmc/cores/paplayer/PAPlayer.cpp | 2 +- - 9 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.cpp b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.cpp -index a9422f7..073769a 100644 ---- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.cpp -+++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.cpp -@@ -603,7 +603,7 @@ void CCoreAudioAEStream::Resume() - m_paused = false; - } - --void CCoreAudioAEStream::Drain() -+void CCoreAudioAEStream::Drain(bool wait) - { - m_draining = true; - } -diff --git a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.h b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.h -index 18c52ed..1366808 100644 ---- a/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.h -+++ b/xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.h -@@ -73,7 +73,7 @@ class CCoreAudioAEStream : public IAEStream, public ICoreAudioSource - - virtual void Pause(); - virtual void Resume(); -- virtual void Drain(); -+ virtual void Drain(bool wait); - virtual void Flush(); - - virtual float GetVolume(); -diff --git a/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.cpp b/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.cpp -index 443c844..e1e1903 100644 ---- a/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.cpp -+++ b/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.cpp -@@ -386,7 +386,7 @@ void CPulseAEStream::Resume() - m_Paused = Cork(false); - } - --void CPulseAEStream::Drain() -+void CPulseAEStream::Drain(bool wait) - { - if (!m_Initialized) - return; -diff --git a/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.h b/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.h -index 51aeda8..8d9435b 100644 ---- a/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.h -+++ b/xbmc/cores/AudioEngine/Engines/PulseAE/PulseAEStream.h -@@ -48,7 +48,7 @@ class CPulseAEStream : public IAEStream - - virtual void Pause (); - virtual void Resume (); -- virtual void Drain (); -+ virtual void Drain (bool wait); - virtual void Flush (); - - virtual float GetVolume (); -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -index 05ee1b0..b5c2da3 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp -@@ -555,7 +555,7 @@ void CSoftAEStream::Resume() - AE.ResumeStream(this); - } - --void CSoftAEStream::Drain() -+void CSoftAEStream::Drain(bool wait) - { - CSingleLock lock(m_lock); - m_draining = true; -diff --git a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -index f7410e3..1475c83 100644 ---- a/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -+++ b/xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.h -@@ -59,7 +59,7 @@ class CSoftAEStream : public IAEStream - - virtual void Pause (); - virtual void Resume (); -- virtual void Drain (); -+ virtual void Drain (bool wait); - virtual bool IsDraining () { return m_draining; } - virtual bool IsDrained (); - virtual void Flush (); -diff --git a/xbmc/cores/AudioEngine/Interfaces/AEStream.h b/xbmc/cores/AudioEngine/Interfaces/AEStream.h -index 67fa5e2..92d5fef 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AEStream.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AEStream.h -@@ -97,7 +97,7 @@ class IAEStream - * Start draining the stream - * @note Once called AddData will not consume more data. - */ -- virtual void Drain() = 0; -+ virtual void Drain(bool wait) = 0; - - /** - * Returns true if the is stream draining -diff --git a/xbmc/cores/dvdplayer/DVDAudio.cpp b/xbmc/cores/dvdplayer/DVDAudio.cpp -index c37d4c5..6404433 100644 ---- a/xbmc/cores/dvdplayer/DVDAudio.cpp -+++ b/xbmc/cores/dvdplayer/DVDAudio.cpp -@@ -298,7 +298,7 @@ void CDVDAudio::Drain() - Finish(); - CSingleLock lock (m_critSection); - if (m_pAudioStream) -- m_pAudioStream->Drain(); -+ m_pAudioStream->Drain(true); - } - - void CDVDAudio::RegisterAudioCallback(IAudioCallback* pCallback) -diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp -index fe77363..555d51e 100644 ---- a/xbmc/cores/paplayer/PAPlayer.cpp -+++ b/xbmc/cores/paplayer/PAPlayer.cpp -@@ -610,7 +610,7 @@ inline void PAPlayer::ProcessStreams(double &delay, double &buffer) - /* unregister the audio callback */ - si->m_stream->UnRegisterAudioCallback(); - si->m_decoder.Destroy(); -- si->m_stream->Drain(); -+ si->m_stream->Drain(false); - m_finishing.push_back(si); - return; - } --- -1.8.1.6 - - -From 2daf7828c64b2b5d1c1599660fc31d1e1a376420 Mon Sep 17 00:00:00 2001 -From: xbmc -Date: Mon, 25 Mar 2013 13:58:11 +0100 -Subject: [PATCH 013/136] ActiveAE: add new audio engine, co-author: fritsch - ---- - xbmc/cores/AudioEngine/AEFactory.cpp | 3 + - xbmc/cores/AudioEngine/AEFactory.h | 3 +- - .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 2270 ++++++++++++++++++++ - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 334 +++ - .../Engines/ActiveAE/ActiveAEBuffer.cpp | 365 ++++ - .../AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h | 110 + - .../Engines/ActiveAE/ActiveAEResample.cpp | 250 +++ - .../Engines/ActiveAE/ActiveAEResample.h | 61 + - .../AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 864 ++++++++ - .../AudioEngine/Engines/ActiveAE/ActiveAESink.h | 138 ++ - .../AudioEngine/Engines/ActiveAE/ActiveAESound.cpp | 161 ++ - .../AudioEngine/Engines/ActiveAE/ActiveAESound.h | 73 + - .../Engines/ActiveAE/ActiveAEStream.cpp | 362 ++++ - .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 117 + - xbmc/cores/AudioEngine/Makefile.in | 7 + - xbmc/utils/ActorProtocol.cpp | 253 +++ - xbmc/utils/ActorProtocol.h | 87 + - xbmc/utils/Makefile.in | 1 + - 18 files changed, 5458 insertions(+), 1 deletion(-) - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.cpp - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp - create mode 100644 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h - create mode 100644 xbmc/utils/ActorProtocol.cpp - create mode 100644 xbmc/utils/ActorProtocol.h - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 0befba9..4f9f566 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -27,6 +27,8 @@ - #include "settings/SettingsManager.h" - #else - #include "Engines/SoftAE/SoftAE.h" -+ #include "Engines/ActiveAE/ActiveAE.h" -+ using namespace ActiveAE; - #endif - - #if defined(HAS_PULSEAUDIO) -@@ -99,6 +101,7 @@ bool CAEFactory::LoadEngine(enum AEEngine engine) - case AE_ENGINE_COREAUDIO: AE = new CCoreAudioAE(); break; - #else - case AE_ENGINE_SOFT : AE = new CSoftAE(); break; -+ case AE_ENGINE_ACTIVE : AE = new CActiveAE(); break; - #endif - #if defined(HAS_PULSEAUDIO) - case AE_ENGINE_PULSE : AE = new CPulseAE(); break; -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index 9e15f79..3059001 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -31,7 +31,8 @@ enum AEEngine - AE_ENGINE_NULL, - AE_ENGINE_SOFT, - AE_ENGINE_COREAUDIO, -- AE_ENGINE_PULSE -+ AE_ENGINE_PULSE, -+ AE_ENGINE_ACTIVE - }; - - class CAEFactory -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -new file mode 100644 -index 0000000..2defd1d ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -0,0 +1,2270 @@ -+/* -+ * 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 "ActiveAE.h" -+ -+using namespace ActiveAE; -+#include "ActiveAESound.h" -+#include "ActiveAEStream.h" -+#include "Utils/AEUtil.h" -+#include "Encoders/AEEncoderFFmpeg.h" -+ -+#include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" -+#include "windowing/WindowingFactory.h" -+ -+#define MAX_CACHE_LEVEL 0.5 // total cache time of stream in seconds -+#define MAX_WATER_LEVEL 0.25 // buffered time after stream stages in seconds -+ -+void CEngineStats::Reset(unsigned int sampleRate) -+{ -+ CSingleLock lock(m_lock); -+ m_sinkUpdate = XbmcThreads::SystemClockMillis(); -+ m_sinkDelay = 0; -+ m_sinkSampleRate = sampleRate; -+ m_bufferedSamples = 0; -+ m_suspended = false; -+} -+ -+void CEngineStats::UpdateSinkDelay(double delay, int samples) -+{ -+ CSingleLock lock(m_lock); -+ m_sinkUpdate = XbmcThreads::SystemClockMillis(); -+ m_sinkDelay = delay; -+ if (samples > m_bufferedSamples) -+ { -+ CLog::Log(LOGERROR, "CEngineStats::UpdateSinkDelay - inconsistency in buffer time"); -+ } -+ else -+ m_bufferedSamples -= samples; -+} -+ -+void CEngineStats::AddSamples(int samples, std::list &streams) -+{ -+ CSingleLock lock(m_lock); -+ m_bufferedSamples += samples; -+ -+ //update buffered time of streams -+ std::list::iterator it; -+ for(it=streams.begin(); it!=streams.end(); ++it) -+ { -+ float delay = 0; -+ std::deque::iterator itBuf; -+ for(itBuf=(*it)->m_processingSamples.begin(); itBuf!=(*it)->m_processingSamples.end(); ++itBuf) -+ { -+ delay += (float)(*itBuf)->pkt->nb_samples / (*itBuf)->pkt->config.sample_rate; -+ } -+ delay += (*it)->m_resampleBuffers->GetDelay(); -+ (*it)->m_bufferedTime = delay; -+ } -+} -+ -+float CEngineStats::GetDelay() -+{ -+ CSingleLock lock(m_lock); -+ unsigned int now = XbmcThreads::SystemClockMillis(); -+ float delay = m_sinkDelay - (double)(now-m_sinkUpdate) / 1000; -+ delay += (float)m_bufferedSamples / m_sinkSampleRate; -+ -+ return delay; -+} -+ -+float CEngineStats::GetDelay(CActiveAEStream *stream) -+{ -+ CSingleLock lock(m_lock); -+ unsigned int now = XbmcThreads::SystemClockMillis(); -+ float delay = m_sinkDelay - (double)(now-m_sinkUpdate) / 1000; -+ delay += (float)m_bufferedSamples / m_sinkSampleRate; -+ -+ delay += stream->m_bufferedTime; -+ return delay; -+} -+ -+float CEngineStats::GetCacheTime(CActiveAEStream *stream) -+{ -+ CSingleLock lock(m_lock); -+ float delay = (float)m_bufferedSamples / m_sinkSampleRate; -+ -+ delay += stream->m_bufferedTime; -+ return delay; -+} -+ -+float CEngineStats::GetCacheTotal(CActiveAEStream *stream) -+{ -+ return MAX_CACHE_LEVEL + m_sinkCacheTotal; -+} -+ -+float CEngineStats::GetWaterLevel() -+{ -+ return (float)m_bufferedSamples / m_sinkSampleRate; -+} -+ -+void CEngineStats::SetSuspended(bool state) -+{ -+ CSingleLock lock(m_lock); -+ m_suspended = state; -+} -+ -+bool CEngineStats::IsSuspended() -+{ -+ CSingleLock lock(m_lock); -+ return m_suspended; -+} -+ -+CActiveAE::CActiveAE() : -+ CThread("ActiveAE"), -+ m_controlPort("OutputControlPort", &m_inMsgEvent, &m_outMsgEvent), -+ m_dataPort("OutputDataPort", &m_inMsgEvent, &m_outMsgEvent), -+ m_sink(&m_outMsgEvent) -+{ -+ m_sinkBuffers = NULL; -+ m_silenceBuffers = NULL; -+ m_encoderBuffers = NULL; -+ m_vizBuffers = NULL; -+ m_volume = 1.0; -+ m_aeVolume = 1.0; -+ m_muted = false; -+ m_aeMuted = false; -+ m_mode = MODE_PCM; -+ m_encoder = NULL; -+ m_audioCallback = NULL; -+ m_vizInitialized = false; -+ m_sinkHasVolume = false; -+} -+ -+CActiveAE::~CActiveAE() -+{ -+ Dispose(); -+} -+ -+void CActiveAE::Dispose() -+{ -+#if defined(HAS_GLX) || defined(TARGET_DARWIN_OSX) -+ g_Windowing.Unregister(this); -+#endif -+ -+ m_bStop = true; -+ m_outMsgEvent.Set(); -+ StopThread(); -+ m_controlPort.Purge(); -+ m_dataPort.Purge(); -+ m_sink.Dispose(); -+ -+ m_dllAvFormat.Unload(); -+ m_dllAvCodec.Unload(); -+ m_dllAvUtil.Unload(); -+} -+ -+//----------------------------------------------------------------------------- -+// Behavior -+//----------------------------------------------------------------------------- -+ -+enum AE_STATES -+{ -+ AE_TOP = 0, // 0 -+ AE_TOP_ERROR, // 1 -+ AE_TOP_UNCONFIGURED, // 2 -+ AE_TOP_RECONFIGURING, // 3 -+ AE_TOP_CONFIGURED, // 4 -+ AE_TOP_CONFIGURED_SUSPEND, // 5 -+ AE_TOP_CONFIGURED_IDLE, // 6 -+ AE_TOP_CONFIGURED_PLAY, // 7 -+}; -+ -+int AE_parentStates[] = { -+ -1, -+ 0, //TOP_ERROR -+ 0, //TOP_UNCONFIGURED -+ 0, //TOP_CONFIGURED -+ 0, //TOP_RECONFIGURING -+ 4, //TOP_CONFIGURED_SUSPEND -+ 4, //TOP_CONFIGURED_IDLE -+ 4, //TOP_CONFIGURED_PLAY -+}; -+ -+void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) -+{ -+ for (int state = m_state; ; state = AE_parentStates[state]) -+ { -+ switch (state) -+ { -+ case AE_TOP: // TOP -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::GETSTATE: -+ msg->Reply(CActiveAEControlProtocol::ACC, &m_state, sizeof(m_state)); -+ return; -+ case CActiveAEControlProtocol::SOUNDMODE: -+ m_soundMode = *(int*)msg->data; -+ return; -+ case CActiveAEControlProtocol::VOLUME: -+ m_volume = *(float*)msg->data; -+ if (m_sinkHasVolume) -+ m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::VOLUME, &m_volume, sizeof(float)); -+ return; -+ case CActiveAEControlProtocol::MUTE: -+ m_muted = *(bool*)msg->data; -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CActiveAEDataProtocol::NEWSOUND: -+ CActiveAESound *sound; -+ sound = *(CActiveAESound**)msg->data; -+ if (sound) -+ { -+ m_sounds.push_back(sound); -+ ResampleSounds(); -+ } -+ return; -+ case CActiveAEDataProtocol::FREESTREAM: -+ CActiveAEStream *stream; -+ stream = *(CActiveAEStream**)msg->data; -+ DiscardStream(stream); -+ return; -+ case CActiveAEDataProtocol::FREESOUND: -+ sound = *(CActiveAESound**)msg->data; -+ DiscardSound(sound); -+ return; -+ case CActiveAEDataProtocol::DRAINSTREAM: -+ stream = *(CActiveAEStream**)msg->data; -+ stream->m_drain = true; -+ stream->m_resampleBuffers->m_drain = true; -+ msg->Reply(CActiveAEDataProtocol::ACC); -+ stream->m_streamPort->SendInMessage(CActiveAEDataProtocol::STREAMDRAINED); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (&m_sink.m_dataPort) -+ { -+ switch (signal) -+ { -+ case CSinkDataProtocol::RETURNSAMPLE: -+ CSampleBuffer **buffer; -+ buffer = (CSampleBuffer**)msg->data; -+ if (buffer) -+ { -+ (*buffer)->Return(); -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ { -+ std::string portName = port == NULL ? "timer" : port->portName; -+ CLog::Log(LOGWARNING, "CActiveAE::%s - signal: %d from port: %s not handled for state: %d", __FUNCTION__, signal, portName.c_str(), m_state); -+ } -+ return; -+ -+ case AE_TOP_ERROR: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::TIMEOUT: -+ m_extError = false; -+ LoadSettings(); -+ Configure(); -+ if (!m_extError) -+ { -+ m_state = AE_TOP_CONFIGURED_IDLE; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_state = AE_TOP_ERROR; -+ m_extTimeout = 500; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case AE_TOP_UNCONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::INIT: -+ m_extError = false; -+ m_sink.EnumerateSinkList(); -+ LoadSettings(); -+ Configure(); -+ msg->Reply(CActiveAEControlProtocol::ACC); -+ if (!m_extError) -+ { -+ m_state = AE_TOP_CONFIGURED_IDLE; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_state = AE_TOP_ERROR; -+ m_extTimeout = 500; -+ } -+ return; -+ -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case AE_TOP_RECONFIGURING: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::TIMEOUT: -+ // drain -+ if (RunStages()) -+ { -+ m_extTimeout = 0; -+ return; -+ } -+ if (!m_sinkBuffers->m_inputSamples.empty() || !m_sinkBuffers->m_outputSamples.empty()) -+ { -+ m_extTimeout = 100; -+ return; -+ } -+ if (NeedReconfigureSink()) -+ DrainSink(); -+ -+ if (!m_extError) -+ Configure(); -+ if (!m_extError) -+ { -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_state = AE_TOP_ERROR; -+ m_extTimeout = 500; -+ } -+ m_extDeferData = false; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case AE_TOP_CONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::RECONFIGURE: -+ LoadSettings(); -+ if (!NeedReconfigureBuffers() && !NeedReconfigureSink()) -+ return; -+ m_state = AE_TOP_RECONFIGURING; -+ m_extTimeout = 0; -+ // don't accept any data until we are reconfigured -+ m_extDeferData = true; -+ return; -+ case CActiveAEControlProtocol::SUSPEND: -+ UnconfigureSink(); -+ m_stats.SetSuspended(true); -+ m_state = AE_TOP_CONFIGURED_SUSPEND; -+ m_extDeferData = true; -+ return; -+ case CActiveAEControlProtocol::DISPLAYLOST: -+ if (m_settings.mode == AUDIO_HDMI) -+ { -+ UnconfigureSink(); -+ m_stats.SetSuspended(true); -+ m_state = AE_TOP_CONFIGURED_SUSPEND; -+ m_extDeferData = true; -+ } -+ return; -+ case CActiveAEControlProtocol::PAUSESTREAM: -+ CActiveAEStream *stream; -+ stream = *(CActiveAEStream**)msg->data; -+ stream->m_paused = true; -+ return; -+ case CActiveAEControlProtocol::RESUMESTREAM: -+ stream = *(CActiveAEStream**)msg->data; -+ stream->m_paused = false; -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ m_extTimeout = 0; -+ return; -+ case CActiveAEControlProtocol::STREAMAMP: -+ MsgStreamParameter *par; -+ par = (MsgStreamParameter*)msg->data; -+ par->stream->m_limiter.SetAmplification(par->parameter.float_par); -+ return; -+ case CActiveAEControlProtocol::STREAMVOLUME: -+ par = (MsgStreamParameter*)msg->data; -+ par->stream->m_volume = par->parameter.float_par; -+ return; -+ case CActiveAEControlProtocol::STREAMRGAIN: -+ par = (MsgStreamParameter*)msg->data; -+ par->stream->m_rgain = par->parameter.float_par; -+ return; -+ case CActiveAEControlProtocol::STREAMRESAMPLERATIO: -+ par = (MsgStreamParameter*)msg->data; -+ if (par->stream->m_resampleBuffers) -+ { -+ par->stream->m_resampleBuffers->m_resampleRatio = par->parameter.double_par; -+ par->stream->m_resampleBuffers->m_changeRatio = true; -+ } -+ return; -+ case CActiveAEControlProtocol::STREAMFADE: -+ MsgStreamFade *fade; -+ fade = (MsgStreamFade*)msg->data; -+ fade->stream->m_fadingBase = fade->from; -+ fade->stream->m_fadingTarget = fade->target; -+ fade->stream->m_fadingTime = fade->millis; -+ fade->stream->m_fadingSamples = -1; -+ return; -+ case CActiveAEControlProtocol::STOPSOUND: -+ CActiveAESound *sound; -+ sound = *(CActiveAESound**)msg->data; -+ SStopSound(sound); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CActiveAEDataProtocol::PLAYSOUND: -+ CActiveAESound *sound; -+ sound = *(CActiveAESound**)msg->data; -+ if (m_soundMode == AE_SOUND_OFF || -+ (m_soundMode == AE_SOUND_IDLE && !m_streams.empty())) -+ return; -+ if (sound) -+ { -+ SoundState st = {sound, 0}; -+ m_sounds_playing.push_back(st); -+ m_extTimeout = 0; -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ } -+ return; -+ case CActiveAEDataProtocol::NEWSTREAM: -+ MsgStreamNew *streamMsg; -+ CActiveAEStream *stream; -+ streamMsg = (MsgStreamNew*)msg->data; -+ stream = CreateStream(streamMsg); -+ if(stream) -+ { -+ msg->Reply(CActiveAEDataProtocol::ACC, &stream, sizeof(CActiveAEStream*)); -+ Configure(); -+ if (!m_extError) -+ { -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_state = AE_TOP_ERROR; -+ m_extTimeout = 500; -+ } -+ } -+ else -+ msg->Reply(CActiveAEDataProtocol::ERR); -+ return; -+ case CActiveAEDataProtocol::STREAMSAMPLE: -+ MsgStreamSample *msgData; -+ CSampleBuffer *samples; -+ msgData = (MsgStreamSample*)msg->data; -+ samples = msgData->stream->m_processingSamples.front(); -+ msgData->stream->m_processingSamples.pop_front(); -+ if (samples != msgData->buffer) -+ CLog::Log(LOGERROR, "CActiveAE - inconsistency in stream sample message"); -+ if (msgData->buffer->pkt->nb_samples == 0) -+ msgData->buffer->Return(); -+ else -+ msgData->stream->m_resampleBuffers->m_inputSamples.push_back(msgData->buffer); -+ m_extTimeout = 0; -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ return; -+ case CActiveAEDataProtocol::FREESTREAM: -+ stream = *(CActiveAEStream**)msg->data; -+ DiscardStream(stream); -+ if (m_streams.empty()) -+ { -+ m_extDrainTimer.Set(m_stats.GetDelay() * 1000); -+ m_extDrain = true; -+ } -+ m_extTimeout = 0; -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ return; -+ case CActiveAEDataProtocol::DRAINSTREAM: -+ stream = *(CActiveAEStream**)msg->data; -+ stream->m_drain = true; -+ stream->m_resampleBuffers->m_drain = true; -+ m_extTimeout = 0; -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ msg->Reply(CActiveAEDataProtocol::ACC); -+ return; -+ case CActiveAEDataProtocol::FLUSHSTREAM: -+ stream = *(CActiveAEStream**)msg->data; -+ SFlushStream(stream); -+ msg->Reply(CActiveAEDataProtocol::ACC); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (&m_sink.m_dataPort) -+ { -+ switch (signal) -+ { -+ case CSinkDataProtocol::RETURNSAMPLE: -+ CSampleBuffer **buffer; -+ buffer = (CSampleBuffer**)msg->data; -+ if (buffer) -+ { -+ (*buffer)->Return(); -+ } -+ m_extTimeout = 0; -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case AE_TOP_CONFIGURED_SUSPEND: -+ if (port == &m_controlPort) -+ { -+ bool displayReset = false; -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::DISPLAYRESET: -+ displayReset = true; -+ case CActiveAEControlProtocol::INIT: -+ m_extError = false; -+ if (!displayReset) -+ { -+ m_sink.EnumerateSinkList(); -+ LoadSettings(); -+ } -+ Configure(); -+ if (!displayReset) -+ msg->Reply(CActiveAEControlProtocol::ACC); -+ if (!m_extError) -+ { -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_state = AE_TOP_ERROR; -+ m_extTimeout = 500; -+ } -+ m_stats.SetSuspended(false); -+ m_extDeferData = false; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case AE_TOP_CONFIGURED_IDLE: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::TIMEOUT: -+ ResampleSounds(); -+ ClearDiscardedBuffers(); -+ if (m_extDrain) -+ { -+ if (m_extDrainTimer.IsTimePast()) -+ { -+ Configure(); -+ if (!m_extError) -+ { -+ m_state = AE_TOP_CONFIGURED_PLAY; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_state = AE_TOP_ERROR; -+ m_extTimeout = 500; -+ } -+ } -+ else -+ m_extTimeout = m_extDrainTimer.MillisLeft(); -+ } -+ else -+ m_extTimeout = 5000; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case AE_TOP_CONFIGURED_PLAY: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CActiveAEControlProtocol::TIMEOUT: -+ if (RunStages()) -+ { -+ m_extTimeout = 0; -+ return; -+ } -+ if (!m_extDrain && HasWork()) -+ { -+ ResampleSounds(); -+ ClearDiscardedBuffers(); -+ m_extTimeout = 100; -+ return; -+ } -+ m_extTimeout = 0; -+ m_state = AE_TOP_CONFIGURED_IDLE; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ default: // we are in no state, should not happen -+ CLog::Log(LOGERROR, "CActiveAE::%s - no valid state: %d", __FUNCTION__, m_state); -+ return; -+ } -+ } // for -+} -+ -+void CActiveAE::Process() -+{ -+ Message *msg = NULL; -+ Protocol *port = NULL; -+ bool gotMsg; -+ bool deferData; -+ -+ m_state = AE_TOP_UNCONFIGURED; -+ m_extTimeout = 1000; -+ m_bStateMachineSelfTrigger = false; -+ m_extDrain = false; -+ m_extDeferData = false; -+ -+ // start sink -+ m_sink.Start(); -+ -+ while (!m_bStop) -+ { -+ gotMsg = false; -+ -+ if (m_bStateMachineSelfTrigger) -+ { -+ m_bStateMachineSelfTrigger = false; -+ // self trigger state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ // check control port -+ else if (m_controlPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_controlPort; -+ } -+ // check sink data port -+ else if (m_sink.m_dataPort.ReceiveInMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_sink.m_dataPort; -+ } -+ else if (!m_extDeferData) -+ { -+ // check data port -+ if (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_dataPort; -+ } -+ // stream data ports -+ else -+ { -+ std::list::iterator it; -+ for(it=m_streams.begin(); it!=m_streams.end(); ++it) -+ { -+ if((*it)->m_streamPort->ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_dataPort; -+ break; -+ } -+ } -+ } -+ } -+ -+ if (gotMsg) -+ { -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ -+ // wait for message -+ else if (m_outMsgEvent.WaitMSec(m_extTimeout)) -+ { -+ continue; -+ } -+ // time out -+ else -+ { -+ msg = m_controlPort.GetMessage(); -+ msg->signal = CActiveAEControlProtocol::TIMEOUT; -+ port = 0; -+ // signal timeout to state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ } -+ } -+} -+ -+void CActiveAE::Configure(AEAudioFormat *desiredFmt) -+{ -+ bool initSink = false; -+ AEAudioFormat sinkInputFormat, inputFormat; -+ m_mode = MODE_PCM; -+ -+ if (m_streams.empty()) -+ { -+ inputFormat.m_dataFormat = AE_FMT_FLOAT; -+ inputFormat.m_sampleRate = 44100; -+ inputFormat.m_encodedRate = 0; -+ inputFormat.m_channelLayout = AE_CH_LAYOUT_2_0; -+ inputFormat.m_frames = 0; -+ inputFormat.m_frameSamples = 0; -+ inputFormat.m_frameSize = 0; -+ UnregisterAudioCallback(); -+ } -+ // force input format after unpausing slave -+ else if (desiredFmt != NULL) -+ { -+ inputFormat = *desiredFmt; -+ } -+ // keep format when having multiple streams -+ else if (m_streams.size() > 1 && m_silenceBuffers == NULL) -+ { -+ inputFormat = m_sinkRequestFormat; -+ } -+ else -+ { -+ inputFormat = m_streams.front()->m_format; -+ } -+ -+ m_sinkRequestFormat = inputFormat; -+ ApplySettingsToFormat(m_sinkRequestFormat, m_settings, true); -+ std::string device = AE_IS_RAW(m_sinkRequestFormat.m_dataFormat) ? m_settings.passthoughdevice : m_settings.device; -+ std::string driver; -+ CAESinkFactory::ParseDevice(device, driver); -+ if (!m_sink.IsCompatible(m_sinkRequestFormat, device) || m_settings.driver.compare(driver) != 0) -+ { -+ if (!InitSink()) -+ return; -+ m_settings.driver = driver; -+ initSink = true; -+ m_stats.Reset(m_sinkFormat.m_sampleRate); -+ m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::VOLUME, &m_volume, sizeof(float)); -+ } -+ -+ if (m_silenceBuffers) -+ { -+ m_discardBufferPools.push_back(m_silenceBuffers); -+ m_silenceBuffers = NULL; -+ } -+ -+ // buffers for driving gui sounds if no streams are active -+ if (m_streams.empty()) -+ { -+ inputFormat = m_sinkFormat; -+ inputFormat.m_dataFormat = AE_FMT_FLOAT; -+ inputFormat.m_frameSize = inputFormat.m_channelLayout.Count() * -+ (CAEUtil::DataFormatToBits(inputFormat.m_dataFormat) >> 3); -+ m_silenceBuffers = new CActiveAEBufferPool(inputFormat); -+ m_silenceBuffers->Create(MAX_WATER_LEVEL*1000); -+ sinkInputFormat = inputFormat; -+ m_internalFormat = inputFormat; -+ -+ bool silence = false; -+ m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::SILENCEMODE, &silence, sizeof(bool)); -+ -+ delete m_encoder; -+ m_encoder = NULL; -+ -+ if (m_encoderBuffers) -+ { -+ m_discardBufferPools.push_back(m_encoderBuffers); -+ m_encoderBuffers = NULL; -+ } -+ if (m_vizBuffers) -+ { -+ m_discardBufferPools.push_back(m_vizBuffers); -+ m_vizBuffers = NULL; -+ } -+ } -+ // resample buffers for streams -+ else -+ { -+ bool silence = true; -+ m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::SILENCEMODE, &silence, sizeof(bool)); -+ -+ AEAudioFormat outputFormat; -+ if (m_mode == MODE_RAW) -+ { -+ outputFormat = inputFormat; -+ sinkInputFormat = m_sinkFormat; -+ } -+ // transcode everything with more than 2 channels -+ else if (m_mode == MODE_TRANSCODE) -+ { -+ outputFormat = inputFormat; -+ outputFormat.m_dataFormat = AE_FMT_FLOATP; -+ -+ if (g_advancedSettings.m_audioResample) -+ { -+ outputFormat.m_sampleRate = g_advancedSettings.m_audioResample; -+ CLog::Log(LOGINFO, "CActiveAE::Configure - Forcing samplerate to %d", inputFormat.m_sampleRate); -+ } -+ -+ // setup encoder -+ if (!m_encoder) -+ { -+ m_encoder = new CAEEncoderFFmpeg(); -+ m_encoder->Initialize(outputFormat, true); -+ m_encoderFormat = outputFormat; -+ } -+ else -+ outputFormat = m_encoderFormat; -+ -+ outputFormat.m_channelLayout = m_encoderFormat.m_channelLayout; -+ outputFormat.m_frames = m_encoderFormat.m_frames; -+ -+ // encoder buffer -+ if (m_encoder->GetCodecID() == CODEC_ID_AC3) -+ { -+ AEAudioFormat format; -+ format.m_channelLayout = AE_CH_LAYOUT_2_0; -+ format.m_dataFormat = AE_FMT_S16NE; -+ format.m_frameSize = 2* (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3); -+ format.m_frames = AC3_FRAME_SIZE; -+ format.m_sampleRate = 48000; -+ if (m_encoderBuffers && initSink) -+ { -+ m_discardBufferPools.push_back(m_encoderBuffers); -+ m_encoderBuffers = NULL; -+ } -+ if (!m_encoderBuffers) -+ { -+ m_encoderBuffers = new CActiveAEBufferPool(format); -+ m_encoderBuffers->Create(MAX_WATER_LEVEL*1000); -+ } -+ } -+ -+ sinkInputFormat = m_sinkFormat; -+ } -+ else -+ { -+ outputFormat = m_sinkFormat; -+ outputFormat.m_channelLayout = m_sinkRequestFormat.m_channelLayout; -+ outputFormat.m_channelLayout.ResolveChannels(m_sinkFormat.m_channelLayout); -+ outputFormat.m_dataFormat = AE_FMT_FLOAT; -+ outputFormat.m_frameSize = outputFormat.m_channelLayout.Count() * -+ (CAEUtil::DataFormatToBits(outputFormat.m_dataFormat) >> 3); -+ // TODO: adjust to decoder -+ sinkInputFormat = outputFormat; -+ } -+ m_internalFormat = outputFormat; -+ -+ std::list::iterator it; -+ for(it=m_streams.begin(); it!=m_streams.end(); ++it) -+ { -+ // check if we support input format of stream -+ if (!AE_IS_RAW((*it)->m_format.m_dataFormat) && -+ CActiveAEResample::GetAVSampleFormat((*it)->m_format.m_dataFormat) == AV_SAMPLE_FMT_FLT && -+ (*it)->m_format.m_dataFormat != AE_FMT_FLOAT) -+ { -+ (*it)->m_convertFn = CAEConvert::ToFloat((*it)->m_format.m_dataFormat); -+ (*it)->m_format.m_dataFormat = AE_FMT_FLOAT; -+ } -+ -+ if (!(*it)->m_inputBuffers) -+ { -+ // align input buffers with period of sink or encoder -+ (*it)->m_format.m_frames = m_internalFormat.m_frames * ((float)(*it)->m_format.m_sampleRate / m_internalFormat.m_sampleRate); -+ -+ // create buffer pool -+ (*it)->m_inputBuffers = new CActiveAEBufferPool((*it)->m_format); -+ (*it)->m_inputBuffers->Create(MAX_CACHE_LEVEL*1000); -+ } -+ if (initSink && (*it)->m_resampleBuffers) -+ { -+ m_discardBufferPools.push_back((*it)->m_resampleBuffers); -+ (*it)->m_resampleBuffers = NULL; -+ } -+ if (!(*it)->m_resampleBuffers) -+ { -+ (*it)->m_resampleBuffers = new CActiveAEBufferPoolResample((*it)->m_inputBuffers->m_format, outputFormat); -+ (*it)->m_resampleBuffers->Create(MAX_CACHE_LEVEL*1000, false); -+ } -+ if (m_mode == MODE_TRANSCODE || m_streams.size() > 1) -+ (*it)->m_resampleBuffers->m_fillPackets = true; -+ } -+ -+ // buffers for viz -+ if (!AE_IS_RAW(inputFormat.m_dataFormat)) -+ { -+ if (initSink && m_vizBuffers) -+ { -+ m_discardBufferPools.push_back(m_vizBuffers); -+ m_vizBuffers = NULL; -+ } -+ if (!m_vizBuffers) -+ { -+ AEAudioFormat vizFormat = m_internalFormat; -+ vizFormat.m_channelLayout = AE_CH_LAYOUT_2_0; -+ vizFormat.m_dataFormat = AE_FMT_FLOAT; -+ m_vizBuffers = new CActiveAEBufferPoolResample(m_internalFormat, vizFormat); -+ // TODO use cache of sync + water level -+ m_vizBuffers->Create(2000, false); -+ } -+ } -+ } -+ -+ // resample buffers for sink -+ if (m_sinkBuffers && !m_sink.IsCompatible(m_sinkBuffers->m_format, device)) -+ { -+ m_discardBufferPools.push_back(m_sinkBuffers); -+ m_sinkBuffers = NULL; -+ } -+ if (!m_sinkBuffers) -+ { -+ m_sinkBuffers = new CActiveAEBufferPoolResample(sinkInputFormat, m_sinkFormat); -+ m_sinkBuffers->Create(MAX_WATER_LEVEL*1000, true); -+ } -+ -+ // reset gui sounds -+ std::vector::iterator it; -+ for (it = m_sounds.begin(); it != m_sounds.end(); ++it) -+ { -+ (*it)->SetConverted(false); -+ } -+ -+ ClearDiscardedBuffers(); -+ m_extDrain = false; -+} -+ -+CActiveAEStream* CActiveAE::CreateStream(MsgStreamNew *streamMsg) -+{ -+ // we only can handle a single pass through stream -+ if (!m_streams.empty()) -+ { -+ if (AE_IS_RAW(m_streams.front()->m_format.m_dataFormat) || AE_IS_RAW(streamMsg->format.m_dataFormat)) -+ return NULL; -+ } -+ -+ // create the stream -+ CActiveAEStream *stream; -+ stream = new CActiveAEStream(&streamMsg->format); -+ stream->m_streamPort = new CActiveAEDataProtocol("stream", -+ &stream->m_inMsgEvent, &m_outMsgEvent); -+ -+ // create buffer pool -+ stream->m_inputBuffers = NULL; // create in Configure when we know the sink format -+ stream->m_resampleBuffers = NULL; // create in Configure when we know the sink format -+ stream->m_statsLock = m_stats.GetLock(); -+ stream->m_fadingSamples = 0; -+ stream->m_started = false; -+ -+ if (streamMsg->options & AESTREAM_PAUSED) -+ stream->m_paused = true; -+ -+ m_streams.push_back(stream); -+ -+ return stream; -+} -+ -+void CActiveAE::DiscardStream(CActiveAEStream *stream) -+{ -+ std::list::iterator it; -+ for (it=m_streams.begin(); it!=m_streams.end(); ) -+ { -+ if (stream == (*it)) -+ { -+ while (!(*it)->m_processingSamples.empty()) -+ { -+ (*it)->m_processingSamples.front()->Return(); -+ (*it)->m_processingSamples.pop_front(); -+ } -+ m_discardBufferPools.push_back((*it)->m_inputBuffers); -+ m_discardBufferPools.push_back((*it)->m_resampleBuffers); -+ CLog::Log(LOGDEBUG, "CActiveAE::DiscardStream - audio stream deleted"); -+ delete (*it)->m_streamPort; -+ delete (*it); -+ it = m_streams.erase(it); -+ } -+ else -+ ++it; -+ } -+ -+ ClearDiscardedBuffers(); -+} -+ -+void CActiveAE::SFlushStream(CActiveAEStream *stream) -+{ -+ while (!stream->m_processingSamples.empty()) -+ { -+ stream->m_processingSamples.front()->Return(); -+ stream->m_processingSamples.pop_front(); -+ } -+ stream->m_resampleBuffers->Flush(); -+ stream->m_streamPort->Purge(); -+ stream->m_bufferedTime = 0.0; -+ stream->m_paused = true; -+} -+ -+void CActiveAE::ClearDiscardedBuffers() -+{ -+ std::list::iterator it; -+ for (it=m_discardBufferPools.begin(); it!=m_discardBufferPools.end(); ++it) -+ { -+ CActiveAEBufferPoolResample *rbuf = dynamic_cast(*it); -+ if (rbuf) -+ { -+ rbuf->Flush(); -+ } -+ // if all buffers have returned, we can delete the buffer pool -+ if ((*it)->m_allSamples.size() == (*it)->m_freeSamples.size()) -+ { -+ delete (*it); -+ CLog::Log(LOGDEBUG, "CActiveAE::ClearDiscardedBuffers - buffer pool deleted"); -+ m_discardBufferPools.erase(it); -+ return; -+ } -+ } -+} -+ -+void CActiveAE::SStopSound(CActiveAESound *sound) -+{ -+ std::list::iterator it; -+ for (it=m_sounds_playing.begin(); it!=m_sounds_playing.end(); ++it) -+ { -+ if (it->sound == sound) -+ { -+ m_sounds_playing.erase(it); -+ return; -+ } -+ } -+} -+ -+void CActiveAE::DiscardSound(CActiveAESound *sound) -+{ -+ SStopSound(sound); -+ -+ std::vector::iterator it; -+ for (it=m_sounds.begin(); it!=m_sounds.end(); ++it) -+ { -+ if ((*it) == sound) -+ { -+ m_sounds.erase(it); -+ return; -+ } -+ } -+} -+ -+float CActiveAE::CalcStreamAmplification(CActiveAEStream *stream, CSampleBuffer *buf) -+{ -+ float amp = 1.0f; -+ int nb_floats = buf->pkt->nb_samples * buf->pkt->config.channels / buf->pkt->planes; -+ float tamp; -+ for(int i=0; ipkt->planes; i++) -+ { -+ tamp = stream->m_limiter.Run((float*)buf->pkt->data[i], nb_floats); -+ amp = std::min(amp, tamp); -+ } -+ return amp; -+} -+ -+void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &settings, bool setmode) -+{ -+ // raw pass through -+ if (m_settings.mode != AUDIO_ANALOG && AE_IS_RAW(format.m_dataFormat)) -+ { -+ if ((format.m_dataFormat == AE_FMT_AC3 && !settings.ac3passthrough) || -+ (format.m_dataFormat == AE_FMT_TRUEHD && !settings.truehdpassthrough) || -+ (format.m_dataFormat == AE_FMT_DTS && !settings.dtspassthrough) || -+ (format.m_dataFormat == AE_FMT_DTSHD && !settings.dtshdpassthrough)) -+ { -+ CLog::Log(LOGERROR, "CActiveAE::ApplySettingsToFormat - input audio format is wrong"); -+ } -+ if (setmode) -+ m_mode = MODE_RAW; -+ } -+ // transcode -+ else if (m_settings.mode != AUDIO_ANALOG && -+ settings.ac3passthrough && -+ (!settings.multichannellpcm || (m_settings.mode != AUDIO_HDMI)) && -+ !m_streams.empty() && -+ format.m_channelLayout.Count() > 2) -+ { -+ format.m_dataFormat = AE_FMT_AC3; -+ format.m_sampleRate = 48000; -+ if (setmode) -+ m_mode = MODE_TRANSCODE; -+ } -+ else -+ { -+ format.m_dataFormat = AE_FMT_FLOAT; -+ if ((format.m_channelLayout.Count() > 2) || settings.stereoupmix) -+ { -+ switch (settings.channels) -+ { -+ default: -+ case 0: format.m_channelLayout = AE_CH_LAYOUT_2_0; break; -+ case 1: format.m_channelLayout = AE_CH_LAYOUT_2_0; break; -+ case 2: format.m_channelLayout = AE_CH_LAYOUT_2_1; break; -+ case 3: format.m_channelLayout = AE_CH_LAYOUT_3_0; break; -+ case 4: format.m_channelLayout = AE_CH_LAYOUT_3_1; break; -+ case 5: format.m_channelLayout = AE_CH_LAYOUT_4_0; break; -+ case 6: format.m_channelLayout = AE_CH_LAYOUT_4_1; break; -+ case 7: format.m_channelLayout = AE_CH_LAYOUT_5_0; break; -+ case 8: format.m_channelLayout = AE_CH_LAYOUT_5_1; break; -+ case 9: format.m_channelLayout = AE_CH_LAYOUT_7_0; break; -+ case 10: format.m_channelLayout = AE_CH_LAYOUT_7_1; break; -+ } -+ } -+ -+ if (g_advancedSettings.m_audioResample) -+ { -+ format.m_sampleRate = g_advancedSettings.m_audioResample; -+ 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; -+ } -+ -+ CAEChannelInfo stdLayout = format.m_channelLayout; -+ format.m_channelLayout.ResolveChannels(stdLayout); -+ } -+} -+ -+bool CActiveAE::NeedReconfigureBuffers() -+{ -+ AEAudioFormat newFormat = m_sinkRequestFormat; -+ ApplySettingsToFormat(newFormat, m_settings); -+ -+ if (newFormat.m_dataFormat != m_sinkRequestFormat.m_dataFormat || -+ newFormat.m_channelLayout != m_sinkRequestFormat.m_channelLayout || -+ newFormat.m_sampleRate != m_sinkRequestFormat.m_sampleRate) -+ return true; -+ -+ return false; -+} -+ -+bool CActiveAE::NeedReconfigureSink() -+{ -+ AEAudioFormat newFormat = m_sinkRequestFormat; -+ ApplySettingsToFormat(newFormat, m_settings); -+ -+ std::string device = AE_IS_RAW(newFormat.m_dataFormat) ? m_settings.passthoughdevice : m_settings.device; -+ std::string driver; -+ CAESinkFactory::ParseDevice(device, driver); -+ if (m_settings.driver.compare(driver) != 0) -+ return true; -+ -+ if (!m_sink.IsCompatible(newFormat, device)) -+ return true; -+ -+ return false; -+} -+ -+bool CActiveAE::InitSink() -+{ -+ SinkConfig config; -+ config.format = m_sinkRequestFormat; -+ config.stats = &m_stats; -+ -+ // send message to sink -+ Message *reply; -+ if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::CONFIGURE, -+ &reply, -+ 5000, -+ &config, sizeof(config))) -+ { -+ bool success = reply->signal == CSinkControlProtocol::ACC ? true : false; -+ if (!success) -+ { -+ reply->Release(); -+ CLog::Log(LOGERROR, "ActiveAE::%s - returned error", __FUNCTION__); -+ m_extError = true; -+ return false; -+ } -+ AEAudioFormat *data; -+ data = (AEAudioFormat*)reply->data; -+ if (data) -+ { -+ m_sinkFormat = *data; -+ } -+ m_sinkHasVolume = m_sink.HasVolume(); -+ reply->Release(); -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - failed to init", __FUNCTION__); -+ m_extError = true; -+ return false; -+ } -+ -+ m_inMsgEvent.Reset(); -+ return true; -+} -+ -+void CActiveAE::DrainSink() -+{ -+ // send message to sink -+ Message *reply; -+ if (m_sink.m_dataPort.SendOutMessageSync(CSinkDataProtocol::DRAIN, -+ &reply, -+ 2000)) -+ { -+ bool success = reply->signal == CSinkDataProtocol::ACC ? true : false; -+ if (!success) -+ { -+ reply->Release(); -+ CLog::Log(LOGERROR, "ActiveAE::%s - returned error on drain", __FUNCTION__); -+ m_extError = true; -+ return; -+ } -+ reply->Release(); -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - failed to drain", __FUNCTION__); -+ m_extError = true; -+ return; -+ } -+} -+ -+void CActiveAE::UnconfigureSink() -+{ -+ // send message to sink -+ Message *reply; -+ if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::UNCONFIGURE, -+ &reply, -+ 2000)) -+ { -+ bool success = reply->signal == CSinkControlProtocol::ACC ? true : false; -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - returned error", __FUNCTION__); -+ m_extError = true; -+ } -+ reply->Release(); -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - failed to unconfigure", __FUNCTION__); -+ m_extError = true; -+ } -+ -+ m_inMsgEvent.Reset(); -+} -+ -+ -+bool CActiveAE::RunStages() -+{ -+ bool busy = false; -+ -+ // serve input streams -+ std::list::iterator it; -+ for (it = m_streams.begin(); it != m_streams.end(); ++it) -+ { -+ if ((*it)->m_resampleBuffers && !(*it)->m_paused) -+ busy = (*it)->m_resampleBuffers->ResampleBuffers(); -+ else if ((*it)->m_resampleBuffers && -+ ((*it)->m_resampleBuffers->m_inputSamples.size() > (*it)->m_resampleBuffers->m_allSamples.size() * 0.5)) -+ { -+ CSingleLock lock((*it)->m_streamLock); -+ (*it)->m_streamIsBuffering = false; -+ } -+ -+ // provide buffers to stream -+ float time = m_stats.GetCacheTime((*it)); -+ CSampleBuffer *buffer; -+ if (!(*it)->m_drain) -+ { -+ while (time < MAX_CACHE_LEVEL && !(*it)->m_inputBuffers->m_freeSamples.empty()) -+ { -+ buffer = (*it)->m_inputBuffers->GetFreeBuffer(); -+ (*it)->m_processingSamples.push_back(buffer); -+ (*it)->m_streamPort->SendInMessage(CActiveAEDataProtocol::STREAMBUFFER, &buffer, sizeof(CSampleBuffer*)); -+ (*it)->IncFreeBuffers(); -+ time += (float)buffer->pkt->max_nb_samples / buffer->pkt->config.sample_rate; -+ } -+ } -+ else -+ { -+ if ((*it)->m_inputBuffers->m_allSamples.size() == (*it)->m_inputBuffers->m_freeSamples.size()) -+ { -+ (*it)->m_streamPort->SendInMessage(CActiveAEDataProtocol::STREAMDRAINED); -+ (*it)->m_drain = false; -+ (*it)->m_resampleBuffers->m_drain = false; -+ (*it)->m_started = false; -+ -+ // set variables being polled via stream interface -+ CSingleLock lock((*it)->m_streamLock); -+ if ((*it)->m_streamSlave) -+ { -+ CActiveAEStream *slave = (CActiveAEStream*)((*it)->m_streamSlave); -+ slave->m_paused = false; -+ Configure(&slave->m_format); -+ (*it)->m_streamSlave = NULL; -+ } -+ (*it)->m_streamDrained = true; -+ (*it)->m_streamDraining = false; -+ } -+ } -+ } -+ -+ if (m_stats.GetWaterLevel() < MAX_WATER_LEVEL && -+ (m_mode != MODE_TRANSCODE || (m_encoderBuffers && !m_encoderBuffers->m_freeSamples.empty()))) -+ { -+ // mix streams and sounds sounds -+ if (m_mode != MODE_RAW) -+ { -+ CSampleBuffer *out = NULL; -+ if (!m_sounds_playing.empty() && m_streams.empty()) -+ { -+ if (m_silenceBuffers && !m_silenceBuffers->m_freeSamples.empty()) -+ { -+ out = m_silenceBuffers->GetFreeBuffer(); -+ for (int i=0; ipkt->planes; i++) -+ { -+ memset(out->pkt->data[i], 0, out->pkt->linesize); -+ } -+ out->pkt->nb_samples = out->pkt->max_nb_samples; -+ } -+ } -+ -+ // mix streams -+ std::list::iterator it; -+ -+ // if we deal with more than a single stream, all streams -+ // must provide samples for mixing -+ bool allStreamsReady = true; -+ for (it = m_streams.begin(); it != m_streams.end(); ++it) -+ { -+ if ((*it)->m_paused || !(*it)->m_started || !(*it)->m_resampleBuffers) -+ continue; -+ -+ if ((*it)->m_resampleBuffers->m_outputSamples.empty()) -+ allStreamsReady = false; -+ } -+ -+ for (it = m_streams.begin(); it != m_streams.end() && allStreamsReady; ++it) -+ { -+ if ((*it)->m_paused || !(*it)->m_resampleBuffers) -+ continue; -+ -+ if (!(*it)->m_resampleBuffers->m_outputSamples.empty()) -+ { -+ (*it)->m_started = true; -+ -+ if (!out) -+ { -+ out = (*it)->m_resampleBuffers->m_outputSamples.front(); -+ (*it)->m_resampleBuffers->m_outputSamples.pop_front(); -+ -+ // volume for stream -+ float amp = (*it)->m_rgain * CalcStreamAmplification((*it), out); -+ -+ int nb_floats = out->pkt->nb_samples * out->pkt->config.channels / out->pkt->planes; -+ int nb_loops = 1; -+ float fadingStep; -+ -+ // fading -+ if ((*it)->m_fadingSamples == -1) -+ { -+ (*it)->m_fadingSamples = m_internalFormat.m_sampleRate * (float)(*it)->m_fadingTime / 1000.0f; -+ (*it)->m_volume = (*it)->m_fadingBase; -+ } -+ if ((*it)->m_fadingSamples > 0) -+ { -+ nb_floats = out->pkt->config.channels / out->pkt->planes; -+ nb_loops = out->pkt->nb_samples; -+ float delta = (*it)->m_fadingTarget - (*it)->m_fadingBase; -+ int samples = m_internalFormat.m_sampleRate * (float)(*it)->m_fadingTime / 1000.0f; -+ fadingStep = delta / samples; -+ } -+ for(int i=0; im_fadingSamples > 0) -+ { -+ (*it)->m_volume += fadingStep; -+ (*it)->m_fadingSamples--; -+ -+ if ((*it)->m_fadingSamples == 0) -+ { -+ // set variables being polled via stream interface -+ CSingleLock lock((*it)->m_streamLock); -+ (*it)->m_streamFading = false; -+ } -+ } -+ float volume = (*it)->m_volume * amp; -+ -+ 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); -+#else -+ float* fbuffer = (float*) out->pkt->data[j]+i*nb_floats; -+ for (int k = 0; k < nb_floats; ++k) -+ *fbuffer++ *= m_muted ? 0.0 : volume; -+#endif -+ } -+ } -+ } -+ else -+ { -+ CSampleBuffer *mix = NULL; -+ mix = (*it)->m_resampleBuffers->m_outputSamples.front(); -+ (*it)->m_resampleBuffers->m_outputSamples.pop_front(); -+ -+ // volume for stream -+ float amp = (*it)->m_volume * (*it)->m_rgain * CalcStreamAmplification((*it), mix); -+ -+ int nb_floats = mix->pkt->nb_samples * mix->pkt->config.channels / mix->pkt->planes; -+ int nb_loops = 1; -+ float fadingStep; -+ -+ // fading -+ if ((*it)->m_fadingSamples == -1) -+ { -+ (*it)->m_fadingSamples = m_internalFormat.m_sampleRate * (float)(*it)->m_fadingTime / 1000.0f; -+ (*it)->m_volume = (*it)->m_fadingBase; -+ } -+ if ((*it)->m_fadingSamples > 0) -+ { -+ nb_floats = mix->pkt->config.channels / mix->pkt->planes; -+ nb_loops = mix->pkt->nb_samples; -+ float delta = (*it)->m_fadingTarget - (*it)->m_fadingBase; -+ int samples = m_internalFormat.m_sampleRate * (float)(*it)->m_fadingTime / 1000.0f; -+ fadingStep = delta / samples; -+ } -+ for(int i=0; im_fadingSamples > 0) -+ { -+ (*it)->m_volume += fadingStep; -+ (*it)->m_fadingSamples--; -+ -+ if ((*it)->m_fadingSamples == 0) -+ { -+ // set variables being polled via stream interface -+ CSingleLock lock((*it)->m_streamLock); -+ (*it)->m_streamFading = false; -+ } -+ } -+ float volume = (*it)->m_volume * amp; -+ -+ for(int j=0; jpkt->planes && jpkt->planes; j++) -+ { -+ 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); -+#else -+ for (int k = 0; k < nb_floats; ++k) -+ *dst++ += *src++ * m_muted ? 0.0 : volume; -+#endif -+ } -+ } -+ mix->Return(); -+ } -+ busy = true; -+ } -+ } -+ -+ // process output buffer, gui sounds, encode, viz -+ if (out) -+ { -+ // mix gui sounds -+ MixSounds(*(out->pkt)); -+ if (!m_sinkHasVolume) -+ Deamplify(*(out->pkt)); -+ -+ // viz -+ { -+ CSingleLock lock(m_vizLock); -+ if (m_audioCallback && m_vizBuffers) -+ { -+ 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 "out" -+ if (!m_vizBuffers->m_freeSamples.empty()) -+ { -+ out->Acquire(); -+ m_vizBuffers->m_inputSamples.push_back(out); -+ } -+ 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; -+ 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 submitted = 0; -+ int samples; -+ while(submitted < buf->pkt->nb_samples) -+ { -+ samples = std::min(512, buf->pkt->nb_samples-submitted); -+ m_audioCallback->OnAudioData((float*)(buf->pkt->data[0]+2*submitted), samples); -+ submitted += samples; -+ } -+ buf->Return(); -+ m_vizBuffers->m_outputSamples.pop_front(); -+ } -+ } -+ } -+ else if (m_vizBuffers) -+ m_vizBuffers->Flush(); -+ } -+ -+ // encode -+ if (m_mode == MODE_TRANSCODE && m_encoder) -+ { -+ CSampleBuffer *buf = m_encoderBuffers->GetFreeBuffer(); -+ int ret = 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; -+ } -+ -+ // update stats -+ m_stats.AddSamples(out->pkt->nb_samples, m_streams); -+ m_sinkBuffers->m_inputSamples.push_back(out); -+ -+ busy = true; -+ } -+ } -+ // pass through -+ else -+ { -+ std::list::iterator it; -+ CSampleBuffer *buffer; -+ for (it = m_streams.begin(); it != m_streams.end(); ++it) -+ { -+ if (!(*it)->m_resampleBuffers->m_outputSamples.empty()) -+ { -+ buffer = (*it)->m_resampleBuffers->m_outputSamples.front(); -+ (*it)->m_resampleBuffers->m_outputSamples.pop_front(); -+ m_stats.AddSamples(buffer->pkt->nb_samples, m_streams); -+ m_sinkBuffers->m_inputSamples.push_back(buffer); -+ } -+ } -+ } -+ -+ // serve sink buffers -+ busy = m_sinkBuffers->ResampleBuffers(); -+ while(!m_sinkBuffers->m_outputSamples.empty()) -+ { -+ CSampleBuffer *out = NULL; -+ out = m_sinkBuffers->m_outputSamples.front(); -+ m_sinkBuffers->m_outputSamples.pop_front(); -+ m_sink.m_dataPort.SendOutMessage(CSinkDataProtocol::SAMPLE, -+ &out, sizeof(CSampleBuffer*)); -+ busy = true; -+ } -+ } -+ -+ return busy; -+} -+ -+bool CActiveAE::HasWork() -+{ -+ if (!m_sounds_playing.empty()) -+ return true; -+ if (!m_sinkBuffers->m_inputSamples.empty()) -+ return true; -+ if (!m_sinkBuffers->m_outputSamples.empty()) -+ return true; -+ -+ std::list::iterator it; -+ for (it = m_streams.begin(); it != m_streams.end(); ++it) -+ { -+ if (!(*it)->m_resampleBuffers->m_inputSamples.empty()) -+ return true; -+ if (!(*it)->m_resampleBuffers->m_outputSamples.empty()) -+ return true; -+ if (!(*it)->m_processingSamples.empty()) -+ return true; -+ } -+ -+ return false; -+} -+ -+void CActiveAE::MixSounds(CSoundPacket &dstSample) -+{ -+ if (m_sounds_playing.empty()) -+ return; -+ -+ float volume; -+ float *out; -+ float *sample_buffer; -+ int max_samples = dstSample.nb_samples; -+ -+ std::list::iterator it; -+ for (it = m_sounds_playing.begin(); it != m_sounds_playing.end(); ) -+ { -+ if (!it->sound->IsConverted()) -+ ResampleSound(it->sound); -+ int available_samples = it->sound->GetSound(false)->nb_samples - it->samples_played; -+ int mix_samples = std::min(max_samples, available_samples); -+ int start = it->samples_played * -+ m_dllAvUtil.av_get_bytes_per_sample(it->sound->GetSound(false)->config.fmt) * -+ it->sound->GetSound(false)->config.channels / -+ it->sound->GetSound(false)->planes; -+ -+ for(int j=0; jsound->GetVolume(); -+ out = (float*)dstSample.data[j]; -+ sample_buffer = (float*)(it->sound->GetSound(false)->data[j]+start); -+ int nb_floats = mix_samples * dstSample.config.channels / dstSample.planes; -+#ifdef __SSE__ -+ CAEUtil::SSEMulAddArray(out, sample_buffer, volume, nb_floats); -+#else -+ for (int k = 0; k < nb_floats; ++k) -+ *out++ += *sample_buffer++ * volume; -+#endif -+ } -+ -+ it->samples_played += mix_samples; -+ -+ // no more frames, so remove it from the list -+ if (it->samples_played >= it->sound->GetSound(false)->nb_samples) -+ { -+ it = m_sounds_playing.erase(it); -+ continue; -+ } -+ ++it; -+ } -+} -+ -+void CActiveAE::Deamplify(CSoundPacket &dstSample) -+{ -+ if (m_volume < 1.0) -+ { -+ float *buffer; -+ int nb_floats = dstSample.nb_samples * dstSample.config.channels / dstSample.planes; -+ -+ for(int j=0; jsignal == CActiveAEControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - returned error", __FUNCTION__); -+ Dispose(); -+ return false; -+ } -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - failed to init", __FUNCTION__); -+ Dispose(); -+ return false; -+ } -+ -+ // hook into windowing for receiving display reset events -+#if defined(HAS_GLX) || defined(TARGET_DARWIN_OSX) -+ g_Windowing.Register(this); -+#endif -+ -+ m_inMsgEvent.Reset(); -+ return true; -+} -+ -+void CActiveAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough) -+{ -+ m_sink.EnumerateOutputDevices(devices, passthrough); -+} -+ -+std::string CActiveAE::GetDefaultDevice(bool passthrough) -+{ -+ return m_sink.GetDefaultDevice(passthrough); -+} -+ -+void CActiveAE::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") -+ { -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::RECONFIGURE); -+ } -+} -+ -+bool CActiveAE::SupportsRaw() -+{ -+ return true; -+} -+ -+void CActiveAE::Shutdown() -+{ -+ Dispose(); -+} -+ -+bool CActiveAE::Suspend() -+{ -+ return m_controlPort.SendOutMessage(CActiveAEControlProtocol::SUSPEND); -+} -+ -+bool CActiveAE::Resume() -+{ -+ Message *reply; -+ if (m_controlPort.SendOutMessageSync(CActiveAEControlProtocol::INIT, -+ &reply, -+ 5000)) -+ { -+ bool success = reply->signal == CActiveAEControlProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - returned error", __FUNCTION__); -+ return false; -+ } -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "ActiveAE::%s - failed to init", __FUNCTION__); -+ return false; -+ } -+ -+ m_inMsgEvent.Reset(); -+ return true; -+} -+ -+bool CActiveAE::IsSuspended() -+{ -+ return m_stats.IsSuspended(); -+} -+ -+float CActiveAE::GetVolume() -+{ -+ return m_aeVolume; -+} -+ -+void CActiveAE::SetVolume(const float volume) -+{ -+ m_aeVolume = std::max( 0.0f, std::min(1.0f, volume)); -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::VOLUME, &m_aeVolume, sizeof(float)); -+} -+ -+void CActiveAE::SetMute(const bool enabled) -+{ -+ m_aeMuted = enabled; -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::MUTE, &m_aeMuted, sizeof(bool)); -+} -+ -+bool CActiveAE::IsMuted() -+{ -+ return m_aeMuted; -+} -+ -+void CActiveAE::SetSoundMode(const int mode) -+{ -+ int soundmode = mode; -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::SOUNDMODE, &soundmode, sizeof(int)); -+} -+ -+ -+void CActiveAE::OnLostDevice() -+{ -+// m_controlPort.SendOutMessage(CActiveAEControlProtocol::DISPLAYLOST); -+} -+ -+void CActiveAE::OnResetDevice() -+{ -+// m_controlPort.SendOutMessage(CActiveAEControlProtocol::DISPLAYRESET); -+} -+ -+//----------------------------------------------------------------------------- -+// Utils -+//----------------------------------------------------------------------------- -+ -+uint8_t **CActiveAE::AllocSoundSample(SampleConfig &config, int &samples, int &bytes_per_sample, int &planes, int &linesize) -+{ -+ uint8_t **buffer; -+ planes = m_dllAvUtil.av_sample_fmt_is_planar(config.fmt) ? config.channels : 1; -+ buffer = new uint8_t*[planes]; -+ m_dllAvUtil.av_samples_alloc(buffer, &linesize, config.channels, -+ samples, config.fmt, 0); -+ bytes_per_sample = m_dllAvUtil.av_get_bytes_per_sample(config.fmt); -+ return buffer; -+} -+ -+void CActiveAE::FreeSoundSample(uint8_t **data) -+{ -+ m_dllAvUtil.av_freep(data); -+ delete [] data; -+} -+ -+//----------------------------------------------------------------------------- -+// GUI Sounds -+//----------------------------------------------------------------------------- -+ -+/** -+ * load sound from an audio file and store original format -+ * register the sound in ActiveAE -+ * later when the engine is idle it will convert the sound to sink format -+ */ -+ -+#define SOUNDBUFFER_SIZE 20480 -+ -+IAESound *CActiveAE::MakeSound(const std::string& file) -+{ -+ AVFormatContext *fmt_ctx = NULL; -+ AVCodecContext *dec_ctx = NULL; -+ AVIOContext *io_ctx; -+ AVInputFormat *io_fmt; -+ AVCodec *dec = NULL; -+ int bit_rate; -+ CActiveAESound *sound = NULL; -+ SampleConfig config; -+ -+ sound = new CActiveAESound(file); -+ if (!sound->Prepare()) -+ return NULL; -+ int fileSize = sound->GetFileSize(); -+ -+ fmt_ctx = m_dllAvFormat.avformat_alloc_context(); -+ unsigned char* buffer = (unsigned char*)m_dllAvUtil.av_malloc(SOUNDBUFFER_SIZE+FF_INPUT_BUFFER_PADDING_SIZE); -+ io_ctx = m_dllAvFormat.avio_alloc_context(buffer, SOUNDBUFFER_SIZE, 0, -+ sound, CActiveAESound::Read, NULL, CActiveAESound::Seek); -+ io_ctx->max_packet_size = sound->GetChunkSize(); -+ if(io_ctx->max_packet_size) -+ io_ctx->max_packet_size *= SOUNDBUFFER_SIZE / io_ctx->max_packet_size; -+ -+ if(!sound->IsSeekPosible()) -+ io_ctx->seekable = 0; -+ -+ fmt_ctx->pb = io_ctx; -+ -+ m_dllAvFormat.av_probe_input_buffer(io_ctx, &io_fmt, file.c_str(), NULL, 0, 0); -+ if (!io_fmt) -+ { -+ m_dllAvFormat.avformat_close_input(&fmt_ctx); -+ delete sound; -+ return NULL; -+ } -+ -+ // find decoder -+ if (m_dllAvFormat.avformat_open_input(&fmt_ctx, file.c_str(), NULL, NULL) == 0) -+ { -+ fmt_ctx->flags |= AVFMT_FLAG_NOPARSE; -+ if (m_dllAvFormat.avformat_find_stream_info(fmt_ctx, NULL) >= 0) -+ { -+ dec_ctx = fmt_ctx->streams[0]->codec; -+ dec = m_dllAvCodec.avcodec_find_decoder(dec_ctx->codec_id); -+ config.sample_rate = dec_ctx->sample_rate; -+ bit_rate = dec_ctx->bit_rate; -+ config.channels = dec_ctx->channels; -+ config.channel_layout = dec_ctx->channel_layout; -+ } -+ } -+ if (dec == NULL) -+ { -+ m_dllAvFormat.avformat_close_input(&fmt_ctx); -+ delete sound; -+ return NULL; -+ } -+ -+ dec_ctx = m_dllAvCodec.avcodec_alloc_context3(dec); -+ dec_ctx->sample_rate = config.sample_rate; -+ dec_ctx->channels = config.channels; -+ if (!config.channel_layout) -+ config.channel_layout = m_dllAvUtil.av_get_default_channel_layout(config.channels); -+ dec_ctx->channel_layout = config.channel_layout; -+ -+ AVPacket avpkt; -+ AVFrame *decoded_frame = NULL; -+ decoded_frame = m_dllAvCodec.avcodec_alloc_frame(); -+ -+ if (m_dllAvCodec.avcodec_open2(dec_ctx, dec, NULL) >= 0) -+ { -+ bool init = false; -+ -+ // decode until eof -+ m_dllAvCodec.av_init_packet(&avpkt); -+ int len; -+ while (m_dllAvFormat.av_read_frame(fmt_ctx, &avpkt) >= 0) -+ { -+ int got_frame = 0; -+ len = m_dllAvCodec.avcodec_decode_audio4(dec_ctx, decoded_frame, &got_frame, &avpkt); -+ if (len < 0) -+ { -+ m_dllAvCodec.avcodec_close(dec_ctx); -+ m_dllAvUtil.av_free(dec_ctx); -+ m_dllAvUtil.av_free(&decoded_frame); -+ m_dllAvFormat.avformat_close_input(&fmt_ctx); -+ delete sound; -+ return NULL; -+ } -+ if (got_frame) -+ { -+ if (!init) -+ { -+ int samples = fileSize / m_dllAvUtil.av_get_bytes_per_sample(dec_ctx->sample_fmt) / config.channels; -+ config.fmt = dec_ctx->sample_fmt; -+ sound->InitSound(true, config, samples); -+ init = true; -+ } -+ sound->StoreSound(true, decoded_frame->extended_data, -+ decoded_frame->nb_samples, decoded_frame->linesize[0]); -+ } -+ } -+ m_dllAvCodec.avcodec_close(dec_ctx); -+ } -+ -+ m_dllAvUtil.av_free(dec_ctx); -+ m_dllAvUtil.av_free(decoded_frame); -+ m_dllAvFormat.avformat_close_input(&fmt_ctx); -+ -+ sound->Finish(); -+ -+ // register sound -+ m_dataPort.SendOutMessage(CActiveAEDataProtocol::NEWSOUND, &sound, sizeof(CActiveAESound*)); -+ -+ return sound; -+} -+ -+void CActiveAE::FreeSound(IAESound *sound) -+{ -+ m_dataPort.SendOutMessage(CActiveAEDataProtocol::FREESOUND, &sound, sizeof(CActiveAESound*)); -+} -+ -+void CActiveAE::PlaySound(CActiveAESound *sound) -+{ -+ m_dataPort.SendOutMessage(CActiveAEDataProtocol::PLAYSOUND, &sound, sizeof(CActiveAESound*)); -+} -+ -+void CActiveAE::StopSound(CActiveAESound *sound) -+{ -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::STOPSOUND, &sound, sizeof(CActiveAESound*)); -+} -+ -+/** -+ * resample sounds to destination format for mixing -+ * destination format is either format of stream or -+ * default sink format when no stream is playing -+ */ -+void CActiveAE::ResampleSounds() -+{ -+ std::vector::iterator it; -+ for (it = m_sounds.begin(); it != m_sounds.end(); ++it) -+ { -+ if (!(*it)->IsConverted()) -+ ResampleSound(*it); -+ } -+} -+ -+bool CActiveAE::ResampleSound(CActiveAESound *sound) -+{ -+ SampleConfig orig_config, dst_config; -+ uint8_t **dst_buffer; -+ int dst_samples; -+ -+ if (m_mode == MODE_RAW || m_internalFormat.m_dataFormat == AE_FMT_INVALID) -+ return false; -+ -+ if (!sound->GetSound(true)) -+ return false; -+ -+ orig_config = sound->GetSound(true)->config; -+ -+ dst_config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_internalFormat.m_channelLayout); -+ dst_config.channels = m_internalFormat.m_channelLayout.Count(); -+ dst_config.sample_rate = m_internalFormat.m_sampleRate; -+ dst_config.fmt = CActiveAEResample::GetAVSampleFormat(m_internalFormat.m_dataFormat); -+ -+ CActiveAEResample *resampler = new CActiveAEResample(); -+ resampler->Init(dst_config.channel_layout, -+ dst_config.channels, -+ dst_config.sample_rate, -+ dst_config.fmt, -+ orig_config.channel_layout, -+ orig_config.channels, -+ orig_config.sample_rate, -+ orig_config.fmt, -+ NULL); -+ -+ dst_samples = resampler->CalcDstSampleCount(sound->GetSound(true)->nb_samples, -+ m_internalFormat.m_sampleRate, -+ orig_config.sample_rate); -+ -+ dst_buffer = sound->InitSound(false, dst_config, dst_samples); -+ if (!dst_buffer) -+ { -+ delete resampler; -+ return false; -+ } -+ int samples = resampler->Resample(dst_buffer, dst_samples, -+ sound->GetSound(true)->data, -+ sound->GetSound(true)->nb_samples); -+ -+ sound->GetSound(false)->nb_samples = samples; -+ -+ delete resampler; -+ sound->SetConverted(true); -+ return true; -+} -+ -+//----------------------------------------------------------------------------- -+// Streams -+//----------------------------------------------------------------------------- -+ -+IAEStream *CActiveAE::MakeStream(enum AEDataFormat dataFormat, unsigned int sampleRate, unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options) -+{ -+ //TODO: pass number of samples in audio packet -+ -+ AEAudioFormat format; -+ format.m_dataFormat = dataFormat; -+ format.m_sampleRate = sampleRate; -+ format.m_encodedRate = encodedSampleRate; -+ format.m_channelLayout = channelLayout; -+ format.m_frames = format.m_sampleRate / 10; -+ format.m_frameSize = format.m_channelLayout.Count() * -+ (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3); -+ -+ MsgStreamNew msg; -+ msg.format = format; -+ msg.options = options; -+ -+ Message *reply; -+ if (m_dataPort.SendOutMessageSync(CActiveAEDataProtocol::NEWSTREAM, -+ &reply,1000, -+ &msg, sizeof(MsgStreamNew))) -+ { -+ bool success = reply->signal == CActiveAEControlProtocol::ACC ? true : false; -+ if (success) -+ { -+ CActiveAEStream *stream = *(CActiveAEStream**)reply->data; -+ reply->Release(); -+ return stream; -+ } -+ reply->Release(); -+ } -+ -+ CLog::Log(LOGERROR, "ActiveAE::%s - could not create stream", __FUNCTION__); -+ return NULL; -+} -+ -+IAEStream *CActiveAE::FreeStream(IAEStream *stream) -+{ -+ m_dataPort.SendOutMessage(CActiveAEDataProtocol::FREESTREAM, &stream, sizeof(IAEStream*)); -+ return NULL; -+} -+ -+void CActiveAE::FlushStream(CActiveAEStream *stream) -+{ -+ Message *reply; -+ if (m_dataPort.SendOutMessageSync(CActiveAEDataProtocol::FLUSHSTREAM, -+ &reply,1000, -+ &stream, sizeof(CActiveAEStream*))) -+ { -+ bool success = reply->signal == CActiveAEDataProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "CActiveAE::FlushStream - failed"); -+ } -+ } -+} -+ -+void CActiveAE::PauseStream(CActiveAEStream *stream, bool pause) -+{ -+ // TODO pause sink, needs api change -+ if (pause) -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::PAUSESTREAM, -+ &stream, sizeof(CActiveAEStream*)); -+ else -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::RESUMESTREAM, -+ &stream, sizeof(CActiveAEStream*)); -+} -+ -+void CActiveAE::SetStreamAmplification(CActiveAEStream *stream, float amplify) -+{ -+ MsgStreamParameter msg; -+ msg.stream = stream; -+ msg.parameter.float_par = amplify; -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::STREAMAMP, -+ &msg, sizeof(MsgStreamParameter)); -+} -+ -+void CActiveAE::SetStreamReplaygain(CActiveAEStream *stream, float rgain) -+{ -+ MsgStreamParameter msg; -+ msg.stream = stream; -+ msg.parameter.float_par = rgain; -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::STREAMRGAIN, -+ &msg, sizeof(MsgStreamParameter)); -+} -+ -+void CActiveAE::SetStreamVolume(CActiveAEStream *stream, float volume) -+{ -+ MsgStreamParameter msg; -+ msg.stream = stream; -+ msg.parameter.float_par = volume; -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::STREAMVOLUME, -+ &msg, sizeof(MsgStreamParameter)); -+} -+ -+void CActiveAE::SetStreamResampleRatio(CActiveAEStream *stream, double ratio) -+{ -+ MsgStreamParameter msg; -+ msg.stream = stream; -+ msg.parameter.double_par = ratio; -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::STREAMRESAMPLERATIO, -+ &msg, sizeof(MsgStreamParameter)); -+} -+ -+void CActiveAE::SetStreamFade(CActiveAEStream *stream, float from, float target, unsigned int millis) -+{ -+ MsgStreamFade msg; -+ msg.stream = stream; -+ msg.from = from; -+ msg.target = target; -+ msg.millis = millis; -+ m_controlPort.SendOutMessage(CActiveAEControlProtocol::STREAMFADE, -+ &msg, sizeof(MsgStreamFade)); -+} -+ -+void CActiveAE::RegisterAudioCallback(IAudioCallback* pCallback) -+{ -+ CSingleLock lock(m_vizLock); -+ m_audioCallback = pCallback; -+ m_vizInitialized = false; -+} -+ -+void CActiveAE::UnregisterAudioCallback() -+{ -+ CSingleLock lock(m_vizLock); -+ m_audioCallback = NULL; -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -new file mode 100644 -index 0000000..d5c5d97 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -0,0 +1,334 @@ -+#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 "system.h" -+#include "threads/Thread.h" -+ -+#include "ActiveAESink.h" -+#include "ActiveAEResample.h" -+#include "Interfaces/AEStream.h" -+#include "Interfaces/AESound.h" -+#include "AEFactory.h" -+#include "guilib/DispResource.h" -+ -+// ffmpeg -+#include "DllAvFormat.h" -+#include "DllAvCodec.h" -+#include "DllAvUtil.h" -+ -+class IAESink; -+class IAEEncoder; -+ -+namespace ActiveAE -+{ -+ -+class CActiveAESound; -+class CActiveAEStream; -+ -+struct AudioSettings -+{ -+ std::string device; -+ std::string driver; -+ std::string passthoughdevice; -+ int mode; -+ int channels; -+ bool ac3passthrough; -+ bool dtspassthrough; -+ bool aacpassthrough; -+ bool truehdpassthrough; -+ bool dtshdpassthrough; -+ bool multichannellpcm; -+ bool stereoupmix; -+}; -+ -+class CActiveAEControlProtocol : public Protocol -+{ -+public: -+ CActiveAEControlProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ INIT = 0, -+ RECONFIGURE, -+ SUSPEND, -+ MUTE, -+ VOLUME, -+ PAUSESTREAM, -+ RESUMESTREAM, -+ STREAMRGAIN, -+ STREAMVOLUME, -+ STREAMAMP, -+ STREAMRESAMPLERATIO, -+ STREAMFADE, -+ STOPSOUND, -+ SOUNDMODE, -+ GETSTATE, -+ DISPLAYLOST, -+ DISPLAYRESET, -+ TIMEOUT, -+ }; -+ enum InSignal -+ { -+ ACC, -+ ERR, -+ STATS, -+ }; -+}; -+ -+class CActiveAEDataProtocol : public Protocol -+{ -+public: -+ CActiveAEDataProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ NEWSOUND = 0, -+ PLAYSOUND, -+ FREESOUND, -+ NEWSTREAM, -+ FREESTREAM, -+ STREAMSAMPLE, -+ DRAINSTREAM, -+ FLUSHSTREAM, -+ }; -+ enum InSignal -+ { -+ ACC, -+ ERR, -+ STREAMBUFFER, -+ STREAMDRAINED, -+ }; -+}; -+ -+struct MsgStreamNew -+{ -+ AEAudioFormat format; -+ unsigned int options; -+}; -+ -+struct MsgStreamSample -+{ -+ CSampleBuffer *buffer; -+ CActiveAEStream *stream; -+}; -+ -+struct MsgStreamParameter -+{ -+ CActiveAEStream *stream; -+ union -+ { -+ float float_par; -+ double double_par; -+ } parameter; -+}; -+ -+struct MsgStreamFade -+{ -+ CActiveAEStream *stream; -+ float from; -+ float target; -+ unsigned int millis; -+}; -+ -+class CEngineStats -+{ -+public: -+ void Reset(unsigned int sampleRate); -+ void UpdateSinkDelay(double delay, int samples); -+ void AddSamples(int samples, std::list &streams); -+ float GetDelay(); -+ float GetDelay(CActiveAEStream *stream); -+ float GetCacheTime(CActiveAEStream *stream); -+ float GetCacheTotal(CActiveAEStream *stream); -+ float GetWaterLevel(); -+ void SetSuspended(bool state); -+ void SetSinkCacheTotal(float time) { m_sinkCacheTotal = time; } -+ bool IsSuspended(); -+ CCriticalSection *GetLock() { return &m_lock; } -+protected: -+ float m_sinkDelay; -+ float m_sinkCacheTotal; -+ int m_bufferedSamples; -+ unsigned int m_sinkSampleRate; -+ unsigned int m_sinkUpdate; -+ bool m_suspended; -+ CCriticalSection m_lock; -+}; -+ -+#if defined(HAS_GLX) || defined(TARGET_DARWIN_OSX) -+class CActiveAE : public IAE, public IDispResource, private CThread -+#else -+class CActiveAE : public IAE, private CThread -+#endif -+{ -+protected: -+ friend class ::CAEFactory; -+ friend class CActiveAESound; -+ friend class CActiveAEStream; -+ friend class CSoundPacket; -+ friend class CActiveAEBufferPoolResample; -+ CActiveAE(); -+ virtual ~CActiveAE(); -+ virtual bool Initialize(); -+ -+public: -+ virtual void Shutdown(); -+ virtual bool Suspend(); -+ virtual bool Resume(); -+ virtual bool IsSuspended(); -+ virtual void OnSettingsChange(const std::string& setting); -+ -+ virtual float GetVolume(); -+ virtual void SetVolume(const float volume); -+ virtual void SetMute(const bool enabled); -+ virtual bool IsMuted(); -+ 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); -+ -+ virtual void GarbageCollect() {}; -+ -+ virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); -+ virtual std::string GetDefaultDevice(bool passthrough); -+ virtual bool SupportsRaw(); -+ -+ virtual void RegisterAudioCallback(IAudioCallback* pCallback); -+ virtual void UnregisterAudioCallback(); -+ -+ virtual void OnLostDevice(); -+ virtual void OnResetDevice(); -+ -+protected: -+ void PlaySound(CActiveAESound *sound); -+ uint8_t **AllocSoundSample(SampleConfig &config, int &samples, int &bytes_per_sample, int &planes, int &linesize); -+ void FreeSoundSample(uint8_t **data); -+ float GetDelay(CActiveAEStream *stream) { return m_stats.GetDelay(stream); } -+ float GetCacheTime(CActiveAEStream *stream) { return m_stats.GetCacheTime(stream); } -+ float GetCacheTotal(CActiveAEStream *stream) { return m_stats.GetCacheTotal(stream); } -+ void FlushStream(CActiveAEStream *stream); -+ void PauseStream(CActiveAEStream *stream, bool pause); -+ void StopSound(CActiveAESound *sound); -+ void SetStreamAmplification(CActiveAEStream *stream, float amplify); -+ void SetStreamReplaygain(CActiveAEStream *stream, float rgain); -+ void SetStreamVolume(CActiveAEStream *stream, float volume); -+ void SetStreamResampleRatio(CActiveAEStream *stream, double ratio); -+ void SetStreamFade(CActiveAEStream *stream, float from, float target, unsigned int millis); -+ -+protected: -+ void Process(); -+ void StateMachine(int signal, Protocol *port, Message *msg); -+ bool InitSink(); -+ void DrainSink(); -+ void UnconfigureSink(); -+ void Start(); -+ void Dispose(); -+ void LoadSettings(); -+ bool NeedReconfigureBuffers(); -+ bool NeedReconfigureSink(); -+ void ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &settings, bool setmode = false); -+ void Configure(AEAudioFormat *desiredFmt = NULL); -+ CActiveAEStream* CreateStream(MsgStreamNew *streamMsg); -+ void DiscardStream(CActiveAEStream *stream); -+ void SFlushStream(CActiveAEStream *stream); -+ void ClearDiscardedBuffers(); -+ void SStopSound(CActiveAESound *sound); -+ void DiscardSound(CActiveAESound *sound); -+ float CalcStreamAmplification(CActiveAEStream *stream, CSampleBuffer *buf); -+ -+ bool RunStages(); -+ bool HasWork(); -+ -+ void ResampleSounds(); -+ bool ResampleSound(CActiveAESound *sound); -+ void MixSounds(CSoundPacket &dstSample); -+ void Deamplify(CSoundPacket &dstSample); -+ -+ CEvent m_inMsgEvent; -+ CEvent m_outMsgEvent; -+ CActiveAEControlProtocol m_controlPort; -+ CActiveAEDataProtocol m_dataPort; -+ int m_state; -+ bool m_bStateMachineSelfTrigger; -+ int m_extTimeout; -+ bool m_extError; -+ bool m_extDrain; -+ XbmcThreads::EndTime m_extDrainTimer; -+ bool m_extDeferData; -+ -+ enum -+ { -+ MODE_RAW, -+ MODE_TRANSCODE, -+ MODE_PCM -+ }m_mode; -+ -+ CActiveAESink m_sink; -+ AEAudioFormat m_sinkFormat; -+ AEAudioFormat m_sinkRequestFormat; -+ AEAudioFormat m_encoderFormat; -+ AEAudioFormat m_internalFormat; -+ AudioSettings m_settings; -+ CEngineStats m_stats; -+ IAEEncoder *m_encoder; -+ -+ // buffers -+ CActiveAEBufferPoolResample *m_sinkBuffers; -+ CActiveAEBufferPoolResample *m_vizBuffers; -+ CActiveAEBufferPool *m_silenceBuffers; // needed to drive gui sounds if we have no streams -+ CActiveAEBufferPool *m_encoderBuffers; -+ -+ // streams -+ std::list m_streams; -+ std::list m_discardBufferPools; -+ -+ // gui sounds -+ struct SoundState -+ { -+ CActiveAESound *sound; -+ int samples_played; -+ }; -+ std::list m_sounds_playing; -+ std::vector m_sounds; -+ int m_soundMode; -+ -+ float m_volume; -+ bool m_muted; -+ bool m_sinkHasVolume; -+ -+ // viz -+ IAudioCallback *m_audioCallback; -+ bool m_vizInitialized; -+ CCriticalSection m_vizLock; -+ -+ // ffmpeg -+ DllAvFormat m_dllAvFormat; -+ DllAvCodec m_dllAvCodec; -+ DllAvUtil m_dllAvUtil; -+ -+ // polled via the interface -+ float m_aeVolume; -+ bool m_aeMuted; -+}; -+}; -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -new file mode 100644 -index 0000000..d3ba213 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -@@ -0,0 +1,365 @@ -+/* -+ * Copyright (C) 2010-2013 Team XBMC -+ * http://www.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 "ActiveAEBuffer.h" -+#include "AEFactory.h" -+#include "ActiveAE.h" -+ -+using namespace ActiveAE; -+ -+/* typecast AE to CActiveAE */ -+#define AE (*((CActiveAE*)CAEFactory::GetEngine())) -+ -+CSoundPacket::CSoundPacket(SampleConfig conf, int samples) : config(conf) -+{ -+ data = AE.AllocSoundSample(config, samples, bytes_per_sample, planes, linesize); -+ max_nb_samples = samples; -+ nb_samples = 0; -+} -+ -+CSoundPacket::~CSoundPacket() -+{ -+ if (data) -+ AE.FreeSoundSample(data); -+} -+ -+CSampleBuffer::CSampleBuffer() : pkt(NULL), pool(NULL) -+{ -+ refCount = 0; -+} -+ -+CSampleBuffer::~CSampleBuffer() -+{ -+ delete pkt; -+} -+ -+CSampleBuffer* CSampleBuffer::Acquire() -+{ -+ refCount++; -+ return this; -+} -+ -+void CSampleBuffer::Return() -+{ -+ refCount--; -+ if (pool && refCount <= 0) -+ pool->ReturnBuffer(this); -+} -+ -+CActiveAEBufferPool::CActiveAEBufferPool(AEAudioFormat format) -+{ -+ m_format = format; -+ if (AE_IS_RAW(m_format.m_dataFormat)) -+ m_format.m_dataFormat = AE_FMT_S16NE; -+} -+ -+CActiveAEBufferPool::~CActiveAEBufferPool() -+{ -+ CSampleBuffer *buffer; -+ while(!m_allSamples.empty()) -+ { -+ buffer = m_allSamples.front(); -+ m_allSamples.pop_front(); -+ delete buffer; -+ } -+} -+ -+CSampleBuffer* CActiveAEBufferPool::GetFreeBuffer() -+{ -+ CSampleBuffer* buf = NULL; -+ -+ if (!m_freeSamples.empty()) -+ { -+ buf = m_freeSamples.front(); -+ m_freeSamples.pop_front(); -+ buf->refCount = 1; -+ } -+ return buf; -+} -+ -+void CActiveAEBufferPool::ReturnBuffer(CSampleBuffer *buffer) -+{ -+ buffer->pkt->nb_samples = 0; -+ m_freeSamples.push_back(buffer); -+} -+ -+bool CActiveAEBufferPool::Create(unsigned int totaltime) -+{ -+ CSampleBuffer *buffer; -+ SampleConfig config; -+ config.fmt = CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat); -+ config.channels = m_format.m_channelLayout.Count(); -+ config.sample_rate = m_format.m_sampleRate; -+ config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout); -+ -+ unsigned int time = 0; -+ unsigned int buffertime = (m_format.m_frames*1000) / m_format.m_sampleRate; -+ unsigned int n = 0; -+ while (time < totaltime || n < 5) -+ { -+ buffer = new CSampleBuffer(); -+ buffer->pool = this; -+ buffer->pkt = new CSoundPacket(config, m_format.m_frames); -+ -+ m_allSamples.push_back(buffer); -+ m_freeSamples.push_back(buffer); -+ time += buffertime; -+ n++; -+ } -+ -+ return true; -+} -+ -+//----------------------------------------------------------------------------- -+ -+CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat) -+ : CActiveAEBufferPool(outputFormat) -+{ -+ m_inputFormat = inputFormat; -+ if (AE_IS_RAW(m_inputFormat.m_dataFormat)) -+ m_inputFormat.m_dataFormat = AE_FMT_S16NE; -+ m_resampler = NULL; -+ m_fillPackets = false; -+ m_drain = false; -+ m_empty = true; -+ m_procSample = NULL; -+ m_resampleRatio = 1.0; -+ m_changeRatio = false; -+} -+ -+CActiveAEBufferPoolResample::~CActiveAEBufferPoolResample() -+{ -+ delete m_resampler; -+} -+ -+bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap) -+{ -+ CActiveAEBufferPool::Create(totaltime); -+ -+ if (m_inputFormat.m_channelLayout != m_format.m_channelLayout || -+ m_inputFormat.m_sampleRate != m_format.m_sampleRate || -+ m_inputFormat.m_dataFormat != m_format.m_dataFormat) -+ { -+ m_resampler = new CActiveAEResample(); -+ m_resampler->Init(CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout), -+ m_format.m_channelLayout.Count(), -+ m_format.m_sampleRate, -+ CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), -+ CActiveAEResample::GetAVChannelLayout(m_inputFormat.m_channelLayout), -+ m_inputFormat.m_channelLayout.Count(), -+ m_inputFormat.m_sampleRate, -+ CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), -+ remap ? &m_format.m_channelLayout : NULL); -+ } -+ -+ // store output sampling rate, needed when ratio gets changed -+ m_outSampleRate = m_format.m_sampleRate; -+ -+ return true; -+} -+ -+void CActiveAEBufferPoolResample::ChangeRatio() -+{ -+// CLog::Log(LOGNOTICE,"---------- sample rate changed from: %d, to: %d", -+// m_outSampleRate, (int)(m_format.m_sampleRate * m_resampleRatio)); -+ -+ m_outSampleRate = m_format.m_sampleRate * m_resampleRatio; -+ -+ delete m_resampler; -+ -+ m_resampler = new CActiveAEResample(); -+ m_resampler->Init(CActiveAEResample::GetAVChannelLayout(m_format.m_channelLayout), -+ m_format.m_channelLayout.Count(), -+ m_outSampleRate, -+ CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat), -+ CActiveAEResample::GetAVChannelLayout(m_inputFormat.m_channelLayout), -+ m_inputFormat.m_channelLayout.Count(), -+ m_inputFormat.m_sampleRate, -+ CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), -+ NULL); -+ -+ m_changeRatio = false; -+} -+ -+bool CActiveAEBufferPoolResample::ResampleBuffers(unsigned int timestamp) -+{ -+ bool busy = false; -+ CSampleBuffer *in; -+ -+ if (m_changeRatio) -+ { -+ if ((unsigned int)(m_format.m_sampleRate * m_resampleRatio) == m_outSampleRate) -+ m_changeRatio = false; -+ } -+ -+ if (!m_resampler) -+ { -+ if (m_changeRatio) -+ { -+ ChangeRatio(); -+ return true; -+ } -+ while(!m_inputSamples.empty()) -+ { -+ in = m_inputSamples.front(); -+ m_inputSamples.pop_front(); -+ m_outputSamples.push_back(in); -+ busy = true; -+ } -+ } -+ else if (m_procSample || !m_freeSamples.empty()) -+ { -+ // GetBufferedSamples is not accurate because of rounding errors -+ int out_samples = m_resampler->GetBufferedSamples(); -+ int free_samples; -+ if (m_procSample) -+ free_samples = m_procSample->pkt->max_nb_samples - m_procSample->pkt->nb_samples; -+ else -+ free_samples = m_format.m_frames; -+ -+ bool skipInput = false; -+ // avoid that ffmpeg resample buffer grows too large -+ if (out_samples > free_samples * 2 && !m_empty) -+ skipInput = true; -+ -+ bool hasInput = !m_inputSamples.empty(); -+ -+ if (hasInput || skipInput || m_drain || m_changeRatio) -+ { -+ if (!m_procSample) -+ { -+ m_procSample = GetFreeBuffer(); -+ } -+ -+ if (hasInput && !skipInput && !m_changeRatio) -+ { -+ in = m_inputSamples.front(); -+ m_inputSamples.pop_front(); -+ } -+ else -+ in = NULL; -+ -+ int start = m_procSample->pkt->nb_samples * -+ m_procSample->pkt->bytes_per_sample * -+ m_procSample->pkt->config.channels / -+ m_procSample->pkt->planes; -+ -+ for(int i=0; ipkt->planes; i++) -+ { -+ m_planes[i] = m_procSample->pkt->data[i] + start; -+ } -+ -+ out_samples = m_resampler->Resample(m_planes, -+ m_procSample->pkt->max_nb_samples - m_procSample->pkt->nb_samples, -+ in ? in->pkt->data : NULL, -+ in ? in->pkt->nb_samples : 0); -+ m_procSample->pkt->nb_samples += out_samples; -+ busy = true; -+ m_empty = (out_samples == 0); -+ -+ if ((m_drain || m_changeRatio) && m_empty) -+ { -+ if (m_fillPackets && m_procSample->pkt->nb_samples != 0) -+ { -+ // pad with zero -+ start = m_procSample->pkt->nb_samples * -+ m_procSample->pkt->bytes_per_sample * -+ m_procSample->pkt->config.channels / -+ m_procSample->pkt->planes; -+ for(int i=0; ipkt->planes; i++) -+ { -+ memset(m_procSample->pkt->data[i]+start, 0, m_procSample->pkt->linesize-start); -+ } -+ } -+ m_procSample->timestamp = timestamp; -+ -+ // check if draining is finished -+ if (m_drain && m_procSample->pkt->nb_samples == 0) -+ { -+ m_procSample->Return(); -+ busy = false; -+ } -+ else -+ m_outputSamples.push_back(m_procSample); -+ -+ m_procSample = NULL; -+ if (m_changeRatio) -+ ChangeRatio(); -+ } -+ // some methods like encode require completely filled packets -+ else if (!m_fillPackets || (m_procSample->pkt->nb_samples == m_procSample->pkt->max_nb_samples)) -+ { -+ m_procSample->timestamp = timestamp; -+ m_outputSamples.push_back(m_procSample); -+ m_procSample = NULL; -+ } -+ -+ if (in) -+ in->Return(); -+ } -+ } -+ return busy; -+} -+ -+float CActiveAEBufferPoolResample::GetDelay() -+{ -+ float delay = 0; -+ std::deque::iterator itBuf; -+ -+ if (m_procSample) -+ delay += m_procSample->pkt->nb_samples / m_procSample->pkt->config.sample_rate; -+ -+ for(itBuf=m_inputSamples.begin(); itBuf!=m_inputSamples.end(); ++itBuf) -+ { -+ delay += (float)(*itBuf)->pkt->nb_samples / (*itBuf)->pkt->config.sample_rate; -+ } -+ -+ for(itBuf=m_outputSamples.begin(); itBuf!=m_outputSamples.end(); ++itBuf) -+ { -+ delay += (float)(*itBuf)->pkt->nb_samples / (*itBuf)->pkt->config.sample_rate; -+ } -+ -+ if (m_resampler) -+ { -+ int samples = m_resampler->GetBufferedSamples(); -+ delay += (float)samples / m_outSampleRate; -+ } -+ -+ return delay; -+} -+ -+void CActiveAEBufferPoolResample::Flush() -+{ -+ if (m_procSample) -+ { -+ m_procSample->Return(); -+ m_procSample = NULL; -+ } -+ while (!m_inputSamples.empty()) -+ { -+ m_inputSamples.front()->Return(); -+ m_inputSamples.pop_front(); -+ } -+ while (!m_outputSamples.empty()) -+ { -+ m_outputSamples.front()->Return(); -+ m_outputSamples.pop_front(); -+ } -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -new file mode 100644 -index 0000000..183c49e ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -@@ -0,0 +1,110 @@ -+#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 "DllAvUtil.h" -+#include "DllSwResample.h" -+#include "AEAudioFormat.h" -+#include -+ -+namespace ActiveAE -+{ -+ -+struct SampleConfig -+{ -+ AVSampleFormat fmt; -+ uint64_t channel_layout; -+ int channels; -+ int sample_rate; -+}; -+ -+/** -+ * the variables here follow ffmpeg naming -+ */ -+class CSoundPacket -+{ -+public: -+ CSoundPacket(SampleConfig conf, int samples); -+ ~CSoundPacket(); -+ uint8_t **data; // array with pointers to planes of data -+ SampleConfig config; -+ AEDataFormat internal_format; // used when carrying pass through -+ int bytes_per_sample; // bytes per sample and per channel -+ int linesize; // see ffmpeg, required for planar formats -+ int planes; // 1 for non planar formats, #channels for planar -+ int nb_samples; // number of frames used -+ int max_nb_samples; // max number of frames this packet can hold -+}; -+ -+class CActiveAEBufferPool; -+ -+class CSampleBuffer -+{ -+public: -+ CSampleBuffer(); -+ ~CSampleBuffer(); -+ CSampleBuffer *Acquire(); -+ void Return(); -+ CSoundPacket *pkt; -+ CActiveAEBufferPool *pool; -+ unsigned int timestamp; -+ int refCount; -+}; -+ -+class CActiveAEBufferPool -+{ -+public: -+ CActiveAEBufferPool(AEAudioFormat format); -+ virtual ~CActiveAEBufferPool(); -+ virtual bool Create(unsigned int totaltime); -+ CSampleBuffer *GetFreeBuffer(); -+ void ReturnBuffer(CSampleBuffer *buffer); -+ AEAudioFormat m_format; -+ std::deque m_allSamples; -+ std::deque m_freeSamples; -+}; -+ -+class CActiveAEResample; -+ -+class CActiveAEBufferPoolResample : public CActiveAEBufferPool -+{ -+public: -+ CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat); -+ virtual ~CActiveAEBufferPoolResample(); -+ virtual bool Create(unsigned int totaltime, bool remap); -+ void ChangeRatio(); -+ bool ResampleBuffers(unsigned int timestamp = 0); -+ float GetDelay(); -+ void Flush(); -+ AEAudioFormat m_inputFormat; -+ std::deque m_inputSamples; -+ std::deque m_outputSamples; -+ CSampleBuffer *m_procSample; -+ CActiveAEResample *m_resampler; -+ uint8_t *m_planes[16]; -+ bool m_fillPackets; -+ bool m_drain; -+ bool m_empty; -+ bool m_changeRatio; -+ double m_resampleRatio; -+ unsigned int m_outSampleRate; -+}; -+ -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp -new file mode 100644 -index 0000000..aee3bfc ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp -@@ -0,0 +1,250 @@ -+/* -+ * 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 "ActiveAEResample.h" -+ -+using namespace ActiveAE; -+ -+CActiveAEResample::CActiveAEResample() -+{ -+ m_pContext = NULL; -+} -+ -+CActiveAEResample::~CActiveAEResample() -+{ -+ if (m_pContext) -+ m_dllSwResample.swr_free(&m_pContext); -+ -+ m_dllAvUtil.Unload(); -+ m_dllSwResample.Unload(); -+} -+ -+bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout) -+{ -+ if (!m_dllAvUtil.Load() || !m_dllSwResample.Load()) -+ return false; -+ -+ m_dst_chan_layout = dst_chan_layout; -+ m_dst_channels = dst_channels; -+ m_dst_rate = dst_rate; -+ m_dst_fmt = dst_fmt; -+ m_src_chan_layout = src_chan_layout; -+ m_src_channels = src_channels; -+ m_src_rate = src_rate; -+ m_src_fmt = src_fmt; -+ -+ if (m_dst_chan_layout == 0) -+ m_dst_chan_layout = m_dllAvUtil.av_get_default_channel_layout(m_dst_channels); -+ if (m_src_chan_layout == 0) -+ m_src_chan_layout = m_dllAvUtil.av_get_default_channel_layout(m_src_channels); -+ -+ m_pContext = m_dllSwResample.swr_alloc_set_opts(NULL, m_dst_chan_layout, m_dst_fmt, m_dst_rate, -+ m_src_chan_layout, m_src_fmt, m_src_rate, -+ 0, NULL); -+ -+ if(!m_pContext) -+ { -+ CLog::Log(LOGERROR, "CActiveAEResample::Init - create context failed"); -+ return false; -+ } -+ if (remapLayout) -+ { -+ // one-to-one mapping of channels -+ // remapLayout is the layout of the sink, if the channel is in our src layout -+ // the channel is mapped by setting coef 1.0 -+ memset(m_rematrix, 0, sizeof(m_rematrix)); -+ for (unsigned int out=0; outCount(); out++) -+ { -+ int idx = GetAVChannelIndex((*remapLayout)[out], m_src_chan_layout); -+ if (idx >= 0) -+ { -+ m_rematrix[out][idx] = 1.0; -+ } -+ } -+ -+ if (m_dllSwResample.swr_set_matrix(m_pContext, (const double*)m_rematrix, AE_CH_MAX) < 0) -+ { -+ CLog::Log(LOGERROR, "CActiveAEResample::Init - setting channel matrix failed"); -+ return false; -+ } -+ } -+ if(m_dllSwResample.swr_init(m_pContext) < 0) -+ { -+ CLog::Log(LOGERROR, "CActiveAEResample::Init - init resampler failed"); -+ return false; -+ } -+ return true; -+} -+ -+int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples) -+{ -+ int ret = m_dllSwResample.swr_convert(m_pContext, dst_buffer, dst_samples, (const uint8_t**)src_buffer, src_samples); -+ if (ret < 0) -+ { -+ CLog::Log(LOGERROR, "CActiveAEResample::Resample - resample failed"); -+ return 0; -+ } -+ return ret; -+} -+ -+int64_t CActiveAEResample::GetDelay(int64_t base) -+{ -+ return m_dllSwResample.swr_get_delay(m_pContext, base); -+} -+ -+int CActiveAEResample::GetBufferedSamples() -+{ -+ return m_dllAvUtil.av_rescale_rnd(m_dllSwResample.swr_get_delay(m_pContext, m_src_rate), -+ m_dst_rate, m_src_rate, AV_ROUND_UP); -+} -+ -+int CActiveAEResample::CalcDstSampleCount(int src_samples, int dst_rate, int src_rate) -+{ -+ return m_dllAvUtil.av_rescale_rnd(src_samples, dst_rate, src_rate, AV_ROUND_UP); -+} -+ -+int CActiveAEResample::GetSrcBufferSize(int samples) -+{ -+ return m_dllAvUtil.av_samples_get_buffer_size(NULL, m_src_channels, samples, m_src_fmt, 1); -+} -+ -+int CActiveAEResample::GetDstBufferSize(int samples) -+{ -+ return m_dllAvUtil.av_samples_get_buffer_size(NULL, m_dst_channels, samples, m_dst_fmt, 1); -+} -+ -+uint64_t CActiveAEResample::GetAVChannelLayout(CAEChannelInfo &info) -+{ -+ uint64_t channelLayout = 0; -+ if (info.HasChannel(AE_CH_FL)) channelLayout |= AV_CH_FRONT_LEFT; -+ if (info.HasChannel(AE_CH_FR)) channelLayout |= AV_CH_FRONT_RIGHT; -+ if (info.HasChannel(AE_CH_FC)) channelLayout |= AV_CH_FRONT_CENTER; -+ if (info.HasChannel(AE_CH_LFE)) channelLayout |= AV_CH_LOW_FREQUENCY; -+ if (info.HasChannel(AE_CH_BL)) channelLayout |= AV_CH_BACK_LEFT; -+ if (info.HasChannel(AE_CH_BR)) channelLayout |= AV_CH_BACK_RIGHT; -+ if (info.HasChannel(AE_CH_FLOC)) channelLayout |= AV_CH_FRONT_LEFT_OF_CENTER; -+ if (info.HasChannel(AE_CH_FROC)) channelLayout |= AV_CH_FRONT_RIGHT_OF_CENTER; -+ if (info.HasChannel(AE_CH_BC)) channelLayout |= AV_CH_BACK_CENTER; -+ if (info.HasChannel(AE_CH_SL)) channelLayout |= AV_CH_SIDE_LEFT; -+ if (info.HasChannel(AE_CH_SR)) channelLayout |= AV_CH_SIDE_RIGHT; -+ if (info.HasChannel(AE_CH_TC)) channelLayout |= AV_CH_TOP_CENTER; -+ if (info.HasChannel(AE_CH_TFL)) channelLayout |= AV_CH_TOP_FRONT_LEFT; -+ if (info.HasChannel(AE_CH_TFC)) channelLayout |= AV_CH_TOP_FRONT_CENTER; -+ if (info.HasChannel(AE_CH_TFR)) channelLayout |= AV_CH_TOP_FRONT_RIGHT; -+ if (info.HasChannel(AE_CH_TBL)) channelLayout |= AV_CH_TOP_BACK_LEFT; -+ if (info.HasChannel(AE_CH_TBC)) channelLayout |= AV_CH_TOP_BACK_CENTER; -+ if (info.HasChannel(AE_CH_TBR)) channelLayout |= AV_CH_TOP_BACK_RIGHT; -+ -+ return channelLayout; -+} -+ -+//CAEChannelInfo CActiveAEResample::GetAEChannelLayout(uint64_t layout) -+//{ -+// CAEChannelInfo channelLayout; -+// channelLayout.Reset(); -+// -+// if (layout & AV_CH_FRONT_LEFT ) channelLayout += AE_CH_FL ; -+// if (layout & AV_CH_FRONT_RIGHT ) channelLayout += AE_CH_FR ; -+// if (layout & AV_CH_FRONT_CENTER ) channelLayout += AE_CH_FC ; -+// if (layout & AV_CH_LOW_FREQUENCY ) channelLayout += AE_CH_LFE ; -+// if (layout & AV_CH_BACK_LEFT ) channelLayout += AE_CH_BL ; -+// if (layout & AV_CH_BACK_RIGHT ) channelLayout += AE_CH_BR ; -+// if (layout & AV_CH_FRONT_LEFT_OF_CENTER ) channelLayout += AE_CH_FLOC; -+// if (layout & AV_CH_FRONT_RIGHT_OF_CENTER) channelLayout += AE_CH_FROC; -+// if (layout & AV_CH_BACK_CENTER ) channelLayout += AE_CH_BC ; -+// if (layout & AV_CH_SIDE_LEFT ) channelLayout += AE_CH_SL ; -+// if (layout & AV_CH_SIDE_RIGHT ) channelLayout += AE_CH_SR ; -+// if (layout & AV_CH_TOP_CENTER ) channelLayout += AE_CH_TC ; -+// if (layout & AV_CH_TOP_FRONT_LEFT ) channelLayout += AE_CH_TFL ; -+// if (layout & AV_CH_TOP_FRONT_CENTER ) channelLayout += AE_CH_TFC ; -+// if (layout & AV_CH_TOP_FRONT_RIGHT ) channelLayout += AE_CH_TFR ; -+// if (layout & AV_CH_TOP_BACK_LEFT ) channelLayout += AE_CH_BL ; -+// if (layout & AV_CH_TOP_BACK_CENTER ) channelLayout += AE_CH_BC ; -+// if (layout & AV_CH_TOP_BACK_RIGHT ) channelLayout += AE_CH_BR ; -+// -+// return channelLayout; -+//} -+ -+AVSampleFormat CActiveAEResample::GetAVSampleFormat(AEDataFormat format) -+{ -+ if (format == AE_FMT_U8) return AV_SAMPLE_FMT_U8; -+ else if (format == AE_FMT_S16NE) return AV_SAMPLE_FMT_S16; -+ else if (format == AE_FMT_S32NE) return AV_SAMPLE_FMT_S32; -+ else if (format == AE_FMT_FLOAT) return AV_SAMPLE_FMT_FLT; -+ else if (format == AE_FMT_DOUBLE) return AV_SAMPLE_FMT_DBL; -+ -+ else if (format == AE_FMT_U8P) return AV_SAMPLE_FMT_U8P; -+ else if (format == AE_FMT_S16NEP) return AV_SAMPLE_FMT_S16P; -+ else if (format == AE_FMT_S32NEP) return AV_SAMPLE_FMT_S32P; -+ else if (format == AE_FMT_FLOATP) return AV_SAMPLE_FMT_FLTP; -+ else if (format == AE_FMT_DOUBLEP) return AV_SAMPLE_FMT_DBLP; -+ -+ return AV_SAMPLE_FMT_FLT; -+} -+ -+AEDataFormat CActiveAEResample::GetAESampleFormat(AVSampleFormat format) -+{ -+ if (format == AV_SAMPLE_FMT_U8) return AE_FMT_U8; -+ else if (format == AV_SAMPLE_FMT_S16) return AE_FMT_S16NE; -+ else if (format == AV_SAMPLE_FMT_S32) return AE_FMT_S32NE; -+ else if (format == AV_SAMPLE_FMT_FLT) return AE_FMT_FLOAT; -+ else if (format == AV_SAMPLE_FMT_DBL) return AE_FMT_DOUBLE; -+ -+ else if (format == AV_SAMPLE_FMT_U8P) return AE_FMT_U8P; -+ else if (format == AV_SAMPLE_FMT_S16P) return AE_FMT_S16NEP; -+ else if (format == AV_SAMPLE_FMT_S32P) return AE_FMT_S32NEP; -+ else if (format == AV_SAMPLE_FMT_FLTP) return AE_FMT_FLOATP; -+ else if (format == AV_SAMPLE_FMT_DBLP) return AE_FMT_DOUBLEP; -+ -+ CLog::Log(LOGERROR, "CActiveAEResample::GetAESampleFormat - format not supported"); -+ return AE_FMT_INVALID; -+} -+ -+uint64_t CActiveAEResample::GetAVChannel(enum AEChannel aechannel) -+{ -+ switch (aechannel) -+ { -+ case AE_CH_FL: return AV_CH_FRONT_LEFT; -+ case AE_CH_FR: return AV_CH_FRONT_RIGHT; -+ case AE_CH_FC: return AV_CH_FRONT_CENTER; -+ case AE_CH_LFE: return AV_CH_LOW_FREQUENCY; -+ case AE_CH_BL: return AV_CH_BACK_LEFT; -+ case AE_CH_BR: return AV_CH_BACK_RIGHT; -+ case AE_CH_FLOC: return AV_CH_FRONT_LEFT_OF_CENTER; -+ case AE_CH_FROC: return AV_CH_FRONT_RIGHT_OF_CENTER; -+ case AE_CH_BC: return AV_CH_BACK_CENTER; -+ case AE_CH_SL: return AV_CH_SIDE_LEFT; -+ case AE_CH_SR: return AV_CH_SIDE_RIGHT; -+ case AE_CH_TC: return AV_CH_TOP_CENTER; -+ case AE_CH_TFL: return AV_CH_TOP_FRONT_LEFT; -+ case AE_CH_TFC: return AV_CH_TOP_FRONT_CENTER; -+ case AE_CH_TFR: return AV_CH_TOP_FRONT_RIGHT; -+ case AE_CH_TBL: return AV_CH_TOP_BACK_LEFT; -+ case AE_CH_TBC: return AV_CH_TOP_BACK_CENTER; -+ case AE_CH_TBR: return AV_CH_TOP_BACK_RIGHT; -+ default: -+ return 0; -+ } -+} -+ -+int CActiveAEResample::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout) -+{ -+ return m_dllAvUtil.av_get_channel_layout_channel_index(layout, GetAVChannel(aechannel)); -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -new file mode 100644 -index 0000000..fa95a1d ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -@@ -0,0 +1,61 @@ -+#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 "DllAvUtil.h" -+#include "DllSwResample.h" -+#include "Utils/AEChannelInfo.h" -+#include "AEAudioFormat.h" -+#include "ActiveAEBuffer.h" -+ -+namespace ActiveAE -+{ -+ -+class CActiveAEResample -+{ -+public: -+ CActiveAEResample(); -+ virtual ~CActiveAEResample(); -+ bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout = NULL); -+ int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples); -+ int64_t GetDelay(int64_t base); -+ int GetBufferedSamples(); -+ int CalcDstSampleCount(int src_samples, int dst_rate, int src_rate); -+ int GetSrcBufferSize(int samples); -+ int GetDstBufferSize(int samples); -+ static uint64_t GetAVChannelLayout(CAEChannelInfo &info); -+// static CAEChannelInfo GetAEChannelLayout(uint64_t layout); -+ static AVSampleFormat GetAVSampleFormat(AEDataFormat format); -+ static AEDataFormat GetAESampleFormat(AVSampleFormat format); -+ static uint64_t GetAVChannel(enum AEChannel aechannel); -+ int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout); -+ -+protected: -+ DllAvUtil m_dllAvUtil; -+ DllSwResample m_dllSwResample; -+ uint64_t m_src_chan_layout, m_dst_chan_layout; -+ int m_src_rate, m_dst_rate; -+ int m_src_channels, m_dst_channels; -+ AVSampleFormat m_src_fmt, m_dst_fmt; -+ SwrContext *m_pContext; -+ double m_rematrix[AE_CH_MAX][AE_CH_MAX]; -+}; -+ -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -new file mode 100644 -index 0000000..c22bb88 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -@@ -0,0 +1,864 @@ -+/* -+ * 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 "ActiveAESink.h" -+#include "Utils/AEUtil.h" -+#include "utils/EndianSwap.h" -+#include "ActiveAE.h" -+ -+#include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" -+ -+using namespace ActiveAE; -+ -+CActiveAESink::CActiveAESink(CEvent *inMsgEvent) : -+ CThread("AESink"), -+ m_controlPort("SinkControlPort", inMsgEvent, &m_outMsgEvent), -+ m_dataPort("SinkDataPort", inMsgEvent, &m_outMsgEvent) -+{ -+ m_inMsgEvent = inMsgEvent; -+ m_sink = NULL; -+ m_stats = NULL; -+ m_convertBuffer = NULL; -+ m_volume = 0.0; -+} -+ -+void CActiveAESink::Start() -+{ -+ if (!IsRunning()) -+ { -+ Create(); -+ SetPriority(THREAD_PRIORITY_ABOVE_NORMAL); -+ } -+} -+ -+void CActiveAESink::Dispose() -+{ -+ m_bStop = true; -+ m_outMsgEvent.Set(); -+ StopThread(); -+ m_controlPort.Purge(); -+ m_dataPort.Purge(); -+ -+ if (m_sink) -+ { -+ m_sink->Drain(); -+ m_sink->Deinitialize(); -+ delete m_sink; -+ m_sink = NULL; -+ } -+ -+ delete m_sampleOfSilence.pkt; -+ m_sampleOfSilence.pkt = NULL; -+ -+ delete m_sampleOfNoise.pkt; -+ m_sampleOfNoise.pkt = NULL; -+ -+ if (m_convertBuffer) -+ { -+ _aligned_free(m_convertBuffer); -+ m_convertBuffer = NULL; -+ } -+} -+ -+bool CActiveAESink::IsCompatible(const AEAudioFormat format, const std::string &device) -+{ -+ if (!m_sink) -+ return false; -+ return m_sink->IsCompatible(format, device); -+} -+ -+bool CActiveAESink::HasVolume() -+{ -+ if (!m_sink) -+ return false; -+ return m_sink->HasVolume(); -+} -+ -+enum SINK_STATES -+{ -+ S_TOP = 0, // 0 -+ S_TOP_UNCONFIGURED, // 1 -+ S_TOP_CONFIGURED, // 2 -+ S_TOP_CONFIGURED_SUSPEND, // 3 -+ S_TOP_CONFIGURED_IDLE, // 4 -+ S_TOP_CONFIGURED_PLAY, // 5 -+ S_TOP_CONFIGURED_SILENCE, // 6 -+ S_TOP_CONFIGURED_WARMUP, // 7 -+}; -+ -+int SINK_parentStates[] = { -+ -1, -+ 0, //TOP_UNCONFIGURED -+ 0, //TOP_CONFIGURED -+ 2, //TOP_CONFIGURED_SUSPEND -+ 2, //TOP_CONFIGURED_IDLE -+ 2, //TOP_CONFIGURED_PLAY -+ 2, //TOP_CONFIGURED_SILENCE -+ 2, //TOP_CONFIGURED_WARMUP -+}; -+ -+void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg) -+{ -+ for (int state = m_state; ; state = SINK_parentStates[state]) -+ { -+ switch (state) -+ { -+ case S_TOP: // TOP -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::CONFIGURE: -+ SinkConfig *data; -+ data = (SinkConfig*)msg->data; -+ if (data) -+ { -+ m_requestedFormat = data->format; -+ m_stats = data->stats; -+ } -+ m_extError = false; -+ m_extSilence = false; -+ ReturnBuffers(); -+ OpenSink(); -+ -+ if (!m_extError) -+ { -+ m_stats->SetSinkCacheTotal(m_sink->GetCacheTotal()); -+ m_state = S_TOP_CONFIGURED_IDLE; -+ m_extTimeout = 10000; -+ msg->Reply(CSinkControlProtocol::ACC, &m_sinkFormat, sizeof(AEAudioFormat)); -+ } -+ else -+ { -+ m_state = S_TOP_UNCONFIGURED; -+ msg->Reply(CSinkControlProtocol::ERR); -+ } -+ return; -+ -+ case CSinkControlProtocol::UNCONFIGURE: -+ ReturnBuffers(); -+ if (m_sink) -+ { -+ m_sink->Drain(); -+ m_sink->Deinitialize(); -+ delete m_sink; -+ m_sink = NULL; -+ } -+ m_state = S_TOP_UNCONFIGURED; -+ msg->Reply(CSinkControlProtocol::ACC); -+ return; -+ -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CSinkDataProtocol::DRAIN: -+ msg->Reply(CSinkDataProtocol::ACC); -+ m_state = S_TOP_UNCONFIGURED; -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ { -+ std::string portName = port == NULL ? "timer" : port->portName; -+ CLog::Log(LOGWARNING, "CActiveAESink::%s - signal: %d form port: %s not handled for state: %d", __FUNCTION__, signal, portName.c_str(), m_state); -+ } -+ return; -+ -+ case S_TOP_UNCONFIGURED: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::TIMEOUT: -+ m_extTimeout = 1000; -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CSinkDataProtocol::SAMPLE: -+ CSampleBuffer *samples; -+ int timeout; -+ samples = *((CSampleBuffer**)msg->data); -+ timeout = 1000*samples->pkt->nb_samples/samples->pkt->config.sample_rate; -+ Sleep(timeout); -+ msg->Reply(CSinkDataProtocol::RETURNSAMPLE, &samples, sizeof(CSampleBuffer*)); -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case S_TOP_CONFIGURED: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::SILENCEMODE: -+ m_extSilence = *(bool*)msg->data; -+ if (g_advancedSettings.m_streamSilence) -+ m_extSilence = true; -+ if (m_extSilence) -+ { -+ m_extCycleCounter = 5; -+ m_state = S_TOP_CONFIGURED_WARMUP; -+ m_extTimeout = 0; -+ } -+ return; -+ case CSinkControlProtocol::VOLUME: -+ m_volume = *(float*)msg->data; -+ m_sink->SetVolume(m_volume); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CSinkDataProtocol::DRAIN: -+ m_sink->Drain(); -+ msg->Reply(CSinkDataProtocol::ACC); -+ m_state = S_TOP_CONFIGURED_IDLE; -+ m_extTimeout = 10000; -+ return; -+ case CSinkDataProtocol::SAMPLE: -+ CSampleBuffer *samples; -+ unsigned int delay; -+ samples = *((CSampleBuffer**)msg->data); -+ delay = OutputSamples(samples); -+ msg->Reply(CSinkDataProtocol::RETURNSAMPLE, &samples, sizeof(CSampleBuffer*)); -+ if (m_extError) -+ { -+ m_sink->Deinitialize(); -+ delete m_sink; -+ m_sink = NULL; -+ m_state = S_TOP_CONFIGURED_SUSPEND; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_state = S_TOP_CONFIGURED_PLAY; -+ m_extTimeout = delay / 2; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case S_TOP_CONFIGURED_SUSPEND: -+ if (port == &m_controlPort) -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::SILENCEMODE: -+ return; -+ case CSinkControlProtocol::VOLUME: -+ m_volume = *(float*)msg->data; -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CSinkDataProtocol::SAMPLE: -+ m_extError = false; -+ OpenSink(); -+ OutputSamples(&m_sampleOfNoise); -+ m_state = S_TOP_CONFIGURED_PLAY; -+ m_extTimeout = 0; -+ m_bStateMachineSelfTrigger = true; -+ return; -+ case CSinkDataProtocol::DRAIN: -+ msg->Reply(CSinkDataProtocol::ACC); -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::TIMEOUT: -+ m_extTimeout = 10000; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case S_TOP_CONFIGURED_IDLE: -+ if (port == &m_dataPort) -+ { -+ switch (signal) -+ { -+ case CSinkDataProtocol::SAMPLE: -+ OutputSamples(&m_sampleOfNoise); -+ m_state = S_TOP_CONFIGURED_PLAY; -+ m_extTimeout = 0; -+ m_bStateMachineSelfTrigger = true; -+ return; -+ default: -+ break; -+ } -+ } -+ else if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::TIMEOUT: -+ m_sink->Deinitialize(); -+ delete m_sink; -+ m_sink = NULL; -+ m_state = S_TOP_CONFIGURED_SUSPEND; -+ m_extTimeout = 10000; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case S_TOP_CONFIGURED_PLAY: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::TIMEOUT: -+ if (m_extSilence) -+ { -+ m_state = S_TOP_CONFIGURED_SILENCE; -+ m_extTimeout = 0; -+ } -+ else -+ { -+ m_sink->Drain(); -+ m_state = S_TOP_CONFIGURED_IDLE; -+ m_extTimeout = 10000; -+ } -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case S_TOP_CONFIGURED_SILENCE: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::TIMEOUT: -+ unsigned int delay; -+ delay = OutputSamples(&m_sampleOfSilence); -+ m_extCycleCounter--; -+ if (m_extError) -+ { -+ m_sink->Deinitialize(); -+ delete m_sink; -+ m_sink = NULL; -+ m_state = S_TOP_CONFIGURED_SUSPEND; -+ } -+ else if(m_extCycleCounter <= 0) -+ { -+ m_extCycleCounter = 2; -+ m_state = S_TOP_CONFIGURED_WARMUP; -+ } -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ case S_TOP_CONFIGURED_WARMUP: -+ if (port == NULL) // timeout -+ { -+ switch (signal) -+ { -+ case CSinkControlProtocol::TIMEOUT: -+ unsigned int delay; -+ delay = OutputSamples(&m_sampleOfNoise); -+ m_extCycleCounter--; -+ if (m_extError) -+ { -+ m_sink->Deinitialize(); -+ delete m_sink; -+ m_sink = NULL; -+ m_state = S_TOP_CONFIGURED_SUSPEND; -+ } -+ else if(m_extCycleCounter <= 0) -+ { -+ m_extCycleCounter = 20; -+ m_state = S_TOP_CONFIGURED_SILENCE; -+ } -+ m_extTimeout = 0; -+ return; -+ default: -+ break; -+ } -+ } -+ break; -+ -+ default: // we are in no state, should not happen -+ CLog::Log(LOGERROR, "CActiveSink::%s - no valid state: %d", __FUNCTION__, m_state); -+ return; -+ } -+ } // for -+} -+ -+void CActiveAESink::Process() -+{ -+ Message *msg = NULL; -+ Protocol *port = NULL; -+ bool gotMsg; -+ -+ m_state = S_TOP_UNCONFIGURED; -+ m_extTimeout = 1000; -+ m_bStateMachineSelfTrigger = false; -+ -+ while (!m_bStop) -+ { -+ gotMsg = false; -+ -+ if (m_bStateMachineSelfTrigger) -+ { -+ m_bStateMachineSelfTrigger = false; -+ // self trigger state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ // check control port -+ else if (m_controlPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_controlPort; -+ } -+ // check data port -+ else if (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ gotMsg = true; -+ port = &m_dataPort; -+ } -+ -+ if (gotMsg) -+ { -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ continue; -+ } -+ -+ // wait for message -+ else if (m_outMsgEvent.WaitMSec(m_extTimeout)) -+ { -+ continue; -+ } -+ // time out -+ else -+ { -+ msg = m_controlPort.GetMessage(); -+ msg->signal = CSinkControlProtocol::TIMEOUT; -+ port = 0; -+ // signal timeout to state machine -+ StateMachine(msg->signal, port, msg); -+ if (!m_bStateMachineSelfTrigger) -+ { -+ msg->Release(); -+ msg = NULL; -+ } -+ } -+ } -+} -+ -+void CActiveAESink::EnumerateSinkList() -+{ -+ unsigned int c_retry = 5; -+ m_sinkInfoList.clear(); -+ 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(); -+} -+ -+void CActiveAESink::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()); -+ } -+ } -+} -+ -+void CActiveAESink::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 CActiveAESink::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"; -+} -+ -+void CActiveAESink::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 CActiveAESink::OpenSink() -+{ -+ std::string device, driver; -+ bool passthrough = AE_IS_RAW(m_requestedFormat.m_dataFormat); -+ if (passthrough) -+ device = CSettings::Get().GetString("audiooutput.passthroughdevice"); -+ else -+ device = CSettings::Get().GetString("audiooutput.audiodevice"); -+ -+ CAESinkFactory::ParseDevice(device, driver); -+ if (driver.empty() && m_sink) -+ driver = m_sink->GetName(); -+ -+ 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(m_requestedFormat, device)) -+ { -+ CLog::Log(LOGINFO, "CActiveAE::OpenSink - sink incompatible, re-starting"); -+ -+ if (m_sink) -+ { -+ m_sink->Drain(); -+ m_sink->Deinitialize(); -+ delete m_sink; -+ m_sink = NULL; -+ } -+ -+ // 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; -+ -+ // WARNING: this changes format and does not use passthrough -+ m_sinkFormat = m_requestedFormat; -+ m_sink = CAESinkFactory::Create(device, m_sinkFormat, passthrough); -+ -+ if (!m_sink) -+ { -+ m_extError = true; -+ return; -+ } -+ -+ m_sink->SetVolume(m_volume); -+ -+#ifdef WORDS_BIGENDIAN -+ if (m_sinkFormat.m_dataFormat == AE_FMT_S16BE) -+ m_sinkFormat.m_dataFormat = AE_FMT_S16NE; -+ else if (m_sinkFormat.m_dataFormat == AE_FMT_S32BE) -+ m_sinkFormat.m_dataFormat = AE_FMT_S32NE; -+#else -+ if (m_sinkFormat.m_dataFormat == AE_FMT_S16LE) -+ m_sinkFormat.m_dataFormat = AE_FMT_S16NE; -+ else if (m_sinkFormat.m_dataFormat == AE_FMT_S32LE) -+ m_sinkFormat.m_dataFormat = AE_FMT_S32NE; -+#endif -+ -+ CLog::Log(LOGDEBUG, "CActiveAE::OpenSink - %s Initialized:", m_sink->GetName()); -+ CLog::Log(LOGDEBUG, " Output Device : %s", m_deviceFriendlyName.c_str()); -+ CLog::Log(LOGDEBUG, " Sample Rate : %d", m_sinkFormat.m_sampleRate); -+ CLog::Log(LOGDEBUG, " Sample Format : %s", CAEUtil::DataFormatToStr(m_sinkFormat.m_dataFormat)); -+ CLog::Log(LOGDEBUG, " Channel Count : %d", m_sinkFormat.m_channelLayout.Count()); -+ CLog::Log(LOGDEBUG, " Channel Layout: %s", ((std::string)m_sinkFormat.m_channelLayout).c_str()); -+ CLog::Log(LOGDEBUG, " Frames : %d", m_sinkFormat.m_frames); -+ CLog::Log(LOGDEBUG, " Frame Samples : %d", m_sinkFormat.m_frameSamples); -+ CLog::Log(LOGDEBUG, " Frame Size : %d", m_sinkFormat.m_frameSize); -+ } -+ else -+ CLog::Log(LOGINFO, "CActiveAE::OpenSink - keeping old sink with : %s, %s, %dhz", -+ CAEUtil::DataFormatToStr(m_sinkFormat.m_dataFormat), -+ ((std::string)m_sinkFormat.m_channelLayout).c_str(), -+ m_sinkFormat.m_sampleRate); -+ -+ // init sample of silence -+ SampleConfig config; -+ config.fmt = CActiveAEResample::GetAVSampleFormat(m_sinkFormat.m_dataFormat); -+ config.channel_layout = CActiveAEResample::GetAVChannelLayout(m_sinkFormat.m_channelLayout); -+ config.channels = m_sinkFormat.m_channelLayout.Count(); -+ config.sample_rate = m_sinkFormat.m_sampleRate; -+ delete m_sampleOfSilence.pkt; -+ m_sampleOfSilence.pkt = new CSoundPacket(config, m_sinkFormat.m_frames); -+ m_sampleOfSilence.pkt->nb_samples = m_sampleOfSilence.pkt->max_nb_samples; -+ -+ // init sample of noise -+ delete m_sampleOfNoise.pkt; -+ m_sampleOfNoise.pkt = new CSoundPacket(config, m_sinkFormat.m_frames); -+ m_sampleOfNoise.pkt->nb_samples = m_sampleOfNoise.pkt->max_nb_samples; -+ if (!passthrough) -+ GenerateNoise(); -+ -+ if (m_convertBuffer) -+ { -+ _aligned_free(m_convertBuffer); -+ m_convertBuffer = NULL; -+ } -+ m_convertFn = NULL; -+ m_convertState = CHECK_CONVERT; -+} -+ -+void CActiveAESink::ReturnBuffers() -+{ -+ Message *msg = NULL; -+ CSampleBuffer *samples; -+ while (m_dataPort.ReceiveOutMessage(&msg)) -+ { -+ if (msg->signal == CSinkDataProtocol::SAMPLE) -+ { -+ samples = *((CSampleBuffer**)msg->data); -+ msg->Reply(CSinkDataProtocol::RETURNSAMPLE, &samples, sizeof(CSampleBuffer*)); -+ } -+ } -+} -+ -+unsigned int CActiveAESink::OutputSamples(CSampleBuffer* samples) -+{ -+ uint8_t *buffer = samples->pkt->data[0]; -+ unsigned int frames = samples->pkt->nb_samples; -+ unsigned int maxFrames; -+ int retry = 0; -+ int written = 0; -+ double sinkDelay = 0.0; -+ -+ switch(m_convertState) -+ { -+ case SKIP_CONVERT: -+ break; -+ case NEED_CONVERT: -+ EnsureConvertBuffer(samples); -+ buffer = Convert(samples); -+ break; -+ case NEED_BYTESWAP: -+ Endian_Swap16_buf((uint16_t *)buffer, (uint16_t *)buffer, frames * samples->pkt->config.channels); -+ break; -+ case CHECK_CONVERT: -+ ConvertInit(samples); -+ if (m_convertState == NEED_CONVERT) -+ buffer = Convert(samples); -+ else if (m_convertState == NEED_BYTESWAP) -+ Endian_Swap16_buf((uint16_t *)buffer, (uint16_t *)buffer, frames * samples->pkt->config.channels); -+ break; -+ default: -+ break; -+ } -+ -+ while(frames > 0) -+ { -+ maxFrames = std::min(frames, m_sinkFormat.m_frames); -+ written = m_sink->AddPackets(buffer, maxFrames, true, true); -+ if (written == 0) -+ { -+ Sleep(500*m_sinkFormat.m_frames/m_sinkFormat.m_sampleRate); -+ retry++; -+ if (retry > 4) -+ { -+ m_extError = true; -+ CLog::Log(LOGERROR, "CActiveAESink::OutputSamples - failed"); -+ return 0; -+ } -+ else -+ continue; -+ } -+ frames -= written; -+ buffer += written*m_sinkFormat.m_frameSize; -+ sinkDelay = m_sink->GetDelay(); -+ m_stats->UpdateSinkDelay(sinkDelay, samples->pool ? written : 0); -+ } -+ return sinkDelay*1000; -+} -+ -+void CActiveAESink::ConvertInit(CSampleBuffer* samples) -+{ -+ if (CActiveAEResample::GetAESampleFormat(samples->pkt->config.fmt) != m_sinkFormat.m_dataFormat) -+ { -+ m_convertFn = CAEConvert::FrFloat(m_sinkFormat.m_dataFormat); -+ if (m_convertBuffer) -+ _aligned_free(m_convertBuffer); -+ m_convertBufferSampleSize = samples->pkt->max_nb_samples; -+ m_convertBuffer = (uint8_t*)_aligned_malloc(samples->pkt->max_nb_samples * m_sinkFormat.m_channelLayout.Count() * m_sinkFormat.m_frameSize, 16); -+ memset(m_convertBuffer, 0, samples->pkt->max_nb_samples * m_sinkFormat.m_channelLayout.Count() * m_sinkFormat.m_frameSize); -+ m_convertState = NEED_CONVERT; -+ } -+ else if (AE_IS_RAW(m_requestedFormat.m_dataFormat) && CAEUtil::S16NeedsByteSwap(AE_FMT_S16NE, m_sinkFormat.m_dataFormat)) -+ { -+ m_convertState = NEED_BYTESWAP; -+ } -+ else -+ m_convertState = SKIP_CONVERT; -+} -+ -+void CActiveAESink::EnsureConvertBuffer(CSampleBuffer* samples) -+{ -+ if (!m_convertBuffer) -+ return; -+ -+ if (samples->pkt->max_nb_samples <= m_convertBufferSampleSize) -+ return; -+ -+ _aligned_free(m_convertBuffer); -+ m_convertBufferSampleSize = samples->pkt->max_nb_samples; -+ m_convertBuffer = (uint8_t*)_aligned_malloc(samples->pkt->max_nb_samples * m_sinkFormat.m_channelLayout.Count() * m_sinkFormat.m_frameSize, 16); -+ memset(m_convertBuffer, 0, samples->pkt->max_nb_samples * m_sinkFormat.m_channelLayout.Count() * m_sinkFormat.m_frameSize); -+} -+ -+uint8_t* CActiveAESink::Convert(CSampleBuffer* samples) -+{ -+ unsigned int nb_samples = m_convertFn((float*)samples->pkt->data[0], samples->pkt->nb_samples * samples->pkt->config.channels, m_convertBuffer); -+ return m_convertBuffer; -+} -+ -+#define PI 3.1415926536f -+ -+void CActiveAESink::GenerateNoise() -+{ -+ int nb_floats = m_sinkFormat.m_frames*m_sinkFormat.m_channelLayout.Count(); -+ float *noise = new float[nb_floats]; -+ -+ float R1, R2; -+ for(int i=0; iconfig.fmt); -+ CAEConvert::AEConvertFrFn convertFn = CAEConvert::FrFloat(fmt); -+ convertFn(noise, nb_floats, m_sampleOfNoise.pkt->data[0]); -+ delete [] noise; -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -new file mode 100644 -index 0000000..559179c ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h -@@ -0,0 +1,138 @@ -+#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 "threads/Event.h" -+#include "threads/Thread.h" -+#include "utils/ActorProtocol.h" -+#include "Interfaces/AE.h" -+#include "Interfaces/AESink.h" -+#include "AESinkFactory.h" -+#include "ActiveAEResample.h" -+#include "Utils/AEConvert.h" -+ -+namespace ActiveAE -+{ -+using namespace Actor; -+ -+class CEngineStats; -+ -+struct SinkConfig -+{ -+ AEAudioFormat format; -+ CEngineStats *stats; -+}; -+ -+class CSinkControlProtocol : public Protocol -+{ -+public: -+ CSinkControlProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ CONFIGURE, -+ UNCONFIGURE, -+ SILENCEMODE, -+ VOLUME, -+ TIMEOUT, -+ }; -+ enum InSignal -+ { -+ ACC, -+ ERR, -+ STATS, -+ }; -+}; -+ -+class CSinkDataProtocol : public Protocol -+{ -+public: -+ CSinkDataProtocol(std::string name, CEvent* inEvent, CEvent *outEvent) : Protocol(name, inEvent, outEvent) {}; -+ enum OutSignal -+ { -+ SAMPLE = 0, -+ DRAIN, -+ }; -+ enum InSignal -+ { -+ RETURNSAMPLE, -+ ACC, -+ }; -+}; -+ -+class CActiveAESink : private CThread -+{ -+public: -+ CActiveAESink(CEvent *inMsgEvent); -+ void EnumerateSinkList(); -+ void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); -+ std::string GetDefaultDevice(bool passthrough); -+ void Start(); -+ void Dispose(); -+ bool IsCompatible(const AEAudioFormat format, const std::string &device); -+ bool HasVolume(); -+ CSinkControlProtocol m_controlPort; -+ CSinkDataProtocol m_dataPort; -+ -+protected: -+ void Process(); -+ void StateMachine(int signal, Protocol *port, Message *msg); -+ void PrintSinks(); -+ void GetDeviceFriendlyName(std::string &device); -+ void OpenSink(); -+ void ReturnBuffers(); -+ -+ unsigned int OutputSamples(CSampleBuffer* samples); -+ void ConvertInit(CSampleBuffer* samples); -+ inline void EnsureConvertBuffer(CSampleBuffer* samples); -+ inline uint8_t* Convert(CSampleBuffer* samples); -+ -+ void GenerateNoise(); -+ -+ CEvent m_outMsgEvent; -+ CEvent *m_inMsgEvent; -+ int m_state; -+ bool m_bStateMachineSelfTrigger; -+ int m_extTimeout; -+ bool m_extError; -+ bool m_extSilence; -+ int m_extCycleCounter; -+ -+ CSampleBuffer m_sampleOfSilence; -+ CSampleBuffer m_sampleOfNoise; -+ uint8_t *m_convertBuffer; -+ int m_convertBufferSampleSize; -+ CAEConvert::AEConvertFrFn m_convertFn; -+ enum -+ { -+ CHECK_CONVERT, -+ NEED_CONVERT, -+ NEED_BYTESWAP, -+ SKIP_CONVERT, -+ } m_convertState; -+ -+ std::string m_deviceFriendlyName; -+ AESinkInfoList m_sinkInfoList; -+ IAESink *m_sink; -+ AEAudioFormat m_sinkFormat, m_requestedFormat; -+ CEngineStats *m_stats; -+ float m_volume; -+}; -+ -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.cpp -new file mode 100644 -index 0000000..fb75ba9 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.cpp -@@ -0,0 +1,161 @@ -+/* -+ * 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 "AEFactory.h" -+#include "AEAudioFormat.h" -+#include "ActiveAE.h" -+#include "ActiveAESound.h" -+#include "utils/log.h" -+#include "DllAvUtil.h" -+ -+using namespace ActiveAE; -+using namespace XFILE; -+ -+/* typecast AE to CActiveAE */ -+#define AE (*((CActiveAE*)CAEFactory::GetEngine())) -+ -+CActiveAESound::CActiveAESound(const std::string &filename) : -+ IAESound (filename), -+ m_filename (filename), -+ m_volume (1.0f ) -+{ -+ m_orig_sound = NULL; -+ m_dst_sound = NULL; -+ m_pFile = NULL; -+} -+ -+CActiveAESound::~CActiveAESound() -+{ -+ delete m_orig_sound; -+ delete m_dst_sound; -+ Finish(); -+} -+ -+void CActiveAESound::Play() -+{ -+ AE.PlaySound(this); -+} -+ -+void CActiveAESound::Stop() -+{ -+ AE.StopSound(this); -+} -+ -+bool CActiveAESound::IsPlaying() -+{ -+ // TODO -+ return false; -+} -+ -+uint8_t** CActiveAESound::InitSound(bool orig, SampleConfig config, int nb_samples) -+{ -+ CSoundPacket **info; -+ if (orig) -+ info = &m_orig_sound; -+ else -+ info = &m_dst_sound; -+ -+ delete *info; -+ *info = new CSoundPacket(config, nb_samples); -+ -+ (*info)->nb_samples = 0; -+ m_isConverted = false; -+ return (*info)->data; -+} -+ -+bool CActiveAESound::StoreSound(bool orig, uint8_t **buffer, int samples, int linesize) -+{ -+ CSoundPacket **info; -+ if (orig) -+ info = &m_orig_sound; -+ else -+ info = &m_dst_sound; -+ -+ if ((*info)->nb_samples + samples > (*info)->max_nb_samples) -+ { -+ CLog::Log(LOGERROR, "CActiveAESound::StoreSound - exceeded max samples"); -+ return false; -+ } -+ -+ int bytes_to_copy = samples * (*info)->bytes_per_sample * (*info)->config.channels; -+ bytes_to_copy /= (*info)->planes; -+ int start = (*info)->nb_samples * (*info)->bytes_per_sample * (*info)->config.channels; -+ start /= (*info)->planes; -+ -+ for (int i=0; i<(*info)->planes; i++) -+ { -+ memcpy((*info)->data[i]+start, buffer[i], bytes_to_copy); -+ } -+ (*info)->nb_samples += samples; -+ -+ return true; -+} -+ -+CSoundPacket *CActiveAESound::GetSound(bool orig) -+{ -+ if (orig) -+ return m_orig_sound; -+ else -+ return m_dst_sound; -+} -+ -+bool CActiveAESound::Prepare() -+{ -+ unsigned int flags = READ_TRUNCATED | READ_CHUNKED; -+ m_pFile = new CFile(); -+ -+ if (!m_pFile->Open(m_filename, flags)) -+ { -+ delete m_pFile; -+ m_pFile = NULL; -+ return false; -+ } -+ m_isSeekPosible = m_pFile->IoControl(IOCTRL_SEEK_POSSIBLE, NULL) != 0; -+ m_fileSize = m_pFile->GetLength(); -+ return true; -+} -+ -+void CActiveAESound::Finish() -+{ -+ delete m_pFile; -+ m_pFile = NULL; -+} -+ -+int CActiveAESound::GetChunkSize() -+{ -+ return m_pFile->GetChunkSize(); -+} -+ -+int CActiveAESound::Read(void *h, uint8_t* buf, int size) -+{ -+ CFile *pFile = static_cast(h)->m_pFile; -+ return pFile->Read(buf, size); -+} -+ -+offset_t CActiveAESound::Seek(void *h, offset_t pos, int whence) -+{ -+ CFile* pFile = static_cast(h)->m_pFile; -+ if(whence == AVSEEK_SIZE) -+ return pFile->GetLength(); -+ else -+ return pFile->Seek(pos, whence & ~AVSEEK_FORCE); -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h -new file mode 100644 -index 0000000..7cdf76c ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h -@@ -0,0 +1,73 @@ -+#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 "Interfaces/AESound.h" -+#include "ActiveAEResample.h" -+#include "filesystem/File.h" -+ -+class DllAvUtil; -+ -+namespace ActiveAE -+{ -+ -+class CActiveAESound : public IAESound -+{ -+public: -+ CActiveAESound (const std::string &filename); -+ virtual ~CActiveAESound(); -+ -+ 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; } -+ -+ uint8_t** InitSound(bool orig, SampleConfig config, int nb_samples); -+ bool StoreSound(bool orig, uint8_t **buffer, int samples, int linesize); -+ CSoundPacket *GetSound(bool orig); -+ -+ bool IsConverted() { return m_isConverted; } -+ void SetConverted(bool state) { m_isConverted = state; } -+ -+ bool Prepare(); -+ void Finish(); -+ int GetChunkSize(); -+ int GetFileSize() { return m_fileSize; } -+ bool IsSeekPosible() { return m_isSeekPosible; } -+ -+ static int Read(void *h, uint8_t* buf, int size); -+ static offset_t Seek(void *h, offset_t pos, int whence); -+ -+protected: -+ std::string m_filename; -+ XFILE::CFile *m_pFile; -+ bool m_isSeekPosible; -+ int m_fileSize; -+ float m_volume; -+ -+ CSoundPacket *m_orig_sound; -+ CSoundPacket *m_dst_sound; -+ -+ bool m_isConverted; -+}; -+} -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -new file mode 100644 -index 0000000..66f62b7 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -@@ -0,0 +1,362 @@ -+/* -+ * 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 "ActiveAE.h" -+#include "ActiveAEStream.h" -+ -+using namespace ActiveAE; -+ -+/* typecast AE to CActiveAE */ -+#define AE (*((CActiveAE*)CAEFactory::GetEngine())) -+ -+ -+CActiveAEStream::CActiveAEStream(AEAudioFormat *format) -+{ -+ m_format = *format; -+ m_bufferedTime = 0; -+ m_currentBuffer = NULL; -+ m_drain = false; -+ m_paused = false; -+ m_rgain = 1.0; -+ m_volume = 1.0; -+ m_streamSpace = m_format.m_frameSize * m_format.m_frames; -+ m_streamDraining = false; -+ m_streamDrained = false; -+ m_streamFading = false; -+ m_streamFreeBuffers = 0; -+ m_streamIsBuffering = true; -+ m_streamSlave = NULL; -+ m_convertFn = NULL; -+} -+ -+CActiveAEStream::~CActiveAEStream() -+{ -+} -+ -+void CActiveAEStream::IncFreeBuffers() -+{ -+ CSingleLock lock(m_streamLock); -+ m_streamFreeBuffers++; -+} -+ -+void CActiveAEStream::DecFreeBuffers() -+{ -+ CSingleLock lock(m_streamLock); -+ m_streamFreeBuffers--; -+} -+ -+void CActiveAEStream::ResetFreeBuffers() -+{ -+ CSingleLock lock(m_streamLock); -+ m_streamFreeBuffers = 0; -+} -+ -+unsigned int CActiveAEStream::GetSpace() -+{ -+ CSingleLock lock(m_streamLock); -+ return m_streamFreeBuffers * m_streamSpace; -+} -+ -+unsigned int CActiveAEStream::AddData(void *data, unsigned int size) -+{ -+ Message *msg; -+ unsigned int copied = 0; -+ int bytesToCopy = size; -+ while(copied < size) -+ { -+ if (m_currentBuffer) -+ { -+ int start = m_currentBuffer->pkt->nb_samples * -+ m_currentBuffer->pkt->bytes_per_sample * -+ m_currentBuffer->pkt->config.channels / -+ m_currentBuffer->pkt->planes; -+ -+ int freeSamples = m_currentBuffer->pkt->max_nb_samples - m_currentBuffer->pkt->nb_samples; -+ int availableSamples = bytesToCopy / m_format.m_frameSize; -+ int space = freeSamples * m_currentBuffer->pkt->bytes_per_sample * m_currentBuffer->pkt->config.channels; -+ int samples = std::min(freeSamples, availableSamples); -+ int bytes = samples * m_format.m_frameSize; -+ //TODO: handle planar formats -+ if (m_convertFn) -+ m_convertFn((uint8_t*)data+copied, samples*m_currentBuffer->pkt->config.channels, (float*)(m_currentBuffer->pkt->data[0] + start)); -+ else -+ memcpy(m_currentBuffer->pkt->data[0] + start, (uint8_t*)data+copied, bytes); -+ { -+ CSingleLock lock(*m_statsLock); -+ m_currentBuffer->pkt->nb_samples += samples; -+ m_bufferedTime += (double)samples / m_currentBuffer->pkt->config.sample_rate; -+ } -+ copied += bytes; -+ bytesToCopy -= bytes; -+ if (m_currentBuffer->pkt->nb_samples == m_currentBuffer->pkt->max_nb_samples) -+ { -+ MsgStreamSample msgData; -+ msgData.buffer = m_currentBuffer; -+ msgData.stream = this; -+ m_streamPort->SendOutMessage(CActiveAEDataProtocol::STREAMSAMPLE, &msgData, sizeof(MsgStreamSample)); -+ m_currentBuffer = NULL; -+ } -+ continue; -+ } -+ else if (m_streamPort->ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == CActiveAEDataProtocol::STREAMBUFFER) -+ { -+ m_currentBuffer = *((CSampleBuffer**)msg->data); -+ msg->Release(); -+ DecFreeBuffers(); -+ continue; -+ } -+ else -+ { -+ CLog::Log(LOGERROR, "CActiveAEStream::AddData - unknown signal"); -+ msg->Release(); -+ break; -+ } -+ } -+ if (!m_inMsgEvent.WaitMSec(200)) -+ break; -+ } -+ return copied; -+} -+ -+double CActiveAEStream::GetDelay() -+{ -+ return AE.GetDelay(this); -+} -+ -+bool CActiveAEStream::IsBuffering() -+{ -+ CSingleLock lock(m_streamLock); -+ return m_streamIsBuffering; -+} -+ -+double CActiveAEStream::GetCacheTime() -+{ -+ return AE.GetCacheTime(this); -+} -+ -+double CActiveAEStream::GetCacheTotal() -+{ -+ return AE.GetCacheTotal(this); -+} -+ -+void CActiveAEStream::Pause() -+{ -+ AE.PauseStream(this, true); -+} -+ -+void CActiveAEStream::Resume() -+{ -+ AE.PauseStream(this, false); -+} -+ -+void CActiveAEStream::Drain(bool wait) -+{ -+ Message *msg; -+ CActiveAEStream *stream = this; -+ -+ m_streamDraining = true; -+ m_streamDrained = false; -+ -+ Message *reply; -+ if (m_streamPort->SendOutMessageSync(CActiveAEDataProtocol::DRAINSTREAM, -+ &reply,2000, -+ &stream, sizeof(CActiveAEStream*))) -+ { -+ bool success = reply->signal == CActiveAEDataProtocol::ACC ? true : false; -+ reply->Release(); -+ if (!success) -+ { -+ CLog::Log(LOGERROR, "CActiveAEStream::Drain - no acc"); -+ } -+ } -+ -+ if (m_currentBuffer) -+ { -+ MsgStreamSample msgData; -+ msgData.buffer = m_currentBuffer; -+ msgData.stream = this; -+ m_streamPort->SendOutMessage(CActiveAEDataProtocol::STREAMSAMPLE, &msgData, sizeof(MsgStreamSample)); -+ m_currentBuffer = NULL; -+ } -+ -+ XbmcThreads::EndTime timer(2000); -+ while (!timer.IsTimePast()) -+ { -+ if (m_streamPort->ReceiveInMessage(&msg)) -+ { -+ if (msg->signal == CActiveAEDataProtocol::STREAMBUFFER) -+ { -+ MsgStreamSample msgData; -+ msgData.stream = this; -+ msgData.buffer = *((CSampleBuffer**)msg->data); -+ msg->Reply(CActiveAEDataProtocol::STREAMSAMPLE, &msgData, sizeof(MsgStreamSample)); -+ DecFreeBuffers(); -+ continue; -+ } -+ else if (msg->signal == CActiveAEDataProtocol::STREAMDRAINED) -+ { -+ msg->Release(); -+ return; -+ } -+ } -+ else if (!wait) -+ return; -+ -+ m_inMsgEvent.WaitMSec(timer.MillisLeft()); -+ } -+ CLog::Log(LOGERROR, "CActiveAEStream::Drain - timeout out"); -+} -+ -+bool CActiveAEStream::IsDraining() -+{ -+ CSingleLock lock(m_streamLock); -+ return m_streamDraining; -+} -+ -+bool CActiveAEStream::IsDrained() -+{ -+ CSingleLock lock(m_streamLock); -+ return m_streamDrained; -+} -+ -+void CActiveAEStream::Flush() -+{ -+ if (m_currentBuffer) -+ { -+ MsgStreamSample msgData; -+ m_currentBuffer->pkt->nb_samples = 0; -+ msgData.buffer = m_currentBuffer; -+ msgData.stream = this; -+ m_streamPort->SendOutMessage(CActiveAEDataProtocol::STREAMSAMPLE, &msgData, sizeof(MsgStreamSample)); -+ m_currentBuffer = NULL; -+ } -+ AE.FlushStream(this); -+ ResetFreeBuffers(); -+} -+ -+float CActiveAEStream::GetAmplification() -+{ -+ return m_streamAmplify; -+} -+ -+void CActiveAEStream::SetAmplification(float amplify) -+{ -+ m_streamAmplify = amplify; -+ AE.SetStreamAmplification(this, m_streamAmplify); -+} -+ -+float CActiveAEStream::GetReplayGain() -+{ -+ return m_streamRgain; -+} -+ -+void CActiveAEStream::SetReplayGain(float factor) -+{ -+ m_streamRgain = std::max( 0.0f, factor); -+ AE.SetStreamReplaygain(this, m_streamRgain); -+} -+ -+float CActiveAEStream::GetVolume() -+{ -+ return m_streamVolume; -+} -+ -+void CActiveAEStream::SetVolume(float volume) -+{ -+ m_streamVolume = std::max( 0.0f, std::min(1.0f, volume)); -+ AE.SetStreamVolume(this, m_streamVolume); -+} -+ -+double CActiveAEStream::GetResampleRatio() -+{ -+ return m_streamResampleRatio; -+} -+ -+bool CActiveAEStream::SetResampleRatio(double ratio) -+{ -+ m_streamResampleRatio = ratio; -+ AE.SetStreamResampleRatio(this, m_streamResampleRatio); -+ return true; -+} -+ -+void CActiveAEStream::FadeVolume(float from, float target, unsigned int time) -+{ -+ if (time == 0) -+ return; -+ -+ m_streamFading = true; -+ AE.SetStreamFade(this, from, target, time); -+} -+ -+bool CActiveAEStream::IsFading() -+{ -+ CSingleLock lock(m_streamLock); -+ return m_streamFading; -+} -+ -+const unsigned int CActiveAEStream::GetFrameSize() const -+{ -+ return m_format.m_frameSize; -+} -+ -+const unsigned int CActiveAEStream::GetChannelCount() const -+{ -+ return m_format.m_channelLayout.Count(); -+} -+ -+const unsigned int CActiveAEStream::GetSampleRate() const -+{ -+ return m_format.m_sampleRate; -+} -+ -+const unsigned int CActiveAEStream::GetEncodedSampleRate() const -+{ -+ return m_format.m_encodedRate; -+} -+ -+const enum AEDataFormat CActiveAEStream::GetDataFormat() const -+{ -+ return m_format.m_dataFormat; -+} -+ -+void CActiveAEStream::RegisterAudioCallback(IAudioCallback* pCallback) -+{ -+} -+ -+void CActiveAEStream::UnRegisterAudioCallback() -+{ -+} -+ -+void CActiveAEStream::RegisterSlave(IAEStream *slave) -+{ -+ CSingleLock lock(m_streamLock); -+ m_streamSlave = slave; -+} -+ -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -new file mode 100644 -index 0000000..bddf1a3 ---- /dev/null -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -@@ -0,0 +1,117 @@ -+#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 "AEAudioFormat.h" -+#include "Interfaces/AEStream.h" -+#include "Utils/AELimiter.h" -+#include "Utils/AEConvert.h" -+ -+namespace ActiveAE -+{ -+ -+class CActiveAEStream : public IAEStream -+{ -+protected: -+ friend class CActiveAE; -+ friend class CEngineStats; -+ CActiveAEStream(AEAudioFormat *format); -+ virtual ~CActiveAEStream(); -+ void FadingFinished(); -+ void IncFreeBuffers(); -+ void DecFreeBuffers(); -+ void ResetFreeBuffers(); -+ -+public: -+ virtual unsigned int GetSpace(); -+ virtual unsigned int AddData(void *data, unsigned int size); -+ virtual double GetDelay(); -+ virtual bool IsBuffering(); -+ virtual double GetCacheTime(); -+ virtual double GetCacheTotal(); -+ -+ virtual void Pause(); -+ virtual void Resume(); -+ virtual void Drain(bool wait); -+ virtual bool IsDraining(); -+ virtual bool IsDrained(); -+ virtual void Flush(); -+ -+ virtual float GetVolume(); -+ virtual float GetReplayGain(); -+ virtual float GetAmplification(); -+ virtual void SetVolume(float volume); -+ virtual void SetReplayGain(float factor); -+ virtual void SetAmplification(float amplify); -+ -+ virtual const unsigned int GetFrameSize() const; -+ virtual const unsigned int GetChannelCount() const; -+ -+ virtual const unsigned int GetSampleRate() const ; -+ virtual const unsigned int GetEncodedSampleRate() const; -+ virtual const enum AEDataFormat GetDataFormat() const; -+ -+ 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); -+ -+protected: -+ -+ AEAudioFormat m_format; -+ float m_streamVolume; -+ float m_streamRgain; -+ float m_streamAmplify; -+ double m_streamResampleRatio; -+ unsigned int m_streamSpace; -+ bool m_streamDraining; -+ bool m_streamDrained; -+ bool m_streamFading; -+ int m_streamFreeBuffers; -+ bool m_streamIsBuffering; -+ IAEStream *m_streamSlave; -+ CAEConvert::AEConvertToFn m_convertFn; -+ CCriticalSection m_streamLock; -+ -+ // only accessed by engine -+ CActiveAEBufferPool *m_inputBuffers; -+ CActiveAEBufferPoolResample *m_resampleBuffers; -+ std::deque m_processingSamples; -+ CSampleBuffer *m_currentBuffer; -+ CActiveAEDataProtocol *m_streamPort; -+ CEvent m_inMsgEvent; -+ CCriticalSection *m_statsLock; -+ bool m_drain; -+ bool m_paused; -+ bool m_started; -+ CAELimiter m_limiter; -+ float m_volume; -+ float m_rgain; -+ float m_bufferedTime; -+ int m_fadingSamples; -+ float m_fadingBase; -+ float m_fadingTarget; -+ int m_fadingTime; -+}; -+} -+ -diff --git a/xbmc/cores/AudioEngine/Makefile.in b/xbmc/cores/AudioEngine/Makefile.in -index 833dfab..2e1a83d 100644 ---- a/xbmc/cores/AudioEngine/Makefile.in -+++ b/xbmc/cores/AudioEngine/Makefile.in -@@ -43,6 +43,13 @@ 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 -+SRCS += Engines/ActiveAE/ActiveAESound.cpp -+SRCS += Engines/ActiveAE/ActiveAEResample.cpp -+SRCS += Engines/ActiveAE/ActiveAEBuffer.cpp -+ - ifeq (@USE_ANDROID@,1) - SRCS += Sinks/AESinkAUDIOTRACK.cpp - else -diff --git a/xbmc/utils/ActorProtocol.cpp b/xbmc/utils/ActorProtocol.cpp -new file mode 100644 -index 0000000..cf4c26f ---- /dev/null -+++ b/xbmc/utils/ActorProtocol.cpp -@@ -0,0 +1,253 @@ -+/* -+ * Copyright (C) 2005-2013 Team XBMC -+ * http://www.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 "ActorProtocol.h" -+ -+using namespace Actor; -+ -+void Message::Release() -+{ -+ bool skip; -+ origin->Lock(); -+ skip = isSync ? !isSyncFini : false; -+ isSyncFini = true; -+ origin->Unlock(); -+ -+ if (skip) -+ return; -+ -+ // free data buffer -+ if (data != buffer) -+ delete [] data; -+ -+ // delete event in case of sync message -+ if (event) -+ delete event; -+ -+ origin->ReturnMessage(this); -+} -+ -+bool Message::Reply(int sig, void *data /* = NULL*/, int size /* = 0 */) -+{ -+ if (!isSync) -+ { -+ if (isOut) -+ return origin->SendInMessage(sig, data, size); -+ else -+ return origin->SendOutMessage(sig, data, size); -+ } -+ -+ origin->Lock(); -+ -+ if (!isSyncTimeout) -+ { -+ Message *msg = origin->GetMessage(); -+ msg->signal = sig; -+ msg->isOut = !isOut; -+ replyMessage = msg; -+ if (data) -+ { -+ if (size > MSG_INTERNAL_BUFFER_SIZE) -+ msg->data = new uint8_t[size]; -+ else -+ msg->data = msg->buffer; -+ memcpy(msg->data, data, size); -+ } -+ } -+ -+ origin->Unlock(); -+ -+ if (event) -+ event->Set(); -+ -+ return true; -+} -+ -+Protocol::~Protocol() -+{ -+ Message *msg; -+ Purge(); -+ while (!freeMessageQueue.empty()) -+ { -+ msg = freeMessageQueue.front(); -+ freeMessageQueue.pop(); -+ delete msg; -+ } -+} -+ -+Message *Protocol::GetMessage() -+{ -+ Message *msg; -+ -+ CSingleLock lock(criticalSection); -+ -+ if (!freeMessageQueue.empty()) -+ { -+ msg = freeMessageQueue.front(); -+ freeMessageQueue.pop(); -+ } -+ else -+ msg = new Message(); -+ -+ msg->isSync = false; -+ msg->isSyncFini = false; -+ msg->isSyncTimeout = false; -+ msg->event = NULL; -+ msg->data = NULL; -+ msg->payloadSize = 0; -+ msg->replyMessage = NULL; -+ msg->origin = this; -+ -+ return msg; -+} -+ -+void Protocol::ReturnMessage(Message *msg) -+{ -+ CSingleLock lock(criticalSection); -+ -+ freeMessageQueue.push(msg); -+} -+ -+bool Protocol::SendOutMessage(int signal, void *data /* = NULL */, int size /* = 0 */, Message *outMsg /* = NULL */) -+{ -+ Message *msg; -+ if (outMsg) -+ msg = outMsg; -+ else -+ msg = GetMessage(); -+ -+ msg->signal = signal; -+ msg->isOut = true; -+ -+ if (data) -+ { -+ if (size > MSG_INTERNAL_BUFFER_SIZE) -+ msg->data = new uint8_t[size]; -+ else -+ msg->data = msg->buffer; -+ memcpy(msg->data, data, size); -+ } -+ -+ { CSingleLock lock(criticalSection); -+ outMessages.push(msg); -+ } -+ containerOutEvent->Set(); -+ -+ return true; -+} -+ -+bool Protocol::SendInMessage(int signal, void *data /* = NULL */, int size /* = 0 */, Message *outMsg /* = NULL */) -+{ -+ Message *msg; -+ if (outMsg) -+ msg = outMsg; -+ else -+ msg = GetMessage(); -+ -+ msg->signal = signal; -+ msg->isOut = false; -+ -+ if (data) -+ { -+ if (size > MSG_INTERNAL_BUFFER_SIZE) -+ msg->data = new uint8_t[size]; -+ else -+ msg->data = msg->buffer; -+ memcpy(msg->data, data, size); -+ } -+ -+ { CSingleLock lock(criticalSection); -+ inMessages.push(msg); -+ } -+ containerInEvent->Set(); -+ -+ return true; -+} -+ -+ -+bool Protocol::SendOutMessageSync(int signal, Message **retMsg, int timeout, void *data /* = NULL */, int size /* = 0 */) -+{ -+ Message *msg = GetMessage(); -+ msg->isOut = true; -+ msg->isSync = true; -+ msg->event = new CEvent; -+ msg->event->Reset(); -+ SendOutMessage(signal, data, size, msg); -+ -+ if (!msg->event->WaitMSec(timeout)) -+ { -+ msg->origin->Lock(); -+ if (msg->replyMessage) -+ *retMsg = msg->replyMessage; -+ else -+ { -+ *retMsg = NULL; -+ msg->isSyncTimeout = true; -+ } -+ msg->origin->Unlock(); -+ } -+ else -+ *retMsg = msg->replyMessage; -+ -+ msg->Release(); -+ -+ if (*retMsg) -+ return true; -+ else -+ return false; -+} -+ -+bool Protocol::ReceiveOutMessage(Message **msg) -+{ -+ CSingleLock lock(criticalSection); -+ -+ if (outMessages.empty() || outDefered) -+ return false; -+ -+ *msg = outMessages.front(); -+ outMessages.pop(); -+ -+ return true; -+} -+ -+bool Protocol::ReceiveInMessage(Message **msg) -+{ -+ CSingleLock lock(criticalSection); -+ -+ if (inMessages.empty() || inDefered) -+ return false; -+ -+ *msg = inMessages.front(); -+ inMessages.pop(); -+ -+ return true; -+} -+ -+ -+void Protocol::Purge() -+{ -+ Message *msg; -+ -+ while (ReceiveInMessage(&msg)) -+ msg->Release(); -+ -+ while (ReceiveOutMessage(&msg)) -+ msg->Release(); -+} -diff --git a/xbmc/utils/ActorProtocol.h b/xbmc/utils/ActorProtocol.h -new file mode 100644 -index 0000000..8ef3359 ---- /dev/null -+++ b/xbmc/utils/ActorProtocol.h -@@ -0,0 +1,87 @@ -+/* -+ * Copyright (C) 2005-2013 Team XBMC -+ * http://www.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 -+ * . -+ * -+ */ -+ -+#pragma once -+ -+#include "threads/Thread.h" -+#include "utils/log.h" -+#include -+#include "memory.h" -+ -+#define MSG_INTERNAL_BUFFER_SIZE 32 -+ -+namespace Actor -+{ -+ -+class Protocol; -+ -+class Message -+{ -+ friend class Protocol; -+public: -+ int signal; -+ bool isSync; -+ bool isSyncFini; -+ bool isOut; -+ bool isSyncTimeout; -+ int payloadSize; -+ uint8_t buffer[MSG_INTERNAL_BUFFER_SIZE]; -+ uint8_t *data; -+ Message *replyMessage; -+ Protocol *origin; -+ CEvent *event; -+ -+ void Release(); -+ bool Reply(int sig, void *data = NULL, int size = 0); -+ -+private: -+ Message() {isSync = false; data = NULL; event = NULL; replyMessage = NULL;}; -+}; -+ -+class Protocol -+{ -+public: -+ Protocol(std::string name, CEvent* inEvent, CEvent *outEvent) -+ : portName(name), inDefered(false), outDefered(false) {containerInEvent = inEvent; containerOutEvent = outEvent;}; -+ virtual ~Protocol(); -+ Message *GetMessage(); -+ void ReturnMessage(Message *msg); -+ bool SendOutMessage(int signal, void *data = NULL, int size = 0, Message *outMsg = NULL); -+ bool SendInMessage(int signal, void *data = NULL, int size = 0, Message *outMsg = NULL); -+ bool SendOutMessageSync(int signal, Message **retMsg, int timeout, void *data = NULL, int size = 0); -+ bool ReceiveOutMessage(Message **msg); -+ bool ReceiveInMessage(Message **msg); -+ void Purge(); -+ void DeferIn(bool value) {inDefered = value;}; -+ void DeferOut(bool value) {outDefered = value;}; -+ void Lock() {criticalSection.lock();}; -+ void Unlock() {criticalSection.unlock();}; -+ std::string portName; -+ -+protected: -+ CEvent *containerInEvent, *containerOutEvent; -+ CCriticalSection criticalSection; -+ std::queue outMessages; -+ std::queue inMessages; -+ std::queue freeMessageQueue; -+ bool inDefered, outDefered; -+}; -+ -+} -diff --git a/xbmc/utils/Makefile.in b/xbmc/utils/Makefile.in -index 694a9bd..ca49be2 100644 ---- a/xbmc/utils/Makefile.in -+++ b/xbmc/utils/Makefile.in -@@ -70,6 +70,7 @@ SRCS += Vector.cpp - SRCS += Weather.cpp - SRCS += XBMCTinyXML.cpp - SRCS += XMLUtils.cpp -+SRCS += ActorProtocol.cpp - - ifeq (@USE_OPENGLES@,1) - SRCS += AMLUtils.cpp --- -1.8.1.6 - - -From dfaf102c264a11252e053ec4477d08db6cbca1f9 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sat, 8 Jun 2013 09:39:38 +0200 -Subject: [PATCH 014/136] ActiveAE: Make Factory aware of environment, change - global namespace - ---- - xbmc/cores/AudioEngine/AEFactory.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 4f9f566..5adda5f 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -28,7 +28,6 @@ - #else - #include "Engines/SoftAE/SoftAE.h" - #include "Engines/ActiveAE/ActiveAE.h" -- using namespace ActiveAE; - #endif - - #if defined(HAS_PULSEAUDIO) -@@ -69,6 +68,8 @@ bool CAEFactory::LoadEngine() - #endif - if (!loaded && engine == "SOFT" ) - loaded = CAEFactory::LoadEngine(AE_ENGINE_SOFT); -+ if (!loaded && engine == "ACTIVE") -+ loaded = CAEFactory::LoadEngine(AE_ENGINE_ACTIVE); - } - #endif - -@@ -101,7 +102,7 @@ bool CAEFactory::LoadEngine(enum AEEngine engine) - case AE_ENGINE_COREAUDIO: AE = new CCoreAudioAE(); break; - #else - case AE_ENGINE_SOFT : AE = new CSoftAE(); break; -- case AE_ENGINE_ACTIVE : AE = new CActiveAE(); break; -+ case AE_ENGINE_ACTIVE : AE = new ActiveAE::CActiveAE(); break; - #endif - #if defined(HAS_PULSEAUDIO) - case AE_ENGINE_PULSE : AE = new CPulseAE(); break; --- -1.8.1.6 - - -From 1032f3155784ceb5781940e7bae5f3369cd7a831 Mon Sep 17 00:00:00 2001 -From: unknown -Date: Thu, 11 Jul 2013 18:33:34 +0200 -Subject: [PATCH 015/136] AE: allow Windows to use ActiveAE via env - ---- - xbmc/cores/AudioEngine/AEFactory.cpp | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 5adda5f..d5517f3 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -73,6 +73,20 @@ bool CAEFactory::LoadEngine() - } - #endif - -+#if defined(TARGET_WINDOWS) -+ std::string engine; -+ if (getenv("AE_ENGINE")) -+ { -+ engine = (std::string)getenv("AE_ENGINE"); -+ std::transform(engine.begin(), engine.end(), engine.begin(), ::toupper); -+ -+ if (!loaded && engine == "SOFT" ) -+ loaded = CAEFactory::LoadEngine(AE_ENGINE_SOFT); -+ if (!loaded && engine == "ACTIVE") -+ loaded = CAEFactory::LoadEngine(AE_ENGINE_ACTIVE); -+ } -+#endif -+ - #if defined(HAS_PULSEAUDIO) - if (!loaded) - loaded = CAEFactory::LoadEngine(AE_ENGINE_PULSE); --- -1.8.1.6 - - -From ca1eb43f810ffa679c9420d740e0474e19b474bc Mon Sep 17 00:00:00 2001 -From: unknown -Date: Tue, 16 Jul 2013 17:06:03 +0200 -Subject: [PATCH 017/136] AE: add streamsilence to gui settings for engines - which suppport drain - ---- - language/English/strings.po | 14 +++++++++++--- - system/settings/settings.xml | 5 +++++ - xbmc/cores/AudioEngine/AEFactory.cpp | 8 ++++++++ - xbmc/cores/AudioEngine/AEFactory.h | 1 + - xbmc/cores/AudioEngine/Interfaces/AE.h | 6 ++++++ - xbmc/settings/Settings.cpp | 4 ++++ - 6 files changed, 35 insertions(+), 3 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index 069dce0..c2c562f 100644 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -1762,7 +1762,10 @@ msgctxt "#420" - msgid "HDMI" - msgstr "" - --#empty string with id 421 -+#: system/settings/settings.xml -+msgctxt "#421" -+msgid "Stream silence when idle" -+msgstr "" - - msgctxt "#422" - msgid "Delete album info" -@@ -12120,8 +12123,13 @@ msgctxt "#34110" - msgid "7.1" - msgstr "" - --#empty strings from id 34111 to 34119 --#34111-34119 reserved for future use -+#: 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" -+msgstr "" -+ -+#empty strings from id 34112 to 34119 -+#34112-34119 reserved for future use - - #: system/settings/settings.xml - msgctxt "#34120" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index a468e97..f7d7f09 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2020,6 +2020,11 @@ - - - -+ -+ 2 -+ audiosupportsdrain -+ true -+ - - - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index d5517f3..5b1d2d6 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -261,6 +261,14 @@ bool CAEFactory::SupportsRaw() - return false; - } - -+bool CAEFactory::SupportsDrain() -+{ -+ if(AE) -+ return AE->SupportsDrain(); -+ -+ return false; -+} -+ - void CAEFactory::SetMute(const bool enabled) - { - if(AE) -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index 3059001..e427519 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -54,6 +54,7 @@ class CAEFactory - static void VerifyOutputDevice(std::string &device, bool passthrough); - static std::string GetDefaultDevice(bool passthrough); - static bool SupportsRaw(); -+ static bool SupportsDrain(); - static void SetMute(const bool enabled); - static bool IsMuted(); - static float GetVolume(); -diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h -index 5741cd8..52c4efc 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AE.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AE.h -@@ -185,6 +185,12 @@ class IAE - */ - virtual bool SupportsRaw() { return false; } - -+ /** -+ * 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 void RegisterAudioCallback(IAudioCallback* pCallback) {} - - virtual void UnregisterAudioCallback() {} -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index d8f6889..37174ac 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -760,6 +760,9 @@ void CSettings::InitializeConditions() - if (g_application.IsStandAlone()) - m_settingsManager->AddCondition("isstandalone"); - -+ if (CAEFactory::SupportsDrain()) -+ m_settingsManager->AddCondition("audiosupportsdrain"); -+ - // add more complex conditions - m_settingsManager->AddCondition("addonhassettings", AddonHasSettings); - m_settingsManager->AddCondition("checkmasterlock", CheckMasterLock); -@@ -852,6 +855,7 @@ void CSettings::InitializeISettingCallbacks() - settingSet.insert("audiooutput.multichannellpcm"); - settingSet.insert("audiooutput.audiodevice"); - settingSet.insert("audiooutput.passthroughdevice"); -+ settingSet.insert("audiooutput.streamsilence"); - settingSet.insert("lookandfeel.skin"); - settingSet.insert("lookandfeel.skinsettings"); - settingSet.insert("lookandfeel.font"); --- -1.8.1.6 - - -From 24e126184ae12557d73b044357e8d41d96e2c76f Mon Sep 17 00:00:00 2001 -From: unknown -Date: Tue, 16 Jul 2013 17:06:51 +0200 -Subject: [PATCH 018/136] ActiveAE: adjust to gui setting streamsilence - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 13 ++++++++++++- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 1 + - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 3 +-- - 3 files changed, 14 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 2defd1d..935f994 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -384,6 +384,11 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - switch (signal) - { - case CActiveAEControlProtocol::RECONFIGURE: -+ if (m_streams.empty()) -+ { -+ bool silence = false; -+ m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::SILENCEMODE, &silence, sizeof(bool)); -+ } - LoadSettings(); - if (!NeedReconfigureBuffers() && !NeedReconfigureSink()) - return; -@@ -1815,7 +1820,8 @@ void CActiveAE::OnSettingsChange(const std::string& setting) - setting == "audiooutput.dtshdpassthrough" || - setting == "audiooutput.channels" || - setting == "audiooutput.multichannellpcm" || -- setting == "audiooutput.stereoupmix") -+ setting == "audiooutput.stereoupmix" || -+ setting == "audiooutput.streamsilence") - { - m_controlPort.SendOutMessage(CActiveAEControlProtocol::RECONFIGURE); - } -@@ -1826,6 +1832,11 @@ bool CActiveAE::SupportsRaw() - return true; - } - -+bool CActiveAE::SupportsDrain() -+{ -+ return true; -+} -+ - void CActiveAE::Shutdown() - { - Dispose(); -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index d5c5d97..9fc1b67 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -213,6 +213,7 @@ class CActiveAE : public IAE, private CThread - virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough); - virtual std::string GetDefaultDevice(bool passthrough); - virtual bool SupportsRaw(); -+ virtual bool SupportsDrain(); - - 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 c22bb88..9af241d 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp -@@ -26,7 +26,6 @@ - #include "ActiveAE.h" - - #include "settings/Settings.h" --#include "settings/AdvancedSettings.h" - - using namespace ActiveAE; - -@@ -229,7 +228,7 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg) - { - case CSinkControlProtocol::SILENCEMODE: - m_extSilence = *(bool*)msg->data; -- if (g_advancedSettings.m_streamSilence) -+ if (CSettings::Get().GetBool("audiooutput.streamsilence")) - m_extSilence = true; - if (m_extSilence) - { --- -1.8.1.6 - - -From d186405dca4ab5c17f5cf5e30aca8ca0c4ac9b9a Mon Sep 17 00:00:00 2001 -From: wsoltys -Date: Tue, 16 Jul 2013 21:17:38 +0200 -Subject: [PATCH 019/136] [WIN32][WASAPI]: made wasapi sink accept default as - device string. set "wasapi:default" as default gui string (could be smarter - when handled via the xml system. possible?) - ---- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 61 +++++++++++++++++---------- - xbmc/settings/Settings.cpp | 3 ++ - 2 files changed, 41 insertions(+), 23 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index 8a3d7ce..8995a0c 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -34,6 +34,7 @@ - #include "../Utils/AEDeviceInfo.h" - #include - #include -+#include "utils/StringUtils.h" - - #pragma comment(lib, "Avrt.lib") - -@@ -206,6 +207,7 @@ bool CAESinkWASAPI::Initialize(AEAudioFormat &format, std::string &device) - return false; - - m_device = device; -+ bool bdefault = false; - - /* Save requested format */ - /* Clear returned format */ -@@ -227,41 +229,47 @@ bool CAESinkWASAPI::Initialize(AEAudioFormat &format, std::string &device) - hr = pEnumDevices->GetCount(&uiCount); - EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of audio endpoint count failed.") - -- for (UINT i = 0; i < uiCount; i++) -+ if(StringUtils::EndsWith(device, std::string("default"))) -+ bdefault = true; -+ -+ if(!bdefault) - { -- IPropertyStore *pProperty = NULL; -- PROPVARIANT varName; -+ for (UINT i = 0; i < uiCount; i++) -+ { -+ IPropertyStore *pProperty = NULL; -+ PROPVARIANT varName; - -- hr = pEnumDevices->Item(i, &m_pDevice); -- EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of WASAPI endpoint failed.") -+ hr = pEnumDevices->Item(i, &m_pDevice); -+ EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of WASAPI endpoint failed.") - -- hr = m_pDevice->OpenPropertyStore(STGM_READ, &pProperty); -- EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of WASAPI endpoint properties failed.") -+ hr = m_pDevice->OpenPropertyStore(STGM_READ, &pProperty); -+ EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of WASAPI endpoint properties failed.") - -- hr = pProperty->GetValue(PKEY_AudioEndpoint_GUID, &varName); -- if (FAILED(hr)) -- { -- CLog::Log(LOGERROR, __FUNCTION__": Retrieval of WASAPI endpoint GUID failed."); -- SAFE_RELEASE(pProperty); -- goto failed; -- } -+ hr = pProperty->GetValue(PKEY_AudioEndpoint_GUID, &varName); -+ if (FAILED(hr)) -+ { -+ CLog::Log(LOGERROR, __FUNCTION__": Retrieval of WASAPI endpoint GUID failed."); -+ SAFE_RELEASE(pProperty); -+ goto failed; -+ } - -- std::string strDevName = localWideToUtf(varName.pwszVal); -+ std::string strDevName = localWideToUtf(varName.pwszVal); - -- if (device == strDevName) -- i = uiCount; -- else -- SAFE_RELEASE(m_pDevice); -+ if (device == strDevName) -+ i = uiCount; -+ else -+ SAFE_RELEASE(m_pDevice); - -- PropVariantClear(&varName); -- SAFE_RELEASE(pProperty); -+ PropVariantClear(&varName); -+ SAFE_RELEASE(pProperty); -+ } - } -- - SAFE_RELEASE(pEnumDevices); - - if (!m_pDevice) - { -- CLog::Log(LOGINFO, __FUNCTION__": Could not locate the device named \"%s\" in the list of WASAPI endpoint devices. Trying the default device...", device.c_str()); -+ if(!bdefault) -+ CLog::Log(LOGINFO, __FUNCTION__": Could not locate the device named \"%s\" in the list of WASAPI endpoint devices. Trying the default device...", device.c_str()); - hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &m_pDevice); - EXIT_ON_FAILURE(hr, __FUNCTION__": Could not retrieve the default WASAPI audio endpoint.") - -@@ -583,6 +591,13 @@ void CAESinkWASAPI::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bool fo - WAVEFORMATEXTENSIBLE wfxex = {0}; - HRESULT hr; - -+ // add default device entry -+ deviceInfo.m_deviceName = std::string("default"); -+ deviceInfo.m_displayName = std::string("default"); -+ -+ /* Store the device info */ -+ deviceInfoList.push_back(deviceInfo); -+ - hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator); - EXIT_ON_FAILURE(hr, __FUNCTION__": Could not allocate WASAPI device enumerator. CoCreateInstance error code: %li", hr) - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 37174ac..5df9d09 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -642,6 +642,9 @@ void CSettings::InitializeDefaults() - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(defaultAudioDeviceName); - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(defaultAudioDeviceName); - #endif -+#elif defined(TARGET_WINDOWS) -+ ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(std::string("WASAPI:default")); -+ ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(std::string("WASAPI:default")); - #else - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(CAEFactory::GetDefaultDevice(false)); - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(CAEFactory::GetDefaultDevice(true)); --- -1.8.1.6 - - -From cbedd31759624e0b4f79b1d3d07fa525f1266cf0 Mon Sep 17 00:00:00 2001 -From: wsoltys -Date: Tue, 16 Jul 2013 21:41:50 +0200 -Subject: [PATCH 020/136] [WIN32] changed: use the new settings system instead - of hardcoded values. - ---- - system/settings/win32.xml | 28 ++++++++++++++++++++++++++++ - xbmc/settings/Settings.cpp | 5 +---- - 2 files changed, 29 insertions(+), 4 deletions(-) - -diff --git a/system/settings/win32.xml b/system/settings/win32.xml -index 76bc2bf..1e0a97b 100644 ---- a/system/settings/win32.xml -+++ b/system/settings/win32.xml -@@ -39,5 +39,33 @@ - - - -+ -+ -+ -+ 2 -+ WASAPI:default -+ -+ audiodevices -+ -+ -+ -+ -+ 2 -+ WASAPI:default -+ -+ audiodevicespassthrough -+ -+ -+ -+ -+ 1 -+ 2 -+ -+ -+ -+ -+ -+ -+ - - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 5df9d09..436c34a 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -642,10 +642,7 @@ void CSettings::InitializeDefaults() - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(defaultAudioDeviceName); - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(defaultAudioDeviceName); - #endif --#elif defined(TARGET_WINDOWS) -- ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(std::string("WASAPI:default")); -- ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(std::string("WASAPI:default")); --#else -+#elif !defined(TARGET_WINDOWS) - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(CAEFactory::GetDefaultDevice(false)); - ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(CAEFactory::GetDefaultDevice(true)); - #endif --- -1.8.1.6 - - -From 5110d1fcdf43c9be249e6e4d8bd4c322191c86ef Mon Sep 17 00:00:00 2001 -From: unknown -Date: Thu, 18 Jul 2013 08:35:29 +0200 -Subject: [PATCH 021/136] AE: WASAPI, DirectSound - allow engine to provide - less samples than buffer size - ---- - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp | 3 +- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 36 +++++++++++++++++++--- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h | 3 ++ - 3 files changed, 37 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -index 797d7f2..81f2c4c 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -@@ -403,7 +403,8 @@ unsigned int CAESinkDirectSound::AddPackets(uint8_t *data, unsigned int frames, - DWORD size = 0, sizeWrap = 0; - if (m_BufferOffset >= m_dwBufferLen) // Wrap-around manually - m_BufferOffset = 0; -- HRESULT res = m_pBuffer->Lock(m_BufferOffset, m_dwChunkSize, &start, &size, &startWrap, &sizeWrap, 0); -+ DWORD dwWriteBytes = std::min((int)m_dwChunkSize, (int)len); -+ HRESULT res = m_pBuffer->Lock(m_BufferOffset, dwWriteBytes, &start, &size, &startWrap, &sizeWrap, 0); - if (DS_OK != res) - { - CLog::Log(LOGERROR, __FUNCTION__ ": Unable to lock buffer at offset %u. HRESULT: 0x%08x", m_BufferOffset, res); -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index 8995a0c..78db727 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -191,7 +191,9 @@ CStdStringA localWideToUtf(LPCWSTR wstr) - m_isDirty(false), - m_uiBufferLen(0), - m_avgTimeWaiting(50), -- m_sinkLatency(0.0) -+ m_sinkLatency(0.0), -+ m_pBuffer(NULL), -+ m_bufferPtr(0) - { - m_channelLayout.Reset(); - } -@@ -315,6 +317,14 @@ bool CAESinkWASAPI::Initialize(AEAudioFormat &format, std::string &device) - m_initialized = true; - m_isDirty = false; - -+ // allow feeding less samples than buffer size -+ // if the device is opened exclusive and event driven, provided samples must match buffersize -+ // ActiveAE tries to align provided samples with buffer size but cannot guarantee (e.g. transcoding) -+ // this can be avoided by dropping the event mode which has not much benefit; SoftAE polls anyway -+ delete [] m_pBuffer; -+ m_pBuffer = new uint8_t[format.m_frames * format.m_frameSize]; -+ m_bufferPtr = 0; -+ - return true; - - failed: -@@ -359,6 +369,9 @@ void CAESinkWASAPI::Deinitialize() - SAFE_RELEASE(m_pDevice); - - m_initialized = false; -+ -+ delete [] m_pBuffer; -+ m_bufferPtr = 0; - } - - bool CAESinkWASAPI::IsCompatible(const AEAudioFormat format, const std::string &device) -@@ -446,7 +459,15 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - LARGE_INTEGER timerFreq; - #endif - -- unsigned int NumFramesRequested = frames; -+ unsigned int NumFramesRequested = m_format.m_frames; -+ unsigned int FramesToCopy = std::min(m_format.m_frames - m_bufferPtr, frames); -+ if (m_bufferPtr != 0 || frames != m_format.m_frames) -+ { -+ memcpy(m_pBuffer+m_bufferPtr*m_format.m_frameSize, data, FramesToCopy*m_format.m_frameSize); -+ m_bufferPtr += FramesToCopy; -+ if (frames != m_format.m_frames) -+ return frames; -+ } - - if (!m_running) //first time called, pre-fill buffer then start audio client - { -@@ -547,7 +568,8 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - #endif - return INT_MAX; - } -- memcpy(buf, data, NumFramesRequested * m_format.m_frameSize); //fill buffer -+ memcpy(buf, m_bufferPtr == 0 ? data : m_pBuffer, NumFramesRequested * m_format.m_frameSize); //fill buffer -+ m_bufferPtr = 0; - hr = m_pRenderClient->ReleaseBuffer(NumFramesRequested, flags); //pass back to audio driver - if (FAILED(hr)) - { -@@ -557,7 +579,13 @@ unsigned int CAESinkWASAPI::AddPackets(uint8_t *data, unsigned int frames, bool - return INT_MAX; - } - -- return NumFramesRequested; -+ if (FramesToCopy != frames) -+ { -+ m_bufferPtr = frames-FramesToCopy; -+ memcpy(m_pBuffer, data+FramesToCopy*m_format.m_frameSize, m_bufferPtr*m_format.m_frameSize); -+ } -+ -+ return frames; - } - - bool CAESinkWASAPI::SoftSuspend() -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -index c4a5a51..37cfd68 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -@@ -78,4 +78,7 @@ class CAESinkWASAPI : public IAESink - unsigned int m_uiBufferLen; /* wasapi endpoint buffer size, in frames */ - double m_avgTimeWaiting; /* time between next buffer of data from SoftAE and driver call for data */ - double m_sinkLatency; /* time in seconds of total duration of the two WASAPI buffers */ -+ -+ uint8_t *m_pBuffer; -+ int m_bufferPtr; - }; --- -1.8.1.6 - - -From 2c7cac05924a2de5dd338e4751c6981a0172190b Mon Sep 17 00:00:00 2001 -From: unknown -Date: Fri, 19 Jul 2013 15:08:33 +0200 -Subject: [PATCH 022/136] AE: DirectSound - implement drain method - ---- - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp | 25 ++++++++++++++++------ - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h | 1 + - 2 files changed, 20 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -index 81f2c4c..5c5e015 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -@@ -442,6 +442,23 @@ void CAESinkDirectSound::Stop() - m_pBuffer->Stop(); - } - -+void CAESinkDirectSound::Drain() -+{ -+ if (!m_initialized || m_isDirtyDS) -+ return; -+ -+ m_pBuffer->Stop(); -+ HRESULT res = m_pBuffer->SetCurrentPosition(0); -+ if (DS_OK != res) -+ { -+ CLog::Log(LOGERROR,__FUNCTION__ ": SetCurrentPosition failed. Unable to determine buffer status. HRESULT = 0x%08x", res); -+ m_isDirtyDS = true; -+ return; -+ } -+ m_BufferOffset = 0; -+ UpdateCacheStatus(); -+} -+ - double CAESinkDirectSound::GetDelay() - { - if (!m_initialized) -@@ -683,10 +700,6 @@ void CAESinkDirectSound::CheckPlayStatus() - bool CAESinkDirectSound::UpdateCacheStatus() - { - CSingleLock lock (m_runLock); -- // TODO: Check to see if we may have cycled around since last time -- unsigned int time = XbmcThreads::SystemClockMillis(); -- if (time == m_LastCacheCheck) -- return true; // Don't recalc more frequently than once/ms (that is our max resolution anyway) - - DWORD playCursor = 0, writeCursor = 0; - HRESULT res = m_pBuffer->GetCurrentPosition(&playCursor, &writeCursor); // Get the current playback and safe write positions -@@ -697,7 +710,6 @@ bool CAESinkDirectSound::UpdateCacheStatus() - return false; - } - -- m_LastCacheCheck = time; - // Check the state of the ring buffer (P->O->W == underrun) - // These are the logical situations that can occur - // O: CurrentOffset W: WriteCursor P: PlayCursor -@@ -729,7 +741,8 @@ bool CAESinkDirectSound::UpdateCacheStatus() - return false; - } - } -- else m_BufferTimeouts = 0; -+ else -+ m_BufferTimeouts = 0; - - // Calculate available space in the ring buffer - if (playCursor == m_BufferOffset && m_BufferOffset == writeCursor) // Playback is stopped and we are all at the same place -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h -index 8ff098d..a6f2912 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h -@@ -39,6 +39,7 @@ class CAESinkDirectSound : public IAESink - virtual bool IsCompatible(const AEAudioFormat format, const std::string &device); - - virtual void Stop (); -+ virtual void Drain (); - virtual double GetDelay (); - virtual double GetCacheTime (); - virtual double GetCacheTotal (); --- -1.8.1.6 - - -From 2670e1379f99dc5952bbe073eb9379640747a49d Mon Sep 17 00:00:00 2001 -From: wsoltys -Date: Thu, 18 Jul 2013 18:13:02 +0200 -Subject: [PATCH 023/136] [WIN32][WASAPI] created a drain method. - ---- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 27 ++++++++++++++++++++++++++- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h | 2 ++ - 2 files changed, 28 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index 78db727..8c8bc1f 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -193,7 +193,8 @@ CStdStringA localWideToUtf(LPCWSTR wstr) - m_avgTimeWaiting(50), - m_sinkLatency(0.0), - m_pBuffer(NULL), -- m_bufferPtr(0) -+ m_bufferPtr(0), -+ m_hnsRequestedDuration(0) - { - m_channelLayout.Reset(); - } -@@ -1161,6 +1162,8 @@ bool CAESinkWASAPI::InitializeExclusive(AEAudioFormat &format) - hr = m_pAudioClient->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, - audioSinkBufferDurationMsec, audioSinkBufferDurationMsec, &wfxex.Format, NULL); - -+ m_hnsRequestedDuration = audioSinkBufferDurationMsec; -+ - if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED) - { - /* WASAPI requires aligned buffer */ -@@ -1290,3 +1293,25 @@ const char *CAESinkWASAPI::WASAPIErrToStr(HRESULT err) - } - return NULL; - } -+ -+void CAESinkWASAPI::Drain() -+{ -+ if(!m_pAudioClient) -+ return; -+ -+ Sleep( (DWORD)(m_hnsRequestedDuration / 10000)); -+ -+ if (m_running) -+ { -+ try -+ { -+ m_pAudioClient->Stop(); //stop the audio output -+ m_pAudioClient->Reset(); //flush buffer and reset audio clock stream position -+ } -+ catch (...) -+ { -+ CLog::Log(LOGDEBUG, __FUNCTION__, "Invalidated AudioClient - Releasing"); -+ } -+ } -+ m_running = false; -+} -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -index 37cfd68..39d62d5 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.h -@@ -45,6 +45,7 @@ class CAESinkWASAPI : public IAESink - virtual unsigned int AddPackets (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false); - virtual bool SoftSuspend (); - virtual bool SoftResume (); -+ virtual void Drain (); - static void EnumerateDevicesEx (AEDeviceInfoList &deviceInfoList, bool force = false); - private: - bool InitializeExclusive(AEAudioFormat &format); -@@ -81,4 +82,5 @@ class CAESinkWASAPI : public IAESink - - uint8_t *m_pBuffer; - int m_bufferPtr; -+ REFERENCE_TIME m_hnsRequestedDuration; - }; --- -1.8.1.6 - - -From 191da169f9bb67d2ecd77a6655115772b53b357b Mon Sep 17 00:00:00 2001 -From: wsoltys -Date: Thu, 18 Jul 2013 20:35:08 +0200 -Subject: [PATCH 024/136] [WIN32][DirectSound] added fake entry default and - make sink understand it. - ---- - xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp | 50 ++++++++++++++-------- - 1 file changed, 31 insertions(+), 19 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -index 5c5e015..da98e1f 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp -@@ -35,6 +35,7 @@ - #include - #include - #include "cores/AudioEngine/Utils/AEUtil.h" -+#include "utils/StringUtils.h" - #pragma comment(lib, "Rpcrt4.lib") - - extern HWND g_hWnd; -@@ -143,10 +144,14 @@ bool CAESinkDirectSound::Initialize(AEAudioFormat &format, std::string &device) - LPGUID deviceGUID = NULL; - RPC_CSTR wszUuid = NULL; - HRESULT hr = E_FAIL; -+ std::string strDeviceGUID = device; - std::list DSDeviceList; - std::string deviceFriendlyName; - DirectSoundEnumerate(DSEnumCallback, &DSDeviceList); - -+ if(StringUtils::EndsWith(device, std::string("default"))) -+ strDeviceGUID = GetDefaultDevice(); -+ - for (std::list::iterator itt = DSDeviceList.begin(); itt != DSDeviceList.end(); ++itt) - { - if ((*itt).lpGuid) -@@ -154,23 +159,27 @@ bool CAESinkDirectSound::Initialize(AEAudioFormat &format, std::string &device) - hr = (UuidToString((*itt).lpGuid, &wszUuid)); - std::string sztmp = (char*)wszUuid; - std::string szGUID = "{" + std::string(sztmp.begin(), sztmp.end()) + "}"; -- if (strcasecmp(szGUID.c_str(), device.c_str()) == 0) -+ if (strcasecmp(szGUID.c_str(), strDeviceGUID.c_str()) == 0) - { - deviceGUID = (*itt).lpGuid; - deviceFriendlyName = (*itt).name.c_str(); - break; - } - } -- if (hr == RPC_S_OK) RpcStringFree(&wszUuid); -+ if (hr == RPC_S_OK) RpcStringFree(&wszUuid); - } - - hr = DirectSoundCreate(deviceGUID, &m_pDSound, NULL); - - if (FAILED(hr)) - { -- CLog::Log(LOGERROR, __FUNCTION__": Failed to create the DirectSound device."); -- CLog::Log(LOGERROR, __FUNCTION__": DSErr: %s", dserr2str(hr)); -- return false; -+ CLog::Log(LOGERROR, __FUNCTION__": Failed to create the DirectSound device %s with error %s, trying the default device.", deviceFriendlyName.c_str(), dserr2str(hr)); -+ hr = DirectSoundCreate(NULL, &m_pDSound, NULL); -+ if (FAILED(hr)) -+ { -+ CLog::Log(LOGERROR, __FUNCTION__": Failed to create the default DirectSound device with error %s.", dserr2str(hr)); -+ return false; -+ } - } - - HWND tmp_hWnd; -@@ -501,6 +510,8 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bo - - HRESULT hr; - -+ std::string strDD = GetDefaultDevice(); -+ - /* See if we are on Windows XP */ - if (!g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista)) - { -@@ -535,6 +546,15 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bo - deviceInfo.m_sampleRates.push_back((DWORD) 96000); - - deviceInfoList.push_back(deviceInfo); -+ -+ // add the default device with m_deviceName = default -+ if(strDD == deviceInfo.m_deviceName) -+ { -+ deviceInfo.m_deviceName = std::string("default"); -+ deviceInfo.m_displayName = std::string("default"); -+ deviceInfo.m_displayNameExtra = std::string(""); -+ deviceInfoList.push_back(deviceInfo); -+ } - } - - RpcStringFree(&cszGUID); -@@ -650,22 +670,14 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bo - deviceInfo.m_deviceType = aeDeviceType; - - deviceInfoList.push_back(deviceInfo); -- } - -- // since AE takes the first device in deviceInfoList as default audio device we need -- // to sort it in order to use the real default device -- if(deviceInfoList.size() > 1) -- { -- std::string strDD = GetDefaultDevice(); -- for (AEDeviceInfoList::iterator itt = deviceInfoList.begin(); itt != deviceInfoList.end(); ++itt) -+ // add the default device with m_deviceName = default -+ if(strDD == strDevName) - { -- CAEDeviceInfo devInfo = *itt; -- if(devInfo.m_deviceName == strDD) -- { -- deviceInfoList.erase(itt); -- deviceInfoList.insert(deviceInfoList.begin(), devInfo); -- break; -- } -+ deviceInfo.m_deviceName = std::string("default"); -+ deviceInfo.m_displayName = std::string("default"); -+ deviceInfo.m_displayNameExtra = std::string(""); -+ deviceInfoList.push_back(deviceInfo); - } - } - --- -1.8.1.6 - - -From ff5caa443be03aefb654f7adb81aadb1a43b9ec4 Mon Sep 17 00:00:00 2001 -From: wsoltys -Date: Tue, 23 Jul 2013 19:03:43 +0200 -Subject: [PATCH 025/136] [WIN32][WASAPI] cosmetics: fill the default device - with proper values. - ---- - xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 40 ++++++++++++++++++++------- - 1 file changed, 30 insertions(+), 10 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -index 8c8bc1f..38065cd 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp -@@ -614,24 +614,32 @@ void CAESinkWASAPI::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bool fo - { - IMMDeviceEnumerator* pEnumerator = NULL; - IMMDeviceCollection* pEnumDevices = NULL; -+ IMMDevice* pDefaultDevice = NULL; - CAEDeviceInfo deviceInfo; - CAEChannelInfo deviceChannels; -+ LPWSTR pwszID = NULL; -+ std::wstring wstrDDID; - - WAVEFORMATEXTENSIBLE wfxex = {0}; - HRESULT hr; - -- // add default device entry -- deviceInfo.m_deviceName = std::string("default"); -- deviceInfo.m_displayName = std::string("default"); -- -- /* Store the device info */ -- deviceInfoList.push_back(deviceInfo); -- - hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator); - EXIT_ON_FAILURE(hr, __FUNCTION__": Could not allocate WASAPI device enumerator. CoCreateInstance error code: %li", hr) - - UINT uiCount = 0; - -+ // get the default audio endpoint -+ if(pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDefaultDevice) == S_OK) -+ { -+ if(pDefaultDevice->GetId(&pwszID) == S_OK) -+ { -+ wstrDDID = pwszID; -+ CoTaskMemFree(pwszID); -+ } -+ SAFE_RELEASE(pDefaultDevice); -+ } -+ -+ // enumerate over all audio endpoints - hr = pEnumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &pEnumDevices); - EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of audio endpoint enumeration failed.") - -@@ -903,9 +911,6 @@ void CAESinkWASAPI::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bool fo - CLog::Log(LOGDEBUG, __FUNCTION__": Failed to activate device for passthrough capability testing."); - } - -- SAFE_RELEASE(pDevice); -- SAFE_RELEASE(pProperty); -- - deviceInfo.m_deviceName = strDevName; - deviceInfo.m_displayName = strWinDevType.append(strFriendlyName); - deviceInfo.m_displayNameExtra = std::string("WASAPI: ").append(strFriendlyName); -@@ -914,6 +919,21 @@ void CAESinkWASAPI::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bool fo - - /* Store the device info */ - deviceInfoList.push_back(deviceInfo); -+ -+ if(pDevice->GetId(&pwszID) == S_OK) -+ { -+ if(wstrDDID.compare(pwszID) == 0) -+ { -+ deviceInfo.m_deviceName = std::string("default"); -+ deviceInfo.m_displayName = std::string("default"); -+ deviceInfo.m_displayNameExtra = std::string(""); -+ deviceInfoList.push_back(deviceInfo); -+ } -+ CoTaskMemFree(pwszID); -+ } -+ -+ SAFE_RELEASE(pDevice); -+ SAFE_RELEASE(pProperty); - } - return; - --- -1.8.1.6 - - -From 46ccc94ce275c574a6eb5bc5f301b79b14fd8e14 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 27 Jul 2013 08:44:13 +0200 -Subject: [PATCH 026/136] AE: add quality setting for engine which support it - ---- - language/English/strings.po | 35 +++++++++++++++++++++++++++++++--- - system/settings/settings.xml | 13 +++++++++++++ - xbmc/cores/AudioEngine/AEFactory.cpp | 8 ++++++++ - xbmc/cores/AudioEngine/AEFactory.h | 1 + - xbmc/cores/AudioEngine/Interfaces/AE.h | 6 ++++++ - xbmc/settings/Settings.cpp | 4 ++++ - 6 files changed, 64 insertions(+), 3 deletions(-) - -diff --git a/language/English/strings.po b/language/English/strings.po -index c2c562f..40fbb74 100644 ---- a/language/English/strings.po -+++ b/language/English/strings.po -@@ -12154,8 +12154,32 @@ msgctxt "#34123" - msgid "Never" - msgstr "" - --#empty strings from id 34124 to 34200 --#34124-34200 reserved for future use -+#. Resampling quality -+#: system/settings/settings.xml -+msgctxt "#34124" -+msgid "Resampling Quality" -+msgstr "" -+ -+#. Resampling quality -+#: system/settings/settings.xml -+msgctxt "#34125" -+msgid "Low" -+msgstr "" -+ -+#. Resampling quality -+#: system/settings/settings.xml -+msgctxt "#34126" -+msgid "Normal" -+msgstr "" -+ -+#. Resampling quality -+#: system/settings/settings.xml -+msgctxt "#34127" -+msgid "High" -+msgstr "" -+ -+#empty strings from id 34128 to 34200 -+#34128-34200 reserved for future use - - #: xbmc\PlayListPlayer.cpp - msgctxt "#34201" -@@ -14140,7 +14164,12 @@ msgctxt "#36420" - msgid "No info available yet." - msgstr "" - --#empty strings from id 36421 to 36999 -+#: system/settings/settings.xml -+msgctxt "#36421" -+msgid "Resampling Quality, higher quality puts higher load on CPU" -+msgstr "" -+ -+#empty strings from id 36422 to 36999 - #end reservation - - #: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index f7d7f09..461e787 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -1950,6 +1950,19 @@ - - - -+ -+ 2 -+ audiosupportsquality -+ 1 -+ -+ -+ -+ -+ -+ -+ -+ -+ - - 2 - true -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 5b1d2d6..250056e 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -269,6 +269,14 @@ bool CAEFactory::SupportsDrain() - return false; - } - -+bool CAEFactory::SupportsQuality() -+{ -+ if(AE) -+ return AE->SupportsQuality(); -+ -+ return false; -+} -+ - void CAEFactory::SetMute(const bool enabled) - { - if(AE) -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index e427519..26efe9f 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -55,6 +55,7 @@ class CAEFactory - static std::string GetDefaultDevice(bool passthrough); - static bool SupportsRaw(); - static bool SupportsDrain(); -+ static bool SupportsQuality(); - static void SetMute(const bool enabled); - static bool IsMuted(); - static float GetVolume(); -diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h -index 52c4efc..69cfc5e 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AE.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AE.h -@@ -191,6 +191,12 @@ class IAE - */ - virtual bool SupportsDrain() { return false; } - -+ /** -+ * Returns true if the AudioEngine supports setting resample quality -+ * @returns true if the AudioEngine is capable of changing resample quality -+ */ -+ virtual bool SupportsQuality() { return false; } -+ - virtual void RegisterAudioCallback(IAudioCallback* pCallback) {} - - virtual void UnregisterAudioCallback() {} -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 436c34a..3f7dfaf 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -763,6 +763,9 @@ void CSettings::InitializeConditions() - if (CAEFactory::SupportsDrain()) - m_settingsManager->AddCondition("audiosupportsdrain"); - -+ if (CAEFactory::SupportsQuality()) -+ m_settingsManager->AddCondition("audiosupportsquality"); -+ - // add more complex conditions - m_settingsManager->AddCondition("addonhassettings", AddonHasSettings); - m_settingsManager->AddCondition("checkmasterlock", CheckMasterLock); -@@ -856,6 +859,7 @@ void CSettings::InitializeISettingCallbacks() - settingSet.insert("audiooutput.audiodevice"); - settingSet.insert("audiooutput.passthroughdevice"); - settingSet.insert("audiooutput.streamsilence"); -+ settingSet.insert("audiooutput.resamplequality"); - settingSet.insert("lookandfeel.skin"); - settingSet.insert("lookandfeel.skinsettings"); - settingSet.insert("lookandfeel.font"); --- -1.8.1.6 - - -From 4803c2f384aab14d1548015e989e496f1b1e84c2 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Thu, 25 Jul 2013 19:40:27 +0200 -Subject: [PATCH 027/136] ActiveAE: Prepare LOW, NORMAL, HIGH quality settings - for resampler - ---- - .../AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp | 18 +++++++++++++++++- - .../AudioEngine/Engines/ActiveAE/ActiveAEResample.h | 7 ++++++- - 2 files changed, 23 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp -index aee3bfc..3412338 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp -@@ -36,7 +36,7 @@ - m_dllSwResample.Unload(); - } - --bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout) -+bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout, int quality) - { - if (!m_dllAvUtil.Load() || !m_dllSwResample.Load()) - return false; -@@ -58,6 +58,22 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst - m_pContext = m_dllSwResample.swr_alloc_set_opts(NULL, m_dst_chan_layout, m_dst_fmt, m_dst_rate, - m_src_chan_layout, m_src_fmt, m_src_rate, - 0, NULL); -+ if(quality == AE_SWR_HIGH_QUALITY) -+ { -+ m_dllAvUtil.av_opt_set_double(m_pContext, "cutoff", 1.0, 0); -+ m_dllAvUtil.av_opt_set_int(m_pContext,"filter_size", 256, 0); -+ } -+ else if(quality == AE_SWR_NORMAL_QUALITY) -+ { -+ // 0.97 is default cutoff so use (1.0 - 0.97) / 2.0 + 0.97 -+ m_dllAvUtil.av_opt_set_double(m_pContext, "cutoff", 0.985, 0); -+ m_dllAvUtil.av_opt_set_int(m_pContext,"filter_size", 64, 0); -+ } -+ else if(quality == AE_SWR_LOW_QUALITY) -+ { -+ m_dllAvUtil.av_opt_set_double(m_pContext, "cutoff", 0.97, 0); -+ m_dllAvUtil.av_opt_set_int(m_pContext,"filter_size", 32, 0); -+ } - - if(!m_pContext) - { -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -index fa95a1d..baa4ef3 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -@@ -25,6 +25,11 @@ - #include "AEAudioFormat.h" - #include "ActiveAEBuffer.h" - -+// This is for the Audiophiles -+#define AE_SWR_LOW_QUALITY 0 -+#define AE_SWR_NORMAL_QUALITY 1 -+#define AE_SWR_HIGH_QUALITY 2 -+ - namespace ActiveAE - { - -@@ -33,7 +38,7 @@ class CActiveAEResample - public: - CActiveAEResample(); - virtual ~CActiveAEResample(); -- bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout = NULL); -+ bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout = NULL, int quality = AE_SWR_NORMAL_QUALITY); - int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples); - int64_t GetDelay(int64_t base); - int GetBufferedSamples(); --- -1.8.1.6 - - -From f8639455cc640b92a08b8dd2f1927b4ed2eac743 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Fri, 26 Jul 2013 19:43:24 +0200 -Subject: [PATCH 028/136] ActiveAE: prepare for changing resample quality by - setting - ---- - .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 38 ++++++++++++++++++---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 3 ++ - .../Engines/ActiveAE/ActiveAEBuffer.cpp | 38 +++++++++------------- - .../AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h | 7 ++-- - .../Engines/ActiveAE/ActiveAEResample.h | 2 +- - 5 files changed, 55 insertions(+), 33 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 935f994..2388f78 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -390,6 +390,7 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::SILENCEMODE, &silence, sizeof(bool)); - } - LoadSettings(); -+ ChangeResampleQuality(); - if (!NeedReconfigureBuffers() && !NeedReconfigureSink()) - return; - m_state = AE_TOP_RECONFIGURING; -@@ -440,8 +441,11 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - par = (MsgStreamParameter*)msg->data; - if (par->stream->m_resampleBuffers) - { -- par->stream->m_resampleBuffers->m_resampleRatio = par->parameter.double_par; -- par->stream->m_resampleBuffers->m_changeRatio = true; -+ if ((unsigned int)(par->stream->m_resampleBuffers->m_format.m_sampleRate * par->parameter.double_par) != par->stream->m_resampleBuffers->m_outSampleRate) -+ { -+ par->stream->m_resampleBuffers->m_resampleRatio = par->parameter.double_par; -+ par->stream->m_resampleBuffers->m_changeResampler = true; -+ } - } - return; - case CActiveAEControlProtocol::STREAMFADE: -@@ -956,7 +960,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt) - } - if (!(*it)->m_resampleBuffers) - { -- (*it)->m_resampleBuffers = new CActiveAEBufferPoolResample((*it)->m_inputBuffers->m_format, outputFormat); -+ (*it)->m_resampleBuffers = new CActiveAEBufferPoolResample((*it)->m_inputBuffers->m_format, outputFormat, m_settings.resampleQuality); - (*it)->m_resampleBuffers->Create(MAX_CACHE_LEVEL*1000, false); - } - if (m_mode == MODE_TRANSCODE || m_streams.size() > 1) -@@ -976,7 +980,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt) - AEAudioFormat vizFormat = m_internalFormat; - vizFormat.m_channelLayout = AE_CH_LAYOUT_2_0; - vizFormat.m_dataFormat = AE_FMT_FLOAT; -- m_vizBuffers = new CActiveAEBufferPoolResample(m_internalFormat, vizFormat); -+ m_vizBuffers = new CActiveAEBufferPoolResample(m_internalFormat, vizFormat, m_settings.resampleQuality); - // TODO use cache of sync + water level - m_vizBuffers->Create(2000, false); - } -@@ -991,7 +995,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt) - } - if (!m_sinkBuffers) - { -- m_sinkBuffers = new CActiveAEBufferPoolResample(sinkInputFormat, m_sinkFormat); -+ m_sinkBuffers = new CActiveAEBufferPoolResample(sinkInputFormat, m_sinkFormat, m_settings.resampleQuality); - m_sinkBuffers->Create(MAX_WATER_LEVEL*1000, true); - } - -@@ -1137,6 +1141,17 @@ float CActiveAE::CalcStreamAmplification(CActiveAEStream *stream, CSampleBuffer - return amp; - } - -+void CActiveAE::ChangeResampleQuality() -+{ -+ std::list::iterator it; -+ for(it=m_streams.begin(); it!=m_streams.end(); ++it) -+ { -+ if ((*it)->m_resampleBuffers && (*it)->m_resampleBuffers->m_resampler && ((*it)->m_resampleBuffers->m_resampleQuality != m_settings.resampleQuality)) -+ (*it)->m_resampleBuffers->m_changeResampler = true; -+ (*it)->m_resampleBuffers->m_resampleQuality = m_settings.resampleQuality; -+ } -+} -+ - void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &settings, bool setmode) - { - // raw pass through -@@ -1756,6 +1771,8 @@ void CActiveAE::LoadSettings() - 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 = CSettings::Get().GetInt("audiooutput.resamplequality"); - } - - bool CActiveAE::Initialize() -@@ -1821,7 +1838,8 @@ void CActiveAE::OnSettingsChange(const std::string& setting) - setting == "audiooutput.channels" || - setting == "audiooutput.multichannellpcm" || - setting == "audiooutput.stereoupmix" || -- setting == "audiooutput.streamsilence") -+ setting == "audiooutput.streamsilence" || -+ setting == "audiooutput.resamplequality") - { - m_controlPort.SendOutMessage(CActiveAEControlProtocol::RECONFIGURE); - } -@@ -1837,6 +1855,11 @@ bool CActiveAE::SupportsDrain() - return true; - } - -+bool CActiveAE::SupportsQuality() -+{ -+ return true; -+} -+ - void CActiveAE::Shutdown() - { - Dispose(); -@@ -2124,7 +2147,8 @@ bool CActiveAE::ResampleSound(CActiveAESound *sound) - orig_config.channels, - orig_config.sample_rate, - orig_config.fmt, -- NULL); -+ NULL, -+ AE_SWR_NORMAL_QUALITY); - - dst_samples = resampler->CalcDstSampleCount(sound->GetSound(true)->nb_samples, - m_internalFormat.m_sampleRate, -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index 9fc1b67..8bbd175 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -57,6 +57,7 @@ struct AudioSettings - bool dtshdpassthrough; - bool multichannellpcm; - bool stereoupmix; -+ int resampleQuality; - }; - - class CActiveAEControlProtocol : public Protocol -@@ -214,6 +215,7 @@ class CActiveAE : public IAE, private CThread - virtual std::string GetDefaultDevice(bool passthrough); - virtual bool SupportsRaw(); - virtual bool SupportsDrain(); -+ virtual bool SupportsQuality(); - - virtual void RegisterAudioCallback(IAudioCallback* pCallback); - virtual void UnregisterAudioCallback(); -@@ -257,6 +259,7 @@ class CActiveAE : public IAE, private CThread - void SStopSound(CActiveAESound *sound); - void DiscardSound(CActiveAESound *sound); - float CalcStreamAmplification(CActiveAEStream *stream, CSampleBuffer *buf); -+ void ChangeResampleQuality(); - - bool RunStages(); - bool HasWork(); -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -index d3ba213..6a2478f 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -@@ -129,7 +129,7 @@ bool CActiveAEBufferPool::Create(unsigned int totaltime) - - //----------------------------------------------------------------------------- - --CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat) -+CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, int quality) - : CActiveAEBufferPool(outputFormat) - { - m_inputFormat = inputFormat; -@@ -141,7 +141,8 @@ bool CActiveAEBufferPool::Create(unsigned int totaltime) - m_empty = true; - m_procSample = NULL; - m_resampleRatio = 1.0; -- m_changeRatio = false; -+ m_resampleQuality = quality; -+ m_changeResampler = false; - } - - CActiveAEBufferPoolResample::~CActiveAEBufferPoolResample() -@@ -166,7 +167,8 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap) - m_inputFormat.m_channelLayout.Count(), - m_inputFormat.m_sampleRate, - CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), -- remap ? &m_format.m_channelLayout : NULL); -+ remap ? &m_format.m_channelLayout : NULL, -+ m_resampleQuality); - } - - // store output sampling rate, needed when ratio gets changed -@@ -175,11 +177,8 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap) - return true; - } - --void CActiveAEBufferPoolResample::ChangeRatio() -+void CActiveAEBufferPoolResample::ChangeResampler() - { --// CLog::Log(LOGNOTICE,"---------- sample rate changed from: %d, to: %d", --// m_outSampleRate, (int)(m_format.m_sampleRate * m_resampleRatio)); -- - m_outSampleRate = m_format.m_sampleRate * m_resampleRatio; - - delete m_resampler; -@@ -193,9 +192,10 @@ void CActiveAEBufferPoolResample::ChangeRatio() - m_inputFormat.m_channelLayout.Count(), - m_inputFormat.m_sampleRate, - CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat), -- NULL); -+ NULL, -+ m_resampleQuality); - -- m_changeRatio = false; -+ m_changeResampler = false; - } - - bool CActiveAEBufferPoolResample::ResampleBuffers(unsigned int timestamp) -@@ -203,17 +203,11 @@ bool CActiveAEBufferPoolResample::ResampleBuffers(unsigned int timestamp) - bool busy = false; - CSampleBuffer *in; - -- if (m_changeRatio) -- { -- if ((unsigned int)(m_format.m_sampleRate * m_resampleRatio) == m_outSampleRate) -- m_changeRatio = false; -- } -- - if (!m_resampler) - { -- if (m_changeRatio) -+ if (m_changeResampler) - { -- ChangeRatio(); -+ ChangeResampler(); - return true; - } - while(!m_inputSamples.empty()) -@@ -241,14 +235,14 @@ bool CActiveAEBufferPoolResample::ResampleBuffers(unsigned int timestamp) - - bool hasInput = !m_inputSamples.empty(); - -- if (hasInput || skipInput || m_drain || m_changeRatio) -+ if (hasInput || skipInput || m_drain || m_changeResampler) - { - if (!m_procSample) - { - m_procSample = GetFreeBuffer(); - } - -- if (hasInput && !skipInput && !m_changeRatio) -+ if (hasInput && !skipInput && !m_changeResampler) - { - in = m_inputSamples.front(); - m_inputSamples.pop_front(); -@@ -274,7 +268,7 @@ bool CActiveAEBufferPoolResample::ResampleBuffers(unsigned int timestamp) - busy = true; - m_empty = (out_samples == 0); - -- if ((m_drain || m_changeRatio) && m_empty) -+ if ((m_drain || m_changeResampler) && m_empty) - { - if (m_fillPackets && m_procSample->pkt->nb_samples != 0) - { -@@ -300,8 +294,8 @@ bool CActiveAEBufferPoolResample::ResampleBuffers(unsigned int timestamp) - m_outputSamples.push_back(m_procSample); - - m_procSample = NULL; -- if (m_changeRatio) -- ChangeRatio(); -+ if (m_changeResampler) -+ ChangeResampler(); - } - // some methods like encode require completely filled packets - else if (!m_fillPackets || (m_procSample->pkt->nb_samples == m_procSample->pkt->max_nb_samples)) -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -index 183c49e..f36d2c0 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h -@@ -86,10 +86,10 @@ class CActiveAEBufferPool - class CActiveAEBufferPoolResample : public CActiveAEBufferPool - { - public: -- CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat); -+ CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, int quality); - virtual ~CActiveAEBufferPoolResample(); - virtual bool Create(unsigned int totaltime, bool remap); -- void ChangeRatio(); -+ void ChangeResampler(); - bool ResampleBuffers(unsigned int timestamp = 0); - float GetDelay(); - void Flush(); -@@ -102,8 +102,9 @@ class CActiveAEBufferPoolResample : public CActiveAEBufferPool - bool m_fillPackets; - bool m_drain; - bool m_empty; -- bool m_changeRatio; -+ bool m_changeResampler; - double m_resampleRatio; -+ int m_resampleQuality; - unsigned int m_outSampleRate; - }; - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -index baa4ef3..6f13b5e 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h -@@ -38,7 +38,7 @@ class CActiveAEResample - public: - CActiveAEResample(); - virtual ~CActiveAEResample(); -- bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout = NULL, int quality = AE_SWR_NORMAL_QUALITY); -+ bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, CAEChannelInfo *remapLayout, int quality); - int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples); - int64_t GetDelay(int64_t base); - int GetBufferedSamples(); --- -1.8.1.6 - - -From ab54a95500021158e2c17973e963a277eafb9d13 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 27 Jul 2013 09:02:37 +0200 -Subject: [PATCH 029/136] ActiveAE: fix starvation caused by viz - ---- - .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 95 +++++++++++----------- - 1 file changed, 49 insertions(+), 46 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 2388f78..4b64235 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -1563,52 +1563,6 @@ bool CActiveAE::RunStages() - if (!m_sinkHasVolume) - Deamplify(*(out->pkt)); - -- // viz -- { -- CSingleLock lock(m_vizLock); -- if (m_audioCallback && m_vizBuffers) -- { -- 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 "out" -- if (!m_vizBuffers->m_freeSamples.empty()) -- { -- out->Acquire(); -- m_vizBuffers->m_inputSamples.push_back(out); -- } -- 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; -- 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 submitted = 0; -- int samples; -- while(submitted < buf->pkt->nb_samples) -- { -- samples = std::min(512, buf->pkt->nb_samples-submitted); -- m_audioCallback->OnAudioData((float*)(buf->pkt->data[0]+2*submitted), samples); -- submitted += samples; -- } -- buf->Return(); -- m_vizBuffers->m_outputSamples.pop_front(); -- } -- } -- } -- else if (m_vizBuffers) -- m_vizBuffers->Flush(); -- } -- - // encode - if (m_mode == MODE_TRANSCODE && m_encoder) - { -@@ -1626,6 +1580,55 @@ bool CActiveAE::RunStages() - - busy = true; - } -+ -+ // viz -+ { -+ CSingleLock lock(m_vizLock); -+ if (m_audioCallback && m_vizBuffers) -+ { -+ 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 "out" -+ if (!m_vizBuffers->m_freeSamples.empty()) -+ { -+ if (out) -+ { -+ out->Acquire(); -+ m_vizBuffers->m_inputSamples.push_back(out); -+ } -+ } -+ 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 submitted = 0; -+ int samples; -+ while(submitted < buf->pkt->nb_samples) -+ { -+ samples = std::min(512, buf->pkt->nb_samples-submitted); -+ m_audioCallback->OnAudioData((float*)(buf->pkt->data[0]+2*submitted), samples); -+ submitted += samples; -+ } -+ buf->Return(); -+ m_vizBuffers->m_outputSamples.pop_front(); -+ } -+ } -+ } -+ else if (m_vizBuffers) -+ m_vizBuffers->Flush(); -+ } - } - // pass through - else --- -1.8.1.6 - - -From a3ed37aa45ad63ef9c9b51248f820898de696167 Mon Sep 17 00:00:00 2001 +From 6eaedd0e1d1b3bb716ea7458b9782a704bf54f1e Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 30 May 2013 10:56:06 +0200 -Subject: [PATCH 030/136] renderer: use fence for determination when a buffer +Subject: [PATCH 001/110] renderer: use fence for determination when a buffer is ready for reuse --- @@ -8642,7 +24,7 @@ index a61d3cf..6acf2f3 100644 virtual bool Supports(ERENDERFEATURE feature) { return false; } diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index d4ed4a1..28b254c 100644 +index d52dead..962680a 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp @@ -128,6 +128,7 @@ @@ -8662,7 +44,7 @@ index d4ed4a1..28b254c 100644 #ifdef HAVE_LIBVA delete &vaapi; #endif -@@ -1207,6 +1210,15 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) +@@ -1228,6 +1231,15 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) RenderSoftware(renderBuffer, m_currentField); VerifyGLState(); } @@ -8678,7 +60,7 @@ index d4ed4a1..28b254c 100644 } void CLinuxRendererGL::RenderSinglePass(int index, int field) -@@ -3397,6 +3409,26 @@ unsigned int CLinuxRendererGL::GetProcessorSize() +@@ -3426,6 +3438,26 @@ unsigned int CLinuxRendererGL::GetProcessorSize() return 0; } @@ -8706,7 +88,7 @@ index d4ed4a1..28b254c 100644 void CLinuxRendererGL::AddProcessor(CVDPAU* vdpau, int index) { diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 93b1a69..1b8bfbe 100644 +index b986d93..a90a532 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h @@ -141,6 +141,7 @@ class CLinuxRendererGL : public CBaseRenderer @@ -8726,7 +108,7 @@ index 93b1a69..1b8bfbe 100644 #ifdef HAVE_LIBVDPAU CVDPAU* vdpau; diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 1b88b36..64c5b1d 100644 +index 0d32715..6a8afff 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -374,11 +374,16 @@ void CXBMCRenderManager::FrameMove() @@ -8751,10 +133,10 @@ index 1b88b36..64c5b1d 100644 1.8.1.6 -From 851631f89b7cf5cc6f915e9588982c732bda1847 Mon Sep 17 00:00:00 2001 +From 4e82aa374e215ba627741f7a0a9ea8da770b2672 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:34:39 +0200 -Subject: [PATCH 031/136] videoplayer: adapt lateness detection and dropping to +Subject: [PATCH 002/110] videoplayer: adapt lateness detection and dropping to buffering --- @@ -8768,7 +150,7 @@ Subject: [PATCH 031/136] videoplayer: adapt lateness detection and dropping to 7 files changed, 260 insertions(+), 38 deletions(-) diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 64c5b1d..8b4476f 100644 +index 6a8afff..deac94b 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -299,6 +299,8 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi @@ -8797,7 +179,7 @@ index 64c5b1d..8b4476f 100644 requeue(m_queued, m_free); /* signal to any waiters to check state */ -@@ -1071,6 +1074,8 @@ void CXBMCRenderManager::PrepareNextRender() +@@ -1076,6 +1079,8 @@ void CXBMCRenderManager::PrepareNextRender() m_discard.push_back(m_presentsource); m_presentsource = idx; m_queued.pop_front(); @@ -8806,7 +188,7 @@ index 64c5b1d..8b4476f 100644 m_presentevent.notifyAll(); } } -@@ -1087,3 +1092,12 @@ void CXBMCRenderManager::DiscardBuffer() +@@ -1092,3 +1097,12 @@ void CXBMCRenderManager::DiscardBuffer() m_presentstep = PRESENT_IDLE; m_presentevent.notifyAll(); } @@ -8867,10 +249,10 @@ index 00fe4c3..52380c1 100644 double m_presenterr; double m_errorbuff[ERRORBUFFSIZE]; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index dc4e8be..ba4a8d5 100644 +index 8fc76b7..7f6d536 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -109,6 +109,10 @@ struct DVDVideoUserData +@@ -117,6 +117,10 @@ struct DVDVideoUserData #define DVP_FLAG_NOSKIP 0x00000010 // indicate this picture should never be dropped #define DVP_FLAG_DROPPED 0x00000020 // indicate that this picture has been dropped in decoder stage, will have no data @@ -8881,7 +263,7 @@ index dc4e8be..ba4a8d5 100644 // DVP_FLAG 0x00000100 - 0x00000f00 is in use by libmpeg2! #define DVP_QSCALE_UNKNOWN 0 -@@ -126,6 +130,9 @@ struct DVDVideoUserData +@@ -134,6 +138,9 @@ struct DVDVideoUserData #define VC_PICTURE 0x00000004 // the decoder got a picture, call Decode(NULL, 0) again to parse the rest of the data #define VC_USERDATA 0x00000008 // the decoder found some userdata, call Decode(NULL, 0) again to parse the rest of the data #define VC_FLUSHED 0x00000010 // the decoder lost it's state, we need to restart decoding again @@ -8891,7 +273,7 @@ index dc4e8be..ba4a8d5 100644 class CDVDVideoCodec { public: -@@ -243,10 +250,16 @@ class CDVDVideoCodec +@@ -251,10 +258,16 @@ class CDVDVideoCodec return 0; } @@ -8910,10 +292,10 @@ index dc4e8be..ba4a8d5 100644 + virtual void SetCodecControl(int flags) {} }; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 4040f38..fef2add 100644 +index 12bad27..530dc9d 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -163,6 +163,7 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx +@@ -167,6 +167,7 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx m_iLastKeyframe = 0; m_dts = DVD_NOPTS_VALUE; m_started = false; @@ -8921,7 +303,7 @@ index 4040f38..fef2add 100644 } CDVDVideoCodecFFmpeg::~CDVDVideoCodecFFmpeg() -@@ -340,6 +341,14 @@ void CDVDVideoCodecFFmpeg::SetDropState(bool bDrop) +@@ -353,6 +354,14 @@ void CDVDVideoCodecFFmpeg::SetDropState(bool bDrop) { if( m_pCodecContext ) { @@ -8936,7 +318,7 @@ index 4040f38..fef2add 100644 // i don't know exactly how high this should be set // couldn't find any good docs on it. think it varies // from codec to codec on what it does -@@ -541,6 +550,7 @@ int CDVDVideoCodecFFmpeg::Decode(uint8_t* pData, int iSize, double dts, double p +@@ -554,6 +563,7 @@ int CDVDVideoCodecFFmpeg::Decode(uint8_t* pData, int iSize, double dts, double p void CDVDVideoCodecFFmpeg::Reset() { m_started = false; @@ -8944,7 +326,7 @@ index 4040f38..fef2add 100644 m_iLastKeyframe = m_pCodecContext->has_b_frames; m_dllAvCodec.avcodec_flush_buffers(m_pCodecContext); -@@ -643,6 +653,22 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture) +@@ -667,6 +677,22 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture) else pDvdVideoPicture->pts = DVD_NOPTS_VALUE; @@ -8967,7 +349,7 @@ index 4040f38..fef2add 100644 if(!m_started) pDvdVideoPicture->iFlags |= DVP_FLAG_DROPPED; -@@ -880,3 +906,8 @@ unsigned CDVDVideoCodecFFmpeg::GetAllowedReferences() +@@ -931,3 +957,8 @@ unsigned CDVDVideoCodecFFmpeg::GetAllowedReferences() else return 0; } @@ -8977,7 +359,7 @@ index 4040f38..fef2add 100644 + m_codecControlFlags = flags; +} diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -index 28416e6..4279222 100644 +index c509339..a511806 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h @@ -46,6 +46,7 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec @@ -8997,7 +379,7 @@ index 28416e6..4279222 100644 bool IsHardwareAllowed() { return !m_bSoftware; } IHardwareDecoder * GetHardware() { return m_pHardware; }; -@@ -124,4 +127,8 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec +@@ -128,4 +131,8 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec double m_dts; bool m_started; std::vector m_formats; @@ -9007,10 +389,10 @@ index 28416e6..4279222 100644 + int m_codecControlFlags; }; diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index dfcbf7e..df54439 100644 +index 51caa05..3284332 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -322,8 +322,10 @@ void CDVDPlayerVideo::Process() +@@ -323,8 +323,10 @@ void CDVDPlayerVideo::Process() int iDropped = 0; //frames dropped in a row bool bRequestDrop = false; @@ -9021,7 +403,7 @@ index dfcbf7e..df54439 100644 while (!m_bStop) { -@@ -433,6 +435,7 @@ void CDVDPlayerVideo::Process() +@@ -434,6 +436,7 @@ void CDVDPlayerVideo::Process() picture.iFlags &= ~DVP_FLAG_ALLOCATED; m_packets.clear(); m_started = false; @@ -9029,7 +411,7 @@ index dfcbf7e..df54439 100644 } else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (CDVDPlayerVideo::Flush()) { -@@ -445,6 +448,7 @@ void CDVDPlayerVideo::Process() +@@ -446,6 +449,7 @@ void CDVDPlayerVideo::Process() //we need to recalculate the framerate //TODO: this needs to be set on a streamchange instead ResetFrameRateCalc(); @@ -9037,7 +419,7 @@ index dfcbf7e..df54439 100644 m_stalled = true; m_started = false; -@@ -462,8 +466,10 @@ void CDVDPlayerVideo::Process() +@@ -463,8 +467,10 @@ void CDVDPlayerVideo::Process() m_speed = static_cast(pMsg)->m_value; if(m_speed == DVD_PLAYSPEED_PAUSE) m_iNrOfPicturesNotToSkip = 0; @@ -9048,7 +430,7 @@ index dfcbf7e..df54439 100644 } else if (pMsg->IsType(CDVDMsg::PLAYER_STARTED)) { -@@ -509,6 +515,28 @@ void CDVDPlayerVideo::Process() +@@ -510,6 +516,28 @@ void CDVDPlayerVideo::Process() m_iNrOfPicturesNotToSkip = 1; } @@ -9077,7 +459,7 @@ index dfcbf7e..df54439 100644 if (m_messageQueue.GetDataSize() == 0 || m_speed < 0) { -@@ -561,15 +589,8 @@ void CDVDPlayerVideo::Process() +@@ -562,15 +590,8 @@ void CDVDPlayerVideo::Process() } m_videoStats.AddSampleBytes(pPacket->iSize); @@ -9095,7 +477,7 @@ index dfcbf7e..df54439 100644 // loop while no error while (!m_bStop) -@@ -1207,33 +1228,12 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) +@@ -1178,33 +1199,12 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) m_FlipTimeStamp += max(0.0, iSleepTime); m_FlipTimeStamp += iFrameDuration; @@ -9133,7 +515,7 @@ index dfcbf7e..df54439 100644 // set fieldsync if picture is interlaced EFIELDSYNC mDisplayField = FS_NONE; -@@ -1266,7 +1266,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) +@@ -1237,7 +1237,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) if (index < 0) return EOS_DROPPED; @@ -9142,7 +524,7 @@ index dfcbf7e..df54439 100644 return result; #else -@@ -1566,3 +1566,127 @@ void CDVDPlayerVideo::CalcFrameRate() +@@ -1537,3 +1537,127 @@ void CDVDPlayerVideo::CalcFrameRate() m_iFrameRateCount = 0; } } @@ -9271,7 +653,7 @@ index dfcbf7e..df54439 100644 + m_totalGain += frametime; +} diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -index 0aee790..c5a3c6c 100644 +index f8ad541..186e271 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h @@ -36,6 +36,25 @@ @@ -9300,7 +682,7 @@ index 0aee790..c5a3c6c 100644 class CDVDPlayerVideo : public CThread { public: -@@ -103,6 +122,7 @@ class CDVDPlayerVideo : public CThread +@@ -104,6 +123,7 @@ class CDVDPlayerVideo : public CThread #define EOS_ABORT 1 #define EOS_DROPPED 2 #define EOS_VERYLATE 4 @@ -9308,7 +690,7 @@ index 0aee790..c5a3c6c 100644 void AutoCrop(DVDVideoPicture* pPicture); void AutoCrop(DVDVideoPicture *pPicture, RECT &crop); -@@ -128,6 +148,7 @@ class CDVDPlayerVideo : public CThread +@@ -129,6 +149,7 @@ class CDVDPlayerVideo : public CThread void ResetFrameRateCalc(); void CalcFrameRate(); @@ -9316,7 +698,7 @@ index 0aee790..c5a3c6c 100644 double m_fFrameRate; //framerate of the video currently playing bool m_bCalcFrameRate; //if we should calculate the framerate from the timestamps -@@ -180,5 +201,7 @@ class CDVDPlayerVideo : public CThread +@@ -182,5 +203,7 @@ class CDVDPlayerVideo : public CThread CPullupCorrection m_pullupCorrection; std::list m_packets; @@ -9328,10 +710,10 @@ index 0aee790..c5a3c6c 100644 1.8.1.6 -From 830f20bd53cd8053f27dae9598718070cde562e0 Mon Sep 17 00:00:00 2001 +From 33ea71cda1fc4767c047865112f2e2a245bcdb50 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 2 Sep 2012 16:05:21 +0200 -Subject: [PATCH 032/136] video player: present correct pts to user for a/v +Subject: [PATCH 003/110] video player: present correct pts to user for a/v sync (after buffering in renderer) --- @@ -9340,10 +722,10 @@ Subject: [PATCH 032/136] video player: present correct pts to user for a/v 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index df54439..25ed8f1 100644 +index 3284332..4970675 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1486,6 +1486,22 @@ void CDVDPlayerVideo::ResetFrameRateCalc() +@@ -1457,6 +1457,22 @@ void CDVDPlayerVideo::ResetFrameRateCalc() g_advancedSettings.m_videoFpsDetect == 0; } @@ -9366,7 +748,7 @@ index df54439..25ed8f1 100644 #define MAXFRAMERATEDIFF 0.01 #define MAXFRAMESERR 1000 -@@ -1604,6 +1620,15 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) +@@ -1575,6 +1591,15 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) else iInterval = 1/m_fFrameRate*(double)DVD_TIME_BASE; @@ -9383,7 +765,7 @@ index df54439..25ed8f1 100644 && bNewFrame && m_bAllowDrop diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -index c5a3c6c..ec30fc5 100644 +index 186e271..59c7f09 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h @@ -100,7 +100,7 @@ class CDVDPlayerVideo : public CThread @@ -9399,10 +781,10 @@ index c5a3c6c..ec30fc5 100644 1.8.1.6 -From 1cd72b29520878b75cef6ec2ff5aa13ec92b291a Mon Sep 17 00:00:00 2001 +From 10a7f371c9c49afcbdbc302380c406bdbb126308 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 16 Feb 2013 18:25:53 +0100 -Subject: [PATCH 033/136] videoplayer: some rework and documentation +Subject: [PATCH 004/110] videoplayer: some rework and documentation --- .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 29 ++++++++++++++++++++-- @@ -9412,10 +794,10 @@ Subject: [PATCH 033/136] videoplayer: some rework and documentation 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index ba4a8d5..809d432 100644 +index 7f6d536..2ccae41 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -131,7 +131,6 @@ struct DVDVideoUserData +@@ -139,7 +139,6 @@ struct DVDVideoUserData #define VC_USERDATA 0x00000008 // the decoder found some userdata, call Decode(NULL, 0) again to parse the rest of the data #define VC_FLUSHED 0x00000010 // the decoder lost it's state, we need to restart decoding again #define VC_DROPPED 0x00000020 // needed to identify if a picture was dropped @@ -9423,7 +805,7 @@ index ba4a8d5..809d432 100644 class CDVDVideoCodec { -@@ -256,10 +255,36 @@ class CDVDVideoCodec +@@ -264,10 +263,36 @@ class CDVDVideoCodec */ virtual unsigned GetAllowedReferences() { return 0; } @@ -9462,10 +844,10 @@ index ba4a8d5..809d432 100644 virtual void SetCodecControl(int flags) {} }; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index fef2add..38e6e3f 100644 +index 530dc9d..e5748df 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -907,6 +907,17 @@ unsigned CDVDVideoCodecFFmpeg::GetAllowedReferences() +@@ -958,6 +958,17 @@ unsigned CDVDVideoCodecFFmpeg::GetAllowedReferences() return 0; } @@ -9484,7 +866,7 @@ index fef2add..38e6e3f 100644 { m_codecControlFlags = flags; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -index 4279222..8e0552f 100644 +index a511806..0436108 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h @@ -64,7 +64,7 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec @@ -9497,10 +879,10 @@ index 4279222..8e0552f 100644 bool IsHardwareAllowed() { return !m_bSoftware; } diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 25ed8f1..3d86d5b 100644 +index 4970675..2e76ff5 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1597,7 +1597,7 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) +@@ -1568,7 +1568,7 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) int iBufferLevel; // get decoder stats @@ -9513,16 +895,16 @@ index 25ed8f1..3d86d5b 100644 1.8.1.6 -From 781fabbc7ec049f00bd4eb1a6511c39dd1c6dbfe Mon Sep 17 00:00:00 2001 +From 5dd41a12cb592e81866245da375541f97d77b861 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 7 Apr 2012 09:19:00 +0200 -Subject: [PATCH 034/136] vdpau: redesign +Subject: [PATCH 005/110] vdpau: redesign --- - language/English/strings.po | 12 +- + language/English/strings.po | 14 +- system/settings/settings.xml | 10 + system/shaders/yuv2rgb_basic.glsl | 12 + - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 200 +- + xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 225 +- xbmc/cores/VideoRenderers/LinuxRendererGL.h | 13 +- xbmc/cores/VideoRenderers/RenderFormats.h | 1 + xbmc/cores/VideoRenderers/RenderManager.cpp | 3 +- @@ -9536,34 +918,34 @@ Subject: [PATCH 034/136] vdpau: redesign xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + xbmc/settings/AdvancedSettings.cpp | 8 +- xbmc/settings/AdvancedSettings.h | 4 +- - xbmc/utils/ActorProtocol.cpp | 4 + - xbmc/utils/ActorProtocol.h | 4 + xbmc/video/dialogs/GUIDialogVideoSettings.cpp | 2 +- xbmc/windowing/X11/WinSystemX11.h | 1 + - 21 files changed, 3578 insertions(+), 1230 deletions(-) + 19 files changed, 3597 insertions(+), 1230 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index 40fbb74..f646f9f 100644 +index ec3ee5f..a6b0297 100644 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -5770,7 +5770,15 @@ msgctxt "#13435" - msgid "Enable HQ Scalers for scalings above" +@@ -5775,7 +5775,17 @@ msgctxt "#13436" + msgid "Allow hardware acceleration (libstagefright)" msgstr "" --#empty strings from id 13436 to 13499 -+msgctxt "#13436" +-#empty strings from id 13437 to 13499 ++#: system/settings/settings.xml ++msgctxt "#13437" +msgid "Allow Vdpau OpenGL interop" +msgstr "" + -+msgctxt "#13437" ++#: system/settings/settings.xml ++msgctxt "#13438" +msgid "Allow Vdpau OpenGL interop YUV" +msgstr "" + -+#empty strings from id 13438 to 13499 ++#empty strings from id 13439 to 13499 #: system/settings/settings.xml msgctxt "#13500" -@@ -6845,7 +6853,7 @@ msgid "Software Blend" +@@ -6850,7 +6860,7 @@ msgid "Software Blend" msgstr "" msgctxt "#16325" @@ -9573,14 +955,14 @@ index 40fbb74..f646f9f 100644 #empty strings from id 16326 to 16399 diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 461e787..b3ab3d1 100644 +index d1e5eff..56d637d 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -375,6 +375,16 @@ 2 true -+ ++ + HAVE_LIBVDPAU + 2 + true @@ -9617,10 +999,10 @@ index c8c8a2e..0799a4b 100644 #if(XBMC_texture_rectangle) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 28b254c..e7abc7b 100644 +index 962680a..388d778 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -681,6 +681,18 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -702,6 +702,18 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) glDisable(GL_POLYGON_STIPPLE); } @@ -9639,7 +1021,7 @@ index 28b254c..e7abc7b 100644 else Render(flags, index); -@@ -761,11 +773,6 @@ void CLinuxRendererGL::FlipPage(int source) +@@ -782,11 +794,6 @@ void CLinuxRendererGL::FlipPage(int source) m_buffers[m_iYV12RenderBuffer].flipindex = ++m_flipindex; @@ -9651,7 +1033,7 @@ index 28b254c..e7abc7b 100644 return; } -@@ -1092,6 +1099,12 @@ void CLinuxRendererGL::LoadShaders(int field) +@@ -1113,6 +1120,12 @@ void CLinuxRendererGL::LoadShaders(int field) m_textureCreate = &CLinuxRendererGL::CreateVDPAUTexture; m_textureDelete = &CLinuxRendererGL::DeleteVDPAUTexture; } @@ -9664,7 +1046,7 @@ index 28b254c..e7abc7b 100644 else if (m_format == RENDER_FMT_VAAPI) { m_textureUpload = &CLinuxRendererGL::UploadVAAPITexture; -@@ -1167,7 +1180,10 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) +@@ -1188,7 +1201,10 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) m_currentField = FIELD_FULL; // call texture load function @@ -9675,7 +1057,7 @@ index 28b254c..e7abc7b 100644 if (m_renderMethod & RENDER_GLSL) { -@@ -1542,17 +1558,12 @@ void CLinuxRendererGL::RenderFromFBO() +@@ -1563,17 +1579,12 @@ void CLinuxRendererGL::RenderFromFBO() void CLinuxRendererGL::RenderVDPAU(int index, int field) { #ifdef HAVE_LIBVDPAU @@ -9693,9 +1075,9 @@ index 28b254c..e7abc7b 100644 - vdpau->BindPixmap(); + glBindTexture(m_textureTarget, plane.id); - // Try some clamping or wrapping - glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -@@ -1610,8 +1621,6 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) + // make sure we know the correct texture size + GetPlaneTextureSize(plane); +@@ -1635,8 +1646,6 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) if (m_pVideoFilterShader) m_pVideoFilterShader->Disable(); @@ -9704,7 +1086,7 @@ index 28b254c..e7abc7b 100644 glBindTexture (m_textureTarget, 0); glDisable(m_textureTarget); #endif -@@ -2288,12 +2297,14 @@ void CLinuxRendererGL::DeleteVDPAUTexture(int index) +@@ -2317,12 +2326,14 @@ void CLinuxRendererGL::DeleteVDPAUTexture(int index) { #ifdef HAVE_LIBVDPAU YUVPLANE &plane = m_buffers[index].fields[0][0]; @@ -9719,7 +1101,7 @@ index 28b254c..e7abc7b 100644 #endif } -@@ -2326,10 +2337,147 @@ bool CLinuxRendererGL::CreateVDPAUTexture(int index) +@@ -2355,10 +2366,172 @@ bool CLinuxRendererGL::CreateVDPAUTexture(int index) void CLinuxRendererGL::UploadVDPAUTexture(int index) { #ifdef HAVE_LIBVDPAU @@ -9727,8 +1109,9 @@ index 28b254c..e7abc7b 100644 + VDPAU::CVdpauRenderPicture *vdpau = m_buffers[index].vdpau; + + unsigned int flipindex = m_buffers[index].flipindex; ++ YV12Image &im = m_buffers[index].image; + YUVFIELDS &fields = m_buffers[index].fields; -+ YUVPLANE &plane = fields[0][0]; ++ YUVPLANE &plane = fields[0][1]; + + if (!vdpau || !vdpau->valid) + { @@ -9736,7 +1119,31 @@ index 28b254c..e7abc7b 100644 + return; + } + -+ fields[0][1].id = vdpau->texture[0]; ++ plane.id = vdpau->texture[0]; ++ ++ plane.pixpertex_x = 1; ++ plane.pixpertex_y = 1; ++ ++ plane.rect = m_sourceRect; ++ plane.width = im.width; ++ plane.height = im.height; ++ ++ plane.height /= plane.pixpertex_y; ++ plane.rect.y1 /= plane.pixpertex_y; ++ plane.rect.y2 /= plane.pixpertex_y; ++ plane.width /= plane.pixpertex_x; ++ plane.rect.x1 /= plane.pixpertex_x; ++ plane.rect.x2 /= plane.pixpertex_x; ++ ++ if (m_textureTarget == GL_TEXTURE_2D) ++ { ++ plane.height /= plane.texheight; ++ plane.rect.y1 /= plane.texheight; ++ plane.rect.y2 /= plane.texheight; ++ plane.width /= plane.texwidth; ++ plane.rect.x1 /= plane.texwidth; ++ plane.rect.x2 /= plane.texwidth; ++ } + +#endif +} @@ -9868,7 +1275,7 @@ index 28b254c..e7abc7b 100644 void CLinuxRendererGL::DeleteVAAPITexture(int index) { -@@ -3252,12 +3400,13 @@ bool CLinuxRendererGL::Supports(EINTERLACEMETHOD method) +@@ -3281,12 +3454,13 @@ bool CLinuxRendererGL::Supports(EINTERLACEMETHOD method) if(method == VS_INTERLACEMETHOD_AUTO) return true; @@ -9886,7 +1293,7 @@ index 28b254c..e7abc7b 100644 #endif return false; } -@@ -3350,14 +3499,7 @@ EINTERLACEMETHOD CLinuxRendererGL::AutoInterlaceMethod() +@@ -3379,14 +3553,7 @@ EINTERLACEMETHOD CLinuxRendererGL::AutoInterlaceMethod() return VS_INTERLACEMETHOD_NONE; if(m_renderMethod & RENDER_VDPAU) @@ -9901,7 +1308,7 @@ index 28b254c..e7abc7b 100644 if(Supports(VS_INTERLACEMETHOD_RENDER_BOB)) return VS_INTERLACEMETHOD_RENDER_BOB; -@@ -3402,6 +3544,7 @@ void CLinuxRendererGL::UnBindPbo(YUVBUFFER& buff) +@@ -3431,6 +3598,7 @@ void CLinuxRendererGL::UnBindPbo(YUVBUFFER& buff) unsigned int CLinuxRendererGL::GetProcessorSize() { if(m_format == RENDER_FMT_VDPAU @@ -9909,7 +1316,7 @@ index 28b254c..e7abc7b 100644 || m_format == RENDER_FMT_VAAPI || m_format == RENDER_FMT_CVBREF) return 1; -@@ -3430,11 +3573,12 @@ bool CLinuxRendererGL::IsProcessed(int idx) +@@ -3459,11 +3627,12 @@ bool CLinuxRendererGL::IsProcessed(int idx) } #ifdef HAVE_LIBVDPAU @@ -9925,7 +1332,7 @@ index 28b254c..e7abc7b 100644 #endif diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 1b8bfbe..aac04bd 100644 +index a90a532..fdda2ed 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h @@ -39,12 +39,11 @@ @@ -9979,7 +1386,7 @@ index 1b8bfbe..aac04bd 100644 #endif #ifdef HAVE_LIBVA VAAPI::CHolder& vaapi; -@@ -326,6 +330,7 @@ class CLinuxRendererGL : public CBaseRenderer +@@ -327,6 +331,7 @@ class CLinuxRendererGL : public CBaseRenderer bool m_nonLinStretch; bool m_nonLinStretchGui; float m_pixelRatio; @@ -9988,7 +1395,7 @@ index 1b8bfbe..aac04bd 100644 diff --git a/xbmc/cores/VideoRenderers/RenderFormats.h b/xbmc/cores/VideoRenderers/RenderFormats.h -index f67a32c..9ad1671 100644 +index 29d45e0..3b09194 100644 --- a/xbmc/cores/VideoRenderers/RenderFormats.h +++ b/xbmc/cores/VideoRenderers/RenderFormats.h @@ -26,6 +26,7 @@ enum ERenderFormat { @@ -10000,7 +1407,7 @@ index f67a32c..9ad1671 100644 RENDER_FMT_UYVY422, RENDER_FMT_YUYV422, diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 8b4476f..5b08c1e 100644 +index deac94b..a1c2fc7 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -925,7 +925,8 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) @@ -10040,7 +1447,7 @@ index ad1940c..48302ff 100644 CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index 809d432..43befb4 100644 +index 2ccae41..0dd29c3 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h @@ -34,7 +34,7 @@ @@ -10052,7 +1459,7 @@ index 809d432..43befb4 100644 class COpenMax; class COpenMaxVideo; struct OpenMaxVideoBuffer; -@@ -55,7 +55,7 @@ struct DVDVideoPicture +@@ -57,7 +57,7 @@ struct DVDVideoPicture DXVA::CSurfaceContext* context; }; struct { @@ -10062,7 +1469,7 @@ index 809d432..43befb4 100644 struct { VAAPI::CHolder* vaapi; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 38e6e3f..e133d78 100644 +index e5748df..aa2d1e4 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -75,11 +75,11 @@ enum PixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avctx @@ -10081,7 +1488,7 @@ index 38e6e3f..e133d78 100644 ctx->SetHardware(vdp); return *cur; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h -index 8e0552f..30c67ab 100644 +index 0436108..c0ce198 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h @@ -29,7 +29,6 @@ @@ -15199,10 +6606,10 @@ index e760f28..1c21535 100644 + +} diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 3d86d5b..b0a33de 100644 +index 2e76ff5..8ed34f9 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1009,6 +1009,7 @@ static std::string GetRenderFormatName(ERenderFormat format) +@@ -1010,6 +1010,7 @@ static std::string GetRenderFormatName(ERenderFormat format) case RENDER_FMT_UYVY422: return "UYVY"; case RENDER_FMT_YUYV422: return "YUY2"; case RENDER_FMT_VDPAU: return "VDPAU"; @@ -15211,7 +6618,7 @@ index 3d86d5b..b0a33de 100644 case RENDER_FMT_VAAPI: return "VAAPI"; case RENDER_FMT_OMXEGL: return "OMXEGL"; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 2a2a15a..f0a997e 100644 +index 3ec25c1..6541f65 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -161,7 +161,7 @@ void CAdvancedSettings::Initialize() @@ -15232,7 +6639,7 @@ index 2a2a15a..f0a997e 100644 m_DXVACheckCompatibility = false; m_DXVACheckCompatibilityPresent = false; m_DXVAForceProcessorRenderer = true; -@@ -572,7 +574,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) +@@ -590,7 +592,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) XMLUtils::GetString(pElement,"cleandatetime", m_videoCleanDateTimeRegExp); XMLUtils::GetString(pElement,"ppffmpegdeinterlacing",m_videoPPFFmpegDeint); XMLUtils::GetString(pElement,"ppffmpegpostprocessing",m_videoPPFFmpegPostProc); @@ -15241,20 +6648,20 @@ index 2a2a15a..f0a997e 100644 XMLUtils::GetFloat(pElement, "nonlinearstretchratio", m_videoNonLinStretchRatio, 0.01f, 1.0f); XMLUtils::GetBoolean(pElement,"enablehighqualityhwscalers", m_videoEnableHighQualityHwScalers); XMLUtils::GetFloat(pElement,"autoscalemaxfps",m_videoAutoScaleMaxFps, 0.0f, 1000.0f); -@@ -581,6 +583,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) +@@ -599,6 +601,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) XMLUtils::GetBoolean(pElement,"allowmpeg4vaapi",m_videoAllowMpeg4VAAPI); XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace); XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1); + XMLUtils::GetBoolean(pElement,"vdpauInvTelecine",m_videoVDPAUtelecine); + XMLUtils::GetBoolean(pElement,"vdpauHDdeintSkipChroma",m_videoVDPAUdeintSkipChromaHD); - TiXmlElement* pAdjustRefreshrate = pElement->FirstChildElement("adjustrefreshrate"); - if (pAdjustRefreshrate) + TiXmlElement* pStagefrightElem = pElement->FirstChildElement("stagefright"); + if (pStagefrightElem) diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index 084fe8b..3a52878 100644 +index 224268a..310db76 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h -@@ -147,6 +147,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler +@@ -158,6 +158,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler int m_videoPercentSeekBackwardBig; CStdString m_videoPPFFmpegDeint; CStdString m_videoPPFFmpegPostProc; @@ -15263,7 +6670,7 @@ index 084fe8b..3a52878 100644 bool m_musicUseTimeSeeking; int m_musicTimeSeekForward; int m_musicTimeSeekBackward; -@@ -162,7 +164,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler +@@ -173,7 +175,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler CStdString m_audioHost; bool m_audioApplyDrc; @@ -15272,39 +6679,11 @@ index 084fe8b..3a52878 100644 float m_videoNonLinStretchRatio; bool m_videoEnableHighQualityHwScalers; float m_videoAutoScaleMaxFps; -diff --git a/xbmc/utils/ActorProtocol.cpp b/xbmc/utils/ActorProtocol.cpp -index cf4c26f..e3090c3 100644 ---- a/xbmc/utils/ActorProtocol.cpp -+++ b/xbmc/utils/ActorProtocol.cpp -@@ -1,5 +1,9 @@ - /* -+<<<<<<< HEAD - * Copyright (C) 2005-2013 Team XBMC -+======= -+ * Copyright (C) 2005-2012 Team XBMC -+>>>>>>> b5471a2... vdpau: redesign - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify -diff --git a/xbmc/utils/ActorProtocol.h b/xbmc/utils/ActorProtocol.h -index 8ef3359..8c4038a 100644 ---- a/xbmc/utils/ActorProtocol.h -+++ b/xbmc/utils/ActorProtocol.h -@@ -1,5 +1,9 @@ - /* -+<<<<<<< HEAD - * Copyright (C) 2005-2013 Team XBMC -+======= -+ * Copyright (C) 2005-2012 Team XBMC -+>>>>>>> b5471a2... vdpau: redesign - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -index 684b471..2bad710 100644 +index a27aed3..8f30248 100644 --- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -@@ -104,7 +104,7 @@ void CGUIDialogVideoSettings::CreateSettings() +@@ -108,7 +108,7 @@ void CGUIDialogVideoSettings::CreateSettings() entries.push_back(make_pair(VS_INTERLACEMETHOD_INVERSE_TELECINE , 16314)); entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL , 16311)); entries.push_back(make_pair(VS_INTERLACEMETHOD_VDPAU_TEMPORAL , 16310)); @@ -15329,35 +6708,36 @@ index a0f7bba..b6b6ec4 100644 1.8.1.6 -From 72f31a6c742e0d2145f9fc85786b7c4d96759214 Mon Sep 17 00:00:00 2001 +From 64a3764653d8021becc1ba27cb1b9900ab581ff5 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 12 Dec 2012 09:52:17 +0100 -Subject: [PATCH 035/136] vdpau: make interop gl default and remove setting, +Subject: [PATCH 006/110] vdpau: make interop gl default and remove setting, rename and intvert interop yuv --- - language/English/strings.po | 8 ++------ + language/English/strings.po | 9 ++------- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 17 ++++++++++------- - 2 files changed, 12 insertions(+), 13 deletions(-) + 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index f646f9f..ba414f9 100644 +index a6b0297..fae2505 100644 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -5771,14 +5771,10 @@ msgid "Enable HQ Scalers for scalings above" - msgstr "" +@@ -5777,15 +5777,10 @@ msgstr "" - msgctxt "#13436" + #: system/settings/settings.xml + msgctxt "#13437" -msgid "Allow Vdpau OpenGL interop" +msgid "Prefer VDPAU Video Mixer" msgstr "" --msgctxt "#13437" +-#: system/settings/settings.xml +-msgctxt "#13438" -msgid "Allow Vdpau OpenGL interop YUV" -msgstr "" - --#empty strings from id 13438 to 13499 -+#empty strings from id 13437 to 13499 +-#empty strings from id 13439 to 13499 ++#empty strings from id 13438 to 13499 #: system/settings/settings.xml msgctxt "#13500" @@ -15437,10 +6817,10 @@ index 4844469..fc95760 100644 1.8.1.6 -From 284223523ec875a402ea85c208da19e5949cab44 Mon Sep 17 00:00:00 2001 +From 9288e2009b64f9ceebda4c27a98a412c07ee8cbf Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 12 Dec 2012 18:34:47 +0100 -Subject: [PATCH 036/136] vdpau: drop studio level conversion +Subject: [PATCH 007/110] vdpau: drop studio level conversion --- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 4 +- @@ -15448,10 +6828,10 @@ Subject: [PATCH 036/136] vdpau: drop studio level conversion 2 files changed, 6 insertions(+), 92 deletions(-) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index e7abc7b..2d63413 100644 +index 388d778..2de63b8 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -3316,7 +3316,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) +@@ -3370,7 +3370,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) { if(feature == RENDERFEATURE_BRIGHTNESS) { @@ -15460,7 +6840,7 @@ index e7abc7b..2d63413 100644 return true; if (m_renderMethod & RENDER_VAAPI) -@@ -3329,7 +3329,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) +@@ -3383,7 +3383,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) if(feature == RENDERFEATURE_CONTRAST) { @@ -15592,10 +6972,10 @@ index fc95760..07af62a 100644 1.8.1.6 -From 16f3d1420c64bd711b95102c6364a308c1b5bd54 Mon Sep 17 00:00:00 2001 +From 471ec30394381baccd0d7c6fe24efc834a1e9d25 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 12 Dec 2012 20:28:49 +0100 -Subject: [PATCH 037/136] vdpau: observe ffmpeg tags for color space +Subject: [PATCH 008/110] vdpau: observe ffmpeg tags for color space --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 38 ++++++++++++++++++-------- @@ -15699,10 +7079,10 @@ index 1c21535..674571b 100644 1.8.1.6 -From b301b228ac26b0ea083865cca42337b9bf816175 Mon Sep 17 00:00:00 2001 +From 0d627c2dfe93bc9cbde2f0c45b209b24ae3afcf6 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 27 Jan 2013 12:10:19 +0100 -Subject: [PATCH 038/136] vdpau: switch off de-interlacing on ff +Subject: [PATCH 009/110] vdpau: switch off de-interlacing on ff --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 5 +++-- @@ -15728,10 +7108,10 @@ index 7ecc2cf..3cc02ee 100644 1.8.1.6 -From cdd164a91bd82358f2c6c0923ba9a33f59ab9c1c Mon Sep 17 00:00:00 2001 +From 9bd37f8dce8f15c2b7db6d998b7637645345f432 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 2 Feb 2013 13:17:09 +0100 -Subject: [PATCH 039/136] vdpau: fix mp4 part2 decoding, activate by default +Subject: [PATCH 010/110] vdpau: fix mp4 part2 decoding, activate by default --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 3 +-- @@ -15755,7 +7135,7 @@ index 3cc02ee..d90df12 100644 { if (!CDVDCodecUtils::IsVP3CompatibleWidth(avctx->coded_width)) diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index f0a997e..292750d 100644 +index 6541f65..8287651 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -165,7 +165,7 @@ void CAdvancedSettings::Initialize() @@ -15771,10 +7151,10 @@ index f0a997e..292750d 100644 1.8.1.6 -From 5f076a0a19a3e5443d08a0a8d1f20c1189919848 Mon Sep 17 00:00:00 2001 +From 084d9ac176408dd4240edb14b144f67a884eda5e Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 2 Mar 2013 15:19:19 +0100 -Subject: [PATCH 040/136] vdpau: re-add limited range conversion +Subject: [PATCH 011/110] vdpau: re-add limited range conversion --- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 4 +- @@ -15782,10 +7162,10 @@ Subject: [PATCH 040/136] vdpau: re-add limited range conversion 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 2d63413..e7abc7b 100644 +index 2de63b8..388d778 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -3316,7 +3316,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) +@@ -3370,7 +3370,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) { if(feature == RENDERFEATURE_BRIGHTNESS) { @@ -15794,7 +7174,7 @@ index 2d63413..e7abc7b 100644 return true; if (m_renderMethod & RENDER_VAAPI) -@@ -3329,7 +3329,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) +@@ -3383,7 +3383,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) if(feature == RENDERFEATURE_CONTRAST) { @@ -15918,10 +7298,10 @@ index d90df12..62cd72e 100644 1.8.1.6 -From f2b725fe8b735a7e6899b5a8dc5630c6498fa277 Mon Sep 17 00:00:00 2001 +From 4b7e68462033d60522677cb8abd3472ffe0734f0 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 25 Sep 2012 12:14:15 +0200 -Subject: [PATCH 041/136] linuxrenderer: drop method RenderMultiPass +Subject: [PATCH 012/110] linuxrenderer: drop method RenderMultiPass --- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 9 ++------- @@ -15929,10 +7309,10 @@ Subject: [PATCH 041/136] linuxrenderer: drop method RenderMultiPass 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index e7abc7b..39ba8a4 100644 +index 388d778..e8ae9df 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -1197,7 +1197,8 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) +@@ -1218,7 +1218,8 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) break; case RQ_MULTIPASS: @@ -15942,7 +7322,7 @@ index e7abc7b..39ba8a4 100644 VerifyGLState(); break; } -@@ -1329,12 +1330,6 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field) +@@ -1350,12 +1351,6 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field) VerifyGLState(); } @@ -15956,7 +7336,7 @@ index e7abc7b..39ba8a4 100644 { YUVPLANES &planes = m_buffers[index].fields[field]; diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index aac04bd..41a1be7 100644 +index fdda2ed..1a3a6cf 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h @@ -218,7 +218,6 @@ class CLinuxRendererGL : public CBaseRenderer @@ -15971,10 +7351,10 @@ index aac04bd..41a1be7 100644 1.8.1.6 -From 67e034b0cec5e24c0c5e8394e27e7046e5a77f69 Mon Sep 17 00:00:00 2001 +From b92169b126e26347156b617be5c7c7ac7a9ed191 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 25 Sep 2012 13:20:47 +0200 -Subject: [PATCH 042/136] linuxrenderer: implement progressive weave for vdpau +Subject: [PATCH 013/110] linuxrenderer: implement progressive weave for vdpau --- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 55 +++++++++++++++++++-------- @@ -15982,10 +7362,10 @@ Subject: [PATCH 042/136] linuxrenderer: implement progressive weave for vdpau 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 39ba8a4..c072f5e 100644 +index e8ae9df..6807df7 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -681,18 +681,6 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +@@ -702,18 +702,6 @@ void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) glDisable(GL_POLYGON_STIPPLE); } @@ -16004,7 +7384,7 @@ index 39ba8a4..c072f5e 100644 else Render(flags, index); -@@ -1192,13 +1180,21 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) +@@ -1213,13 +1201,21 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) { case RQ_LOW: case RQ_SINGLEPASS: @@ -16029,7 +7409,7 @@ index 39ba8a4..c072f5e 100644 VerifyGLState(); break; } -@@ -1330,7 +1326,7 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field) +@@ -1351,7 +1347,7 @@ void CLinuxRendererGL::RenderSinglePass(int index, int field) VerifyGLState(); } @@ -16038,7 +7418,7 @@ index 39ba8a4..c072f5e 100644 { YUVPLANES &planes = m_buffers[index].fields[field]; -@@ -1432,6 +1428,8 @@ void CLinuxRendererGL::RenderToFBO(int index, int field) +@@ -1453,6 +1449,8 @@ void CLinuxRendererGL::RenderToFBO(int index, int field) } m_fbo.width *= planes[0].pixpertex_x; m_fbo.height *= planes[0].pixpertex_y; @@ -16047,7 +7427,7 @@ index 39ba8a4..c072f5e 100644 // 1st Pass to video frame size glBegin(GL_QUADS); -@@ -1550,6 +1548,31 @@ void CLinuxRendererGL::RenderFromFBO() +@@ -1571,6 +1569,31 @@ void CLinuxRendererGL::RenderFromFBO() VerifyGLState(); } @@ -16080,7 +7460,7 @@ index 39ba8a4..c072f5e 100644 { #ifdef HAVE_LIBVDPAU diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 41a1be7..274f980 100644 +index 1a3a6cf..258a598 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h @@ -218,12 +218,12 @@ class CLinuxRendererGL : public CBaseRenderer @@ -16102,10 +7482,10 @@ index 41a1be7..274f980 100644 1.8.1.6 -From 561523ebacefe1e8f29b6f701501cc4212daf134 Mon Sep 17 00:00:00 2001 +From 43a1ea8a43bc950f3f60bdeb02adf0d2a117273f Mon Sep 17 00:00:00 2001 From: fritsch Date: Thu, 28 Mar 2013 10:38:37 +0100 -Subject: [PATCH 043/136] VDPAU: silence compiler warnings +Subject: [PATCH 014/110] VDPAU: silence compiler warnings --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 19 ++++++++----------- @@ -16201,10 +7581,10 @@ index 62cd72e..a0ccd9f 100644 1.8.1.6 -From b65e8eb5fd1a5ba8fc4371c73f3f5ddb9b1f4f06 Mon Sep 17 00:00:00 2001 +From 6e2414da30e6a874fa7ac6a56930e42b737eeac8 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 25 Feb 2013 08:47:10 +0100 -Subject: [PATCH 044/136] vdpau: release more resources on pre-cleanup +Subject: [PATCH 015/110] vdpau: release more resources on pre-cleanup --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 72 +++++++++++++++++++++++--- @@ -16342,10 +7722,10 @@ index 674571b..c0835cf 100644 1.8.1.6 -From 190abb1d038374350c9b3ec41de6d78632a58d49 Mon Sep 17 00:00:00 2001 +From dd49526d8216e4544ec56101f62f85a5b92ee2e0 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 6 Mar 2013 07:35:10 +0100 -Subject: [PATCH 045/136] vdpau: set deinterlacing method to auto, if default +Subject: [PATCH 016/110] vdpau: set deinterlacing method to auto, if default method not supported --- @@ -16377,10 +7757,10 @@ index 89ffc6e..b23f530 100644 1.8.1.6 -From d0f6095e6298ed46e4ccc991d2491fada8d1a0fd Mon Sep 17 00:00:00 2001 +From c5785dcbd029102df0e3bcd0e3ef071105ed6954 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 21 Apr 2013 09:19:34 +0200 -Subject: [PATCH 046/136] vdpau: fix deadlock if decoder is closed while +Subject: [PATCH 017/110] vdpau: fix deadlock if decoder is closed while refresh rate changes --- @@ -16418,10 +7798,10 @@ index b23f530..2fdcf37 100644 1.8.1.6 -From 2fc0e791999aa60262088b97e67d11fc339be17f Mon Sep 17 00:00:00 2001 +From a8f89679a150db3f6d9e11dbe214de888b373546 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 1 Jun 2013 11:21:19 +0200 -Subject: [PATCH 047/136] renderer: bump buffers to 5 +Subject: [PATCH 018/110] renderer: bump buffers to 5 --- xbmc/cores/VideoRenderers/BaseRenderer.h | 2 +- @@ -16444,10 +7824,10 @@ index 6acf2f3..f44024c 100644 1.8.1.6 -From 4d6c7fbefdfedad5e67a37e8f1f33714a9cc10dd Mon Sep 17 00:00:00 2001 +From 152844f66eeca185da6982d9e7e66a2ae5a502da Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:41:31 +0200 -Subject: [PATCH 048/136] videoplayer: update frametime, it might change due to +Subject: [PATCH 019/110] videoplayer: update frametime, it might change due to fps detection --- @@ -16455,10 +7835,10 @@ Subject: [PATCH 048/136] videoplayer: update frametime, it might change due to 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index b0a33de..d45d8ae 100644 +index 8ed34f9..bc049bd 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -707,6 +707,8 @@ void CDVDPlayerVideo::Process() +@@ -708,6 +708,8 @@ void CDVDPlayerVideo::Process() int iResult = OutputPicture(&picture, pts); @@ -16471,10 +7851,10 @@ index b0a33de..d45d8ae 100644 1.8.1.6 -From e4359bc5349ccecd4b7d7511c513eadcde12bc87 Mon Sep 17 00:00:00 2001 +From 4375b9a0c7e7e12f5f7d5d7dfd8319b26c4f1490 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:43:06 +0200 -Subject: [PATCH 049/136] videoplayer: give streams with invalid fps a chance +Subject: [PATCH 020/110] videoplayer: give streams with invalid fps a chance for fps detection --- @@ -16482,10 +7862,10 @@ Subject: [PATCH 049/136] videoplayer: give streams with invalid fps a chance 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index d45d8ae..9dc5cd6 100644 +index bc049bd..21d023e 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1529,7 +1529,7 @@ void CDVDPlayerVideo::CalcFrameRate() +@@ -1500,7 +1500,7 @@ void CDVDPlayerVideo::CalcFrameRate() double frameduration = m_pullupCorrection.GetFrameDuration(); if (frameduration == DVD_NOPTS_VALUE || @@ -16498,10 +7878,10 @@ index d45d8ae..9dc5cd6 100644 1.8.1.6 -From 4843169664c024b7361a1191c72fdca6d17f88de Mon Sep 17 00:00:00 2001 +From a217254277fdd441c31713bcdad816d72263da4e Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:49:05 +0200 -Subject: [PATCH 050/136] dvdplayer: allow rewinding at end of stream, do a +Subject: [PATCH 021/110] dvdplayer: allow rewinding at end of stream, do a seek after rewind --- @@ -16509,10 +7889,10 @@ Subject: [PATCH 050/136] dvdplayer: allow rewinding at end of stream, do a 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 1246b9f..994e7b4 100644 +index 27e9ff1..1bd122b 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -1555,7 +1555,7 @@ void CDVDPlayer::HandlePlaySpeed() +@@ -1556,7 +1556,7 @@ void CDVDPlayer::HandlePlaySpeed() } else if (m_CurrentVideo.id >= 0 @@ -16521,7 +7901,7 @@ index 1246b9f..994e7b4 100644 && m_SpeedState.lastpts != m_dvdPlayerVideo.GetCurrentPts() && m_SpeedState.lasttime != GetTime()) { -@@ -2221,6 +2221,12 @@ void CDVDPlayer::HandleMessages() +@@ -2222,6 +2222,12 @@ void CDVDPlayer::HandleMessages() pvrinputstream->Pause( speed == 0 ); } @@ -16538,10 +7918,10 @@ index 1246b9f..994e7b4 100644 1.8.1.6 -From 79f7fcd5ba7b5f8ed2bc9b0df83b8d88b2173324 Mon Sep 17 00:00:00 2001 +From 1e02fb0d7f844b722743ea37f2984f5595b38e3a Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 15:22:05 +0200 -Subject: [PATCH 051/136] X11: ditch SDL for video and window events +Subject: [PATCH 022/110] X11: ditch SDL for video and window events --- xbmc/Application.cpp | 2 +- @@ -16557,10 +7937,10 @@ Subject: [PATCH 051/136] 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 ae82308..eb81f6e 100644 +index b4fa73b..55a2685 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -844,7 +844,7 @@ bool CApplication::CreateGUI() +@@ -845,7 +845,7 @@ bool CApplication::CreateGUI() uint32_t sdlFlags = 0; @@ -18025,10 +9405,10 @@ index b6b6ec4..448a1bb 100644 1.8.1.6 -From 218b76e5a0d3701e853a7837a37f781879bbe194 Mon Sep 17 00:00:00 2001 +From 629aa294a77faa2a9165909ee7750039d997396e Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 15:24:22 +0200 -Subject: [PATCH 052/136] X11: Add xbmc icon +Subject: [PATCH 023/110] X11: Add xbmc icon --- xbmc/windowing/X11/WinSystemX11.cpp | 126 +++++++++++++++++++++++++++++++++++- @@ -18217,10 +9597,10 @@ index 448a1bb..e618268 100644 1.8.1.6 -From 26831a9a36a7bcc6b4fd8f96ab2520006a3956de Mon Sep 17 00:00:00 2001 +From aa580c081b65e5697123a70c128c35a32701ec0b Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 20 May 2012 14:11:26 +0200 -Subject: [PATCH 053/136] X11: add SDL joystick until we have a better solution +Subject: [PATCH 024/110] X11: add SDL joystick until we have a better solution --- xbmc/windowing/WinEventsX11.cpp | 26 ++++++++++++++++++++++++++ @@ -18274,10 +9654,10 @@ index 5a8bbb8..5bc1de0 100644 1.8.1.6 -From 3423c3a34e42f14feeb11b5b6ad118ae202317e5 Mon Sep 17 00:00:00 2001 +From d7ec27990c479ef980236e7a20a40bb8f7be791a Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 5 Jul 2012 12:35:55 +0200 -Subject: [PATCH 054/136] X11: factor out code handling device reset +Subject: [PATCH 025/110] X11: factor out code handling device reset notification --- @@ -18341,10 +9721,10 @@ index e618268..c4d4b76 100644 1.8.1.6 -From 8c27a2f1921746ada6d896d3b2aaff684f7592ba Mon Sep 17 00:00:00 2001 +From 7a15d6da19afaa671225156f8364b289a78ad677 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 15:02:00 +0200 -Subject: [PATCH 055/136] X11: move xrandr events to WinEventsX11 +Subject: [PATCH 026/110] X11: move xrandr events to WinEventsX11 --- xbmc/windowing/WinEventsX11.cpp | 42 +++++++++++++++++++++++++++++++++++++ @@ -18488,10 +9868,10 @@ index c5938af..9f74dd5 100644 1.8.1.6 -From 698851ff884e21eaa8bb8507f0a409a65c02541e Mon Sep 17 00:00:00 2001 +From c3f7dcc65a38d830f80937011e03aa936ab459a8 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 12 Apr 2012 15:43:56 +0200 -Subject: [PATCH 056/136] xrandr: remove method RestoreState +Subject: [PATCH 027/110] xrandr: remove method RestoreState --- xbmc/windowing/X11/WinSystemX11.cpp | 13 +++++++++++-- @@ -18570,10 +9950,10 @@ index 0aec487..00b49dc 100644 1.8.1.6 -From 25150228eac582bf7c58a1ab8ff23c19b26bed94 Mon Sep 17 00:00:00 2001 +From 15e2791c6a56f086182134662fca12e2b6ce7bcc Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 20 May 2012 13:17:10 +0200 -Subject: [PATCH 057/136] xrandr: observe orientation +Subject: [PATCH 028/110] xrandr: observe orientation --- xbmc/windowing/X11/WinSystemX11.cpp | 89 ++++++++++++++++++++++++++++++------- @@ -18788,10 +10168,10 @@ index 00b49dc..508604d 100644 1.8.1.6 -From daca99e7b7078a1ad99d06a97317d7d4f7576c05 Mon Sep 17 00:00:00 2001 +From 4211de0e0358648ef50f9449c496757081b7671a Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:54:15 +0200 -Subject: [PATCH 058/136] xrandr: allow getting info for multiple screen's +Subject: [PATCH 029/110] xrandr: allow getting info for multiple screen's Refactored by: Joakim Plate --- @@ -18966,10 +10346,10 @@ index 508604d..d37838a 100644 1.8.1.6 -From 2ec9d0a9b0c843ac8b4f4de2482f29ce89441479 Mon Sep 17 00:00:00 2001 +From 752269938c1f15620b39d7473236252eaf8a9ebf Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:44:00 +0200 -Subject: [PATCH 059/136] X11: fix multi-head setups +Subject: [PATCH 030/110] X11: fix multi-head setups --- language/English/strings.po | 4 +- @@ -18984,7 +10364,7 @@ Subject: [PATCH 059/136] 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 ba414f9..940dded 100644 +index fae2505..ce56914 100644 --- a/language/English/strings.po +++ b/language/English/strings.po @@ -999,7 +999,9 @@ msgctxt "#245" @@ -18999,10 +10379,10 @@ index ba414f9..940dded 100644 msgctxt "#247" msgid "Scripts" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index b3ab3d1..60135a1 100644 +index 56d637d..f99ba9c 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -1841,6 +1841,15 @@ +@@ -1863,6 +1863,15 @@
@@ -19018,7 +10398,7 @@ index b3ab3d1..60135a1 100644 0 0 -@@ -1862,6 +1871,7 @@ +@@ -1884,6 +1893,7 @@ -1 @@ -19026,7 +10406,7 @@ index b3ab3d1..60135a1 100644 -@@ -1879,6 +1889,7 @@ +@@ -1901,6 +1911,7 @@ -1 @@ -19035,7 +10415,7 @@ index b3ab3d1..60135a1 100644 diff --git a/xbmc/rendering/gl/RenderSystemGL.h b/xbmc/rendering/gl/RenderSystemGL.h -index 662134d..292761a 100644 +index 4bd540b..f1e2c50 100644 --- a/xbmc/rendering/gl/RenderSystemGL.h +++ b/xbmc/rendering/gl/RenderSystemGL.h @@ -44,6 +44,7 @@ class CRenderSystemGL : public CRenderSystemBase @@ -19047,10 +10427,10 @@ index 662134d..292761a 100644 virtual void SetViewPort(CRect& viewPort); virtual void GetViewPort(CRect& viewPort); diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp -index 032e752..cf5deba 100644 +index bf307f6..1a85651 100644 --- a/xbmc/settings/DisplaySettings.cpp +++ b/xbmc/settings/DisplaySettings.cpp -@@ -198,13 +198,19 @@ bool CDisplaySettings::OnSettingChanging(const CSetting *setting) +@@ -219,13 +219,19 @@ bool CDisplaySettings::OnSettingChanging(const CSetting *setting) const std::string &settingId = setting->GetId(); if (settingId == "videoscreen.resolution" || @@ -19071,7 +10451,7 @@ index 032e752..cf5deba 100644 string screenmode = GetStringFromResolution(newRes); CSettings::Get().SetString("videoscreen.screenmode", screenmode); -@@ -215,7 +221,11 @@ bool CDisplaySettings::OnSettingChanging(const CSetting *setting) +@@ -236,7 +242,11 @@ bool CDisplaySettings::OnSettingChanging(const CSetting *setting) RESOLUTION newRes = GetResolutionFromString(((CSettingString*)setting)->GetValue()); SetCurrentResolution(newRes, false); @@ -19084,7 +10464,7 @@ index 032e752..cf5deba 100644 // check if the old or the new resolution was/is windowed // in which case we don't show any prompt to the user -@@ -571,6 +581,10 @@ void CDisplaySettings::SettingOptionsScreensFiller(const CSetting *setting, std: +@@ -622,6 +632,10 @@ void CDisplaySettings::SettingOptionsScreensFiller(const CSetting *setting, std: if (g_advancedSettings.m_canWindowed) list.push_back(make_pair(g_localizeStrings.Get(242), DM_WINDOWED)); @@ -19095,7 +10475,7 @@ index 032e752..cf5deba 100644 for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++) { int screen = CDisplaySettings::Get().GetResolutionInfo(RES_DESKTOP + idx).iScreen; -@@ -585,6 +599,7 @@ void CDisplaySettings::SettingOptionsScreensFiller(const CSetting *setting, std: +@@ -636,6 +650,7 @@ void CDisplaySettings::SettingOptionsScreensFiller(const CSetting *setting, std: RESOLUTION_INFO resInfo = CDisplaySettings::Get().GetResolutionInfo(res); current = resInfo.iScreen; } @@ -19103,9 +10483,9 @@ index 032e752..cf5deba 100644 } void CDisplaySettings::SettingOptionsVerticalSyncsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t) -@@ -596,3 +611,28 @@ void CDisplaySettings::SettingOptionsVerticalSyncsFiller(const CSetting *setting - list.push_back(make_pair(g_localizeStrings.Get(13107), VSYNC_VIDEO)); - list.push_back(make_pair(g_localizeStrings.Get(13108), VSYNC_ALWAYS)); +@@ -663,3 +678,28 @@ void CDisplaySettings::SettingOptionsPreferredStereoscopicViewModesFiller(const + SettingOptionsStereoscopicModesFiller(setting, list, current); + list.push_back(make_pair(g_localizeStrings.Get(36525), RENDER_STEREO_MODE_AUTO)); // option for autodetect } + +void CDisplaySettings::SettingOptionsMonitorsFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t) @@ -19133,7 +10513,7 @@ index 032e752..cf5deba 100644 + } +} diff --git a/xbmc/settings/DisplaySettings.h b/xbmc/settings/DisplaySettings.h -index 4540a34..618a644 100644 +index cc4002b..d80f1dc 100644 --- a/xbmc/settings/DisplaySettings.h +++ b/xbmc/settings/DisplaySettings.h @@ -78,6 +78,7 @@ class CDisplaySettings : public ISettingCallback, public ISubSettings, @@ -19144,35 +10524,35 @@ index 4540a34..618a644 100644 float GetZoomAmount() const { return m_zoomAmount; } void SetZoomAmount(float zoomAmount) { m_zoomAmount = zoomAmount; } -@@ -93,6 +94,7 @@ class CDisplaySettings : public ISettingCallback, public ISubSettings, - static void SettingOptionsResolutionsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); - static void SettingOptionsScreensFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); +@@ -95,6 +96,7 @@ class CDisplaySettings : public ISettingCallback, public ISubSettings, static void SettingOptionsVerticalSyncsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); + static void SettingOptionsStereoscopicModesFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); + static void SettingOptionsPreferredStereoscopicViewModesFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t); + static void SettingOptionsMonitorsFiller(const CSetting *setting, std::vector< std::pair > &list, std::string ¤t); protected: CDisplaySettings(); diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 3f7dfaf..42a1363 100644 +index c1d6443..1de1ac6 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp -@@ -374,6 +374,7 @@ void CSettings::Uninitialize() - m_settingsManager->UnregisterSettingOptionsFiller("rendermethods"); - m_settingsManager->UnregisterSettingOptionsFiller("resolutions"); +@@ -381,6 +381,7 @@ void CSettings::Uninitialize() m_settingsManager->UnregisterSettingOptionsFiller("screens"); + m_settingsManager->UnregisterSettingOptionsFiller("stereoscopicmodes"); + m_settingsManager->UnregisterSettingOptionsFiller("preferedstereoscopicviewmodes"); + m_settingsManager->UnregisterSettingOptionsFiller("monitors"); m_settingsManager->UnregisterSettingOptionsFiller("shutdownstates"); m_settingsManager->UnregisterSettingOptionsFiller("startupwindows"); m_settingsManager->UnregisterSettingOptionsFiller("streamlanguages"); -@@ -677,6 +678,7 @@ void CSettings::InitializeOptionFillers() - m_settingsManager->RegisterSettingOptionsFiller("rendermethods", CBaseRenderer::SettingOptionsRenderMethodsFiller); - m_settingsManager->RegisterSettingOptionsFiller("resolutions", CDisplaySettings::SettingOptionsResolutionsFiller); +@@ -688,6 +689,7 @@ void CSettings::InitializeOptionFillers() m_settingsManager->RegisterSettingOptionsFiller("screens", CDisplaySettings::SettingOptionsScreensFiller); + m_settingsManager->RegisterSettingOptionsFiller("stereoscopicmodes", CDisplaySettings::SettingOptionsStereoscopicModesFiller); + m_settingsManager->RegisterSettingOptionsFiller("preferedstereoscopicviewmodes", CDisplaySettings::SettingOptionsPreferredStereoscopicViewModesFiller); + m_settingsManager->RegisterSettingOptionsFiller("monitors", CDisplaySettings::SettingOptionsMonitorsFiller); m_settingsManager->RegisterSettingOptionsFiller("shutdownstates", CPowerManager::SettingOptionsShutdownStatesFiller); m_settingsManager->RegisterSettingOptionsFiller("startupwindows", ADDON::CSkinInfo::SettingOptionsStartupWindowsFiller); m_settingsManager->RegisterSettingOptionsFiller("streamlanguages", CLangInfo::SettingOptionsStreamLanguagesFiller); -@@ -704,6 +706,9 @@ void CSettings::InitializeConditions() +@@ -715,6 +717,9 @@ void CSettings::InitializeConditions() #ifdef HAS_GL m_settingsManager->AddCondition("has_gl"); #endif @@ -19182,7 +10562,7 @@ index 3f7dfaf..42a1363 100644 #ifdef HAS_GLES m_settingsManager->AddCondition("has_gles"); #endif -@@ -843,6 +848,7 @@ void CSettings::InitializeISettingCallbacks() +@@ -857,6 +862,7 @@ void CSettings::InitializeISettingCallbacks() settingSet.insert("videoscreen.screen"); settingSet.insert("videoscreen.resolution"); settingSet.insert("videoscreen.screenmode"); @@ -19738,10 +11118,10 @@ index 0727bb9..b1eb278 100644 1.8.1.6 -From d425584dff1c7740e6a4608cb199703fb0fb5bcf Mon Sep 17 00:00:00 2001 +From 9626121cde1743a8d2ef2d51cf92592523ab8b7b Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:36:32 +0200 -Subject: [PATCH 060/136] X11: remove all DefaultScreen and RootWindow macros +Subject: [PATCH 031/110] X11: remove all DefaultScreen and RootWindow macros --- xbmc/windowing/X11/WinSystemX11.cpp | 6 +++--- @@ -19809,10 +11189,10 @@ index 095012f..60a6878 100644 1.8.1.6 -From 2a854ad8f557b07417803aadf1bef203805ec25b Mon Sep 17 00:00:00 2001 +From 5d281408e8eb37184e44c1f6aebf3dea09c9b952 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 11:45:22 +0200 -Subject: [PATCH 061/136] X11: remove all DefaultScreen and RootWindow macros +Subject: [PATCH 032/110] X11: remove all DefaultScreen and RootWindow macros (VideoRefClock) Note this is on a separate display connection. @@ -19884,10 +11264,10 @@ index 5bf3656..0b9e7b3 100644 1.8.1.6 -From 6e45c9935e11576ed87be25bfcddeb20de52965f Mon Sep 17 00:00:00 2001 +From 583087348aa3e019f13df994090cadc7dd1bfbf3 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 20 Jun 2012 17:37:11 +0200 -Subject: [PATCH 062/136] X11: recreate gl context after output has changed +Subject: [PATCH 033/110] X11: recreate gl context after output has changed --- xbmc/windowing/X11/WinSystemX11.cpp | 24 ++++++++++++++---------- @@ -20038,10 +11418,10 @@ index 60a6878..d6ba80a 100644 1.8.1.6 -From ea23b4d9befee933789c1fa1b5075a1a3a823bbe Mon Sep 17 00:00:00 2001 +From fe9ee4c66e08f11d514b94d61b0fc0585626796e Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 12:06:25 +0200 -Subject: [PATCH 063/136] X11: hook video reference clock in windowing +Subject: [PATCH 034/110] X11: hook video reference clock in windowing --- xbmc/video/VideoReferenceClock.cpp | 71 +++++++++++++++++++++++++++----------- @@ -20246,10 +11626,10 @@ index dd65a1b..afd71fc 100644 1.8.1.6 -From 329948c02c86f251c1cb62c02dee4b9e0138d0b2 Mon Sep 17 00:00:00 2001 +From 7cd90575e2e7ba0cba25f8882828a03eedd3fa9a Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 21 Jun 2012 17:26:51 +0200 -Subject: [PATCH 064/136] X11: fix video calibrations +Subject: [PATCH 035/110] X11: fix video calibrations --- xbmc/windowing/WinSystem.h | 1 + @@ -20258,7 +11638,7 @@ Subject: [PATCH 064/136] X11: fix video calibrations 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/xbmc/windowing/WinSystem.h b/xbmc/windowing/WinSystem.h -index 3500a8d..0e309f9 100644 +index fc467f1..608b1e1 100644 --- a/xbmc/windowing/WinSystem.h +++ b/xbmc/windowing/WinSystem.h @@ -103,6 +103,7 @@ class CWinSystemBase @@ -20341,10 +11721,10 @@ index 05aa60e..95672d1 100644 1.8.1.6 -From e29ff8d63cd564e8a04456ed46a66f9791768f60 Mon Sep 17 00:00:00 2001 +From 53d7b5b81553e08dd98c6bd8b7fa47b2407e3eb6 Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 12:00:26 +0200 -Subject: [PATCH 065/136] X11: deactivate screen saver on startup +Subject: [PATCH 036/110] X11: deactivate screen saver on startup --- xbmc/windowing/X11/WinSystemX11.cpp | 29 +++++++++++++++++++++++++++++ @@ -20414,10 +11794,10 @@ index 95672d1..51ac314 100644 1.8.1.6 -From 921bc0eb36b61dd20cbc0c73f64b1d57de7e2d76 Mon Sep 17 00:00:00 2001 +From b5864a4dc3b1c84fddb4d9f2bbaf51fc365c51af Mon Sep 17 00:00:00 2001 From: FernetMenta Date: Thu, 5 Jul 2012 12:10:09 +0200 -Subject: [PATCH 066/136] X11: change method of going full-screen +Subject: [PATCH 037/110] X11: change method of going full-screen --- xbmc/windowing/X11/WinSystemX11.cpp | 9 ++++++++- @@ -20461,10 +11841,10 @@ index 14a4307..66b91fd 100644 1.8.1.6 -From ae3d417b4be9fa2d650305d77ca5809226d01922 Mon Sep 17 00:00:00 2001 +From c815c5039786c0edfb5a008346f6400be5e8ec29 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 28 Jun 2012 19:12:39 +0200 -Subject: [PATCH 067/136] X11: reset key repeat and key modifier on focus lost +Subject: [PATCH 038/110] X11: reset key repeat and key modifier on focus lost and gain --- @@ -20496,10 +11876,10 @@ index c58067b..c9f8a20 100644 1.8.1.6 -From 0803e7aa355c5e8a5ec2985b8c052d7731259a70 Mon Sep 17 00:00:00 2001 +From 18d3da75416f79bb9482c79d00a8449105690bea Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 5 Jul 2012 14:18:46 +0200 -Subject: [PATCH 068/136] X11: replace custom utf8 to unicode with charset +Subject: [PATCH 039/110] X11: replace custom utf8 to unicode with charset convertor (squash to x11 events) --- @@ -20716,10 +12096,10 @@ index 6100933..72955ad 100644 1.8.1.6 -From e5ed6062126c8af426a27e85aaacf2f9f40fe246 Mon Sep 17 00:00:00 2001 +From 7de91f91cb2686e468206bd646d303ce65fe8b98 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Thu, 5 Jul 2012 14:23:54 +0200 -Subject: [PATCH 069/136] X11: fixed invalid usage of sizeof() (squash into x11 +Subject: [PATCH 040/110] X11: fixed invalid usage of sizeof() (squash into x11 changes) --- @@ -20783,10 +12163,10 @@ index 72955ad..102a076 100644 1.8.1.6 -From 3cea9e4151c7aab9d885a52553b920a829fbf618 Mon Sep 17 00:00:00 2001 +From 81b0fe7a671d9c366eae577e4be00f52d3d9c435 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 9 Jun 2012 18:23:53 +0200 -Subject: [PATCH 070/136] add missing keys to xbmc keytable +Subject: [PATCH 041/110] add missing keys to xbmc keytable --- xbmc/input/XBMC_keytable.cpp | 2 ++ @@ -20809,10 +12189,10 @@ index b430f55..246164b 100644 1.8.1.6 -From 69be70d8245123c599ff08b2fd34077dedfd4fc4 Mon Sep 17 00:00:00 2001 +From a610a6c24039fb885956894fbcfd19b3b35df3db Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 16 Mar 2012 15:57:51 +0100 -Subject: [PATCH 071/136] videorefclock: temp deactivate of nv settings +Subject: [PATCH 042/110] videorefclock: temp deactivate of nv settings --- xbmc/video/VideoReferenceClock.cpp | 2 +- @@ -20835,10 +12215,10 @@ index 3bd8133..59f924c 100644 1.8.1.6 -From 9df52bfe9977127883d9402fdc38801370c45d32 Mon Sep 17 00:00:00 2001 +From 1492ea88c9b9659d8e0345fd8d18580cb9ceb259 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 20 Aug 2012 09:09:09 +0200 -Subject: [PATCH 072/136] videorefclock: ask graphics context for refresh rate +Subject: [PATCH 043/110] videorefclock: ask graphics context for refresh rate --- xbmc/video/VideoReferenceClock.cpp | 3 ++- @@ -20869,10 +12249,10 @@ index 59f924c..2f8bc69 100644 1.8.1.6 -From d98805eb590a6288109e4a57195d72170f0ce8c0 Mon Sep 17 00:00:00 2001 +From df1cfeff10a2e8e766925da2f60bf06f635da404 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 9 Jul 2012 14:00:18 +0200 -Subject: [PATCH 073/136] X11: fix icon texture after +Subject: [PATCH 044/110] X11: fix icon texture after cc5ed3c2474084ebc0373a3046410e6f766e03f4 --- @@ -20980,10 +12360,10 @@ index 66b91fd..b00eddc 100644 1.8.1.6 -From 6cac4892fb21d6e57c746d7a1e283a52d79af39f Mon Sep 17 00:00:00 2001 +From 33a8571e84fb01fd33a6cb3ae72b6feaf23d6776 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 10 Jul 2012 11:14:12 +0200 -Subject: [PATCH 074/136] X11: check for window manager +Subject: [PATCH 045/110] X11: check for window manager --- xbmc/windowing/X11/WinSystemX11.cpp | 74 ++++++++++++++++++++++++++++++++++++- @@ -21104,10 +12484,10 @@ index 51ac314..ce3c289 100644 1.8.1.6 -From 098d70d4fad6852652aa95a2609255b278aa1e3c Mon Sep 17 00:00:00 2001 +From 12c401980ef933b8f8c1cba6b7eee11118ca48d3 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 12 Jul 2012 11:11:47 +0200 -Subject: [PATCH 075/136] X11: dont set window on xrandr if no mode available +Subject: [PATCH 046/110] X11: dont set window on xrandr if no mode available --- xbmc/windowing/X11/WinSystemX11.cpp | 11 ++++++----- @@ -21144,10 +12524,10 @@ index 05279ad..9697cbb 100644 1.8.1.6 -From e1389a1e33971decac7a919457b8dd67252e4535 Mon Sep 17 00:00:00 2001 +From ca53c5cdd2b3b9067f750cd47f1789e00f1436c6 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 26 Jul 2012 09:34:28 +0200 -Subject: [PATCH 076/136] X11: fix crash after a resolution change on startup +Subject: [PATCH 047/110] X11: fix crash after a resolution change on startup --- xbmc/windowing/X11/WinSystemX11.cpp | 3 ++- @@ -21171,10 +12551,10 @@ index 9697cbb..868071c 100644 1.8.1.6 -From d49dd6375898d0775205b0954fd9ed9ebc0e3ec8 Mon Sep 17 00:00:00 2001 +From a2a2730899584fdfe5c8eb9888076941cb9502e8 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 15 Sep 2012 18:27:29 +0200 -Subject: [PATCH 077/136] X11: lock graphics context in NotifyXRREvent +Subject: [PATCH 048/110] X11: lock graphics context in NotifyXRREvent --- xbmc/windowing/X11/WinSystemX11.cpp | 2 ++ @@ -21197,10 +12577,10 @@ index 868071c..9ff947c 100644 1.8.1.6 -From 4f3fad4a542e166e557a34c27ae333478f9ff613 Mon Sep 17 00:00:00 2001 +From 8b0a7d7533a3b77e5673b31f5b0493aeb0718b0a Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 8 Oct 2011 16:45:13 +0200 -Subject: [PATCH 078/136] ffmpeg: add xvba hwaccel +Subject: [PATCH 049/110] ffmpeg: add xvba hwaccel --- lib/ffmpeg/configure | 11 ++ @@ -21372,7 +12752,7 @@ index 584446f..7a8f61c 100644 /* video codecs */ REGISTER_ENCODER(A64MULTI, a64multi); diff --git a/lib/ffmpeg/libavcodec/h264.c b/lib/ffmpeg/libavcodec/h264.c -index 937ad7a..299039f 100644 +index 85f2372..02d0a26 100644 --- a/lib/ffmpeg/libavcodec/h264.c +++ b/lib/ffmpeg/libavcodec/h264.c @@ -81,6 +81,9 @@ @@ -22049,33 +13429,33 @@ index 1c00ac4..6437e29 100644 1.8.1.6 -From db45b1127b0b81ff013e4f03b8938b3076fef306 Mon Sep 17 00:00:00 2001 +From 6e42c0d587b54da3ea6af2afab48f8b5d50457c8 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 12 Apr 2012 12:09:31 +0200 -Subject: [PATCH 079/136] xvba: add decoder +Subject: [PATCH 050/110] xvba: add decoder --- configure.in | 47 + - language/English/strings.po | 12 +- + language/English/strings.po | 13 +- system/settings/settings.xml | 5 + xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 218 +- xbmc/cores/VideoRenderers/LinuxRendererGL.h | 15 +- xbmc/cores/VideoRenderers/RenderFormats.h | 1 + - xbmc/cores/VideoRenderers/RenderManager.cpp | 4 + + xbmc/cores/VideoRenderers/RenderManager.cpp | 8 +- .../dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 4 + .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 16 + - xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 3 + + xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 4 + xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp | 2367 ++++++++++++++++++++ xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h | 383 ++++ xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + xbmc/settings/VideoSettings.h | 2 + xbmc/video/dialogs/GUIDialogVideoSettings.cpp | 1 + - 15 files changed, 3071 insertions(+), 8 deletions(-) + 15 files changed, 3076 insertions(+), 9 deletions(-) create mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp create mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h diff --git a/configure.in b/configure.in -index bd2934d..94f6455 100644 +index d63d13d..e145d43 100644 --- a/configure.in +++ b/configure.in @@ -143,6 +143,8 @@ vaapi_not_found="== Could not find libva. VAAPI support disabled. ==" @@ -22138,7 +13518,7 @@ index bd2934d..94f6455 100644 # VTBDecoder if test "x$use_vtbdecoder" != "xno"; then if test "$host_vendor" = "apple" ; then -@@ -1977,6 +2016,12 @@ else +@@ -1982,6 +2021,12 @@ else final_message="$final_message\n CrystalHD:\tNo" fi @@ -22151,7 +13531,7 @@ index bd2934d..94f6455 100644 if test "x$use_vtbdecoder" != "xno"; then final_message="$final_message\n VTBDecoder:\tYes" else -@@ -2447,6 +2492,7 @@ AC_SUBST(USE_OPENGLES) +@@ -2452,6 +2497,7 @@ AC_SUBST(USE_OPENGLES) AC_SUBST(USE_VDPAU) AC_SUBST(USE_VAAPI) AC_SUBST(USE_CRYSTALHD) @@ -22159,7 +13539,7 @@ index bd2934d..94f6455 100644 AC_SUBST(USE_LIBSMBCLIENT) AC_SUBST(USE_LIBNFS) AC_SUBST(USE_LIBAFPCLIENT) -@@ -2631,6 +2677,7 @@ XB_CONFIG_MODULE([lib/ffmpeg], [ +@@ -2636,6 +2682,7 @@ XB_CONFIG_MODULE([lib/ffmpeg], [ `if test "x$use_vdpau" != "xno"; then echo --enable-vdpau; else echo --disable-vdpau; fi` \ `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \ `if test "$use_optimizations" != "no"; then echo --enable-optimizations; else echo --disable-optimizations; fi` \ @@ -22168,23 +13548,24 @@ index bd2934d..94f6455 100644 --enable-pthreads \ --enable-runtime-cpudetect \ diff --git a/language/English/strings.po b/language/English/strings.po -index 940dded..1fdf542 100644 +index ce56914..fc1f5ec4d 100644 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -5776,7 +5776,11 @@ msgctxt "#13436" +@@ -5782,7 +5782,12 @@ msgctxt "#13437" msgid "Prefer VDPAU Video Mixer" msgstr "" --#empty strings from id 13437 to 13499 -+msgctxt "#13437" +-#empty strings from id 13438 to 13499 ++#: system/settings/settings.xml ++msgctxt "#13438" +msgid "Allow hardware acceleration (XVBA)" +msgstr "" + -+#empty strings from id 13438 to 13499 ++#empty strings from id 13439 to 13499 #: system/settings/settings.xml msgctxt "#13500" -@@ -6854,7 +6858,11 @@ msgctxt "#16325" +@@ -6860,7 +6865,11 @@ msgctxt "#16325" msgid "VDPAU - Bob" msgstr "" @@ -22198,23 +13579,23 @@ index 940dded..1fdf542 100644 msgctxt "#16400" msgid "Post-processing" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 60135a1..4655d59 100644 +index f99ba9c..ac87a69 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -410,6 +410,11 @@ 2 true -+ ++ + HAVE_LIBXVBA + 2 + true -+ - - HAS_GL - 4 ++ + + HAVE_LIBSTAGEFRIGHTDECODER + 2 diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index c072f5e..73a8cc8 100644 +index 6807df7..b2beb2e 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp @@ -65,6 +65,9 @@ @@ -22237,7 +13618,7 @@ index c072f5e..73a8cc8 100644 } CLinuxRendererGL::YUVBUFFER::~YUVBUFFER() -@@ -600,12 +606,15 @@ void CLinuxRendererGL::Flush() +@@ -621,12 +627,15 @@ void CLinuxRendererGL::Flush() void CLinuxRendererGL::ReleaseBuffer(int idx) { @@ -22254,7 +13635,7 @@ index c072f5e..73a8cc8 100644 #ifdef HAVE_LIBVA buf.vaapi.surface.reset(); #endif -@@ -871,7 +880,7 @@ void CLinuxRendererGL::UpdateVideoFilter() +@@ -892,7 +901,7 @@ void CLinuxRendererGL::UpdateVideoFilter() case VS_SCALINGMETHOD_LINEAR: SetTextureFilter(m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR); m_renderQuality = RQ_SINGLEPASS; @@ -22263,7 +13644,7 @@ index c072f5e..73a8cc8 100644 { m_pVideoFilterShader = new StretchFilterShader(); if (!m_pVideoFilterShader->CompileAndLink()) -@@ -957,6 +966,11 @@ void CLinuxRendererGL::LoadShaders(int field) +@@ -978,6 +987,11 @@ void CLinuxRendererGL::LoadShaders(int field) CLog::Log(LOGNOTICE, "GL: Using CVBREF render method"); m_renderMethod = RENDER_CVREF; } @@ -22275,7 +13656,7 @@ index c072f5e..73a8cc8 100644 else { int requestedMethod = CSettings::Get().GetInt("videoplayer.rendermethod"); -@@ -1105,6 +1119,12 @@ void CLinuxRendererGL::LoadShaders(int field) +@@ -1126,6 +1140,12 @@ void CLinuxRendererGL::LoadShaders(int field) m_textureCreate = &CLinuxRendererGL::CreateCVRefTexture; m_textureDelete = &CLinuxRendererGL::DeleteCVRefTexture; } @@ -22288,7 +13669,7 @@ index c072f5e..73a8cc8 100644 else { // setup default YV12 texture handlers -@@ -1217,6 +1237,13 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) +@@ -1238,6 +1258,13 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) RenderVAAPI(renderBuffer, m_currentField); } #endif @@ -22302,7 +13683,7 @@ index c072f5e..73a8cc8 100644 else { // RENDER_CVREF uses the same render as the default case -@@ -1733,6 +1760,77 @@ void CLinuxRendererGL::RenderVAAPI(int index, int field) +@@ -1762,6 +1789,77 @@ void CLinuxRendererGL::RenderVAAPI(int index, int field) #endif } @@ -22354,17 +13735,17 @@ index c072f5e..73a8cc8 100644 + glBegin(GL_QUADS); + if (m_textureTarget==GL_TEXTURE_2D) + { -+ glTexCoord2f(plane.rect.x1, plane.rect.y1); glVertex2f(m_destRect.x1, m_destRect.y1); -+ glTexCoord2f(plane.rect.x2, plane.rect.y1); glVertex2f(m_destRect.x2, m_destRect.y1); -+ glTexCoord2f(plane.rect.x2, plane.rect.y2); glVertex2f(m_destRect.x2, m_destRect.y2); -+ glTexCoord2f(plane.rect.x1, plane.rect.y2); glVertex2f(m_destRect.x1, m_destRect.y2); ++ glTexCoord2f(plane.rect.x1, plane.rect.y1); glVertex2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y); ++ glTexCoord2f(plane.rect.x2, plane.rect.y1); glVertex2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y); ++ glTexCoord2f(plane.rect.x2, plane.rect.y2); glVertex2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y); ++ glTexCoord2f(plane.rect.x1, plane.rect.y2); glVertex2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y); + } + else + { -+ glTexCoord2f(m_destRect.x1, m_destRect.y1); glVertex4f(m_destRect.x1, m_destRect.y1, 0.0f, 0.0f); -+ glTexCoord2f(m_destRect.x2, m_destRect.y1); glVertex4f(m_destRect.x2, m_destRect.y1, 1.0f, 0.0f); -+ glTexCoord2f(m_destRect.x2, m_destRect.y2); glVertex4f(m_destRect.x2, m_destRect.y2, 1.0f, 1.0f); -+ glTexCoord2f(m_destRect.x1, m_destRect.y2); glVertex4f(m_destRect.x1, m_destRect.y2, 0.0f, 1.0f); ++ glTexCoord2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y); glVertex4f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y, 0.0f, 0.0f); ++ glTexCoord2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y); glVertex4f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y, 1.0f, 0.0f); ++ glTexCoord2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y); glVertex4f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y, 1.0f, 1.0f); ++ glTexCoord2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y); glVertex4f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y, 0.0f, 1.0f); + } + glEnd(); + VerifyGLState(); @@ -22380,7 +13761,7 @@ index c072f5e..73a8cc8 100644 void CLinuxRendererGL::RenderSoftware(int index, int field) { // used for textues uploaded from rgba or CVPixelBuffers. -@@ -2766,6 +2864,88 @@ bool CLinuxRendererGL::CreateCVRefTexture(int index) +@@ -2820,6 +2918,88 @@ bool CLinuxRendererGL::CreateCVRefTexture(int index) return true; } @@ -22469,7 +13850,7 @@ index c072f5e..73a8cc8 100644 void CLinuxRendererGL::UploadYUV422PackedTexture(int source) { YUVBUFFER& buf = m_buffers[source]; -@@ -3340,6 +3520,9 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) +@@ -3394,6 +3574,9 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) if (m_renderMethod & RENDER_VAAPI) return false; @@ -22479,7 +13860,7 @@ index c072f5e..73a8cc8 100644 return (m_renderMethod & RENDER_GLSL) || (m_renderMethod & RENDER_ARB) || ((m_renderMethod & RENDER_SW) && glewIsSupported("GL_ARB_imaging") == GL_TRUE); -@@ -3353,6 +3536,9 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) +@@ -3407,6 +3590,9 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) if (m_renderMethod & RENDER_VAAPI) return false; @@ -22489,7 +13870,7 @@ index c072f5e..73a8cc8 100644 return (m_renderMethod & RENDER_GLSL) || (m_renderMethod & RENDER_ARB) || ((m_renderMethod & RENDER_SW) && glewIsSupported("GL_ARB_imaging") == GL_TRUE); -@@ -3376,7 +3562,8 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) +@@ -3430,7 +3616,8 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature) if (feature == RENDERFEATURE_NONLINSTRETCH) { if (((m_renderMethod & RENDER_GLSL) && !(m_renderMethod & RENDER_POT)) || @@ -22499,7 +13880,7 @@ index c072f5e..73a8cc8 100644 return true; } -@@ -3448,6 +3635,16 @@ bool CLinuxRendererGL::Supports(EINTERLACEMETHOD method) +@@ -3502,6 +3689,16 @@ bool CLinuxRendererGL::Supports(EINTERLACEMETHOD method) return false; } @@ -22516,7 +13897,7 @@ index c072f5e..73a8cc8 100644 #ifdef TARGET_DARWIN // YADIF too slow for HD but we have no methods to fall back // to something that works so just turn it off. -@@ -3497,7 +3694,7 @@ bool CLinuxRendererGL::Supports(ESCALINGMETHOD method) +@@ -3551,7 +3748,7 @@ bool CLinuxRendererGL::Supports(ESCALINGMETHOD method) return false; if ((glewIsSupported("GL_EXT_framebuffer_object") && (m_renderMethod & RENDER_GLSL)) || @@ -22525,7 +13906,7 @@ index c072f5e..73a8cc8 100644 { // spline36 and lanczos3 are only allowed through advancedsettings.xml if(method != VS_SCALINGMETHOD_SPLINE36 -@@ -3564,7 +3761,8 @@ unsigned int CLinuxRendererGL::GetProcessorSize() +@@ -3618,7 +3815,8 @@ unsigned int CLinuxRendererGL::GetProcessorSize() if(m_format == RENDER_FMT_VDPAU || m_format == RENDER_FMT_VDPAU_420 || m_format == RENDER_FMT_VAAPI @@ -22535,7 +13916,7 @@ index c072f5e..73a8cc8 100644 return 1; else return 0; -@@ -3620,4 +3818,14 @@ void CLinuxRendererGL::AddProcessor(struct __CVBuffer *cvBufferRef, int index) +@@ -3674,4 +3872,14 @@ void CLinuxRendererGL::AddProcessor(struct __CVBuffer *cvBufferRef, int index) } #endif @@ -22551,7 +13932,7 @@ index c072f5e..73a8cc8 100644 + #endif diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h -index 274f980..958a06c 100644 +index 258a598..6fa1dbc 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h @@ -44,6 +44,8 @@ @@ -22612,34 +13993,42 @@ index 274f980..958a06c 100644 typedef YUVBUFFER YUVBUFFERS[NUM_BUFFERS]; diff --git a/xbmc/cores/VideoRenderers/RenderFormats.h b/xbmc/cores/VideoRenderers/RenderFormats.h -index 9ad1671..cfa4726 100644 +index 3b09194..b193c24 100644 --- a/xbmc/cores/VideoRenderers/RenderFormats.h +++ b/xbmc/cores/VideoRenderers/RenderFormats.h -@@ -35,6 +35,7 @@ enum ERenderFormat { - RENDER_FMT_OMXEGL, +@@ -36,6 +36,7 @@ enum ERenderFormat { RENDER_FMT_CVBREF, RENDER_FMT_BYPASS, + RENDER_FMT_EGLIMG, + RENDER_FMT_XVBA, }; #endif diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 5b08c1e..7e12a46 100644 +index a1c2fc7..5056100 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp -@@ -941,6 +941,10 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) +@@ -941,11 +941,17 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) else if(pic.format == RENDER_FMT_VAAPI) m_pRenderer->AddProcessor(*pic.vaapi, index); #endif +-#ifdef HAS_LIBSTAGEFRIGHT ++ ++ #ifdef HAS_LIBSTAGEFRIGHT + else if(pic.format == RENDER_FMT_EGLIMG) + m_pRenderer->AddProcessor(pic.stf, pic.eglimg, index); + #endif + +#ifdef HAVE_LIBXVBA + else if(pic.format == RENDER_FMT_XVBA) + m_pRenderer->AddProcessor(pic.xvba, index); +#endif ++ m_pRenderer->ReleaseImage(index, false); return index; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h -index 43befb4..46369c7 100644 +index 0dd29c3..b346d26 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h @@ -35,6 +35,7 @@ @@ -22650,7 +14039,7 @@ index 43befb4..46369c7 100644 class COpenMax; class COpenMaxVideo; struct OpenMaxVideoBuffer; -@@ -60,6 +61,9 @@ struct DVDVideoPicture +@@ -62,6 +63,9 @@ struct DVDVideoPicture struct { VAAPI::CHolder* vaapi; }; @@ -22661,7 +14050,7 @@ index 43befb4..46369c7 100644 struct { COpenMax *openMax; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index e133d78..6dabb25 100644 +index aa2d1e4..cd48f4e 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -60,6 +60,9 @@ @@ -22695,19 +14084,20 @@ index e133d78..6dabb25 100644 // mpeg4 vaapi decoding is disabled if(*cur == PIX_FMT_VAAPI_VLD && CSettings::Get().GetBool("videoplayer.usevaapi") diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -index 979e3ce..cacc876 100644 +index 86b0a89..7bc4065 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in -@@ -22,6 +22,9 @@ SRCS += OpenMax.cpp - SRCS += OpenMaxVideo.cpp - SRCS += DVDVideoCodecOpenMax.cpp +@@ -34,6 +34,10 @@ INCLUDES += -I${prefix}/opt/android-source/system/core/include + INCLUDES += -I${prefix}/opt/android-source/libhardware/include endif + +ifeq (@USE_XVBA@,1) +SRCS += XVBA.cpp +endif - ++ ifeq (@USE_LIBAMCODEC@,1) SRCS += AMLCodec.cpp + SRCS += DVDVideoCodecAmlogic.cpp diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp new file mode 100644 index 0000000..43a331f @@ -25471,19 +16861,19 @@ index 0000000..3bd0cea + +} diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 9dc5cd6..b18cc79 100644 +index 21d023e..f35419f 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1017,6 +1017,7 @@ static std::string GetRenderFormatName(ERenderFormat format) - case RENDER_FMT_OMXEGL: return "OMXEGL"; +@@ -1019,6 +1019,7 @@ static std::string GetRenderFormatName(ERenderFormat format) case RENDER_FMT_CVBREF: return "BGRA"; + case RENDER_FMT_EGLIMG: return "EGLIMG"; case RENDER_FMT_BYPASS: return "BYPASS"; + case RENDER_FMT_XVBA: return "XVBA"; case RENDER_FMT_NONE: return "NONE"; } return "UNKNOWN"; diff --git a/xbmc/settings/VideoSettings.h b/xbmc/settings/VideoSettings.h -index 0de785d..f3fed5d 100644 +index 293f363..3db70fb 100644 --- a/xbmc/settings/VideoSettings.h +++ b/xbmc/settings/VideoSettings.h @@ -63,6 +63,8 @@ enum EINTERLACEMETHOD @@ -25496,10 +16886,10 @@ index 0de785d..f3fed5d 100644 }; diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -index 2bad710..2146e9b 100644 +index 8f30248..db58075 100644 --- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -@@ -111,6 +111,7 @@ void CGUIDialogVideoSettings::CreateSettings() +@@ -115,6 +115,7 @@ void CGUIDialogVideoSettings::CreateSettings() entries.push_back(make_pair(VS_INTERLACEMETHOD_DXVA_BOB , 16320)); entries.push_back(make_pair(VS_INTERLACEMETHOD_DXVA_BEST , 16321)); entries.push_back(make_pair(VS_INTERLACEMETHOD_AUTO_ION , 16325)); @@ -25511,10 +16901,10 @@ index 2bad710..2146e9b 100644 1.8.1.6 -From a0188b0aa26af315b65cad2f4ca5ba979298330f Mon Sep 17 00:00:00 2001 +From 21b33a37ba677c4b62a15cb02182b44c542b7613 Mon Sep 17 00:00:00 2001 From: fritsch Date: Sun, 4 Nov 2012 16:24:10 +0100 -Subject: [PATCH 080/136] xvba: add string for available decoders - we are +Subject: [PATCH 051/110] xvba: add string for available decoders - we are important so make sure we are there --- @@ -25522,10 +16912,10 @@ Subject: [PATCH 080/136] xvba: add string for available decoders - we are 1 file changed, 5 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index 022c613..a9ce269 100644 +index ab3696e..329b6f0 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -@@ -177,6 +177,11 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne +@@ -183,6 +183,11 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne #elif defined(TARGET_POSIX) && !defined(TARGET_DARWIN) hwSupport += "VAAPI:no "; #endif @@ -25541,17 +16931,17 @@ index 022c613..a9ce269 100644 1.8.1.6 -From f7f273c95dc1e31e8f141a73e102494b61d61a18 Mon Sep 17 00:00:00 2001 +From 6bbda006ed9e8b2503d69908e571391fbff90532 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 16 Jun 2012 12:46:30 +0200 -Subject: [PATCH 081/136] xvba: do not use vaapi if xvba is present +Subject: [PATCH 052/110] xvba: do not use vaapi if xvba is present --- xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index 7951ee7..ff0b550 100644 +index 52b356d..6ed0fc5 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp @@ -261,6 +261,15 @@ void CDecoder::Close() @@ -25574,10 +16964,10 @@ index 7951ee7..ff0b550 100644 1.8.1.6 -From b101c41a7a96fdadafea70fa4c063c934f18bf04 Mon Sep 17 00:00:00 2001 +From c6d9d1aeaa7905066d354d6182df6da8dcee58b6 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 23 Aug 2012 19:39:49 +0200 -Subject: [PATCH 082/136] ffmpeg: add av_find_default_stream_index to interface +Subject: [PATCH 053/110] ffmpeg: add av_find_default_stream_index to interface --- lib/DllAvFormat.h | 4 ++++ @@ -25623,10 +17013,10 @@ index ee41fa8..56605cb 100644 1.8.1.6 -From b303da3d1b9f8d8be5fe562ecdbbcaabc182ba5e Mon Sep 17 00:00:00 2001 +From 17456e4ad8737d27ae084dfae0045ed3eb9da577 Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 13 Apr 2013 11:30:39 +0200 -Subject: [PATCH 083/136] XVBA: revisit draw functions +Subject: [PATCH 054/110] XVBA: revisit draw functions --- lib/ffmpeg/libavcodec/xvba_h264.c | 2 +- @@ -25663,10 +17053,10 @@ index bf3d9c2..ff35a28 100644 1.8.1.6 -From ec2cddc3964a33d9a129b07a303d774cb4c222b8 Mon Sep 17 00:00:00 2001 +From 898c52bb46e3ad80cf64d7db7c60d5b2d338563b Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 13 Apr 2013 12:06:02 +0200 -Subject: [PATCH 084/136] (ffmpeg): Make XVBA codec available +Subject: [PATCH 055/110] (ffmpeg): Make XVBA codec available --- lib/ffmpeg/libavcodec/vc1dec.c | 3 +++ @@ -25690,10 +17080,10 @@ index 2130c74..4d611f9 100644 1.8.1.6 -From 7ed99cc1226802f84c6de6388945a833b0e0040d Mon Sep 17 00:00:00 2001 +From 3b952bf28abbd43949c303b858be9a27ebf864d2 Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 13 Apr 2013 16:38:50 +0200 -Subject: [PATCH 085/136] ffmpeg: XVBA-VC1 use v->second_field instead of +Subject: [PATCH 056/110] ffmpeg: XVBA-VC1 use v->second_field instead of !s->first_field to make VC1 interlaced working --- @@ -25717,10 +17107,10 @@ index ff35a28..04e7983 100644 1.8.1.6 -From 36e745498803b6eb8ac6e7d6b1aa3e5b9e9342b3 Mon Sep 17 00:00:00 2001 +From 80e05a1fdafc66ab25364cd661f4839df4d16a1a Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 27 Apr 2013 17:36:15 +0200 -Subject: [PATCH 086/136] XVBA: Only set second_field when we are interlaced +Subject: [PATCH 057/110] XVBA: Only set second_field when we are interlaced and an interlaced field --- @@ -25744,10 +17134,10 @@ index 04e7983..eb90c12 100644 1.8.1.6 -From 1a5b0d7e28e410df41d97659fc327c39308001e1 Mon Sep 17 00:00:00 2001 +From fdd88b6e39dd8ec7cf5899276dc583b7eb4237fd Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 27 Apr 2013 22:08:50 +0200 -Subject: [PATCH 087/136] xvba: translate picture_structure to a value xvba +Subject: [PATCH 058/110] xvba: translate picture_structure to a value xvba understands --- @@ -25830,10 +17220,10 @@ index eb90c12..c98dba5 100644 1.8.1.6 -From 4cc7e515c75eb853055cc74367751829fc425b96 Mon Sep 17 00:00:00 2001 +From 98b0def969e92f7c8075f8401cd2bb107b0e79b1 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 30 Apr 2013 21:18:55 +0200 -Subject: [PATCH 088/136] ffmpeg xvba: fix vc1 field interlace +Subject: [PATCH 059/110] ffmpeg xvba: fix vc1 field interlace --- lib/ffmpeg/libavcodec/xvba.c | 4 ++-- @@ -25885,10 +17275,10 @@ index c98dba5..e7a85a7 100644 1.8.1.6 -From f058a132f053d6bb86452d249a74cd6f05c80fad Mon Sep 17 00:00:00 2001 +From a2d3dec001d3876d74a8838744050648eff45724 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 30 Apr 2013 21:19:07 +0200 -Subject: [PATCH 089/136] xvba: fix vc1 field interlace +Subject: [PATCH 060/110] xvba: fix vc1 field interlace --- xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp | 3 +++ @@ -25912,10 +17302,10 @@ index 43a331f..568632f 100644 1.8.1.6 -From ea6a0186f1321a74ff34ce0e72df4ad7939b7981 Mon Sep 17 00:00:00 2001 +From 0199079932e05c87a5166d190bd9f414a85eada3 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 30 Apr 2013 21:40:55 +0200 -Subject: [PATCH 090/136] xvba: vc1 - honor psf +Subject: [PATCH 061/110] xvba: vc1 - honor psf --- xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp | 3 +++ @@ -25946,20 +17336,20 @@ index 568632f..1db9363 100644 1.8.1.6 -From 4c749cca39425daa10533aa8a5cc7498fa236766 Mon Sep 17 00:00:00 2001 +From 5903b207c8fd52c5bee549612c0c35d86ebef1eb Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 4 May 2013 10:31:32 +0200 -Subject: [PATCH 091/136] xvba: squash me, settings +Subject: [PATCH 062/110] xvba: squash me, settings --- xbmc/settings/Settings.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 42a1363..861bd1a 100644 +index 1de1ac6..1174659 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp -@@ -747,6 +747,9 @@ void CSettings::InitializeConditions() +@@ -758,6 +758,9 @@ void CSettings::InitializeConditions() #ifdef HAVE_LIBVDPAU m_settingsManager->AddCondition("have_libvdpau"); #endif @@ -25973,10 +17363,10 @@ index 42a1363..861bd1a 100644 1.8.1.6 -From abf5055b780fca08a495f76b1258c2eea3fe84d2 Mon Sep 17 00:00:00 2001 +From 03a51a564d6a80f53c67d1204737bb61b3265c2f Mon Sep 17 00:00:00 2001 From: fritsch Date: Fri, 24 May 2013 12:02:02 +0200 -Subject: [PATCH 092/136] XVBA: Limit video to 2048x1152 as this is the max all +Subject: [PATCH 063/110] XVBA: Limit video to 2048x1152 as this is the max all blocks can handle --- @@ -26006,10 +17396,10 @@ index 1db9363..54d7aea 100644 1.8.1.6 -From ba8f531d904709116d23f135fd512c6fb7eb666c Mon Sep 17 00:00:00 2001 +From bc55f265667c12b21f24f443f434a9541d8871fc Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 20 Aug 2012 16:06:39 +0200 -Subject: [PATCH 093/136] dvdplayer: observe pts counter overflow +Subject: [PATCH 064/110] dvdplayer: observe pts counter overflow --- .../cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 198 ++++++++++++++++++++- @@ -26017,7 +17407,7 @@ Subject: [PATCH 093/136] dvdplayer: observe pts counter overflow 2 files changed, 201 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 9c395da..356b965 100644 +index 4e7ca89..4a21438 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -18,7 +18,6 @@ @@ -26296,10 +17686,10 @@ index aef5ab1..35abbdf 100644 1.8.1.6 -From 9eba76f46ea93a2d60b8277296a93eb04a431c7c Mon Sep 17 00:00:00 2001 +From 1ef2e98ecd3c9f22c66c7b0abb2def18559fd114 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 2 Oct 2012 13:02:10 +0200 -Subject: [PATCH 094/136] dvdplayer: avoid short screen flicker caused by +Subject: [PATCH 065/110] dvdplayer: avoid short screen flicker caused by unnecessary reconfigure of renderer --- @@ -26307,10 +17697,10 @@ Subject: [PATCH 094/136] dvdplayer: avoid short screen flicker caused by 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index b18cc79..adee04a 100644 +index f35419f..61aa709 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1095,7 +1095,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) +@@ -1062,7 +1062,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) || ( m_output.height != pPicture->iHeight ) || ( m_output.dwidth != pPicture->iDisplayWidth ) || ( m_output.dheight != pPicture->iDisplayHeight ) @@ -26319,7 +17709,7 @@ index b18cc79..adee04a 100644 || ( m_output.color_format != (unsigned int)pPicture->format ) || ( m_output.extended_format != pPicture->extended_format ) || ( m_output.color_matrix != pPicture->color_matrix && pPicture->color_matrix != 0 ) // don't reconfigure on unspecified -@@ -1148,7 +1148,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) +@@ -1118,7 +1118,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) m_output.height = pPicture->iHeight; m_output.dwidth = pPicture->iDisplayWidth; m_output.dheight = pPicture->iDisplayHeight; @@ -26332,10 +17722,10 @@ index b18cc79..adee04a 100644 1.8.1.6 -From 129c2699510723ffa813b04d098377018854a40c Mon Sep 17 00:00:00 2001 +From d54a67b705e0cb0febdb7acb7cee45b77975c2a2 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 11 Oct 2012 12:05:50 +0200 -Subject: [PATCH 095/136] vdpau: advanced settings for auto deinterlacing +Subject: [PATCH 066/110] vdpau: advanced settings for auto deinterlacing --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++++---- @@ -26363,7 +17753,7 @@ index 2fdcf37..2805613 100644 if (deint != -1) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 292750d..f0cb9dd 100644 +index 8287651..79d4f90 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -169,6 +169,8 @@ void CAdvancedSettings::Initialize() @@ -26375,7 +17765,7 @@ index 292750d..f0cb9dd 100644 m_videoVDPAUtelecine = false; m_videoVDPAUdeintSkipChromaHD = false; m_DXVACheckCompatibility = false; -@@ -583,6 +585,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) +@@ -601,6 +603,8 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file) XMLUtils::GetBoolean(pElement,"allowmpeg4vaapi",m_videoAllowMpeg4VAAPI); XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace); XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1); @@ -26385,10 +17775,10 @@ index 292750d..f0cb9dd 100644 XMLUtils::GetBoolean(pElement,"vdpauHDdeintSkipChroma",m_videoVDPAUdeintSkipChromaHD); diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index 3a52878..3e6901b 100644 +index 310db76..830a241 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h -@@ -147,6 +147,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler +@@ -158,6 +158,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler int m_videoPercentSeekBackwardBig; CStdString m_videoPPFFmpegDeint; CStdString m_videoPPFFmpegPostProc; @@ -26401,10 +17791,10 @@ index 3a52878..3e6901b 100644 1.8.1.6 -From ffa4c08a6d26b68604c4980728a91569097f530d Mon Sep 17 00:00:00 2001 +From 46d6b77751fa93a9868bba4086250e8841d939db Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 2 Nov 2012 13:20:03 +0100 -Subject: [PATCH 096/136] player: fix rewind +Subject: [PATCH 067/110] player: fix rewind --- xbmc/cores/dvdplayer/DVDMessage.h | 5 ++++- @@ -26452,10 +17842,10 @@ index 2ea8b8f..e8274f9 100644 class CDVDMsgPlayerSeekChapter : public CDVDMsg diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 994e7b4..c8a4585 100644 +index 1bd122b..99f0042 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -1556,11 +1556,13 @@ void CDVDPlayer::HandlePlaySpeed() +@@ -1557,11 +1557,13 @@ void CDVDPlayer::HandlePlaySpeed() } else if (m_CurrentVideo.id >= 0 && (m_CurrentVideo.inited == true || GetPlaySpeed() < 0) // allow rewind at end of file @@ -26470,7 +17860,7 @@ index 994e7b4..c8a4585 100644 // check how much off clock video is when ff/rw:ing // a problem here is that seeking isn't very accurate // and since the clock will be resynced after seek -@@ -1579,7 +1581,7 @@ void CDVDPlayer::HandlePlaySpeed() +@@ -1580,7 +1582,7 @@ void CDVDPlayer::HandlePlaySpeed() { CLog::Log(LOGDEBUG, "CDVDPlayer::Process - Seeking to catch up"); int64_t iTime = (int64_t)DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset + 500000.0 * m_playSpeed / DVD_PLAYSPEED_NORMAL); @@ -26479,7 +17869,7 @@ index 994e7b4..c8a4585 100644 } } } -@@ -2067,7 +2069,7 @@ void CDVDPlayer::HandleMessages() +@@ -2068,7 +2070,7 @@ void CDVDPlayer::HandleMessages() else m_StateInput.dts = start; @@ -26488,7 +17878,7 @@ index 994e7b4..c8a4585 100644 } else CLog::Log(LOGWARNING, "error while seeking"); -@@ -2206,9 +2208,10 @@ void CDVDPlayer::HandleMessages() +@@ -2207,9 +2209,10 @@ void CDVDPlayer::HandleMessages() double offset; offset = CDVDClock::GetAbsoluteClock() - m_State.timestamp; offset *= m_playSpeed / DVD_PLAYSPEED_NORMAL; @@ -26500,7 +17890,7 @@ index 994e7b4..c8a4585 100644 m_State.timestamp = CDVDClock::GetAbsoluteClock(); } -@@ -2224,7 +2227,8 @@ void CDVDPlayer::HandleMessages() +@@ -2225,7 +2228,8 @@ void CDVDPlayer::HandleMessages() // do a seek after rewind, clock is not in sync with current pts if (m_playSpeed < 0 && speed >= 0) { @@ -26510,7 +17900,7 @@ index 994e7b4..c8a4585 100644 } // if playspeed is different then DVD_PLAYSPEED_NORMAL or DVD_PLAYSPEED_PAUSE -@@ -3173,7 +3177,7 @@ bool CDVDPlayer::CloseTeletextStream(bool bWaitForBuffers) +@@ -3177,7 +3181,7 @@ bool CDVDPlayer::CloseTeletextStream(bool bWaitForBuffers) return true; } @@ -26519,7 +17909,7 @@ index 994e7b4..c8a4585 100644 { double startpts; if(accurate) -@@ -3185,19 +3189,23 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) +@@ -3189,19 +3193,23 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) if(startpts != DVD_NOPTS_VALUE) startpts -= m_offset_pts; @@ -26547,7 +17937,7 @@ index 994e7b4..c8a4585 100644 m_CurrentTeletext.dts = DVD_NOPTS_VALUE; m_CurrentTeletext.startpts = startpts; -@@ -3241,7 +3249,7 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) +@@ -3245,7 +3253,7 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) m_CurrentTeletext.started = false; } @@ -26557,10 +17947,10 @@ index 994e7b4..c8a4585 100644 UpdatePlayState(0); diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h -index c6b9ce3..c49b9e7 100644 +index 237aba4d..9e54bc8 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.h +++ b/xbmc/cores/dvdplayer/DVDPlayer.h -@@ -304,7 +304,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer +@@ -303,7 +303,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer bool GetCachingTimes(double& play_left, double& cache_left, double& file_offset); @@ -26569,7 +17959,7 @@ index c6b9ce3..c49b9e7 100644 void HandleMessages(); void HandlePlaySpeed(); -@@ -353,8 +353,9 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer +@@ -352,8 +352,9 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer int m_playSpeed; struct SSpeedState { @@ -26582,10 +17972,10 @@ index c6b9ce3..c49b9e7 100644 int m_errorCount; diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index adee04a..e28c57d 100644 +index 61aa709..e668d29 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -@@ -1500,7 +1500,7 @@ double CDVDPlayerVideo::GetCurrentPts() +@@ -1471,7 +1471,7 @@ double CDVDPlayerVideo::GetCurrentPts() if( m_stalled ) iRenderPts = DVD_NOPTS_VALUE; @@ -26594,7 +17984,7 @@ index adee04a..e28c57d 100644 iRenderPts = iRenderPts - max(0.0, iSleepTime); return iRenderPts; -@@ -1600,6 +1600,8 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) +@@ -1571,6 +1571,8 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts) int iSkippedDeint = 0; int iBufferLevel; @@ -26604,7 +17994,7 @@ index adee04a..e28c57d 100644 if (!m_pVideoCodec->GetCodecStats(iDecoderPts, iSkippedDeint, interlaced)) iDecoderPts = pts; diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h -index ec30fc5..be22aef 100644 +index 59c7f09..65dea76 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h @@ -50,6 +50,7 @@ class CDroppingStats @@ -26619,10 +18009,10 @@ index ec30fc5..be22aef 100644 1.8.1.6 -From e1373b7a234d42c675a4394afcfdca25e85ff28b Mon Sep 17 00:00:00 2001 +From 9dd0b7d5f46e62f4868f414a599bc8c7bbc7a8b8 Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 23 Nov 2012 17:41:12 +0100 -Subject: [PATCH 097/136] xrandr: fix query for multiple screens +Subject: [PATCH 068/110] xrandr: fix query for multiple screens --- xbmc/windowing/X11/XRandR.cpp | 10 ++++++---- @@ -26663,10 +18053,10 @@ index 9e181f2..ce0a02b 100644 1.8.1.6 -From a8e1b0e463c796066fcd66309b974ed7d699bb25 Mon Sep 17 00:00:00 2001 +From 8e619e069765d3ee80e17c92d5e4f9ef395046ee Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 2 Dec 2012 15:46:55 +0100 -Subject: [PATCH 098/136] X11: add debug log to print out refresh after xrr +Subject: [PATCH 069/110] X11: add debug log to print out refresh after xrr event --- @@ -26694,10 +18084,10 @@ index 9ff947c..a3394e6 100644 1.8.1.6 -From b02869e45241811e11468721a45ddd574a8f00cc Mon Sep 17 00:00:00 2001 +From e9039e88331e391396b445120472b15f8e782cb3 Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 11 Dec 2012 11:08:13 +0100 -Subject: [PATCH 099/136] X11: dont call XCloseDisplay on shutdown, it crashes +Subject: [PATCH 070/110] X11: dont call XCloseDisplay on shutdown, it crashes when powered doen by cec on ATI --- @@ -26722,10 +18112,10 @@ index a3394e6..b941c14 100644 1.8.1.6 -From f4d209618fabd698c22843bfd5ae5503c8ec4c77 Mon Sep 17 00:00:00 2001 +From 1e2b5a08eac009b3972c62c58a7f9ed92ce827a0 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 100/136] x11: support for multiple x screens +Subject: [PATCH 071/110] x11: support for multiple x screens --- xbmc/windowing/X11/XRandR.cpp | 2 +- @@ -26748,10 +18138,10 @@ index ce0a02b..aa27d2b 100644 1.8.1.6 -From 52ec48f34857ee51438bec6726713d76a1b9a220 Mon Sep 17 00:00:00 2001 +From 55e7a139566a3d3d00ba6119deffb0f39c4ef911 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 24 Dec 2012 16:02:42 +0100 -Subject: [PATCH 101/136] pvr: increase changes counter of stream on stream +Subject: [PATCH 072/110] pvr: increase changes counter of stream on stream change, cosmetics after dd307930d39d92f145a01a16600cd00e01ec39be --- @@ -26785,10 +18175,10 @@ index 7e35581..7adfa27 100644 1.8.1.6 -From 899be2ee7821494b1288d628726a55c7358f1de1 Mon Sep 17 00:00:00 2001 +From 3897839d0a960e56b0fb2428fac1b6b984c8aa33 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 17 Jan 2013 16:03:22 +0100 -Subject: [PATCH 102/136] X11: add keymapping for XF86XK_Sleep +Subject: [PATCH 073/110] X11: add keymapping for XF86XK_Sleep --- xbmc/windowing/WinEventsX11.cpp | 1 + @@ -26810,17 +18200,17 @@ index 4a5aab4..da5d412 100644 1.8.1.6 -From bb11996a98324a9aa649dd5c4bc5dde7a56b4646 Mon Sep 17 00:00:00 2001 +From 05b4672c598d37ff47e07839e3329fcbe2756c14 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 21 Jan 2013 09:00:19 +0100 -Subject: [PATCH 103/136] X11: remove toggle full screen after resume +Subject: [PATCH 074/110] X11: remove toggle full screen after resume --- xbmc/powermanagement/PowerManager.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp -index fa2a21d..c47219c 100644 +index d658a97..7f12a5d 100644 --- a/xbmc/powermanagement/PowerManager.cpp +++ b/xbmc/powermanagement/PowerManager.cpp @@ -260,11 +260,6 @@ void CPowerManager::OnWake() @@ -26839,10 +18229,10 @@ index fa2a21d..c47219c 100644 1.8.1.6 -From da18dc246c24c1f5e41193fccd9fbdd998e4b862 Mon Sep 17 00:00:00 2001 +From fcab0158f441c5f7ee06bb360a2d56a14ab79b77 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 23 Jan 2013 17:03:02 +0100 -Subject: [PATCH 104/136] xrandr: set screen on mode change command +Subject: [PATCH 075/110] xrandr: set screen on mode change command --- xbmc/windowing/X11/XRandR.cpp | 2 +- @@ -26865,10 +18255,10 @@ index aa27d2b..67bf6ca 100644 1.8.1.6 -From 85c1875c1ed563e78620ee21e96e90a1ea390ef5 Mon Sep 17 00:00:00 2001 +From 3c978a401c2624ec0391b25cc66633e247255cd5 Mon Sep 17 00:00:00 2001 From: xbmc Date: Wed, 23 Jan 2013 17:03:39 +0100 -Subject: [PATCH 105/136] X11: recreate glx context when output changes +Subject: [PATCH 076/110] X11: recreate glx context when output changes --- xbmc/windowing/X11/WinSystemX11.cpp | 6 +++--- @@ -26919,10 +18309,10 @@ index ce3c289..311e4cc 100644 1.8.1.6 -From 8ff7803668859d0b56739338c9cfea0a50b28fad Mon Sep 17 00:00:00 2001 +From 6cddfccd77d365c81a384512a5cfee3b00f9b15c Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 14 Dec 2012 14:19:15 +0100 -Subject: [PATCH 106/136] pvr: do not show selection dialog for a single menu +Subject: [PATCH 077/110] pvr: do not show selection dialog for a single menu hook --- @@ -26960,10 +18350,10 @@ index c84bd4d..a39584b 100644 1.8.1.6 -From d96801eb4eb8fe38f8217890de6b0728b9c00d67 Mon Sep 17 00:00:00 2001 +From 2f7e8b17ab53a312588d4895cae2fa678760e069 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 3 Feb 2013 08:17:16 +0100 -Subject: [PATCH 107/136] X11: use default screen parameters if no output +Subject: [PATCH 078/110] X11: use default screen parameters if no output connected --- @@ -27067,10 +18457,10 @@ index c84e793..5215f4d 100644 1.8.1.6 -From 3b55e3a3239d6d78abe5a5bb515e9e0791269d11 Mon Sep 17 00:00:00 2001 +From f15251c6dabb64a50cec28eb745534be103437db Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 23 Mar 2013 15:13:32 +0100 -Subject: [PATCH 108/136] X11: create parent window +Subject: [PATCH 079/110] X11: create parent window --- xbmc/windowing/X11/WinSystemX11.cpp | 69 +++++++++++++++++++++++-------------- @@ -27336,10 +18726,10 @@ index 311e4cc..49365a8 100644 1.8.1.6 -From 5886b4f4c1f33dc17d0f0bd6737ffb445443261c Mon Sep 17 00:00:00 2001 +From fdbc56ee223bb0ab998470b5ceb897ac82519530 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 24 Mar 2013 12:30:12 +0100 -Subject: [PATCH 109/136] X11: use system key repeat rate instead of hardcoded +Subject: [PATCH 080/110] X11: use system key repeat rate instead of hardcoded one, taken from 58fd64b194e38b73b5f3132744bab35e994e7441 --- @@ -27541,10 +18931,10 @@ index 102a076..5b1f3fa 100644 1.8.1.6 -From 93f2e693d0f4079e0fc5be4db844683166bb97c6 Mon Sep 17 00:00:00 2001 +From a70c2e4a776c5be440a1b6c65824d4b36402574f Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 24 Mar 2013 16:04:48 +0100 -Subject: [PATCH 110/136] linux: use CLOCK_MONOTONIC_RAW as this is not subject +Subject: [PATCH 081/110] linux: use CLOCK_MONOTONIC_RAW as this is not subject to NTP --- @@ -27582,20 +18972,20 @@ index c06b8c5..4390d2e 100644 1.8.1.6 -From d302ad05afaf2abe50cc17b0ad76bcd20b30250d Mon Sep 17 00:00:00 2001 +From a79350b43a1c60dc162868475da99421863c74bc Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 28 Mar 2013 15:18:53 +0100 -Subject: [PATCH 111/136] OMXPlayer: some caching fixes for pvr +Subject: [PATCH 082/110] OMXPlayer: some caching fixes for pvr --- xbmc/cores/omxplayer/OMXPlayer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp -index b3d4314..12f6087 100644 +index 31b690c..9d24622 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp -@@ -2459,7 +2459,8 @@ void COMXPlayer::HandleMessages() +@@ -2460,7 +2460,8 @@ void COMXPlayer::HandleMessages() m_messenger.Put(new CDVDMsgPlayerSeek(DVD_TIME_TO_MSEC(m_clock.GetClock()), (speed < 0), true, false, false, true)); m_playSpeed = speed; @@ -27609,20 +18999,20 @@ index b3d4314..12f6087 100644 1.8.1.6 -From d7b3c8730b73b45e21f8e2c6af5ae13fc1a2408f Mon Sep 17 00:00:00 2001 +From c36206ab65b88bee3d9216d09382f523f470635c Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 28 Mar 2013 20:50:59 +0100 -Subject: [PATCH 112/136] fix incorrect display of fps when dr kicks in +Subject: [PATCH 083/110] 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 eb81f6e..93a790c 100644 +index 55a2685..c864770 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2153,10 +2153,11 @@ void CApplication::Render() +@@ -2174,10 +2174,11 @@ void CApplication::Render() if (frameTime < singleFrameTime) Sleep(singleFrameTime - frameTime); } @@ -27639,17 +19029,17 @@ index eb81f6e..93a790c 100644 1.8.1.6 -From 9e585b158ee04aa95ed4cfe3f7d51bb3d38cd627 Mon Sep 17 00:00:00 2001 +From 26f9d7c84392476cd83eb25fae0cd467478d5300 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 8 Apr 2013 11:18:31 +0200 -Subject: [PATCH 113/136] squash to dropping control +Subject: [PATCH 084/110] squash to dropping control --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index e28c57d..3c3309b 100644 +index e668d29..3474fe6 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -39,6 +39,7 @@ @@ -27664,10 +19054,10 @@ index e28c57d..3c3309b 100644 1.8.1.6 -From 22a6a2ad21e3bbfac94102794f9141634d6f759b Mon Sep 17 00:00:00 2001 +From be88e4fbe0b07c5604e1e8a548b09f55b67f02ae Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 11 Apr 2013 12:33:46 +0200 -Subject: [PATCH 114/136] pvr: try SwtichChannel when selecting a channel via +Subject: [PATCH 085/110] pvr: try SwtichChannel when selecting a channel via EPG --- @@ -27702,10 +19092,10 @@ index 8616980..198b074 100644 1.8.1.6 -From 572ed7a6fe6427533c92ea6637dc800759c7bf6f Mon Sep 17 00:00:00 2001 +From 51814a1e2c8a562395544a5424fb514a3cda8883 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sat, 13 Apr 2013 08:32:06 +0200 -Subject: [PATCH 115/136] X11: fix mouse coverage +Subject: [PATCH 086/110] X11: fix mouse coverage --- xbmc/windowing/X11/WinSystemX11.cpp | 11 ++++++++--- @@ -27771,10 +19161,10 @@ index 49365a8..924af1d 100644 1.8.1.6 -From f397661d5f0dbc97d6d133a4326deeca7db44e11 Mon Sep 17 00:00:00 2001 +From 72e48eb8dbcd4e9d6463a5bfaf32bb8eb03aa8c3 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 8 May 2013 13:14:58 +0200 -Subject: [PATCH 116/136] X11: fix incorrectly used screen num in desktop +Subject: [PATCH 087/110] X11: fix incorrectly used screen num in desktop resolution --- @@ -27809,10 +19199,10 @@ index 186a28e..66955b8 100644 1.8.1.6 -From 758cbebfba5fb5dcddca399a7fcd1c49382015f8 Mon Sep 17 00:00:00 2001 +From 5f7c989345a0bc874dab7985e5b1dd7f524b743d Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 9 May 2013 12:07:09 +0200 -Subject: [PATCH 117/136] X11: do not overwrite user selected monitor with +Subject: [PATCH 088/110] X11: do not overwrite user selected monitor with fallback --- @@ -27937,10 +19327,10 @@ index 924af1d..2fb9e0f 100644 1.8.1.6 -From 21f9058201f4968525f53dc6d05e486ad0fb8f14 Mon Sep 17 00:00:00 2001 +From 4df886974f2671a5879f43f5154d7204f8b4f11b Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 12 May 2013 10:50:30 +0200 -Subject: [PATCH 118/136] xrandr: add turn on/off to wrapper +Subject: [PATCH 089/110] xrandr: add turn on/off to wrapper --- xbmc/windowing/X11/XRandR.cpp | 78 +++++++++++++++++++++++++++++++++++++++---- @@ -28106,10 +19496,10 @@ index d37838a..059062f 100644 1.8.1.6 -From cbec1e01b383d19b0f830d252fe8913f0c9f55ea Mon Sep 17 00:00:00 2001 +From 48754be0ac3f25931cef14a72090a775536d1443 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 19 May 2013 12:55:35 +0200 -Subject: [PATCH 119/136] xrandr: add GetPreferredMode to wrapper +Subject: [PATCH 090/110] xrandr: add GetPreferredMode to wrapper --- xbmc/windowing/X11/XRandR.cpp | 23 +++++++++++++++++++++++ @@ -28166,10 +19556,10 @@ index 059062f..ab7cc63 100644 1.8.1.6 -From 5d21236a1a099b7daa68b956ab39161bbe22151f Mon Sep 17 00:00:00 2001 +From 667eb31e549880a80aaf1ccd983e010ddc833eae Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 11 May 2013 17:12:12 +0200 -Subject: [PATCH 120/136] X11: multi-head improvement - poll for desired output +Subject: [PATCH 091/110] X11: multi-head improvement - poll for desired output if we do not get an xrr event --- @@ -28184,10 +19574,10 @@ Subject: [PATCH 120/136] 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 1fdf542..38d0b08 100644 +index fc1f5ec4d..645d7be 100644 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -6235,7 +6235,7 @@ msgctxt "#14071" +@@ -6242,7 +6242,7 @@ msgctxt "#14071" msgid "Allow file renaming and deletion" msgstr "" @@ -28196,7 +19586,7 @@ index 1fdf542..38d0b08 100644 msgctxt "#14074" msgid "Set timezone" -@@ -6367,7 +6367,12 @@ msgctxt "#14100" +@@ -6374,7 +6374,12 @@ msgctxt "#14100" msgid "Stop ripping CD" msgstr "" @@ -28211,10 +19601,10 @@ index 1fdf542..38d0b08 100644 #: xbmc/dialogs/GUIDialogFavourites.cpp msgctxt "#15015" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 4655d59..1875ad4 100644 +index ac87a69..688964e 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml -@@ -1855,6 +1855,11 @@ +@@ -1877,6 +1877,11 @@ @@ -28226,7 +19616,7 @@ index 4655d59..1875ad4 100644 0 0 -@@ -1906,6 +1911,7 @@ +@@ -1928,6 +1933,7 @@ @@ -28235,10 +19625,10 @@ index 4655d59..1875ad4 100644 false diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp -index cf5deba..0cbcdd1 100644 +index 1a85651..46895d2 100644 --- a/xbmc/settings/DisplaySettings.cpp +++ b/xbmc/settings/DisplaySettings.cpp -@@ -244,6 +244,10 @@ bool CDisplaySettings::OnSettingChanging(const CSetting *setting) +@@ -265,6 +265,10 @@ bool CDisplaySettings::OnSettingChanging(const CSetting *setting) m_resolutionChangeAborted = false; } } @@ -28450,10 +19840,10 @@ index 4809821..1ad26b2 100644 1.8.1.6 -From 71cc7a9d64c06d3fe0f3a13f6e14a1b2175a35f6 Mon Sep 17 00:00:00 2001 +From b83db2b42b1f940544e4c353439a97d43379cd73 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 15 May 2013 09:14:34 +0200 -Subject: [PATCH 121/136] X11: ignore mouse move event form other windows +Subject: [PATCH 092/110] X11: ignore mouse move event form other windows --- xbmc/windowing/WinEventsX11.cpp | 4 +++- @@ -28485,10 +19875,10 @@ index 879d8f2..2ec9b6f 100644 1.8.1.6 -From 0072bf85d4c6a8046cbc0bbf27a80033906f2bfe Mon Sep 17 00:00:00 2001 +From f8633b3687ef65d4467e0779854ba2f6b6a853b1 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 2 Jun 2013 14:53:45 +0200 -Subject: [PATCH 122/136] vdpau: fix segfault caused by uninitialized member +Subject: [PATCH 093/110] vdpau: fix segfault caused by uninitialized member --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 1 + @@ -28510,10 +19900,10 @@ index 2805613..cdfceb7 100644 1.8.1.6 -From 9ab5f948068b49d38cc721f1e1107ac4f23f3a5b Mon Sep 17 00:00:00 2001 +From d1884a4dade9ce7e7e6a90a15fdcc13b789f23b0 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 11 Jun 2013 16:13:45 +0200 -Subject: [PATCH 123/136] vdpau: sync video mixer +Subject: [PATCH 094/110] vdpau: sync video mixer --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 15 +++++++++++++++ @@ -28549,10 +19939,10 @@ index cdfceb7..75ac6f0 100644 1.8.1.6 -From c32f6f0f83cf5e85526e24753b9af7d4baf2b08b Mon Sep 17 00:00:00 2001 +From 01311ab34796feff00c771a3ac357b650ef340e6 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 11 Jun 2013 16:20:29 +0200 -Subject: [PATCH 124/136] renderer: allow some lateness within vblank interval +Subject: [PATCH 095/110] renderer: allow some lateness within vblank interval --- xbmc/cores/VideoRenderers/RenderManager.cpp | 12 ++++++++++-- @@ -28560,7 +19950,7 @@ Subject: [PATCH 124/136] renderer: allow some lateness within vblank interval 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index 7e12a46..9347766 100644 +index 5056100..97fed9a 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -398,6 +398,8 @@ void CXBMCRenderManager::FrameFinish() @@ -28572,7 +19962,7 @@ index 7e12a46..9347766 100644 { CSingleLock lock(m_presentlock); if(m_presentstep == PRESENT_FRAME) -@@ -1043,6 +1045,12 @@ void CXBMCRenderManager::PrepareNextRender() +@@ -1050,6 +1052,12 @@ void CXBMCRenderManager::PrepareNextRender() double clocktime = GetPresentTime(); double frametime = 1.0 / GetMaximumFPS(); @@ -28585,7 +19975,7 @@ index 7e12a46..9347766 100644 /* see if any future queued frames are already due */ std::deque::reverse_iterator curr, prev; -@@ -1051,8 +1059,8 @@ void CXBMCRenderManager::PrepareNextRender() +@@ -1058,8 +1066,8 @@ void CXBMCRenderManager::PrepareNextRender() ++prev; while (prev != m_queued.rend()) { @@ -28612,10 +20002,10 @@ index befd851..27283ec 100644 1.8.1.6 -From 6a67efb103960272e96ef716cbeff0d2880db689 Mon Sep 17 00:00:00 2001 +From caa6819211e3709d0b07a243769efd98713abf7d Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 14 Jun 2013 09:23:22 +0200 -Subject: [PATCH 125/136] vdpau: calculate timestamp of second field when doing +Subject: [PATCH 096/110] vdpau: calculate timestamp of second field when doing deinterlacing --- @@ -28641,10 +20031,10 @@ index 75ac6f0..67b6cf2 100644 1.8.1.6 -From a42f4fb77882658c70d9e53a0c2510395d005572 Mon Sep 17 00:00:00 2001 +From e25ff6fc6ca096549e9a8be0d87b63d4dd9bc45c Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 14 Jun 2013 10:46:58 +0200 -Subject: [PATCH 126/136] vdpau: comment debug log: long decoding time +Subject: [PATCH 097/110] vdpau: comment debug log: long decoding time --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++++---- @@ -28680,10 +20070,10 @@ index 67b6cf2..55430a6 100644 1.8.1.6 -From 0f900c89fd4136858fcb45365004dd236499fcf5 Mon Sep 17 00:00:00 2001 +From 9fe7fd83414c3963a10fe333c439203d6b34873e Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 16 Jun 2013 13:22:58 +0200 -Subject: [PATCH 127/136] X11: another fix for mouse coverage +Subject: [PATCH 098/110] X11: another fix for mouse coverage --- xbmc/windowing/WinEventsX11.cpp | 6 ++++-- @@ -28716,20 +20106,20 @@ index 2ec9b6f..4ed978c 100644 1.8.1.6 -From 15b76d91f51cb399b9574fe2758255214c7fba66 Mon Sep 17 00:00:00 2001 +From cb8babb62b2adb4ec05722d67a23982516a5c3f0 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 16 Jun 2013 13:23:19 +0200 -Subject: [PATCH 128/136] renderer: delete fence on uninit +Subject: [PATCH 099/110] renderer: delete fence on uninit --- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 73a8cc8..6b28601 100644 +index b2beb2e..2613083 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -1166,7 +1166,12 @@ void CLinuxRendererGL::UnInit() +@@ -1187,7 +1187,12 @@ void CLinuxRendererGL::UnInit() // YV12 textures for (int i = 0; i < NUM_BUFFERS; ++i) @@ -28746,20 +20136,20 @@ index 73a8cc8..6b28601 100644 1.8.1.6 -From 168265eeba10a227cee2c310d8812f67ced95a25 Mon Sep 17 00:00:00 2001 +From adc3b53ae2357465184d38409c9dc5f2d61dc007 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 16 Jun 2013 14:28:01 +0200 -Subject: [PATCH 129/136] renderer: limit fence to vdpau +Subject: [PATCH 100/110] renderer: limit fence to vdpau --- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 6b28601..1594d45 100644 +index 2613083..9337ee6 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -1256,14 +1256,17 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) +@@ -1277,14 +1277,17 @@ void CLinuxRendererGL::Render(DWORD flags, int renderBuffer) VerifyGLState(); } @@ -28787,10 +20177,10 @@ index 6b28601..1594d45 100644 1.8.1.6 -From 804b001ee6c35f10dbb8076816250e8fccaf04f4 Mon Sep 17 00:00:00 2001 +From 69b3991f1c8f45295dbd62f42f3af0e153337980 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 4 Jul 2013 16:38:26 +0200 -Subject: [PATCH 130/136] XVBA: replace CODEC_IS with AV_CODEC_ID +Subject: [PATCH 101/110] XVBA: replace CODEC_IS with AV_CODEC_ID --- xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp | 14 +++++++------- @@ -28865,10 +20255,10 @@ index 54d7aea..5845dbf 100644 1.8.1.6 -From 4de4eabbb2532bb841618980625ce1973e858377 Mon Sep 17 00:00:00 2001 +From 07d82699f9aff83d4228e1cea4a5da05460f8717 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 5 Jul 2013 12:14:00 +0200 -Subject: [PATCH 131/136] X11: set windows class name +Subject: [PATCH 102/110] X11: set windows class name --- xbmc/windowing/X11/WinSystemX11.cpp | 9 ++++++++- @@ -28910,10 +20300,10 @@ index 7e4b637..44e40a3 100644 1.8.1.6 -From d5461fcb39aea90cd9deb3ccac1dd25a0d6fd865 Mon Sep 17 00:00:00 2001 +From 4a6c2229447b4dfbbadaa0fa8005d2278ee52353 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 13 Jul 2013 20:00:45 +0200 -Subject: [PATCH 132/136] VDPAU: revert sync mixer, does a busy wait +Subject: [PATCH 103/110] VDPAU: revert sync mixer, does a busy wait --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 31 +++++++++++++------------- @@ -28979,10 +20369,10 @@ index 55430a6..aac0646 100644 1.8.1.6 -From b6d69ffe7399e8f75927b32ae8b5c421247b2bf7 Mon Sep 17 00:00:00 2001 +From 810827650de3ad9c682d6c40bb275c8549c093f7 Mon Sep 17 00:00:00 2001 From: fritsch Date: Sun, 14 Jul 2013 14:21:52 +0200 -Subject: [PATCH 133/136] ActiveAE: Make ActiveAE default Audio Engine to get +Subject: [PATCH 104/110] ActiveAE: Make ActiveAE default Audio Engine to get it tested via ppa --- @@ -28990,7 +20380,7 @@ Subject: [PATCH 133/136] ActiveAE: Make ActiveAE default Audio Engine to get 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index 250056e..9c2ccb6 100644 +index 50a309c..8ce02d7 100644 --- a/xbmc/cores/AudioEngine/AEFactory.cpp +++ b/xbmc/cores/AudioEngine/AEFactory.cpp @@ -97,7 +97,7 @@ bool CAEFactory::LoadEngine() @@ -29006,10 +20396,10 @@ index 250056e..9c2ccb6 100644 1.8.1.6 -From 81ab9de24651da35b3dc3f1d4e1b292c7ac5877b Mon Sep 17 00:00:00 2001 +From 13d61226017eede4aae9e48edcbb6c8fa90dc42a Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 21 Jul 2013 13:03:45 +0200 -Subject: [PATCH 134/136] ffmpeg: xvba - add missing pix formats for xvba +Subject: [PATCH 105/110] ffmpeg: xvba - add missing pix formats for xvba --- lib/ffmpeg/libavcodec/h263dec.c | 3 +++ @@ -29031,7 +20421,7 @@ index e231b08..6fcd2a0 100644 AV_PIX_FMT_NONE }; diff --git a/lib/ffmpeg/libavcodec/h264.c b/lib/ffmpeg/libavcodec/h264.c -index 299039f..2f628ab 100644 +index 02d0a26..4f09c67 100644 --- a/lib/ffmpeg/libavcodec/h264.c +++ b/lib/ffmpeg/libavcodec/h264.c @@ -101,6 +101,9 @@ @@ -29048,20 +20438,20 @@ index 299039f..2f628ab 100644 1.8.1.6 -From fe7dcabef8bb02c29494206818bb20491767cbc0 Mon Sep 17 00:00:00 2001 +From db09e815ec42cca91d13ef48479f05d4abed9c24 Mon Sep 17 00:00:00 2001 From: spiff Date: Tue, 16 Jul 2013 14:34:04 +0200 -Subject: [PATCH 135/136] fixed: typo +Subject: [PATCH 106/110] 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 38d0b08..484c564 100644 +index 645d7be..7cc5c3b 100644 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -6369,7 +6369,7 @@ msgstr "" +@@ -6376,7 +6376,7 @@ msgstr "" #: xbmc/settings/settings.xml msgctxt "#14101" @@ -29074,17 +20464,17 @@ index 38d0b08..484c564 100644 1.8.1.6 -From 275709a2b99e437d2940bc2b3126b96700e03d39 Mon Sep 17 00:00:00 2001 +From e0368f17203eda08ea68b6c4665ced323c37852a Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 25 Jul 2013 17:18:13 +0200 -Subject: [PATCH 136/136] ActiveAE: slightly reduce buffer size +Subject: [PATCH 107/110] 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 4b64235..7835e81 100644 +index 31aa3c0..fd4d7c5 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -30,8 +30,8 @@ @@ -29100,4 +20490,3 @@ index 4b64235..7835e81 100644 { -- 1.8.1.6 - diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-995.10-disable-alt-tab.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-995.10-disable-alt-tab.patch similarity index 100% rename from packages/mediacenter/xbmc/patches/f68634b/xbmc-995.10-disable-alt-tab.patch rename to packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-995.10-disable-alt-tab.patch diff --git a/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-999.02-rpipower.patch b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-999.02-rpipower.patch new file mode 100644 index 0000000000..5153c26caa --- /dev/null +++ b/packages/mediacenter/xbmc/patches/13.alpha-6edea14/xbmc-999.02-rpipower.patch @@ -0,0 +1,113 @@ +From 3c27e947a2c52c7b124b1bcf32f554b82b60f690 Mon Sep 17 00:00:00 2001 +From: Stephan Raue +Date: Fri, 2 Aug 2013 01:32:03 +0200 +Subject: [PATCH] Disable Hibernate and Suspend related power options for + Raspberry & Co. without (working) Upower/HAL/CK/Systemd support. Usually this + devices dont support Suspend & Hibernate. + +--- + xbmc/powermanagement/PowerManager.cpp | 21 ++++++++---- + xbmc/powermanagement/linux/FallbackPowerSyscall.h | 39 +++++++++++++++++++++++ + 2 files changed, 53 insertions(+), 7 deletions(-) + create mode 100644 xbmc/powermanagement/linux/FallbackPowerSyscall.h + +diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp +index d658a97..993477e 100644 +--- a/xbmc/powermanagement/PowerManager.cpp ++++ b/xbmc/powermanagement/PowerManager.cpp +@@ -40,14 +40,17 @@ + #include "osx/CocoaPowerSyscall.h" + #elif defined(TARGET_ANDROID) + #include "android/AndroidPowerSyscall.h" +-#elif defined(TARGET_POSIX) && defined(HAS_DBUS) ++#elif defined(TARGET_POSIX) ++#include "linux/FallbackPowerSyscall.h" ++#if defined(HAS_DBUS) + #include "linux/ConsoleUPowerSyscall.h" + #include "linux/ConsoleDeviceKitPowerSyscall.h" + #include "linux/LogindUPowerSyscall.h" + #include "linux/UPowerSyscall.h" +-#ifdef HAS_HAL ++#if defined(HAS_HAL) + #include "linux/HALPowerSyscall.h" +-#endif ++#endif // HAS_HAL ++#endif // HAS_DBUS + #elif defined(TARGET_WINDOWS) + #include "powermanagement/windows/Win32PowerSyscall.h" + extern HWND g_hWnd; +@@ -73,7 +76,8 @@ void CPowerManager::Initialize() + m_instance = new CCocoaPowerSyscall(); + #elif defined(TARGET_ANDROID) + m_instance = new CAndroidPowerSyscall(); +-#elif defined(TARGET_POSIX) && defined(HAS_DBUS) ++#elif defined(TARGET_POSIX) ++#if defined(HAS_DBUS) + if (CConsoleUPowerSyscall::HasConsoleKitAndUPower()) + m_instance = new CConsoleUPowerSyscall(); + else if (CConsoleDeviceKitPowerSyscall::HasDeviceConsoleKit()) +@@ -82,10 +86,13 @@ void CPowerManager::Initialize() + m_instance = new CLogindUPowerSyscall(); + else if (CUPowerSyscall::HasUPower()) + m_instance = new CUPowerSyscall(); +-#ifdef HAS_HAL +- else ++#if defined(HAS_HAL) ++ else if(1) + m_instance = new CHALPowerSyscall(); +-#endif ++#endif // HAS_HAL ++ else ++#endif // HAS_DBUS ++ m_instance = new CFallbackPowerSyscall(); + #elif defined(TARGET_WINDOWS) + m_instance = new CWin32PowerSyscall(); + #endif +diff --git a/xbmc/powermanagement/linux/FallbackPowerSyscall.h b/xbmc/powermanagement/linux/FallbackPowerSyscall.h +new file mode 100644 +index 0000000..a6ed27b +--- /dev/null ++++ b/xbmc/powermanagement/linux/FallbackPowerSyscall.h +@@ -0,0 +1,39 @@ ++/* ++ * Copyright (C) 2005-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 ++ * . ++ * ++ */ ++#pragma once ++#include "powermanagement/IPowerSyscall.h" ++#include "system.h" ++#if defined(TARGET_POSIX) ++ ++class CFallbackPowerSyscall : public CPowerSyscallWithoutEvents ++{ ++public: ++ virtual bool Powerdown() {return true; } ++ virtual bool Suspend() {return false; } ++ virtual bool Hibernate() {return false; } ++ virtual bool Reboot() {return true; } ++ ++ virtual bool CanPowerdown() {return true; } ++ virtual bool CanSuspend() {return false; } ++ virtual bool CanHibernate() {return false; } ++ virtual bool CanReboot() {return true; } ++ virtual int BatteryLevel() {return 0; } ++}; ++#endif +-- +1.8.1.6 + diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-602-add_as.xml_busy_dialog_delay_control.patch b/packages/mediacenter/xbmc/patches/f68634b/xbmc-602-add_as.xml_busy_dialog_delay_control.patch deleted file mode 100644 index 8300e13296..0000000000 --- a/packages/mediacenter/xbmc/patches/f68634b/xbmc-602-add_as.xml_busy_dialog_delay_control.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff -Naur xbmc-12.1.8/xbmc/cores/dvdplayer/DVDPlayer.cpp xbmc-12.1.8.patch/xbmc/cores/dvdplayer/DVDPlayer.cpp ---- xbmc-12.1.8/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-04-24 23:38:36.000000000 +0200 -+++ xbmc-12.1.8.patch/xbmc/cores/dvdplayer/DVDPlayer.cpp 2013-04-26 00:49:07.732011721 +0200 -@@ -470,7 +470,7 @@ - #endif - - Create(); -- if(!m_ready.WaitMSec(100)) -+ if(!m_ready.WaitMSec(g_advancedSettings.m_videoBusyDialogDelay_ms)) - { - CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); - if(dialog) -diff -Naur xbmc-12.1.8/xbmc/cores/omxplayer/OMXPlayer.cpp xbmc-12.1.8.patch/xbmc/cores/omxplayer/OMXPlayer.cpp ---- xbmc-12.1.8/xbmc/cores/omxplayer/OMXPlayer.cpp 2013-04-24 23:38:36.000000000 +0200 -+++ xbmc-12.1.8.patch/xbmc/cores/omxplayer/OMXPlayer.cpp 2013-04-26 00:50:56.974691417 +0200 -@@ -474,7 +474,7 @@ - g_renderManager.PreInit(); - - Create(); -- if(!m_ready.WaitMSec(100)) -+ if(!m_ready.WaitMSec(g_advancedSettings.m_videoBusyDialogDelay_ms)) - { - CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY); - if(dialog) -diff -Naur xbmc-12.1.8/xbmc/settings/AdvancedSettings.cpp xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.cpp ---- xbmc-12.1.8/xbmc/settings/AdvancedSettings.cpp 2013-04-26 00:48:59.375036542 +0200 -+++ xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.cpp 2013-04-26 00:49:07.732011721 +0200 -@@ -111,6 +111,7 @@ - m_DXVAForceProcessorRenderer = true; - m_DXVANoDeintProcForProgressive = false; - m_videoFpsDetect = 1; -+ m_videoBusyDialogDelay_ms = 100; - m_videoDefaultLatency = 0.0; - m_videoDisableHi10pMultithreading = false; - -@@ -592,6 +593,10 @@ - //0 = disable fps detect, 1 = only detect on timestamps with uniform spacing, 2 detect on all timestamps - XMLUtils::GetInt(pElement, "fpsdetect", m_videoFpsDetect, 0, 2); - -+ // controls the delay, in milliseconds, until -+ // the busy dialog is shown when starting video playback. -+ XMLUtils::GetInt(pElement, "busydialogdelayms", m_videoBusyDialogDelay_ms, 0, 1000); -+ - // Store global display latency settings - TiXmlElement* pVideoLatency = pElement->FirstChildElement("latency"); - if (pVideoLatency) -diff -Naur xbmc-12.1.8/xbmc/settings/AdvancedSettings.h xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.h ---- xbmc-12.1.8/xbmc/settings/AdvancedSettings.h 2013-04-26 00:48:59.383036518 +0200 -+++ xbmc-12.1.8.patch/xbmc/settings/AdvancedSettings.h 2013-04-26 00:49:07.732011721 +0200 -@@ -165,6 +165,7 @@ - bool m_DXVANoDeintProcForProgressive; - int m_videoFpsDetect; - bool m_videoDisableHi10pMultithreading; -+ int m_videoBusyDialogDelay_ms; - - CStdString m_videoDefaultPlayer; - CStdString m_videoDefaultDVDPlayer; diff --git a/packages/mediacenter/xbmc/patches/f68634b/xbmc-999.01-automake-1.13.patch b/packages/mediacenter/xbmc/patches/f68634b/xbmc-999.01-automake-1.13.patch deleted file mode 100644 index a4703491b5..0000000000 --- a/packages/mediacenter/xbmc/patches/f68634b/xbmc-999.01-automake-1.13.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur xbmc-8ad691a/lib/libdvd/libdvdcss/configure.ac xbmc-8ad691a.patch/lib/libdvd/libdvdcss/configure.ac ---- xbmc-8ad691a/lib/libdvd/libdvdcss/configure.ac 2013-04-08 12:03:51.000000000 +0200 -+++ xbmc-8ad691a.patch/lib/libdvd/libdvdcss/configure.ac 2013-04-08 14:20:14.793113682 +0200 -@@ -5,7 +5,7 @@ - AC_CANONICAL_SYSTEM - - AM_INIT_AUTOMAKE(libdvdcss, 1.2.12) --AM_CONFIG_HEADER(config.h) -+AC_CONFIG_HEADERS(config.h) - - AC_PROG_CC - AC_STDC_HEADERS