Merge pull request #3140 from wsnipex/binary-addons
authorMartijn Kaijser <machine.sanctum@gmail.com>
Mon, 26 Aug 2013 08:03:24 +0000 (01:03 -0700)
committerMartijn Kaijser <machine.sanctum@gmail.com>
Mon, 26 Aug 2013 08:03:24 +0000 (01:03 -0700)
Make waveform and spectrum visualizations optional and stop installing unwanted stuff

91 files changed:
addons/skin.touched
lib/DllAvUtil.h
system/settings/android.xml
system/settings/settings.xml
system/settings/win32.xml
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.cpp
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h
xbmc/cores/AudioEngine/Utils/AEConvert.cpp
xbmc/cores/AudioEngine/Utils/AEUtil.cpp
xbmc/cores/AudioEngine/Utils/AEUtil.h
xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp
xbmc/cores/paplayer/MP3codec.cpp
xbmc/guilib/AnimatedGif.h
xbmc/guilib/D3DResource.h
xbmc/guilib/DDSImage.cpp
xbmc/guilib/DDSImage.h
xbmc/guilib/DirectXGraphics.cpp
xbmc/guilib/FrameBufferObject.cpp
xbmc/guilib/FrameBufferObject.h
xbmc/guilib/GUIAction.cpp
xbmc/guilib/GUIBaseContainer.cpp
xbmc/guilib/GUIBaseContainer.h
xbmc/guilib/GUIBorderedImage.cpp
xbmc/guilib/GUIButtonControl.h
xbmc/guilib/GUICallback.h
xbmc/guilib/GUICheckMarkControl.cpp
xbmc/guilib/GUIControl.cpp
xbmc/guilib/GUIControl.h
xbmc/guilib/GUIControlFactory.h
xbmc/guilib/GUIControlGroup.cpp
xbmc/guilib/GUIControlGroup.h
xbmc/guilib/GUIEditControl.h
xbmc/guilib/GUIFadeLabelControl.cpp
xbmc/guilib/GUIFontManager.cpp
xbmc/guilib/GUIFontManager.h
xbmc/guilib/GUIFontTTF.cpp
xbmc/guilib/GUIFontTTF.h
xbmc/guilib/GUIFontTTFDX.cpp
xbmc/guilib/GUIImage.cpp
xbmc/guilib/GUIImage.h
xbmc/guilib/GUIInfoTypes.cpp
xbmc/guilib/GUIInfoTypes.h
xbmc/guilib/GUILabel.cpp
xbmc/guilib/GUIListItem.cpp
xbmc/guilib/GUIListItem.h
xbmc/guilib/GUIListLabel.cpp
xbmc/guilib/GUIMessage.cpp
xbmc/guilib/GUIMessage.h
xbmc/guilib/GUIMultiImage.cpp
xbmc/guilib/GUIMultiSelectText.cpp
xbmc/guilib/GUIRSSControl.cpp
xbmc/guilib/GUISliderControl.h
xbmc/guilib/GUISpinControl.cpp
xbmc/guilib/GUIStaticItem.cpp
xbmc/guilib/GUITextBox.cpp
xbmc/guilib/GUITextLayout.cpp
xbmc/guilib/GUITextLayout.h
xbmc/guilib/GUITexture.cpp
xbmc/guilib/GUITexture.h
xbmc/guilib/GUIVisualisationControl.cpp
xbmc/guilib/GUIWindow.cpp
xbmc/guilib/GUIWindowManager.cpp
xbmc/guilib/GUIWindowManager.h
xbmc/guilib/GraphicContext.cpp
xbmc/guilib/JpegIO.cpp
xbmc/guilib/JpegIO.h
xbmc/guilib/Key.cpp
xbmc/guilib/Key.h
xbmc/guilib/LocalizeStrings.h
xbmc/guilib/MatrixGLES.h
xbmc/guilib/Resolution.h
xbmc/guilib/Shader.h
xbmc/guilib/StereoscopicsManager.cpp
xbmc/guilib/Texture.cpp
xbmc/guilib/Texture.h
xbmc/guilib/TextureBundleXPR.cpp
xbmc/guilib/TextureManager.cpp
xbmc/guilib/TextureManager.h
xbmc/guilib/Tween.h
xbmc/guilib/VisibleEffect.cpp
xbmc/guilib/VisibleEffect.h
xbmc/guilib/iimage.h
xbmc/utils/BitstreamConverter.cpp
xbmc/utils/BitstreamConverter.h
xbmc/video/dialogs/GUIDialogVideoInfo.cpp

index 68a27fc..c716b54 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 68a27fc3355e7f6fd87e1fc5644ac37bc055e344
+Subproject commit c716b54af6adc62dc859c8f60fe65f611e230e33
index d4fd0c0..ce5889b 100644 (file)
@@ -107,6 +107,7 @@ public:
   virtual int av_get_channel_layout_channel_index (uint64_t channel_layout, uint64_t channel) = 0;
   virtual int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) = 0;
   virtual int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt) = 0;
+  virtual uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index) = 0;
 #if defined(AVFRAME_IN_LAVU)
   virtual void av_frame_free(AVFrame **frame)=0;
   virtual AVFrame *av_frame_alloc(void)=0;
@@ -161,6 +162,8 @@ public:
     { return ::av_samples_fill_arrays(audio_data, linesize, buf, nb_channels, nb_samples, sample_fmt, align); }
   virtual int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
     { return ::av_samples_copy(dst, src, dst_offset, src_offset, nb_samples, nb_channels, sample_fmt); }
+  virtual uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
+    { return ::av_channel_layout_extract_channel(channel_layout, index); }
 #if defined(AVFRAME_IN_LAVU)
   virtual void av_frame_free(AVFrame **frame) { return ::av_frame_free(frame); }
   virtual AVFrame *av_frame_alloc() { return ::av_frame_alloc(); }
@@ -219,6 +222,7 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
   DEFINE_METHOD2(int, av_get_channel_layout_channel_index, (uint64_t p1, uint64_t p2))
   DEFINE_METHOD7(int, av_samples_fill_arrays, (uint8_t **p1, int *p2, const uint8_t *p3, int p4, int p5, enum AVSampleFormat p6, int p7))
   DEFINE_METHOD7(int, av_samples_copy, (uint8_t **p1, uint8_t *const *p2, int p3, int p4, int p5, int p6, enum AVSampleFormat p7))
+  DEFINE_METHOD2(uint64_t, av_channel_layout_extract_channel, (uint64_t p1, int p2))
 #if defined(AVFRAME_IN_LAVU)
   DEFINE_METHOD1(void, av_frame_free, (AVFrame **p1))
   DEFINE_METHOD0(AVFrame *, av_frame_alloc)
@@ -260,6 +264,7 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
     RESOLVE_METHOD(av_get_channel_layout_channel_index)
     RESOLVE_METHOD(av_samples_fill_arrays)
     RESOLVE_METHOD(av_samples_copy)
+    RESOLVE_METHOD(av_channel_layout_extract_channel)
 #if defined(AVFRAME_IN_LAVU)
     RESOLVE_METHOD(av_frame_free)
     RESOLVE_METHOD(av_frame_alloc)
index 2982b93..a335b50 100644 (file)
@@ -7,4 +7,15 @@
       </group>
     </category>
   </section>
+  <section id="videos">
+    <category id="videoplayer">
+      <group id="2">
+        <setting id="videoplayer.usestagefright" type="boolean" label="13436" help="36260">
+          <requirement>HAVE_LIBSTAGEFRIGHTDECODER</requirement>
+          <level>2</level>
+          <default>true</default>
+        </setting>
+      </group>
+    </category>
+  </section>
 </settings>
index 2bad9bb..3da9550 100644 (file)
           <level>2</level>
           <default>true</default>
         </setting>
-        <setting id="videoplayer.usestagefright" type="boolean" label="13436" help="36260">
-          <requirement>HAVE_LIBSTAGEFRIGHTDECODER</requirement>
-          <level>2</level>
-          <default>true</default>
-        </setting>
         <setting id="videoplayer.usepbo" type="boolean" label="13424" help="36163">
           <requirement>HAS_GL</requirement>
           <level>4</level>
index c0b42e6..bb716a2 100644 (file)
@@ -43,7 +43,7 @@
       <group id="2">
         <setting id="audiooutput.audiodevice" type="string" label="545" help="36371">
           <level>2</level>
-          <default>WASAPI:default</default> <!-- will be properly set on startup -->
+          <default>DirectSound:default</default>
           <constraints>
             <options>audiodevices</options>
           </constraints>
@@ -51,7 +51,7 @@
         </setting>
         <setting id="audiooutput.passthroughdevice" type="string" label="546" help="36372">
           <level>2</level>
-          <default>WASAPI:default</default> <!-- will be properly set on startup -->
+          <default>DirectSound:default</default>
           <constraints>
             <options>audiodevicespassthrough</options>
           </constraints>
index dc937b5..f4947c5 100644 (file)
@@ -423,6 +423,8 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg)
           CActiveAEStream *stream;
           stream = *(CActiveAEStream**)msg->data;
           stream->m_paused = true;
+          if (m_streams.size() == 1)
+            FlushEngine();
           return;
         case CActiveAEControlProtocol::RESUMESTREAM:
           stream = *(CActiveAEStream**)msg->data;
@@ -796,6 +798,7 @@ void CActiveAE::Process()
 void CActiveAE::Configure(AEAudioFormat *desiredFmt)
 {
   bool initSink = false;
+
   AEAudioFormat sinkInputFormat, inputFormat;
   m_mode = MODE_PCM;
 
@@ -829,7 +832,7 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
   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 (!IsSinkCompatible(m_sinkRequestFormat, device) || m_settings.driver.compare(driver) != 0)
   {
     if (!InitSink())
       return;
@@ -1015,7 +1018,8 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
   }
 
   // resample buffers for sink
-  if (m_sinkBuffers && !m_sink.IsCompatible(m_sinkBuffers->m_format, device))
+  if (m_sinkBuffers && 
+     (!CompareFormat(m_sinkBuffers->m_format,m_sinkFormat) || !CompareFormat(m_sinkBuffers->m_inputFormat, sinkInputFormat)))
   {
     m_discardBufferPools.push_back(m_sinkBuffers);
     m_sinkBuffers = NULL;
@@ -1108,31 +1112,36 @@ void CActiveAE::SFlushStream(CActiveAEStream *stream)
   // flush the engine if we only have a single stream
   if (m_streams.size() == 1)
   {
-    if (m_sinkBuffers)
-      m_sinkBuffers->Flush();
-    if (m_vizBuffers)
-      m_vizBuffers->Flush();
+    FlushEngine();
+  }
+}
 
-    // send message to sink
-    Message *reply;
-    if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::FLUSH, 
-                                             &reply, 2000))
-    {
-      bool success = reply->signal == CSinkControlProtocol::ACC ? true : false;
-      if (!success)
-      {
-        CLog::Log(LOGERROR, "ActiveAE::%s - returned error on flush", __FUNCTION__);
-        m_extError = true;
-      }
-      reply->Release();
-    }
-    else
+void CActiveAE::FlushEngine()
+{
+  if (m_sinkBuffers)
+    m_sinkBuffers->Flush();
+  if (m_vizBuffers)
+    m_vizBuffers->Flush();
+
+  // send message to sink
+  Message *reply;
+  if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::FLUSH,
+                                           &reply, 2000))
+  {
+    bool success = reply->signal == CSinkControlProtocol::ACC ? true : false;
+    if (!success)
     {
-      CLog::Log(LOGERROR, "ActiveAE::%s - failed to flush", __FUNCTION__);
+      CLog::Log(LOGERROR, "ActiveAE::%s - returned error on flush", __FUNCTION__);
       m_extError = true;
     }
-    m_stats.Reset(m_sinkFormat.m_sampleRate);
+    reply->Release();
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "ActiveAE::%s - failed to flush", __FUNCTION__);
+    m_extError = true;
   }
+  m_stats.Reset(m_sinkFormat.m_sampleRate);
 }
 
 void CActiveAE::ClearDiscardedBuffers()
@@ -1292,7 +1301,7 @@ bool CActiveAE::NeedReconfigureSink()
   if (m_settings.driver.compare(driver) != 0)
     return true;
 
-  if (!m_sink.IsCompatible(newFormat, device))
+  if (!IsSinkCompatible(newFormat, device))
     return true;
 
   return false;
@@ -1303,6 +1312,8 @@ bool CActiveAE::InitSink()
   SinkConfig config;
   config.format = m_sinkRequestFormat;
   config.stats = &m_stats;
+  config.device = AE_IS_RAW(m_sinkRequestFormat.m_dataFormat) ? &m_settings.passthoughdevice :
+                                                                &m_settings.device;
 
   // send message to sink
   Message *reply;
@@ -1365,6 +1376,40 @@ void CActiveAE::DrainSink()
   }
 }
 
+bool CActiveAE::IsSinkCompatible(const AEAudioFormat format, const std::string &device)
+{
+  bool compatible = false;
+  SinkConfig config;
+  config.format = format;
+  config.device = &device;
+
+  // send message to sink
+  Message *reply;
+  if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::ISCOMPATIBLE,
+                                                 &reply,
+                                                 1000,
+                                                 &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;
+    }
+    compatible = *(bool*)reply->data;
+    reply->Release();
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "ActiveAE::%s - failed to query compatibility", __FUNCTION__);
+    m_extError = true;
+    return false;
+  }
+  return compatible;
+}
+
 void CActiveAE::UnconfigureSink()
 {
   // send message to sink
@@ -2027,8 +2072,10 @@ uint8_t **CActiveAE::AllocSoundSample(SampleConfig &config, int &samples, int &b
   uint8_t **buffer;
   planes = m_dllAvUtil.av_sample_fmt_is_planar(config.fmt) ? config.channels : 1;
   buffer = new uint8_t*[planes];
+
+  // align buffer to 16 in order to be compatible with sse in CAEConvert
   m_dllAvUtil.av_samples_alloc(buffer, &linesize, config.channels,
-                                 samples, config.fmt, 0);
+                                 samples, config.fmt, 16);
   bytes_per_sample = m_dllAvUtil.av_get_bytes_per_sample(config.fmt);
   return buffer;
 }
@@ -2039,6 +2086,17 @@ void CActiveAE::FreeSoundSample(uint8_t **data)
   delete [] data;
 }
 
+bool CActiveAE::CompareFormat(AEAudioFormat &lhs, AEAudioFormat &rhs)
+{
+  if (lhs.m_channelLayout != rhs.m_channelLayout ||
+      lhs.m_dataFormat != rhs.m_dataFormat ||
+      lhs.m_sampleRate != rhs.m_sampleRate ||
+      lhs.m_frames != rhs.m_frames)
+    return false;
+  else
+    return true;
+}
+
 //-----------------------------------------------------------------------------
 // GUI Sounds
 //-----------------------------------------------------------------------------
@@ -2144,6 +2202,7 @@ IAESound *CActiveAE::MakeSound(const std::string& file)
         {
           int samples = fileSize / m_dllAvUtil.av_get_bytes_per_sample(dec_ctx->sample_fmt) / config.channels;
           config.fmt = dec_ctx->sample_fmt;
+          config.bits_per_sample = dec_ctx->bits_per_coded_sample;
           sound->InitSound(true, config, samples);
           init = true;
         }
@@ -2214,16 +2273,19 @@ bool CActiveAE::ResampleSound(CActiveAESound *sound)
   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);
+  dst_config.bits_per_sample = CAEUtil::DataFormatToUsedBits(m_internalFormat.m_dataFormat);
 
   CActiveAEResample *resampler = new CActiveAEResample();
   resampler->Init(dst_config.channel_layout,
                   dst_config.channels,
                   dst_config.sample_rate,
                   dst_config.fmt,
+                  dst_config.bits_per_sample,
                   orig_config.channel_layout,
                   orig_config.channels,
                   orig_config.sample_rate,
                   orig_config.fmt,
+                  orig_config.bits_per_sample,
                   NULL,
                   AE_QUALITY_MID);
 
index 9b4c243..2333a5f 100644 (file)
@@ -245,6 +245,7 @@ protected:
   bool InitSink();
   void DrainSink();
   void UnconfigureSink();
+  bool IsSinkCompatible(const AEAudioFormat format, const std::string &device);
   void Start();
   void Dispose();
   void LoadSettings();
@@ -255,6 +256,7 @@ protected:
   CActiveAEStream* CreateStream(MsgStreamNew *streamMsg);
   void DiscardStream(CActiveAEStream *stream);
   void SFlushStream(CActiveAEStream *stream);
+  void FlushEngine();
   void ClearDiscardedBuffers();
   void SStopSound(CActiveAESound *sound);
   void DiscardSound(CActiveAESound *sound);
@@ -268,6 +270,8 @@ protected:
   void MixSounds(CSoundPacket &dstSample);
   void Deamplify(CSoundPacket &dstSample);
 
+  bool CompareFormat(AEAudioFormat &lhs, AEAudioFormat &rhs);
+
   CEvent m_inMsgEvent;
   CEvent m_outMsgEvent;
   CActiveAEControlProtocol m_controlPort;
index c5d8b8b..cce76fb 100644 (file)
@@ -21,6 +21,7 @@
 #include "ActiveAEBuffer.h"
 #include "AEFactory.h"
 #include "ActiveAE.h"
+#include "Utils/AEUtil.h"
 
 using namespace ActiveAE;
 
@@ -105,6 +106,7 @@ bool CActiveAEBufferPool::Create(unsigned int totaltime)
   CSampleBuffer *buffer;
   SampleConfig config;
   config.fmt = CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat);
+  config.bits_per_sample = CAEUtil::DataFormatToUsedBits(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);
@@ -163,10 +165,12 @@ bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap)
                                 m_format.m_channelLayout.Count(),
                                 m_format.m_sampleRate,
                                 CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat),
+                                CAEUtil::DataFormatToUsedBits(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),
+                                CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat),
                                 remap ? &m_format.m_channelLayout : NULL,
                                 m_resampleQuality);
   }
@@ -188,10 +192,12 @@ void CActiveAEBufferPoolResample::ChangeResampler()
                                 m_format.m_channelLayout.Count(),
                                 m_outSampleRate,
                                 CActiveAEResample::GetAVSampleFormat(m_format.m_dataFormat),
+                                CAEUtil::DataFormatToUsedBits(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),
+                                CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat),
                                 NULL,
                                 m_resampleQuality);
 
index 5b42168..8e31966 100644 (file)
@@ -34,6 +34,7 @@ struct SampleConfig
   uint64_t channel_layout;
   int channels;
   int sample_rate;
+  int bits_per_sample;
 };
 
 /**
index 5678ebc..7bf2bd1 100644 (file)
@@ -36,7 +36,7 @@ CActiveAEResample::~CActiveAEResample()
   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, AEQuality quality)
+bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, CAEChannelInfo *remapLayout, AEQuality quality)
 {
   if (!m_dllAvUtil.Load() || !m_dllSwResample.Load())
     return false;
@@ -45,10 +45,12 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst
   m_dst_channels = dst_channels;
   m_dst_rate = dst_rate;
   m_dst_fmt = dst_fmt;
+  m_dst_bits = dst_bits;
   m_src_chan_layout = src_chan_layout;
   m_src_channels = src_channels;
   m_src_rate = src_rate;
   m_src_fmt = src_fmt;
+  m_src_bits = src_bits;
 
   if (m_dst_chan_layout == 0)
     m_dst_chan_layout = m_dllAvUtil.av_get_default_channel_layout(m_dst_channels);
@@ -75,6 +77,11 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst
     m_dllAvUtil.av_opt_set_int(m_pContext,"filter_size", 32, 0);
   }
 
+  if (m_dst_fmt == AV_SAMPLE_FMT_S32 || m_dst_fmt == AV_SAMPLE_FMT_S32P)
+  {
+    m_dllAvUtil.av_opt_set_int(m_pContext, "output_sample_bits", m_dst_bits, 0);
+  }
+
   if(!m_pContext)
   {
     CLog::Log(LOGERROR, "CActiveAEResample::Init - create context failed");
@@ -101,6 +108,45 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst
       return false;
     }
   }
+  // stereo upmix
+  else if (m_src_channels == 2 && m_dst_channels > 2)
+  {
+    memset(m_rematrix, 0, sizeof(m_rematrix));
+    for (int out=0; out<m_dst_channels; out++)
+    {
+      uint64_t out_chan = m_dllAvUtil.av_channel_layout_extract_channel(m_dst_chan_layout, out);
+      switch(out_chan)
+      {
+        case AV_CH_FRONT_LEFT:
+        case AV_CH_BACK_LEFT:
+        case AV_CH_SIDE_LEFT:
+          m_rematrix[out][0] = 1.0;
+          break;
+        case AV_CH_FRONT_RIGHT:
+        case AV_CH_BACK_RIGHT:
+        case AV_CH_SIDE_RIGHT:
+          m_rematrix[out][1] = 1.0;
+          break;
+        case AV_CH_FRONT_CENTER:
+          m_rematrix[out][0] = 0.5;
+          m_rematrix[out][1] = 0.5;
+          break;
+        case AV_CH_LOW_FREQUENCY:
+          m_rematrix[out][0] = 0.5;
+          m_rematrix[out][1] = 0.5;
+          break;
+        default:
+          break;
+      }
+    }
+
+    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");
@@ -203,29 +249,33 @@ 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_S24NE4) 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_S24NE4P) 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)
+AEDataFormat CActiveAEResample::GetAESampleFormat(AVSampleFormat format, int bits)
 {
   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_S32 && bits == 32)  return AE_FMT_S32NE;
+  else if (format == AV_SAMPLE_FMT_S32 && bits == 24)  return AE_FMT_S24NE4;
   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_S32P && bits == 32)  return AE_FMT_S32NEP;
+  else if (format == AV_SAMPLE_FMT_S32P && bits == 24)  return AE_FMT_S24NE4P;
   else if (format == AV_SAMPLE_FMT_FLTP)  return AE_FMT_FLOATP;
   else if (format == AV_SAMPLE_FMT_DBLP)  return AE_FMT_DOUBLEP;
 
index 2c5aff1..84d4d05 100644 (file)
@@ -34,7 +34,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, AEQuality quality);
+  bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, CAEChannelInfo *remapLayout, AEQuality 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();
@@ -44,7 +44,7 @@ public:
   static uint64_t GetAVChannelLayout(CAEChannelInfo &info);
 //  static CAEChannelInfo GetAEChannelLayout(uint64_t layout);
   static AVSampleFormat GetAVSampleFormat(AEDataFormat format);
-  static AEDataFormat GetAESampleFormat(AVSampleFormat format);
+  static AEDataFormat GetAESampleFormat(AVSampleFormat format, int bits);
   static uint64_t GetAVChannel(enum AEChannel aechannel);
   int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout);
 
@@ -55,6 +55,7 @@ protected:
   int m_src_rate, m_dst_rate;
   int m_src_channels, m_dst_channels;
   AVSampleFormat m_src_fmt, m_dst_fmt;
+  int m_src_bits, m_dst_bits;
   SwrContext *m_pContext;
   double m_rematrix[AE_CH_MAX][AE_CH_MAX];
 };
index 84c5777..834e938 100644 (file)
@@ -134,6 +134,7 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg)
           {
             m_requestedFormat = data->format;
             m_stats = data->stats;
+            m_device = *(data->device);
           }
           m_extError = false;
           m_extSilence = false;
@@ -172,6 +173,13 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg)
           msg->Reply(CSinkControlProtocol::ACC);
           return;
 
+        case CSinkControlProtocol::ISCOMPATIBLE:
+          data = (SinkConfig*)msg->data;
+          bool compatible;
+          compatible = IsCompatible(data->format, *(data->device));
+          msg->Reply(CSinkControlProtocol::ACC, &compatible, sizeof(bool));
+          return;
+
         default:
           break;
         }
@@ -626,14 +634,10 @@ void CActiveAESink::GetDeviceFriendlyName(std::string &device)
 
 void CActiveAESink::OpenSink()
 {
-  std::string device, driver;
+  std::string 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);
+  CAESinkFactory::ParseDevice(m_device, driver);
   if (driver.empty() && m_sink)
     driver = m_sink->GetName();
 
@@ -644,7 +648,7 @@ void CActiveAESink::OpenSink()
     std::transform(sinkName.begin(), sinkName.end(), sinkName.begin(), ::toupper);
   }
 
-  if (!m_sink || sinkName != driver || !m_sink->IsCompatible(m_requestedFormat, device))
+  if (!m_sink || sinkName != driver || !m_sink->IsCompatible(m_requestedFormat, m_device))
   {
     CLog::Log(LOGINFO, "CActiveAE::OpenSink - sink incompatible, re-starting");
 
@@ -657,15 +661,15 @@ void CActiveAESink::OpenSink()
     }
 
     // get the display name of the device
-    GetDeviceFriendlyName(device);
+    GetDeviceFriendlyName(m_device);
 
     // if we already have a driver, prepend it to the device string
     if (!driver.empty())
-      device = driver + ":" + device;
+      m_device = driver + ":" + m_device;
 
     // WARNING: this changes format and does not use passthrough
     m_sinkFormat = m_requestedFormat;
-    m_sink = CAESinkFactory::Create(device, m_sinkFormat, passthrough);
+    m_sink = CAESinkFactory::Create(m_device, m_sinkFormat, passthrough);
 
     if (!m_sink)
     {
@@ -706,6 +710,7 @@ void CActiveAESink::OpenSink()
   // init sample of silence
   SampleConfig config;
   config.fmt = CActiveAEResample::GetAVSampleFormat(m_sinkFormat.m_dataFormat);
+  config.bits_per_sample = CAEUtil::DataFormatToUsedBits(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;
@@ -802,7 +807,7 @@ unsigned int CActiveAESink::OutputSamples(CSampleBuffer* samples)
 
 void CActiveAESink::ConvertInit(CSampleBuffer* samples)
 {
-  if (CActiveAEResample::GetAESampleFormat(samples->pkt->config.fmt) != m_sinkFormat.m_dataFormat)
+  if (CActiveAEResample::GetAESampleFormat(samples->pkt->config.fmt, samples->pkt->config.bits_per_sample) != m_sinkFormat.m_dataFormat)
   {
     m_convertFn = CAEConvert::FrFloat(m_sinkFormat.m_dataFormat);
     if (m_convertBuffer)
@@ -845,7 +850,7 @@ uint8_t* CActiveAESink::Convert(CSampleBuffer* samples)
 void CActiveAESink::GenerateNoise()
 {
   int nb_floats = m_sinkFormat.m_frames*m_sinkFormat.m_channelLayout.Count();
-  float *noise = new float[nb_floats];
+  float *noise = (float*)_aligned_malloc(nb_floats*sizeof(float), 16);
 
   float R1, R2;
   for(int i=0; i<nb_floats;i++)
@@ -860,8 +865,8 @@ void CActiveAESink::GenerateNoise()
     noise[i] = (float) sqrt( -2.0f * log( R1 )) * cos( 2.0f * PI * R2 ) * 0.00001;
   }
 
-  AEDataFormat fmt = CActiveAEResample::GetAESampleFormat(m_sampleOfNoise.pkt->config.fmt);
+  AEDataFormat fmt = CActiveAEResample::GetAESampleFormat(m_sampleOfNoise.pkt->config.fmt, m_sampleOfNoise.pkt->config.bits_per_sample);
   CAEConvert::AEConvertFrFn convertFn = CAEConvert::FrFloat(fmt);
   convertFn(noise, nb_floats, m_sampleOfNoise.pkt->data[0]);
-  delete [] noise;
+  _aligned_free(noise);
 }
index e241b03..ee35021 100644 (file)
@@ -38,6 +38,7 @@ struct SinkConfig
 {
   AEAudioFormat format;
   CEngineStats *stats;
+  const std::string *device;
 };
 
 class CSinkControlProtocol : public Protocol
@@ -49,6 +50,7 @@ public:
     CONFIGURE,
     UNCONFIGURE,
     SILENCEMODE,
+    ISCOMPATIBLE,
     VOLUME,
     FLUSH,
     TIMEOUT,
@@ -86,7 +88,6 @@ public:
   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;
@@ -98,6 +99,7 @@ protected:
   void GetDeviceFriendlyName(std::string &device);
   void OpenSink();
   void ReturnBuffers();
+  bool IsCompatible(const AEAudioFormat format, const std::string &device);
 
   unsigned int OutputSamples(CSampleBuffer* samples);
   void ConvertInit(CSampleBuffer* samples);
@@ -129,6 +131,7 @@ protected:
   } m_convertState;
 
   std::string m_deviceFriendlyName;
+  std::string m_device;
   AESinkInfoList m_sinkInfoList;
   IAESink *m_sink;
   AEAudioFormat m_sinkFormat, m_requestedFormat;
index 8884c9f..711ec04 100644 (file)
@@ -797,7 +797,7 @@ unsigned int CAEConvert::Float_S24NE4(float *data, const unsigned int samples, u
   /* work around invalid alignment */
   while ((((uintptr_t)data & 0xF) || ((uintptr_t)dest & 0xF)) && count > 0)
   {
-    dst[0] = safeRound(data[0] * ((float)INT24_MAX+.5f));
+    dst[0] = (safeRound(data[0] * ((float)INT24_MAX+.5f)) & 0xFFFFFF) << 8;
     ++data;
     ++dst;
     --count;
@@ -812,11 +812,11 @@ unsigned int CAEConvert::Float_S24NE4(float *data, const unsigned int samples, u
     memcpy(dst, &con, sizeof(int32_t) * 4);
   }
 
-  if (samples != even)
+  if (count != even)
   {
-    const uint32_t odd = samples - even;
+    const uint32_t odd = count - even;
     if (odd == 1)
-      dst[0] = safeRound(data[0] * ((float)INT24_MAX+.5f));
+      dst[0] = (safeRound(data[0] * ((float)INT24_MAX+.5f)) & 0xFFFFFF) << 8;
     else
     {
       __m128 in;
@@ -886,9 +886,9 @@ unsigned int CAEConvert::Float_S24NE3(float *data, const unsigned int samples, u
     *((uint32_t*)(dest + 9)) = (dst[3] & 0xFFFFFF) << leftShift;
   }
 
-  if (samples != even)
+  if (count != even)
   {
-    const uint32_t odd = samples - even;
+    const uint32_t odd = count - even;
     if (odd == 1)
       dst[0] = safeRound(data[0] * ((float)INT24_MAX+.5f)) & 0xFFFFFF;
     else
@@ -958,9 +958,9 @@ unsigned int CAEConvert::Float_S32LE(float *data, const unsigned int samples, ui
     dst[3] = Endian_SwapLE32(dst[3]);
   }
 
-  if (samples != even)
+  if (count != even)
   {
-    const uint32_t odd = samples - even;
+    const uint32_t odd = count - even;
     if (odd == 1)
     {
       dst[0] = safeRound(data[0] * AE_MUL32);
@@ -1067,9 +1067,9 @@ unsigned int CAEConvert::Float_S32BE(float *data, const unsigned int samples, ui
     dst[3] = Endian_SwapBE32(dst[3]);
   }
 
-  if (samples != even)
+  if (count != even)
   {
-    const uint32_t odd = samples - even;
+    const uint32_t odd = count - even;
     if (odd == 1)
     {
       dst[0] = safeRound(data[0] * AE_MUL32);
index 1ff44f8..feaa621 100644 (file)
@@ -123,6 +123,14 @@ const unsigned int CAEUtil::DataFormatToBits(const enum AEDataFormat dataFormat)
   return formats[dataFormat];
 }
 
+const unsigned int CAEUtil::DataFormatToUsedBits(const enum AEDataFormat dataFormat)
+{
+  if (dataFormat == AE_FMT_S24BE4 || dataFormat == AE_FMT_S24LE4 || dataFormat == AE_FMT_S24NE4)
+    return 24;
+  else
+    return DataFormatToBits(dataFormat);
+}
+
 const char* CAEUtil::DataFormatToStr(const enum AEDataFormat dataFormat)
 {
   if (dataFormat < 0 || dataFormat >= AE_FMT_MAX)
index 6fdb7f2..384a490 100644 (file)
@@ -80,6 +80,7 @@ public:
   static CAEChannelInfo          GuessChLayout     (const unsigned int channels);
   static const char*             GetStdChLayoutName(const enum AEStdChLayout layout);
   static const unsigned int      DataFormatToBits  (const enum AEDataFormat dataFormat);
+  static const unsigned int      DataFormatToUsedBits (const enum AEDataFormat dataFormat);
   static const char*             DataFormatToStr   (const enum AEDataFormat dataFormat);
 
   /*! \brief convert a volume percentage (as a proportion) to a dB gain
index 200bcb5..edbc45d 100644 (file)
@@ -86,7 +86,7 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option
       m_pFormatName = "am-h264";
       // convert h264-avcC to h264-annex-b as h264-avcC
       // under streamers can have issues when seeking.
-      if (*(uint8_t*)m_hints.extradata == 1)
+      if (m_hints.extradata && *(uint8_t*)m_hints.extradata == 1)
       {
         m_bitstream = new CBitstreamConverter;
         m_bitstream->Open(m_hints.codec, (uint8_t*)m_hints.extradata, m_hints.extrasize, true);
index bdd2955..7db7a15 100644 (file)
@@ -561,11 +561,11 @@ madx_sig MP3Codec::madx_read(madx_house *mxhouse, madx_stat *mxstat, int maxwrit
   for(int i=0; i < mxhouse->synth.pcm.length; i++)
   {
     // Left channel
-    *dest++ = mad_f_todouble(mxhouse->synth.pcm.samples[0][i]);
+    *dest++ = (float)mad_f_todouble(mxhouse->synth.pcm.samples[0][i]);
 
     // Right channel
     if(MAD_NCHANNELS(&mxhouse->frame.header) == 2)
-      *dest++ = mad_f_todouble(mxhouse->synth.pcm.samples[1][i]);
+      *dest++ = (float)mad_f_todouble(mxhouse->synth.pcm.samples[1][i]);
   }
 
   // Tell calling code buffer size
index 4c4d23d..4739b29 100644 (file)
@@ -154,6 +154,6 @@ public:
 
   void Release();
 protected:
-  unsigned char getbyte(FILE *fd);
+  static unsigned char getbyte(FILE *fd);
 };
 
index 36c7350..a926736 100644 (file)
@@ -50,8 +50,8 @@ public:
 
   // Accessors
   LPDIRECT3DTEXTURE9 Get() const { return m_texture; };
-  UINT GetWidth()  { return m_width; }
-  UINT GetHeight() { return m_height; }
+  UINT GetWidth()  const { return m_width; }
+  UINT GetHeight() const { return m_height; }
 
   virtual void OnDestroyDevice();
   virtual void OnCreateDevice();
index a21bf4b..9d1cbba 100644 (file)
@@ -144,7 +144,7 @@ bool CDDSImage::WriteFile(const std::string &outputFile) const
   return true;
 }
 
-unsigned int CDDSImage::GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format) const
+unsigned int CDDSImage::GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format)
 {
   switch (format)
   {
@@ -248,7 +248,7 @@ void CDDSImage::Allocate(unsigned int width, unsigned int height, unsigned int f
   m_data = new unsigned char[m_desc.linearSize];
 }
 
-const char *CDDSImage::GetFourCC(unsigned int format) const
+const char *CDDSImage::GetFourCC(unsigned int format)
 {
   switch (format)
   {
index aa9a0cc..3856ebe 100644 (file)
@@ -63,7 +63,7 @@ public:
 
 private:
   void Allocate(unsigned int width, unsigned int height, unsigned int format);
-  const char *GetFourCC(unsigned int format) const;
+  static const char *GetFourCC(unsigned int format);
   bool WriteFile(const std::string &file) const;
 
   /*! \brief Compress an ARGB buffer into a DXT1/3/5 image
@@ -76,7 +76,7 @@ private:
    */
   bool Compress(unsigned int width, unsigned int height, unsigned int pitch, unsigned char const *argb, double maxMSE = 0);
 
-  unsigned int GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format) const;
+  static unsigned int GetStorageRequirements(unsigned int width, unsigned int height, unsigned int format);
   enum {
     ddsd_caps        = 0x00000001,
     ddsd_height      = 0x00000002,
index fdcf800..47efb29 100644 (file)
@@ -117,7 +117,7 @@ bool IsSwizzledFormat(XB_D3DFORMAT format)
 // Currently only works for 32bit and 8bit textures, with power of 2 width and height
 void Unswizzle(const void *src, unsigned int depth, unsigned int width, unsigned int height, void *dest)
 {
-  if (height <= 0 || width <= 0)
+  if (height == 0 || width == 0)
     return;
 
   for (UINT y = 0; y < height; y++)
index 6b41452..1fa9398 100644 (file)
@@ -154,7 +154,7 @@ bool CFrameBufferObject::BeginRender()
 }
 
 // Finish rendering to FBO
-void CFrameBufferObject::EndRender()
+void CFrameBufferObject::EndRender() const
 {
   if (IsValid())
     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
index e7e5af2..9aa6386 100644 (file)
@@ -55,10 +55,10 @@ public:
   bool IsSupported();
 
   // returns true if FBO has been initialized
-  bool IsValid() { return m_valid; }
+  bool IsValid() const { return m_valid; }
 
   // returns true if FBO has a texture bound to it
-  bool IsBound() { return m_bound; }
+  bool IsBound() const { return m_bound; }
 
   // initialize the FBO
   bool Initialize();
@@ -77,12 +77,12 @@ public:
                               GLenum filter=GL_LINEAR, GLenum clampmode=GL_CLAMP_TO_EDGE);
 
   // Return the internally created texture ID
-  GLuint Texture() { return m_texid; }
+  GLuint Texture() const { return m_texid; }
 
   // Begin rendering to FBO
   bool BeginRender();
   // Finish rendering to FBO
-  void EndRender();
+  void EndRender() const;
 
 private:
   GLuint m_fbo;
index 0633a23..26b7694 100644 (file)
@@ -42,7 +42,7 @@ bool CGUIAction::ExecuteActions(int controlID, int parentID) const
   if (m_actions.size() == 0) return false;
   // take a copy of actions that satisfy our conditions
   vector<CStdString> actions;
-  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (it->condition.IsEmpty() || g_infoManager.EvaluateBool(it->condition))
     {
@@ -67,7 +67,7 @@ bool CGUIAction::ExecuteActions(int controlID, int parentID) const
 
 int CGUIAction::GetNavigation() const
 {
-  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (StringUtils::IsInteger(it->action))
     {
@@ -83,7 +83,7 @@ void CGUIAction::SetNavigation(int id)
   if (id == 0) return;
   CStdString strId;
   strId.Format("%i", id);
-  for (iActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (iActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (StringUtils::IsInteger(it->action) && it->condition.IsEmpty())
     {
@@ -98,7 +98,7 @@ void CGUIAction::SetNavigation(int id)
 
 bool CGUIAction::HasActionsMeetingCondition() const
 {
-  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; it++)
+  for (ciActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
   {
     if (it->condition.IsEmpty() || g_infoManager.EvaluateBool(it->condition))
       return true;
index e37750a..a89e4e8 100644 (file)
@@ -807,7 +807,7 @@ void CGUIBaseContainer::UpdateLayout(bool updateAllItems)
 {
   if (updateAllItems)
   { // free memory of items
-    for (iItems it = m_items.begin(); it != m_items.end(); it++)
+    for (iItems it = m_items.begin(); it != m_items.end(); ++it)
       (*it)->FreeMemory();
   }
   // and recalculate the layout
@@ -1206,7 +1206,7 @@ int CGUIBaseContainer::GetCurrentPage() const
   return GetOffset() / m_itemsPerPage + 1;
 }
 
-void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter)
+void CGUIBaseContainer::GetCacheOffsets(int &cacheBefore, int &cacheAfter) const
 {
   if (m_scroller.IsScrollingDown())
   {
index 63d3c4f..f433e69 100644 (file)
@@ -161,7 +161,7 @@ protected:
                     // changing around)
 
   void UpdateScrollByLetter();
-  void GetCacheOffsets(int &cacheBefore, int &cacheAfter);
+  void GetCacheOffsets(int &cacheBefore, int &cacheAfter) const;
   int GetCacheCount() const { return m_cacheItems; };
   bool ScrollingDown() const { return m_scroller.IsScrollingDown(); };
   bool ScrollingUp() const { return m_scroller.IsScrollingUp(); };
index 2e4d3c1..7582fcf 100644 (file)
@@ -29,9 +29,8 @@ CGUIBorderedImage::CGUIBorderedImage(int parentID, int controlID, float posX, fl
 }
 
 CGUIBorderedImage::CGUIBorderedImage(const CGUIBorderedImage &right)
-: CGUIImage(right), m_borderImage(right.m_borderImage)
+: CGUIImage(right), m_borderImage(right.m_borderImage), m_borderSize(right.m_borderSize)
 {
-  m_borderSize = right.m_borderSize;
   ControlType = GUICONTROL_BORDEREDIMAGE;
 }
 
index ddbf2c1..1b6a2b6 100644 (file)
@@ -73,7 +73,7 @@ public:
   void PythonSetDisabledColor(color_t disabledColor);
 
   virtual void OnClick();
-  bool HasClickActions() { return m_clickActions.HasActionsMeetingCondition(); };
+  bool HasClickActions() const { return m_clickActions.HasActionsMeetingCondition(); };
 
   virtual bool UpdateColors();
 
index 29fea51..2810ba0 100644 (file)
@@ -55,27 +55,22 @@ public:
   // Assign an EventHandler (EventHandler's are derived from Event)
   GUIEvent<Cookie> &operator=(GUIEvent<Cookie> &aEvent)
   {
-    if (&aEvent)
+    if (&aEvent != this)
     {
       m_pInstance = aEvent.m_pInstance;
       m_pMethod = aEvent.m_pMethod;
     }
-    else
-    {
-      GUIEvent();
-    }
-
     return *this;
   }
 
   // Are the class instance and method pointers initialised?
-  bool HasAHandler()
+  bool HasAHandler() const
   {
     return (m_pInstance && m_pMethod);
   }
 
   // Execute the associated class method
-  void Fire(Cookie aCookie)
+  void Fire(Cookie aCookie) const
   {
     if (HasAHandler())
     {
@@ -136,27 +131,22 @@ public:
   // Assign a CallbackHandler (CallbackHandler's are derived from Callback)
   Callback<Result, Cookie> &operator=(Callback<Result, Cookie> &aCallback)
   {
-    if (&aCallback)
+    if (&aCallback != this)
     {
       m_pInstance = aCallback.m_pInstance;
       m_pMethod = aCallback.m_pMethod;
     }
-    else
-    {
-      Callback();
-    }
-
     return *this;
   }
 
   // Are the class instance and method pointers initialised?
-  bool HasAHandler()
+  bool HasAHandler() const
   {
     return (m_pInstance && m_pMethod);
   }
 
   // Execute the associated class method and return the result
-  Result Fire(Cookie aCookie)
+  Result Fire(Cookie aCookie) const
   {
     if (HasAHandler())
     {
index e7d1dd5..bf7bcbb 100644 (file)
@@ -29,8 +29,8 @@ CGUICheckMarkControl::CGUICheckMarkControl(int parentID, int controlID, float po
     , m_imgCheckMark(posX, posY, checkWidth, checkHeight, textureCheckMark)
     , m_imgCheckMarkNoFocus(posX, posY, checkWidth, checkHeight, textureCheckMarkNF)
     , m_label(posX, posY, width, height, labelInfo)
+    , m_strLabel("")
 {
-  m_strLabel = "";
   m_bSelected = false;
   m_label.GetLabelInfo().align |= XBFONT_CENTER_Y;
   ControlType = GUICONTROL_CHECKMARK;
index 68ce96c..9c58fa0 100644 (file)
@@ -30,7 +30,8 @@
 
 using namespace std;
 
-CGUIControl::CGUIControl()
+CGUIControl::CGUIControl() :
+  m_diffuseColor(0xffffffff)
 {
   m_hasProcessed = false;
   m_bHasFocus = false;
@@ -42,7 +43,6 @@ CGUIControl::CGUIControl()
   m_visibleCondition = 0;
   m_enableCondition = 0;
   m_enabled = true;
-  m_diffuseColor = 0xffffffff;
   m_posX = 0;
   m_posY = 0;
   m_width = 0;
@@ -58,7 +58,8 @@ CGUIControl::CGUIControl()
 }
 
 CGUIControl::CGUIControl(int parentID, int controlID, float posX, float posY, float width, float height)
-: m_hitRect(posX, posY, posX + width, posY + height)
+: m_hitRect(posX, posY, posX + width, posY + height),
+  m_diffuseColor(0xffffffff)
 {
   m_posX = posX;
   m_posY = posY;
@@ -69,7 +70,6 @@ CGUIControl::CGUIControl(int parentID, int controlID, float posX, float posY, fl
   m_parentID = parentID;
   m_visible = VISIBLE;
   m_visibleFromSkinCondition = true;
-  m_diffuseColor = 0xffffffff;
   m_forceHidden = false;
   m_visibleCondition = 0;
   m_enableCondition = 0;
@@ -229,7 +229,7 @@ bool CGUIControl::OnAction(const CAction &action)
   return false;
 }
 
-bool CGUIControl::Navigate(int direction)
+bool CGUIControl::Navigate(int direction) const
 {
   if (HasFocus())
   {
@@ -275,7 +275,7 @@ void CGUIControl::OnPrevControl()
   Navigate(ACTION_PREV_CONTROL);
 }
 
-bool CGUIControl::SendWindowMessage(CGUIMessage &message)
+bool CGUIControl::SendWindowMessage(CGUIMessage &message) const
 {
   CGUIWindow *pWindow = g_windowManager.GetWindow(GetParentID());
   if (pWindow)
@@ -935,10 +935,13 @@ bool CGUIControl::CanFocusFromPoint(const CPoint &point) const
 
 void CGUIControl::UnfocusFromPoint(const CPoint &point)
 {
-  CPoint controlPoint(point);
-  m_transform.InverseTransformPosition(controlPoint.x, controlPoint.y);
-  if (!HitTest(controlPoint))
-    SetFocus(false);
+  if (HasFocus())
+  {
+    CPoint controlPoint(point);
+    m_transform.InverseTransformPosition(controlPoint.x, controlPoint.y);
+    if (!HitTest(controlPoint))
+      SetFocus(false);
+  }
 }
 
 bool CGUIControl::HasID(int id) const
index ee5fa3d..e81b7d4 100644 (file)
@@ -204,7 +204,7 @@ public:
   bool GetNavigationAction(int direction, CGUIAction& action) const;
   /*! \brief  Start navigating in given direction.
    */
-  bool Navigate(int direction);
+  bool Navigate(int direction) const;
   virtual void SetFocus(bool focus);
   virtual void SetWidth(float width);
   virtual void SetHeight(float height);
@@ -311,7 +311,7 @@ protected:
   virtual bool Animate(unsigned int currentTime);
   virtual bool CheckAnimation(ANIMATION_TYPE animType);
   void UpdateStates(ANIMATION_TYPE type, ANIMATION_PROCESS currentProcess, ANIMATION_STATE currentState);
-  bool SendWindowMessage(CGUIMessage &message);
+  bool SendWindowMessage(CGUIMessage &message) const;
 
   // navigation and actions
   CGUIAction m_actionLeft;
index d98db1a..383d9ca 100644 (file)
@@ -104,7 +104,7 @@ private:
   static CStdString GetType(const TiXmlElement *pControlNode);
   static bool GetConditionalVisibility(const TiXmlNode* control, CStdString &condition, CStdString &allowHiddenFocus);
   bool GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strString);
-  bool GetFloatRange(const TiXmlNode* pRootNode, const char* strTag, float& iMinValue, float& iMaxValue, float& iIntervalValue);
-  bool GetIntRange(const TiXmlNode* pRootNode, const char* strTag, int& iMinValue, int& iMaxValue, int& iIntervalValue);
+  static bool GetFloatRange(const TiXmlNode* pRootNode, const char* strTag, float& iMinValue, float& iMaxValue, float& iIntervalValue);
+  static bool GetIntRange(const TiXmlNode* pRootNode, const char* strTag, int& iMinValue, int& iMaxValue, int& iIntervalValue);
 };
 #endif
index 52e00c6..ff260d9 100644 (file)
@@ -441,7 +441,7 @@ const CGUIControl* CGUIControlGroup::GetControl(int iControl) const
   if (first != m_lookup.end())
   {
     LookupMap::const_iterator last = m_lookup.upper_bound(iControl);
-    for (LookupMap::const_iterator i = first; i != last; i++)
+    for (LookupMap::const_iterator i = first; i != last; ++i)
     {
       CGUIControl *control = i->second;
       if (control->IsVisible())
@@ -531,7 +531,7 @@ void CGUIControlGroup::AddLookup(CGUIControl *control)
   if (control->IsGroup())
   { // first add all the subitems of this group (if they exist)
     const LookupMap map = ((CGUIControlGroup *)control)->GetLookup();
-    for (LookupMap::const_iterator i = map.begin(); i != map.end(); i++)
+    for (LookupMap::const_iterator i = map.begin(); i != map.end(); ++i)
       m_lookup.insert(m_lookup.upper_bound(i->first), make_pair(i->first, i->second));
   }
   if (control->GetID())
@@ -546,9 +546,9 @@ void CGUIControlGroup::RemoveLookup(CGUIControl *control)
   if (control->IsGroup())
   { // remove the group's lookup
     const LookupMap &map = ((CGUIControlGroup *)control)->GetLookup();
-    for (LookupMap::const_iterator i = map.begin(); i != map.end(); i++)
+    for (LookupMap::const_iterator i = map.begin(); i != map.end(); ++i)
     { // remove this control
-      for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+      for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
       {
         if (i->second == it->second)
         {
@@ -561,7 +561,7 @@ void CGUIControlGroup::RemoveLookup(CGUIControl *control)
   // remove the actual control
   if (control->GetID())
   {
-    for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+    for (LookupMap::iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
     {
       if (control == it->second)
       {
@@ -578,7 +578,7 @@ bool CGUIControlGroup::IsValidControl(const CGUIControl *control) const
 {
   if (control->GetID())
   {
-    for (LookupMap::const_iterator it = m_lookup.begin(); it != m_lookup.end(); it++)
+    for (LookupMap::const_iterator it = m_lookup.begin(); it != m_lookup.end(); ++it)
     {
       if (control == it->second)
         return true;
@@ -636,11 +636,11 @@ void CGUIControlGroup::ClearAll()
   // first remove from the lookup table
   if (m_parentControl)
   {
-    for (iControls it = m_children.begin(); it != m_children.end(); it++)
+    for (iControls it = m_children.begin(); it != m_children.end(); ++it)
       ((CGUIControlGroup *)m_parentControl)->RemoveLookup(*it);
   }
   // and delete all our children
-  for (iControls it = m_children.begin(); it != m_children.end(); it++)
+  for (iControls it = m_children.begin(); it != m_children.end(); ++it)
   {
     CGUIControl *control = *it;
     delete control;
index 2ae0537..b6e0120 100644 (file)
@@ -106,7 +106,7 @@ protected:
   typedef std::multimap<int, CGUIControl *> LookupMap;
   void AddLookup(CGUIControl *control);
   void RemoveLookup(CGUIControl *control);
-  const LookupMap &GetLookup() { return m_lookup; };
+  const LookupMap &GetLookup() const { return m_lookup; };
   LookupMap m_lookup;
 
   int  m_defaultControl;
index e35389c..7eb28ff 100644 (file)
@@ -78,7 +78,7 @@ public:
 
   void SetTextChangeActions(const CGUIAction& textChangeActions) { m_textChangeActions = textChangeActions; };
 
-  bool HasTextChangeActions() { return m_textChangeActions.HasActionsMeetingCondition(); };
+  bool HasTextChangeActions() const { return m_textChangeActions.HasActionsMeetingCondition(); };
 
 protected:
   virtual void ProcessText(unsigned int currentTime);
index fe056aa..642ebef 100644 (file)
 using namespace std;
 
 CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange)
-    : CGUIControl(parentID, controlID, posX, posY, width, height), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed)
+    : CGUIControl(parentID, controlID, posX, posY, width, height), m_label(labelInfo), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed)
     , m_textLayout(labelInfo.font, false)
+    , m_fadeAnim(CAnimation::CreateFader(100, 0, timeToDelayAtEnd, 200))
 {
-  m_label = labelInfo;
   m_currentLabel = 0;
   ControlType = GUICONTROL_FADELABEL;
   m_scrollOut = scrollOut;
-  m_fadeAnim = CAnimation::CreateFader(100, 0, timeToDelayAtEnd, 200);
   m_fadeAnim.ApplyAnimation();
   m_lastLabel = -1;
   m_scrollSpeed = labelInfo.scrollSpeed;  // save it for later
@@ -39,14 +38,13 @@ CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float po
 }
 
 CGUIFadeLabelControl::CGUIFadeLabelControl(const CGUIFadeLabelControl &from)
-: CGUIControl(from), m_infoLabels(from.m_infoLabels), m_scrollInfo(from.m_scrollInfo), m_textLayout(from.m_textLayout)
+: CGUIControl(from), m_infoLabels(from.m_infoLabels), m_label(from.m_label), m_scrollInfo(from.m_scrollInfo), m_textLayout(from.m_textLayout), 
+  m_fadeAnim(from.m_fadeAnim)
 {
-  m_label = from.m_label;
   m_scrollOut = from.m_scrollOut;
   m_scrollSpeed = from.m_scrollSpeed;
   m_resetOnLabelChange = from.m_resetOnLabelChange;
 
-  m_fadeAnim = from.m_fadeAnim;
   m_fadeAnim.ApplyAnimation();
   m_currentLabel = 0;
   m_lastLabel = -1;
index bef2883..e09601b 100644 (file)
@@ -51,7 +51,7 @@ GUIFontManager::~GUIFontManager(void)
   Clear();
 }
 
-void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const
+void GUIFontManager::RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect)
 {
   // set scaling resolution so that we can scale our font sizes correctly
   // as fonts aren't scaled at render time (due to aliasing) we must scale
@@ -243,12 +243,12 @@ void GUIFontManager::ReloadTTFFonts(void)
 
 void GUIFontManager::UnloadTTFFonts()
 {
-  for (vector<CGUIFontTTFBase*>::iterator i = m_vecFontFiles.begin(); i != m_vecFontFiles.end(); i++)
+  for (vector<CGUIFontTTFBase*>::iterator i = m_vecFontFiles.begin(); i != m_vecFontFiles.end(); ++i)
     delete (*i);
 
   m_vecFontFiles.clear();
 
-  for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); i++)
+  for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); ++i)
     (*i)->SetFont(NULL);
 }
 
index 774ff6c..a77f643 100644 (file)
@@ -76,7 +76,7 @@ public:
   void Clear();
   void FreeFontFile(CGUIFontTTFBase *pFont);
 
-  bool IsFontSetUnicode() { return m_fontsetUnicode; }
+  bool IsFontSetUnicode() const { return m_fontsetUnicode; }
   bool IsFontSetUnicode(const CStdString& strFontSet);
   bool GetFirstFontSetUnicode(CStdString& strFontSet);
 
@@ -86,7 +86,7 @@ public:
   static void SettingOptionsFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current);
 
 protected:
-  void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const;
+  static void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect);
   void LoadFonts(const TiXmlNode* fontNode);
   CGUIFontTTFBase* GetFontFile(const CStdString& strFontFile);
   bool OpenFontFile(CXBMCTinyXML& xmlDoc);
index 77c27fd..9c8e516 100644 (file)
@@ -112,13 +112,13 @@ public:
     return stroker;
   };
 
-  void ReleaseFont(FT_Face face)
+  static void ReleaseFont(FT_Face face)
   {
     assert(face);
     FT_Done_Face(face);
   };
   
-  void ReleaseStroker(FT_Stroker stroker)
+  static void ReleaseStroker(FT_Stroker stroker)
   {
     assert(stroker);
     FT_Stroker_Done(stroker);
@@ -353,7 +353,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors
     // first compute the size of the text to render in both characters and pixels
     unsigned int lineChars = 0;
     float linePixels = 0;
-    for (vecText::const_iterator pos = text.begin(); pos != text.end(); pos++)
+    for (vecText::const_iterator pos = text.begin(); pos != text.end(); ++pos)
     {
       Character *ch = GetCharacter(*pos);
       if (ch)
@@ -367,7 +367,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors
   }
   float cursorX = 0; // current position along the line
 
-  for (vecText::const_iterator pos = text.begin(); pos != text.end(); pos++)
+  for (vecText::const_iterator pos = text.begin(); pos != text.end(); ++pos)
   {
     // If starting text on a new line, determine justification effects
     // Get the current letter in the CStdString
@@ -486,10 +486,9 @@ CGUIFontTTFBase::Character* CGUIFontTTFBase::GetCharacter(character_t chr)
 
   int low = 0;
   int high = m_numChars - 1;
-  int mid;
   while (low <= high)
   {
-    mid = (low + high) >> 1;
+    int mid = (low + high) >> 1;
     if (ch > m_char[mid].letterAndStyle)
       low = mid + 1;
     else if (ch < m_char[mid].letterAndStyle)
index 0dafea4..9723a43 100644 (file)
@@ -118,7 +118,7 @@ protected:
 
   // modifying glyphs
   void EmboldenGlyph(FT_GlyphSlot slot);
-  void ObliqueGlyph(FT_GlyphSlot slot);
+  static void ObliqueGlyph(FT_GlyphSlot slot);
 
   CBaseTexture* m_texture;        // texture that holds our rendered characters (8bit alpha only)
 
@@ -169,6 +169,8 @@ protected:
   CStdString m_strFileName;
 
 private:
+  CGUIFontTTFBase(const CGUIFontTTFBase&);
+  CGUIFontTTFBase& operator=(const CGUIFontTTFBase&);
   int m_referenceCount;
 };
 
index 67174bc..e3eba24 100644 (file)
@@ -200,7 +200,6 @@ CBaseTexture* CGUIFontTTFDX::ReallocTexture(unsigned int& newHeight)
   }
 
   LPDIRECT3DSURFACE9 pSource, pTarget;
-  HRESULT hr;
   // There might be data to copy from the previous texture
   if ((newSpeedupTexture && m_speedupTexture) || (newTexture && m_texture))
   {
@@ -262,7 +261,7 @@ CBaseTexture* CGUIFontTTFDX::ReallocTexture(unsigned int& newHeight)
     const RECT rect = { 0, 0, m_textureWidth, m_textureHeight };
     const POINT point = { 0, 0 };
 
-    hr = g_Windowing.Get3DDevice()->UpdateSurface(pSource, &rect, pTarget, &point);
+    HRESULT hr = g_Windowing.Get3DDevice()->UpdateSurface(pSource, &rect, pTarget, &point);
     SAFE_RELEASE(pSource);
     SAFE_RELEASE(pTarget);
 
index 2a9df26..b96d65e 100644 (file)
@@ -37,9 +37,14 @@ CGUIImage::CGUIImage(int parentID, int controlID, float posX, float posY, float
 }
 
 CGUIImage::CGUIImage(const CGUIImage &left)
-    : CGUIControl(left), m_texture(left.m_texture)
+  : CGUIControl(left), 
+  m_image(left.m_image),
+  m_info(left.m_info),
+  m_texture(left.m_texture),
+  m_fadingTextures(),
+  m_currentTexture(),
+  m_currentFallback()
 {
-  m_info = left.m_info;
   m_crossFadeTime = left.m_crossFadeTime;
   // defaults
   m_currentFadeTime = 0;
@@ -122,7 +127,7 @@ void CGUIImage::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions
         if (!ProcessFading(*i, frameTime, currentTime))
           i = m_fadingTextures.erase(i);
         else
-          i++;
+          ++i;
       }
 
       if (m_texture.ReadyToRender() || m_texture.GetFileName().IsEmpty())
@@ -169,7 +174,7 @@ void CGUIImage::Render()
 {
   if (!IsVisible()) return;
 
-  for (vector<CFadingTexture *>::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); itr++)
+  for (vector<CFadingTexture *>::iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr)
     (*itr)->m_texture->Render();
 
   m_texture.Render();
@@ -282,7 +287,7 @@ CRect CGUIImage::CalcRenderRegion() const
 {
   CRect region = m_texture.GetRenderRect();
 
-  for (vector<CFadingTexture *>::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); itr++)
+  for (vector<CFadingTexture *>::const_iterator itr = m_fadingTextures.begin(); itr != m_fadingTextures.end(); ++itr)
     region.Union( (*itr)->m_texture->GetRenderRect() );
 
   return CGUIControl::CalcRenderRegion().Intersect(region);
index 4ac6b7c..69b6506 100644 (file)
@@ -59,6 +59,10 @@ public:
     CGUITexture *m_texture;  ///< texture to fade out
     unsigned int m_fadeTime; ///< time to fade out (ms)
     bool         m_fading;   ///< whether we're fading out
+
+  private:
+    CFadingTexture(const CFadingTexture&);
+    CFadingTexture& operator=(const CFadingTexture&);
   };
 
   CGUIImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture);
index 2f39eac..505c8c9 100644 (file)
@@ -67,14 +67,14 @@ CGUIInfoColor::CGUIInfoColor(uint32_t color)
   m_info = 0;
 }
 
-const CGUIInfoColor &CGUIInfoColor::operator=(color_t color)
+CGUIInfoColor &CGUIInfoColor::operator=(color_t color)
 {
   m_color = color;
   m_info = 0;
   return *this;
 }
 
-const CGUIInfoColor &CGUIInfoColor::operator=(const CGUIInfoColor &color)
+CGUIInfoColor &CGUIInfoColor::operator=(const CGUIInfoColor &color)
 {
   m_color = color.m_color;
   m_info = color.m_info;
index 728078c..80f7995 100644 (file)
@@ -54,8 +54,8 @@ class CGUIInfoColor
 public:
   CGUIInfoColor(color_t color = 0);
 
-  const CGUIInfoColor &operator=(const CGUIInfoColor &color);
-  const CGUIInfoColor &operator=(color_t color);
+  CGUIInfoColor& operator=(const CGUIInfoColor &color);
+  CGUIInfoColor& operator=(color_t color);
   operator color_t() const { return m_color; };
 
   bool Update();
index b9cabfb..ffc28c6 100644 (file)
@@ -223,12 +223,12 @@ bool CGUILabel::CheckAndCorrectOverlap(CGUILabel &label1, CGUILabel &label2)
   if (rect.Intersect(label2.m_renderRect).IsEmpty())
     return false; // nothing to do (though it could potentially encroach on the min_space requirement)
   
-  static const float min_space = 10;
   // overlap vertically and horizontally - check alignment
   CGUILabel &left = label1.m_renderRect.x1 <= label2.m_renderRect.x1 ? label1 : label2;
   CGUILabel &right = label1.m_renderRect.x1 <= label2.m_renderRect.x1 ? label2 : label1;
   if ((left.m_label.align & 3) == 0 && right.m_label.align & XBFONT_RIGHT)
   {
+    static const float min_space = 10;
     float chopPoint = (left.m_maxRect.x1 + left.GetMaxWidth() + right.m_maxRect.x2 - right.GetMaxWidth()) * 0.5f;
     // [1       [2...[2  1].|..........1]         2]
     // [1       [2.....[2   |      1]..1]         2]
index d3f34fd..bdd75c0 100644 (file)
@@ -234,7 +234,7 @@ bool CGUIListItem::IsSelected() const
   return m_bSelected;
 }
 
-const CGUIListItem& CGUIListItem::operator =(const CGUIListItem& item)
+CGUIListItem& CGUIListItem::operator =(const CGUIListItem& item)
 {
   if (&item == this) return * this;
   m_strLabel2 = item.m_strLabel2;
@@ -264,19 +264,19 @@ void CGUIListItem::Archive(CArchive &ar)
     ar << m_bSelected;
     ar << m_overlayIcon;
     ar << (int)m_mapProperties.size();
-    for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); it++)
+    for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); ++it)
     {
       ar << it->first;
       ar << it->second;
     }
     ar << (int)m_art.size();
-    for (ArtMap::const_iterator i = m_art.begin(); i != m_art.end(); i++)
+    for (ArtMap::const_iterator i = m_art.begin(); i != m_art.end(); ++i)
     {
       ar << i->first;
       ar << i->second;
     }
     ar << (int)m_artFallbacks.size();
-    for (ArtMap::const_iterator i = m_artFallbacks.begin(); i != m_artFallbacks.end(); i++)
+    for (ArtMap::const_iterator i = m_artFallbacks.begin(); i != m_artFallbacks.end(); ++i)
     {
       ar << i->first;
       ar << i->second;
@@ -332,11 +332,11 @@ void CGUIListItem::Serialize(CVariant &value)
   value["strIcon"] = m_strIcon;
   value["selected"] = m_bSelected;
 
-  for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); it++)
+  for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); ++it)
   {
     value["properties"][it->first] = it->second;
   }
-  for (ArtMap::const_iterator it = m_art.begin(); it != m_art.end(); it++)
+  for (ArtMap::const_iterator it = m_art.begin(); it != m_art.end(); ++it)
     value["art"][it->first] = it->second;
 }
 
index 940d9aa..5b8e04a 100644 (file)
@@ -63,7 +63,7 @@ public:
   virtual ~CGUIListItem(void);
   virtual CGUIListItem *Clone() const { return new CGUIListItem(*this); };
 
-  const CGUIListItem& operator =(const CGUIListItem& item);
+  CGUIListItem& operator =(const CGUIListItem& item);
 
   virtual void SetLabel(const CStdString& strLabel);
   const CStdString& GetLabel() const;
@@ -169,7 +169,7 @@ public:
   void Serialize(CVariant& value);
 
   bool       HasProperty(const CStdString &strKey) const;
-  bool       HasProperties() const { return m_mapProperties.size() > 0; };
+  bool       HasProperties() const { return !m_mapProperties.empty(); };
   void       ClearProperty(const CStdString &strKey);
 
   CVariant   GetProperty(const CStdString &strKey) const;
index f2a7775..e63a99d 100644 (file)
@@ -24,8 +24,8 @@
 CGUIListLabel::CGUIListLabel(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoLabel &info, bool alwaysScroll)
     : CGUIControl(parentID, controlID, posX, posY, width, height)
     , m_label(posX, posY, width, height, labelInfo, alwaysScroll ? CGUILabel::OVER_FLOW_SCROLL : CGUILabel::OVER_FLOW_TRUNCATE)
+    , m_info(info)
 {
-  m_info = info;
   m_alwaysScroll = alwaysScroll;
   // TODO: Remove this "correction"
   if (labelInfo.align & XBFONT_RIGHT)
index 34c075a..56efa8b 100644 (file)
@@ -101,7 +101,7 @@ int CGUIMessage::GetSenderId() const
 }
 
 
-const CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg)
+CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg)
 {
   if (this == &msg) return * this;
 
index 5467cbd..2b76ad0 100644 (file)
@@ -305,7 +305,7 @@ public:
   CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, const CGUIListItemPtr &item);
   CGUIMessage(const CGUIMessage& msg);
   virtual ~CGUIMessage(void);
-  const CGUIMessage& operator = (const CGUIMessage& msg);
+  CGUIMessage& operator = (const CGUIMessage& msg);
 
   int GetControlId() const ;
   int GetMessage() const;
index 1e5b8e3..ecfdbb7 100644 (file)
@@ -49,9 +49,8 @@ CGUIMultiImage::CGUIMultiImage(int parentID, int controlID, float posX, float po
 }
 
 CGUIMultiImage::CGUIMultiImage(const CGUIMultiImage &from)
-: CGUIControl(from), m_image(from.m_image)
+  : CGUIControl(from), m_texturePath(), m_imageTimer(), m_files(), m_image(from.m_image)
 {
-  m_texturePath = from.m_texturePath;
   m_timePerImage = from.m_timePerImage;
   m_timeToPauseAtEnd = from.m_timeToPauseAtEnd;
   m_randomized = from.m_randomized;
index aec616f..9287909 100644 (file)
@@ -39,10 +39,10 @@ CGUIMultiSelectTextControl::CSelectableString::CSelectableString(CGUIFont *font,
 
 CGUIMultiSelectTextControl::CGUIMultiSelectTextControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CLabelInfo& labelInfo, const CGUIInfoLabel &content)
     : CGUIControl(parentID, controlID, posX, posY, width, height)
+    , m_label(labelInfo)
+    , m_info(content)
     , m_button(parentID, controlID, posX, posY, width, height, textureFocus, textureNoFocus, labelInfo)
 {
-  m_info = content;
-  m_label = labelInfo;
   m_selectedItem = 0;
   m_offset = 0;
   m_totalWidth = 0;
index e79cbd7..b68e08b 100644 (file)
@@ -31,12 +31,12 @@ using namespace std;
 
 CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, CStdString& strRSSTags)
 : CGUIControl(parentID, controlID, posX, posY, width, height),
-  m_scrollInfo(0,0,labelInfo.scrollSpeed,"")
+  m_label(labelInfo),
+  m_channelColor(channelColor),
+  m_headlineColor(headlineColor),
+  m_scrollInfo(0,0,labelInfo.scrollSpeed,""),
+  m_dirty(true)
 {
-  m_label = labelInfo;
-  m_headlineColor = headlineColor;
-  m_channelColor = channelColor;
-
   m_strRSSTags = strRSSTags;
 
   m_pReader = NULL;
@@ -47,11 +47,16 @@ CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float po
 }
 
 CGUIRSSControl::CGUIRSSControl(const CGUIRSSControl &from)
-: CGUIControl(from),m_scrollInfo(from.m_scrollInfo), m_dirty(true)
+  : CGUIControl(from),
+  m_feed(),
+  m_label(from.m_label),
+  m_channelColor(from.m_channelColor),
+  m_headlineColor(from.m_headlineColor),
+  m_vecUrls(),
+  m_vecIntervals(),
+  m_scrollInfo(from.m_scrollInfo),
+  m_dirty(true)
 {
-  m_label = from.m_label;
-  m_headlineColor = from.m_headlineColor;
-  m_channelColor = from.m_channelColor;
   m_strRSSTags = from.m_strRSSTags;
   m_pReader = NULL;
   m_rtl = from.m_rtl;
index 4d20850..d96d789 100644 (file)
@@ -72,7 +72,7 @@ public:
   virtual bool OnMessage(CGUIMessage& message);
   bool ProcessSelector(CGUITexture &nib, unsigned int currentTime, float fScaleY, RangeSelector selector);
   void SetRangeSelection(bool rangeSelection);
-  bool GetRangeSelection() { return m_rangeSelection; }
+  bool GetRangeSelection() const { return m_rangeSelection; }
   void SetRangeSelector(RangeSelector selector);
   void SwitchRangeSelector();
   void SetInfo(int iInfo);
index 1672408..46c8697 100644 (file)
@@ -410,12 +410,12 @@ void CGUISpinControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyr
 
   changed |= m_label.SetText(text);
 
-  const float space = 5;
   float textWidth = m_label.GetTextWidth() + 2 * m_label.GetLabelInfo().offsetX;
   // Position the arrows
   bool arrowsOnRight(0 != (m_label.GetLabelInfo().align & (XBFONT_RIGHT | XBFONT_CENTER_X)));
   if (!arrowsOnRight)
   {
+    const float space = 5;
     changed |= m_imgspinDownFocus.SetPosition(m_posX + textWidth + space, m_posY);
     changed |= m_imgspinDown.SetPosition(m_posX + textWidth + space, m_posY);
     changed |= m_imgspinUpFocus.SetPosition(m_posX + textWidth + space + m_imgspinDown.GetWidth(), m_posY);
index 6fd8adc..7e47ce6 100644 (file)
@@ -90,7 +90,7 @@ CGUIStaticItem::CGUIStaticItem(const TiXmlElement *item, int parentID) : CFileIt
     
 void CGUIStaticItem::UpdateProperties(int contextWindow)
 {
-  for (InfoVector::const_iterator i = m_info.begin(); i != m_info.end(); i++)
+  for (InfoVector::const_iterator i = m_info.begin(); i != m_info.end(); ++i)
   {
     const CGUIInfoLabel &info = i->first;
     const CStdString &name = i->second;
index e63e8ef..ec7b6c2 100644 (file)
@@ -29,6 +29,7 @@ CGUITextBox::CGUITextBox(int parentID, int controlID, float posX, float posY, fl
                          const CLabelInfo& labelInfo, int scrollTime)
     : CGUIControl(parentID, controlID, posX, posY, width, height)
     , CGUITextLayout(labelInfo.font, true)
+    , m_label(labelInfo)
 {
   m_offset = 0;
   m_scrollOffset = 0;
@@ -44,7 +45,6 @@ CGUITextBox::CGUITextBox(int parentID, int controlID, float posX, float posY, fl
   m_autoScrollDelay = 3000;
   m_autoScrollDelayTime = 0;
   m_autoScrollRepeatAnim = NULL;
-  m_label = labelInfo;
 }
 
 CGUITextBox::CGUITextBox(const CGUITextBox &from)
index 103242b..652a3ab 100644 (file)
@@ -81,7 +81,7 @@ void CGUITextLayout::Render(float x, float y, float angle, color_t color, color_
     alignment &= ~XBFONT_CENTER_Y;
   }
   m_font->Begin();
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     uint32_t align = alignment;
@@ -137,7 +137,7 @@ void CGUITextLayout::RenderScrolling(float x, float y, float angle, color_t colo
   //       any difference to the smoothness of scrolling though which will be
   //       jumpy with this sort of thing.  It's not exactly a well used situation
   //       though, so this hack is probably OK.
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     m_font->DrawScrollingText(x, y, m_colors, shadowColor, string.m_text, alignment, maxWidth, scrollInfo);
@@ -169,7 +169,7 @@ void CGUITextLayout::RenderOutline(float x, float y, color_t color, color_t outl
     // adjust so the baselines of the fonts align
     float by = y + m_font->GetTextBaseLine() - m_borderFont->GetTextBaseLine();
     m_borderFont->Begin();
-    for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+    for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
     {
       const CGUIString &string = *i;
       uint32_t align = alignment;
@@ -201,7 +201,7 @@ void CGUITextLayout::RenderOutline(float x, float y, color_t color, color_t outl
     m_colors[0] = color;
 
   m_font->Begin();
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     uint32_t align = alignment;
@@ -507,7 +507,7 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth)
             // skip over spaces
             pos = lastSpace;
             while (pos != line.m_text.end() && IsSpace(*pos))
-              pos++;
+              ++pos;
             curLine.clear();
             lastSpaceInLine = 0;
             lastSpace = line.m_text.begin();
@@ -518,7 +518,7 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth)
         lastSpaceInLine = curLine.size();
       }
       curLine.push_back(letter);
-      pos++;
+      ++pos;
     }
     // now add whatever we have left to the string
     float width = m_font->GetTextWidth(curLine);
@@ -562,7 +562,7 @@ void CGUITextLayout::LineBreakText(const vecText &text, vector<CGUIString> &line
       lines.push_back(string);
       lineStart = pos + 1;
     }
-    pos++;
+    ++pos;
   }
   // handle the last line if non-empty
   if (lineStart < text.end() && (nMaxLines <= 0 || lines.size() < (size_t)nMaxLines))
@@ -584,7 +584,7 @@ void CGUITextLayout::CalcTextExtent()
   m_textHeight = 0;
   if (!m_font) return;
 
-  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::iterator i = m_lines.begin(); i != m_lines.end(); ++i)
   {
     const CGUIString &string = *i;
     float w = m_font->GetTextWidth(string.m_text);
@@ -597,7 +597,7 @@ void CGUITextLayout::CalcTextExtent()
 unsigned int CGUITextLayout::GetTextLength() const
 {
   unsigned int length = 0;
-  for (vector<CGUIString>::const_iterator i = m_lines.begin(); i != m_lines.end(); i++)
+  for (vector<CGUIString>::const_iterator i = m_lines.begin(); i != m_lines.end(); ++i)
     length += i->m_text.size();
   return length;
 }
index 5146a28..bc2bdfe 100644 (file)
@@ -113,8 +113,8 @@ public:
 protected:
   void LineBreakText(const vecText &text, std::vector<CGUIString> &lines);
   void WrapText(const vecText &text, float maxWidth);
-  void BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder);
-  CStdStringW BidiFlip(const CStdStringW &text, bool forceLTRReadingOrder);
+  static void BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder);
+  static CStdStringW BidiFlip(const CStdStringW &text, bool forceLTRReadingOrder);
   void CalcTextExtent();
 
   // our text to render
index 78ded2a..68c9c5c 100644 (file)
@@ -51,13 +51,12 @@ CTextureInfo& CTextureInfo::operator=(const CTextureInfo &right)
   return *this;
 }
 
-CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float height, const CTextureInfo& texture)
+CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float height, const CTextureInfo& texture) :
+  m_height(height), m_info(texture)
 {
   m_posX = posX;
   m_posY = posY;
   m_width = width;
-  m_height = height;
-  m_info = texture;
 
   // defaults
   m_visible = true;
@@ -86,18 +85,18 @@ CGUITextureBase::CGUITextureBase(float posX, float posY, float width, float heig
   m_invalid = true;
 }
 
-CGUITextureBase::CGUITextureBase(const CGUITextureBase &right)
+CGUITextureBase::CGUITextureBase(const CGUITextureBase &right) :
+  m_height(right.m_height),
+  m_alpha(right.m_alpha),
+  m_info(right.m_info),
+  m_aspect(right.m_aspect)
 {
   m_posX = right.m_posX;
   m_posY = right.m_posY;
   m_width = right.m_width;
-  m_height = right.m_height;
-  m_info = right.m_info;
 
   m_visible = right.m_visible;
   m_diffuseColor = right.m_diffuseColor;
-  m_alpha = right.m_alpha;
-  m_aspect = right.m_aspect;
 
   m_allocateDynamically = right.m_allocateDynamically;
 
index 0c0f718..5a37d42 100644 (file)
@@ -127,7 +127,7 @@ protected:
   bool AllocateOnDemand();
   bool UpdateAnimFrame();
   void Render(float left, float top, float bottom, float right, float u1, float v1, float u2, float v2, float u3, float v3);
-  void OrientateTexture(CRect &rect, float width, float height, int orientation);
+  static void OrientateTexture(CRect &rect, float width, float height, int orientation);
 
   // functions that our implementation classes handle
   virtual void Allocate() {}; ///< called after our textures have been allocated
index 9fe6f7a..d213b36 100644 (file)
@@ -42,7 +42,7 @@ CGUIVisualisationControl::CGUIVisualisationControl(int parentID, int controlID,
 }
 
 CGUIVisualisationControl::CGUIVisualisationControl(const CGUIVisualisationControl &from)
-: CGUIRenderingControl(from), m_bAttemptedLoad(false)
+  : CGUIRenderingControl(from), m_bAttemptedLoad(false), m_addon()
 {
   ControlType = GUICONTROL_VISUALISATION;
 }
index 0928287..a1f894b 100644 (file)
@@ -584,7 +584,6 @@ bool CGUIWindow::OnMessage(CGUIMessage& message)
         CLog::Log(LOGDEBUG, "Unfocus WindowID: %i, ControlID: %i",GetID(), control->GetID());
       }
       return true;
-    break;
     }
 
   case GUI_MSG_SELCHANGED:
@@ -1073,7 +1072,7 @@ void CGUIWindow::SetID(int id)
 
 bool CGUIWindow::HasID(int controlID) const
 {
-  for (std::vector<int>::const_iterator it = m_idRange.begin(); it != m_idRange.end() ; it++)
+  for (std::vector<int>::const_iterator it = m_idRange.begin(); it != m_idRange.end() ; ++it)
   {
     if (controlID == *it)
       return true;
index a2eaadd..e9cf5e6 100644 (file)
@@ -89,7 +89,7 @@ bool CGUIWindowManager::SendMessage(CGUIMessage& message)
       dialog->OnMessage(message);
     }
 
-    for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+    for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
     {
       CGUIWindow *pWindow = (*it).second;
       pWindow->OnMessage(message);
@@ -187,7 +187,7 @@ void CGUIWindowManager::Add(CGUIWindow* pWindow)
   // push back all the windows if there are more than one covered by this class
   CSingleLock lock(g_graphicsContext);
   const vector<int>& idRange = pWindow->GetIDRange();
-  for (vector<int>::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; idIt++)
+  for (vector<int>::const_iterator idIt = idRange.begin(); idIt != idRange.end() ; ++idIt)
   {
     WindowMap::iterator it = m_mapWindows.find(*idIt);
     if (it != m_mapWindows.end())
@@ -227,7 +227,7 @@ void CGUIWindowManager::Remove(int id)
       if(*it2 == it->second)
         it2 = m_activeDialogs.erase(it2);
       else
-        it2++;
+        ++it2;
     }
 
     m_mapWindows.erase(it);
@@ -423,7 +423,7 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector<CStd
   // as all messages done in WINDOW_INIT will want to be sent to the new
   // topmost window).  If we are swapping windows, we pop the old window
   // off the history stack
-  if (swappingWindows && m_windowHistory.size())
+  if (swappingWindows && !m_windowHistory.empty())
     m_windowHistory.pop();
   AddToWindowHistory(iWindowID);
 
@@ -435,7 +435,7 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector<CStd
 //  g_infoManager.SetPreviousWindow(WINDOW_INVALID);
 }
 
-void CGUIWindowManager::CloseDialogs(bool forceClose)
+void CGUIWindowManager::CloseDialogs(bool forceClose) const
 {
   CSingleLock lock(g_graphicsContext);
   while (m_activeDialogs.size() > 0)
@@ -445,7 +445,7 @@ void CGUIWindowManager::CloseDialogs(bool forceClose)
   }
 }
 
-bool CGUIWindowManager::OnAction(const CAction &action)
+bool CGUIWindowManager::OnAction(const CAction &action) const
 {
   CSingleLock lock(g_graphicsContext);
   unsigned int topMost = m_activeDialogs.size();
@@ -504,14 +504,14 @@ void CGUIWindowManager::Process(unsigned int currentTime)
     pWindow->DoProcess(currentTime, dirtyregions);
 
   // process all dialogs - visibility may change etc.
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow *pWindow = (*it).second;
     if (pWindow && pWindow->IsDialog())
       pWindow->DoProcess(currentTime, dirtyregions);
   }
 
-  for (CDirtyRegionList::iterator itr = dirtyregions.begin(); itr != dirtyregions.end(); itr++)
+  for (CDirtyRegionList::iterator itr = dirtyregions.begin(); itr != dirtyregions.end(); ++itr)
     m_tracker.MarkDirtyRegion(*itr);
 }
 
@@ -525,7 +525,7 @@ void CGUIWindowManager::MarkDirty(const CRect& rect)
   m_tracker.MarkDirtyRegion(rect);
 }
 
-void CGUIWindowManager::RenderPass()
+void CGUIWindowManager::RenderPass() const
 {
   CGUIWindow* pWindow = GetWindow(GetActiveWindow());
   if (pWindow)
@@ -569,7 +569,7 @@ bool CGUIWindowManager::Render()
   }
   else
   {
-    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
+    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); ++i)
     {
       if (i->IsEmpty())
         continue;
@@ -585,9 +585,9 @@ bool CGUIWindowManager::Render()
   {
     g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
     const CDirtyRegionList &markedRegions  = m_tracker.GetMarkedRegions(); 
-    for (CDirtyRegionList::const_iterator i = markedRegions.begin(); i != markedRegions.end(); i++)
+    for (CDirtyRegionList::const_iterator i = markedRegions.begin(); i != markedRegions.end(); ++i)
       CGUITexture::DrawQuad(*i, 0x0fff0000);
-    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); i++)
+    for (CDirtyRegionList::const_iterator i = dirtyRegions.begin(); i != dirtyRegions.end(); ++i)
       CGUITexture::DrawQuad(*i, 0x4c00ff00);
   }
 
@@ -619,7 +619,7 @@ void CGUIWindowManager::FrameMove()
   if(m_iNested == 0)
   {
     // delete any windows queued for deletion
-    for(iDialog it = m_deleteWindows.begin(); it != m_deleteWindows.end(); it++)
+    for(iDialog it = m_deleteWindows.begin(); it != m_deleteWindows.end(); ++it)
     {
       // Free any window resources
       (*it)->FreeResources(true);
@@ -675,7 +675,7 @@ void CGUIWindowManager::SetCallback(IWindowManagerCallback& callback)
 void CGUIWindowManager::DeInitialize()
 {
   CSingleLock lock(g_graphicsContext);
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow* pWindow = (*it).second;
     if (IsWindowActive(it->first))
@@ -798,7 +798,7 @@ void CGUIWindowManager::DispatchThreadMessages()
 
   CSingleLock lock(m_critSection);
 
-  for(int msgCount = m_vecThreadMessages.size(); m_vecThreadMessages.size() > 0 && msgCount > 0; --msgCount)
+  for(int msgCount = m_vecThreadMessages.size(); !m_vecThreadMessages.empty() && msgCount > 0; --msgCount)
   {
     // pop up one message per time to make messages be processed by order.
     // this will ensure rule No.2 & No.3
@@ -912,7 +912,7 @@ bool CGUIWindowManager::IsWindowVisible(const CStdString &xmlFile) const
 void CGUIWindowManager::LoadNotOnDemandWindows()
 {
   CSingleLock lock(g_graphicsContext);
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow *pWindow = (*it).second;
     if (pWindow->GetLoadType() == CGUIWindow::LOAD_ON_GUI_INIT)
@@ -926,7 +926,7 @@ void CGUIWindowManager::LoadNotOnDemandWindows()
 void CGUIWindowManager::UnloadNotOnDemandWindows()
 {
   CSingleLock lock(g_graphicsContext);
-  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
+  for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); ++it)
   {
     CGUIWindow *pWindow = (*it).second;
     if (pWindow->GetLoadType() == CGUIWindow::LOAD_ON_GUI_INIT ||
@@ -963,7 +963,7 @@ void CGUIWindowManager::AddToWindowHistory(int newWindowID)
   // and if so, pop all the other windows off the stack so that we
   // always have a predictable "Back" behaviour for each window
   stack<int> historySave = m_windowHistory;
-  while (historySave.size())
+  while (!historySave.empty())
   {
     if (historySave.top() == newWindowID)
       break;
@@ -1023,7 +1023,7 @@ bool CGUIWindowManager::IsWindowTopMost(const CStdString &xmlFile) const
 
 void CGUIWindowManager::ClearWindowHistory()
 {
-  while (m_windowHistory.size())
+  while (!m_windowHistory.empty())
     m_windowHistory.pop();
 }
 
index bea2bc1..70d9b9a 100644 (file)
@@ -62,12 +62,12 @@ public:
   void ActivateWindow(int iWindowID, const std::vector<CStdString>& params, bool swappingWindows = false);
   void PreviousWindow();
 
-  void CloseDialogs(bool forceClose = false);
+  void CloseDialogs(bool forceClose = false) const;
 
   // OnAction() runs through our active dialogs and windows and sends the message
   // off to the callbacks (application, python, playlist player) and to the
   // currently focused window(s).  Returns true only if the message is handled.
-  bool OnAction(const CAction &action);
+  bool OnAction(const CAction &action) const;
 
   /*! \brief Process active controls allowing them to animate before rendering.
    */
@@ -142,7 +142,7 @@ public:
   void DumpTextureUse();
 #endif
 private:
-  void RenderPass();
+  void RenderPass() const;
 
   void LoadNotOnDemandWindows();
   void UnloadNotOnDemandWindows();
index 0c2ee8c..736fee3 100644 (file)
@@ -86,7 +86,7 @@ void CGraphicContext::OnSettingChanged(const CSetting *setting)
 
 void CGraphicContext::SetOrigin(float x, float y)
 {
-  if (m_origins.size())
+  if (!m_origins.empty())
     m_origins.push(CPoint(x,y) + m_origins.top());
   else
     m_origins.push(CPoint(x,y));
@@ -96,7 +96,7 @@ void CGraphicContext::SetOrigin(float x, float y)
 
 void CGraphicContext::RestoreOrigin()
 {
-  if (m_origins.size())
+  if (!m_origins.empty())
     m_origins.pop();
   RemoveTransform();
 }
@@ -105,13 +105,13 @@ void CGraphicContext::RestoreOrigin()
 bool CGraphicContext::SetClipRegion(float x, float y, float w, float h)
 { // transform from our origin
   CPoint origin;
-  if (m_origins.size())
+  if (!m_origins.empty())
     origin = m_origins.top();
 
   // ok, now intersect with our old clip region
   CRect rect(x, y, x + w, y + h);
   rect += origin;
-  if (m_clipRegions.size())
+  if (!m_clipRegions.empty())
   {
     // intersect with original clip region
     rect.Intersect(m_clipRegions.top());
@@ -128,7 +128,7 @@ bool CGraphicContext::SetClipRegion(float x, float y, float w, float h)
 
 void CGraphicContext::RestoreClipRegion()
 {
-  if (m_clipRegions.size())
+  if (!m_clipRegions.empty())
     m_clipRegions.pop();
 
   // here we could reset the hardware clipping, if applicable
@@ -138,12 +138,12 @@ void CGraphicContext::ClipRect(CRect &vertex, CRect &texture, CRect *texture2)
 {
   // this is the software clipping routine.  If the graphics hardware is set to do the clipping
   // (eg via SetClipPlane in D3D for instance) then this routine is unneeded.
-  if (m_clipRegions.size())
+  if (!m_clipRegions.empty())
   {
     // take a copy of the vertex rectangle and intersect
     // it with our clip region (moved to the same coordinate system)
     CRect clipRegion(m_clipRegions.top());
-    if (m_origins.size())
+    if (!m_origins.empty())
       clipRegion -= m_origins.top();
     CRect original(vertex);
     vertex.Intersect(clipRegion);
@@ -795,10 +795,10 @@ void CGraphicContext::SetScalingResolution(const RESOLUTION_INFO &res, bool need
   }
 
   // reset our origin and camera
-  while (m_origins.size())
+  while (!m_origins.empty())
     m_origins.pop();
   m_origins.push(CPoint(0, 0));
-  while (m_cameras.size())
+  while (!m_cameras.empty())
     m_cameras.pop();
   m_cameras.push(CPoint(0.5f*m_iScreenWidth, 0.5f*m_iScreenHeight));
 
@@ -828,7 +828,7 @@ void CGraphicContext::SetStereoView(RENDER_STEREO_VIEW view)
 {
   m_stereoView = view;
 
-  while(m_viewStack.size())
+  while(!m_viewStack.empty())
     m_viewStack.pop();
 
   CRect viewport(0.0f, 0.0f, (float)m_iScreenWidth, (float)m_iScreenHeight);
@@ -858,7 +858,7 @@ void CGraphicContext::SetCameraPosition(const CPoint &camera)
   // offset the camera from our current location (this is in XML coordinates) and scale it up to
   // the screen resolution
   CPoint cam(camera);
-  if (m_origins.size())
+  if (!m_origins.empty())
     cam += m_origins.top();
 
   cam.x *= (float)m_iScreenWidth / m_windowResolution.iWidth;
@@ -980,7 +980,7 @@ bool CGraphicContext::ToggleFullScreenRoot ()
     {
       /* we need to trick renderer that we are fullscreen already so it gives us a valid value */
       m_bFullScreenRoot = true;
-      newRes = g_renderManager.GetResolution();
+      uiRes = g_renderManager.GetResolution();
       m_bFullScreenRoot = false;
     }
 #endif
index fadb49f..3c0e339 100644 (file)
@@ -288,12 +288,16 @@ bool CJpegIO::Open(const CStdString &texturePath, unsigned int minx, unsigned in
       if (!free_space)
       { // (re)alloc
         m_inputBuffSize += chunksize;
-        m_inputBuff = (unsigned char *)realloc(m_inputBuff, m_inputBuffSize);
-        if (!m_inputBuff)
+        unsigned char* new_buf = (unsigned char *)realloc(m_inputBuff, m_inputBuffSize);
+        if (!new_buf)
         {
           CLog::Log(LOGERROR, "%s unable to allocate buffer of size %u", __FUNCTION__, m_inputBuffSize);
+          free(m_inputBuff);
           return false;
         }
+        else
+          m_inputBuff = new_buf;
+
         free_space = chunksize;
         chunksize = std::min(chunksize*2, maxchunksize);
       }
@@ -490,7 +494,7 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int wid
   long unsigned int outBufSize = width * height;
   unsigned char* result;
   unsigned char* src = buffer;
-  unsigned char* rgbbuf, *src2, *dst2;
+  unsigned char* rgbbuf;
 
   if(buffer == NULL)
   {
@@ -516,8 +520,8 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int wid
     unsigned char* dst = rgbbuf;
     for (unsigned int y = 0; y < height; y++)
     {
-      dst2 = dst;
-      src2 = src;
+      unsigned char* dst2 = dst;
+      unsigned char* src2 = src;
       for (unsigned int x = 0; x < width; x++, src2 += 4)
       {
         *dst2++ = src2[2];
@@ -742,7 +746,7 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* bufferin, unsigned int w
   JSAMPROW row_pointer[1];
   long unsigned int outBufSize = width * height;
   unsigned char* src = bufferin;
-  unsigned char* rgbbuf, *src2, *dst2;
+  unsigned char* rgbbuf;
 
   if(bufferin == NULL)
   {
@@ -768,8 +772,9 @@ bool CJpegIO::CreateThumbnailFromSurface(unsigned char* bufferin, unsigned int w
     unsigned char* dst = rgbbuf;
     for (unsigned int y = 0; y < height; y++)
     {
-      dst2 = dst;
-      src2 = src;
+
+      unsigned char* dst2 = dst;
+      unsigned char* src2 = src;
       for (unsigned int x = 0; x < width; x++, src2 += 4)
       {
         *dst2++ = src2[2];
index b420606..8129062 100644 (file)
@@ -40,7 +40,7 @@ public:
   bool           Read(unsigned char* buffer, unsigned int bufSize, unsigned int minx, unsigned int miny);
   bool           CreateThumbnail(const CStdString& sourceFile, const CStdString& destFile, int minx, int miny, bool rotateExif);
   bool           CreateThumbnailFromMemory(unsigned char* buffer, unsigned int bufSize, const CStdString& destFile, unsigned int minx, unsigned int miny);
-  bool           CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
+  static bool           CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
   void           Close();
   // methods for the imagefactory
   virtual bool   Decode(const unsigned char *pixels, unsigned int pitch, unsigned int format);
@@ -52,7 +52,7 @@ public:
 protected:
   static  void   jpeg_error_exit(j_common_ptr cinfo);
 
-  unsigned int   GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
+  static unsigned int   GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
 
   unsigned char  *m_inputBuff;
   unsigned int   m_inputBuffSize;
index 68c7840..2a798b8 100644 (file)
@@ -87,7 +87,7 @@ void CKey::Reset()
   m_held = 0;
 }
 
-const CKey& CKey::operator=(const CKey& key)
+CKey& CKey::operator=(const CKey& key)
 {
   if (&key == this) return * this;
   m_leftTrigger  = key.m_leftTrigger;
index 3bb2621..902798e 100644 (file)
@@ -470,7 +470,7 @@ public:
   CKey(const CKey& key);
 
   virtual ~CKey(void);
-  const CKey& operator=(const CKey& key);
+  CKey& operator=(const CKey& key);
   uint8_t GetLeftTrigger() const;
   uint8_t GetRightTrigger() const;
   float GetLeftThumbX() const;
index 5f978b1..e27656a 100644 (file)
@@ -93,7 +93,7 @@ protected:
    */
   bool LoadXML(const CStdString &filename, CStdString &encoding, uint32_t offset = 0);
 
-  CStdString ToUTF8(const CStdString &encoding, const CStdString &str);
+  static CStdString ToUTF8(const CStdString &encoding, const CStdString &str);
   std::map<uint32_t, LocStr> m_strings;
   typedef std::map<uint32_t, LocStr>::const_iterator ciStrings;
   typedef std::map<uint32_t, LocStr>::iterator       iStrings;
index 4a012dd..f4be9be 100644 (file)
@@ -51,13 +51,13 @@ public:
   void MultMatrixf(const GLfloat *matrix);
   void LookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz);
   void PrintMatrix(void);
-  bool Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz);
+  static bool Project(GLfloat objx, GLfloat objy, GLfloat objz, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4], GLfloat* winx, GLfloat* winy, GLfloat* winz);
 
 protected:
 
   struct MatrixWrapper 
   {
-    MatrixWrapper(){};
+    MatrixWrapper(){ memset(&m_values, 0, sizeof(m_values)); };
     MatrixWrapper( const float values[16]) { memcpy(m_values,values,sizeof(m_values)); }
     MatrixWrapper( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); }
     MatrixWrapper &operator=( const MatrixWrapper &rhs ) { memcpy(m_values, rhs.m_values, sizeof(m_values)); return *this;}
index 7dbda95..08be14e 100644 (file)
@@ -116,9 +116,10 @@ public:
   {
     return iWidth * fPixelRatio / iHeight;
   }
-  RESOLUTION_INFO(const RESOLUTION_INFO& res)
+  RESOLUTION_INFO(const RESOLUTION_INFO& res) :
+    Overscan(res.Overscan)
   {
-    Overscan = res.Overscan; bFullScreen = res.bFullScreen;
+    bFullScreen = res.bFullScreen;
     iScreen = res.iScreen; iWidth = res.iWidth; iHeight = res.iHeight;
     iScreenWidth = res.iScreenWidth; iScreenHeight = res.iScreenHeight;
     iSubtitles = res.iSubtitles; dwFlags = res.dwFlags;
index 099d3e5..3283164 100644 (file)
@@ -46,7 +46,7 @@ namespace Shaders {
     virtual GLuint Handle() = 0;
     virtual void SetSource(const string& src) { m_source = src; }
     virtual bool LoadSource(const string& filename, const string& prefix = "");
-    bool OK() { return m_compiled; }
+    bool OK() const { return m_compiled; }
 
   protected:
     string m_source;
@@ -150,7 +150,7 @@ namespace Shaders {
     virtual void Disable() = 0;
 
     // returns true if shader is compiled and linked
-    bool OK() { return m_ok; }
+    bool OK() const { return m_ok; }
 
     // free resources
     virtual void Free() {}
@@ -189,13 +189,15 @@ namespace Shaders {
     : virtual public CShaderProgram
   {
   public:
-    CGLSLShaderProgram()
+    CGLSLShaderProgram() : 
+      m_validated(false)
       {
         m_pFP = new CGLSLPixelShader();
         m_pVP = new CGLSLVertexShader();
       }
     CGLSLShaderProgram(const std::string& vert
-                     , const std::string& frag)
+                     , const std::string& frag) :
+      m_validated(false)
       {
         m_pFP = new CGLSLPixelShader();
         m_pFP->LoadSource(frag);
index eac7cdc..ec7f5d0 100644 (file)
@@ -349,13 +349,12 @@ void CStereoscopicsManager::OnPlaybackStarted(void)
       RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode();
       RENDER_STEREO_MODE playing   = GetStereoModeOfPlayingVideo();
 
-      int idx_preferred = -1
-        , idx_playing   = -1
-        , idx_mono      = -1
-        , idx_select    = -1;
+      int idx_playing   = -1
+        , idx_mono      = -1;
+        
 
       // add choices
-      idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530)
+      int idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530)
                                      + " ("
                                      + GetLabelForStereoMode(preferred)
                                      + ")");
@@ -370,7 +369,7 @@ void CStereoscopicsManager::OnPlaybackStarted(void)
                                     + GetLabelForStereoMode(playing)
                                     + ")");
 
-      idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select
+      int idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select
 
       pDlgSelect->DoModal();
 
index 7d9355e..be3244e 100644 (file)
@@ -311,7 +311,6 @@ bool CBaseTexture::LoadFromFileInternal(const CStdString& texturePath, unsigned
   if(!LoadIImage(pImage, (unsigned char *) inputBuff, inputBuffSize, width, height, autoRotate))
   {
     delete pImage;
-    pImage = NULL;
     pImage = ImageFactory::CreateFallbackLoader(texturePath);
     if(!LoadIImage(pImage, (unsigned char *) inputBuff, inputBuffSize, width, height))
     {
@@ -339,7 +338,6 @@ bool CBaseTexture::LoadFromFileInMem(unsigned char* buffer, size_t size, const s
   if(!LoadIImage(pImage, buffer, size, width, height))
   {
     delete pImage;
-    pImage = NULL;
     pImage = ImageFactory::CreateFallbackLoader(mimeType);
     if(!LoadIImage(pImage, buffer, size, width, height))
     {
index 3239179..01ae547 100644 (file)
@@ -101,7 +101,7 @@ public:
   void ClampToEdge();
 
   static unsigned int PadPow2(unsigned int x);
-  bool SwapBlueRed(unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements = 4, unsigned int offset=0);
+  static bool SwapBlueRed(unsigned char *pixels, unsigned int height, unsigned int pitch, unsigned int elements = 4, unsigned int offset=0);
 
 private:
   // no copy constructor
index 6d798c7..0f20b65 100644 (file)
@@ -58,10 +58,14 @@ public:
   CAutoBuffer() { p = 0; }
   explicit CAutoBuffer(size_t s) { p = (BYTE*)malloc(s); }
   ~CAutoBuffer() { free(p); }
-operator BYTE*() { return p; }
+operator BYTE*() const { return p; }
   void Set(BYTE* buf) { free(p); p = buf; }
   bool Resize(size_t s);
 void Release() { p = 0; }
+
+private:
+  CAutoBuffer(const CAutoBuffer&);
+  CAutoBuffer& operator=(const CAutoBuffer&);
 };
 
 bool CAutoBuffer::Resize(size_t s)
@@ -91,7 +95,7 @@ public:
   CAutoTexBuffer() { p = 0; }
   explicit CAutoTexBuffer(size_t s) { p = (BYTE*)XPhysicalAlloc(s, MAXULONG_PTR, 128, PAGE_READWRITE); }
   ~CAutoTexBuffer() { if (p) XPhysicalFree(p); }
-operator BYTE*() { return p; }
+operator BYTE*() const { return p; }
   BYTE* Set(BYTE* buf) { if (p) XPhysicalFree(p); return p = buf; }
 void Release() { p = 0; }
 };
@@ -257,7 +261,7 @@ void CTextureBundleXPR::GetTexturesFromPath(const CStdString &path, std::vector<
     testPath += "\\";
   int testLength = testPath.GetLength();
   std::map<CStdString, FileHeader_t>::iterator it;
-  for (it = m_FileHeaders.begin(); it != m_FileHeaders.end(); it++)
+  for (it = m_FileHeaders.begin(); it != m_FileHeaders.end(); ++it)
   {
     if (it->first.Left(testLength).Equals(testPath))
       textures.push_back(it->first);
index cb375be..18257d5 100644 (file)
@@ -225,7 +225,7 @@ CGUITextureManager::~CGUITextureManager(void)
 /************************************************************************/
 /*                                                                      */
 /************************************************************************/
-bool CGUITextureManager::CanLoad(const CStdString &texturePath) const
+bool CGUITextureManager::CanLoad(const CStdString &texturePath)
 {
   if (texturePath == "-")
     return false;
@@ -299,7 +299,7 @@ const CTextureArray& CGUITextureManager::Load(const CStdString& strTextureName,
     return emptyTexture;
   }
 
-  for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); i++)
+  for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); ++i)
   {
     CTextureMap* pMap = i->first;
     if (pMap->GetName() == strTextureName)
@@ -473,7 +473,7 @@ void CGUITextureManager::FreeUnusedTextures(unsigned int timeDelay)
       i = m_unusedTextures.erase(i);
     }
     else
-      i++;
+      ++i;
   }
 
 #if defined(HAS_GL) || defined(HAS_GLES)
index 8f9939f..33a33bf 100644 (file)
@@ -108,7 +108,7 @@ public:
   virtual ~CGUITextureManager(void);
 
   bool HasTexture(const CStdString &textureName, CStdString *path = NULL, int *bundle = NULL, int *size = NULL);
-  bool CanLoad(const CStdString &texturePath) const; ///< Returns true if the texture manager can load this texture
+  static bool CanLoad(const CStdString &texturePath); ///< Returns true if the texture manager can load this texture
   const CTextureArray& Load(const CStdString& strTextureName, bool checkBundleOnly = false);
   void ReleaseTexture(const CStdString& strTextureName);
   void Cleanup();
index 32c5e44..140b9a6 100644 (file)
@@ -267,7 +267,7 @@ public:
     return easeOut(time, start, change, duration);
   }
 protected:
-  float easeOut(float time, float start, float change, float duration)
+  static float easeOut(float time, float start, float change, float duration)
   {
     time /= duration;
     if (time < (1/2.75)) {
@@ -313,7 +313,7 @@ protected:
   float _a;
   float _p;
 
-  float easeIn(float time, float start, float change, float duration)
+  float easeIn(float time, float start, float change, float duration) const
   {
     float s=0;
     float a=_a;
@@ -339,7 +339,7 @@ protected:
     return -(a * pow(2.0f, 10*time) * sin((time * duration - s) * (2 * M_PI) / p )) + start;
   }
 
-  float easeOut(float time, float start, float change, float duration)
+  float easeOut(float time, float start, float change, float duration) const
   {
     float s=0;
     float a=_a;
@@ -364,7 +364,7 @@ protected:
     return (a * pow(2.0f, -10*time) * sin((time * duration - s) * (2 * M_PI) / p )) + change + start;
   }
 
-  float easeInOut(float time, float start, float change, float duration)
+  float easeInOut(float time, float start, float change, float duration) const
   {
     float s=0;
     float a=_a;
index e4cc526..6bd8318 100644 (file)
@@ -61,7 +61,7 @@ CAnimEffect::CAnimEffect(const CAnimEffect &src)
   *this = src;
 }
 
-const CAnimEffect &CAnimEffect::operator=(const CAnimEffect &src)
+CAnimEffect& CAnimEffect::operator=(const CAnimEffect &src)
 {
   if (&src == this) return *this;
 
@@ -248,12 +248,11 @@ void CRotateEffect::ApplyEffect(float offset, const CPoint &center)
     m_matrix.SetZRotation(((m_endAngle - m_startAngle)*offset + m_startAngle) * degree_to_radian, m_center.x, m_center.y, g_graphicsContext.GetScalingPixelRatio());
 }
 
-CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEffect(node, EFFECT_TYPE_ZOOM)
+CZoomEffect::CZoomEffect(const TiXmlElement *node, const CRect &rect) : CAnimEffect(node, EFFECT_TYPE_ZOOM), m_center(CPoint(0,0))
 {
   // effect defaults
   m_startX = m_startY = 100;
   m_endX = m_endY = 100;
-  m_center = CPoint(0,0);
   m_autoCenter = false;
 
   float startPosX = rect.x1;
@@ -385,7 +384,7 @@ CAnimation::~CAnimation()
   m_effects.clear();
 }
 
-const CAnimation &CAnimation::operator =(const CAnimation &src)
+CAnimation &CAnimation::operator =(const CAnimation &src)
 {
   if (this == &src) return *this; // same
   m_type = src.m_type;
@@ -721,7 +720,7 @@ CScroller::CScroller(const CScroller& right)
   *this = right;
 }
 
-const CScroller &CScroller::operator=(const CScroller &right)
+CScroller& CScroller::operator=(const CScroller &right)
 {
   if (&right == this) return *this;
 
index 5d352c0..0d44455 100644 (file)
@@ -56,7 +56,7 @@ public:
   CAnimEffect(const CAnimEffect &src);
 
   virtual ~CAnimEffect();
-  const CAnimEffect &operator=(const CAnimEffect &src);
+  CAnimEffect& operator=(const CAnimEffect &src);
 
   void Calculate(unsigned int time, const CPoint &center);
   void ApplyState(ANIMATION_STATE state, const CPoint &center);
@@ -148,7 +148,7 @@ public:
 
   virtual ~CAnimation();
 
-  const CAnimation &operator=(const CAnimation &src);
+  CAnimation& operator=(const CAnimation &src);
 
   static CAnimation CreateFader(float start, float end, unsigned int delay, unsigned int length, ANIMATION_TYPE type = ANIM_TYPE_NONE);
 
@@ -216,7 +216,7 @@ class CScroller
 public:
   CScroller(unsigned int duration = 200, boost::shared_ptr<Tweener> tweener = boost::shared_ptr<Tweener>());
   CScroller(const CScroller& right);
-  const CScroller &operator=(const CScroller &src);
+  CScroller& operator=(const CScroller &src);
   ~CScroller();
 
   /**
index 0fa8a28..84f29c6 100644 (file)
@@ -64,12 +64,12 @@ public:
    */
   virtual void ReleaseThumbnailBuffer() {return;}
 
-  unsigned int Width()              { return m_width; }
-  unsigned int Height()             { return m_height; }
-  unsigned int originalWidth()      { return m_originalWidth; }
-  unsigned int originalHeight()     { return m_originalHeight; }
-  unsigned int Orientation()        { return m_orientation; }
-  bool hasAlpha()                   { return m_hasAlpha; }
+  unsigned int Width() const              { return m_width; }
+  unsigned int Height() const             { return m_height; }
+  unsigned int originalWidth() const      { return m_originalWidth; }
+  unsigned int originalHeight() const     { return m_originalHeight; }
+  unsigned int Orientation() const        { return m_orientation; }
+  bool hasAlpha() const                   { return m_hasAlpha; }
 
 protected:
 
index fbc461f..5365caf 100644 (file)
@@ -296,7 +296,7 @@ CBitstreamConverter::~CBitstreamConverter()
   Close();
 }
 
-bool CBitstreamConverter::Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb)
+bool CBitstreamConverter::Open(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb)
 {
   m_to_annexb = to_annexb;
 
index 85c372d..dc4b24b 100644 (file)
@@ -133,7 +133,7 @@ public:
   CBitstreamConverter();
   ~CBitstreamConverter();
 
-  bool              Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb);
+  bool              Open(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb);
   void              Close(void);
   bool              NeedConvert(void) { return m_convert_bitstream; };
   bool              Convert(uint8_t *pData, int iSize);
index 5c072f3..2eb9f56 100644 (file)
@@ -1300,11 +1300,17 @@ bool CGUIDialogVideoInfo::UpdateVideoItemSortTitle(const CFileItemPtr &pItem)
   else if (iType == VIDEODB_CONTENT_TVSHOWS)
     database.GetTvShowInfo(pItem->GetVideoInfoTag()->m_strFileNameAndPath, detail, iDbId);
 
+  CStdString currentTitle;
+  if (detail.m_strSortTitle.IsEmpty())
+    currentTitle = detail.m_strTitle;
+  else
+    currentTitle = detail.m_strSortTitle;
+  
   // get the new sort title
-  if (!CGUIKeyboardFactory::ShowAndGetInput(detail.m_strTitle, g_localizeStrings.Get(16107), false))
+  if (!CGUIKeyboardFactory::ShowAndGetInput(currentTitle, g_localizeStrings.Get(16107), false))
     return false;
 
-  return database.UpdateVideoSortTitle(iDbId, detail.m_strTitle, iType);
+  return database.UpdateVideoSortTitle(iDbId, currentTitle, iType);
 }
 
 bool CGUIDialogVideoInfo::LinkMovieToTvShow(const CFileItemPtr &item, bool bRemove, CVideoDatabase &database)