Merge pull request #1852 from Montellese/ra_fixes
authorSascha Montellese <sascha.montellese@gmail.com>
Thu, 29 Nov 2012 08:29:35 +0000 (00:29 -0800)
committerSascha Montellese <sascha.montellese@gmail.com>
Thu, 29 Nov 2012 08:29:35 +0000 (00:29 -0800)
fix and improve updating of recentlyadded

system/keymaps/keyboard.xml
xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAE.cpp
xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioAEStream.cpp
xbmc/filesystem/NFSDirectory.cpp
xbmc/guilib/D3DResource.cpp
xbmc/settings/GUIDialogContentSettings.cpp
xbmc/settings/GUIWindowSettingsCategory.cpp
xbmc/utils/JobManager.cpp
xbmc/utils/JobManager.h

index 460a5ec..4271157 100644 (file)
       <r>Rewind</r>
       <period>SkipNext</period>
       <comma>SkipPrevious</comma>
+      <backspace>Fullscreen</backspace>
       <return>OSD</return>
       <enter>OSD</enter>
       <m>OSD</m>
index 82c56db..334e9ac 100644 (file)
@@ -451,7 +451,6 @@ IAEStream* CCoreAudioAE::MakeStream(enum AEDataFormat dataFormat,
     m_lastStreamFormat = dataFormat;
     m_lastChLayoutCount = channelLayout.Count();
     m_lastSampleRate = sampleRate;
-    Start();
   }
 
   /* if the stream was not initialized, do it now */
index a531166..807fdb7 100644 (file)
@@ -406,8 +406,6 @@ unsigned int CCoreAudioAEStream::AddData(void *data, unsigned int size)
   // upmix the ouput to output channels
   if ( (!m_isRaw || m_rawDataFormat == AE_FMT_LPCM) && (m_chLayoutCountOutput > channelsInBuffer) )
   {
-    frames = addsize / m_StreamFormat.m_frameSize;
-
     CheckOutputBufferSize((void **)&m_upmixBuffer, &m_upmixBufferSize, frames * m_chLayoutCountOutput  * sizeof(float));
     Upmix(adddata, channelsInBuffer, m_upmixBuffer, m_chLayoutCountOutput, frames, m_OutputFormat.m_dataFormat);
     adddata = m_upmixBuffer;
index 4dc0f31..d306331 100644 (file)
@@ -35,6 +35,7 @@
 #include "threads/SingleLock.h"
 using namespace XFILE;
 using namespace std;
+#include <limits.h>
 #include <nfsc/libnfs-raw-mount.h>
 #include <nfsc/libnfs-raw-nfs.h>
 
index 3822a83..0e206fc 100644 (file)
@@ -345,7 +345,7 @@ bool CD3DEffect::CreateEffect()
     CLog::Log(LOGERROR, "CD3DEffect::CreateEffect(): %s", error.c_str());
   }
   else
-    CLog::Log(LOGERROR, "CD3DEffect::CreateEffect(): call to D3DXCreateEffect() failed with %l", hr);
+    CLog::Log(LOGERROR, "CD3DEffect::CreateEffect(): call to D3DXCreateEffect() failed with %" PRId32, hr);
   return false;
 }
 
index 85de478..401951f 100644 (file)
@@ -167,11 +167,10 @@ void CGUIDialogContentSettings::CreateSettings()
     break;
   case CONTENT_MUSICVIDEOS:
     {
-      AddBool(1,20346,&m_bScanRecursive, m_bShowScanSettings);
-      AddBool(2,20330,&m_bUseDirNames, m_bShowScanSettings);
-      AddBool(3,20346,&m_bScanRecursive, m_bShowScanSettings && ((m_bUseDirNames && !m_bSingleItem) || !m_bUseDirNames));
-      AddBool(4,20383,&m_bSingleItem, m_bShowScanSettings && (m_bUseDirNames && !m_bScanRecursive));
-      AddBool(5,20432,&m_bNoUpdate, m_bShowScanSettings);
+      AddBool(1,20330,&m_bUseDirNames, m_bShowScanSettings);
+      AddBool(2,20346,&m_bScanRecursive, m_bShowScanSettings && ((m_bUseDirNames && !m_bSingleItem) || !m_bUseDirNames));
+      AddBool(3,20383,&m_bSingleItem, m_bShowScanSettings && (m_bUseDirNames && !m_bScanRecursive));
+      AddBool(4,20432,&m_bNoUpdate, m_bShowScanSettings);
     }
     break;
   case CONTENT_ALBUMS:
index 0090d2e..8b29c4f 100644 (file)
@@ -1954,7 +1954,12 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC
     {
       CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
 #if defined(TARGET_DARWIN)
-      g_guiSettings.SetString("audiooutput.audiodevice", pControl->GetCurrentLabel());
+      // save the sinkname - since we don't have sinks on osx
+      // we need to get the fitting sinkname for the device label from the
+      // factory
+      std::string label2sink = pControl->GetCurrentLabel();
+      CAEFactory::VerifyOutputDevice(label2sink, false);
+      g_guiSettings.SetString("audiooutput.audiodevice", label2sink.c_str());
 #else
       g_guiSettings.SetString("audiooutput.audiodevice", m_AnalogAudioSinkMap[pControl->GetCurrentLabel()]);
 #endif
index da3e17b..bebf80b 100644 (file)
@@ -258,17 +258,14 @@ CJob *CJobManager::PopJob()
   {
     if (m_jobQueue[priority].size() && m_processing.size() < GetMaxWorkers(CJob::PRIORITY(priority)))
     {
-      CWorkItem job = m_jobQueue[priority].front();
-
       // skip adding any paused types
-      if (priority <= CJob::PRIORITY_LOW)
-      {
-        std::vector<std::string>::iterator i = find(m_pausedTypes.begin(), m_pausedTypes.end(), job.m_job->GetType());
-        if (i != m_pausedTypes.end())
-          return NULL;
-      }
+      if (!SkipPausedJobs((CJob::PRIORITY)priority))
+        return NULL;
 
+      // pop the job off the queue
+      CWorkItem job = m_jobQueue[priority].front();
       m_jobQueue[priority].pop_front();
+
       // add to the processing vector
       m_processing.push_back(job);
       job.m_job->m_callback = this;
@@ -302,6 +299,31 @@ bool CJobManager::IsPaused(const std::string &pausedType)
   return (i != m_pausedTypes.end());
 }
 
+bool CJobManager::SkipPausedJobs(CJob::PRIORITY priority)
+{
+  if (priority > CJob::PRIORITY_LOW)
+    return true;
+
+  // find the first unpaused job
+  JobQueue::iterator first_job = m_jobQueue[priority].begin();
+  for (; first_job != m_jobQueue[priority].end(); ++first_job)
+  {
+    std::vector<std::string>::iterator i = find(m_pausedTypes.begin(), m_pausedTypes.end(), first_job->m_job->GetType());
+    if (i == m_pausedTypes.end())
+      break; // found a job that can be performed
+  }
+  if (first_job == m_jobQueue[priority].end())
+    return false; // no jobs ready to go
+
+  // shunt all the paused ones to the back of the queue
+  for (JobQueue::iterator i = m_jobQueue[priority].begin(); i != first_job; i++)
+  {
+    m_jobQueue[priority].push_back(*i);
+    m_jobQueue[priority].pop_front();
+  }
+  return true;
+}
+
 int CJobManager::IsProcessing(const std::string &pausedType)
 {
   int jobsMatched = 0;
index ad0fb6b..dff1ab9 100644 (file)
@@ -304,6 +304,14 @@ private:
   void RemoveWorker(const CJobWorker *worker);
   unsigned int GetMaxWorkers(CJob::PRIORITY priority) const;
 
+  /*! \brief skips over any paused jobs of given priority.
+   Moves any paused jobs at the front of the queue to the back of the
+   queue, allowing unpaused jobs to continue processing.
+   \param priority the priority queue to consider.
+   \return true if an unpaused job is available, false if no unpaused jobs are available.
+   */
+  bool SkipPausedJobs(CJob::PRIORITY priority);
+
   unsigned int m_jobCounter;
 
   typedef std::deque<CWorkItem>    JobQueue;