Skip to content
This repository
Browse code

settings: migrate old audiooutput.channellayout setting to audiooutpu…

…t.channels and reset audiooutput.audiodevice if necessary
  • Loading branch information...
commit 6b99d90f9342c489fd02d29fdeb9376748f805cd 1 parent 938ea02
Sascha Montellese authored November 22, 2012

Showing 1 changed file with 29 additions and 0 deletions. Show diff stats Hide diff stats

  1. 29  xbmc/settings/GUISettings.cpp
29  xbmc/settings/GUISettings.cpp
@@ -1354,10 +1354,35 @@ void CGUISettings::GetSettingsGroup(CSettingsCategory* cat, vecSettings &setting
1354 1354
 
1355 1355
 void CGUISettings::LoadXML(TiXmlElement *pRootElement, bool hideSettings /* = false */)
1356 1356
 { // load our stuff...
  1357
+  bool updated = false;
  1358
+
1357 1359
   for (mapIter it = settingsMap.begin(); it != settingsMap.end(); it++)
1358 1360
   {
1359 1361
     LoadFromXML(pRootElement, it, hideSettings);
1360 1362
   }
  1363
+
  1364
+  // check if we are updating to Frodo and need to update from
  1365
+  // audiooutput.channellayout to audiooutput.channels
  1366
+  TiXmlNode *channelNode = pRootElement->FirstChild("audiooutput");
  1367
+  if (channelNode != NULL)
  1368
+  {
  1369
+    channelNode = channelNode->FirstChild("channellayout");
  1370
+    CSettingInt* channels = (CSettingInt*)GetSetting("audiooutput.channels");
  1371
+    if (channelNode != NULL && channelNode->FirstChild() != NULL && channels != NULL)
  1372
+    {
  1373
+      channels->FromString(channelNode->FirstChild()->ValueStr());
  1374
+      if (channels->GetData() < AE_CH_LAYOUT_MAX - 1)
  1375
+        channels->SetData(channels->GetData() + 1);
  1376
+
  1377
+      // let's just reset the audiodevice settings as well
  1378
+      std::string audiodevice = GetString("audiooutput.audiodevice");
  1379
+      CAEFactory::VerifyOutputDevice(audiodevice, false);
  1380
+      SetString("audiooutput.audiodevice", audiodevice.c_str());
  1381
+
  1382
+      updated = true;
  1383
+    }
  1384
+  }
  1385
+
1361 1386
   // Get hardware based stuff...
1362 1387
   CLog::Log(LOGNOTICE, "Getting hardware information now...");
1363 1388
   // FIXME: Check if the hardware supports it (if possible ;)
@@ -1401,6 +1426,7 @@ void CGUISettings::LoadXML(TiXmlElement *pRootElement, bool hideSettings /* = fa
1401 1426
     {
1402 1427
       timezone = g_timezone.GetOSConfiguredTimezone();
1403 1428
       SetString("locale.timezone", timezone);
  1429
+      updated = true;
1404 1430
     }
1405 1431
     g_timezone.SetTimezone(timezone);
1406 1432
   }
@@ -1417,6 +1443,9 @@ void CGUISettings::LoadXML(TiXmlElement *pRootElement, bool hideSettings /* = fa
1417 1443
     g_langInfo.SetSubtitleLanguage(streamLanguage);
1418 1444
   else
1419 1445
     g_langInfo.SetSubtitleLanguage("");
  1446
+
  1447
+  if (updated)
  1448
+    g_settings.Save();
1420 1449
 }
1421 1450
 
1422 1451
 void CGUISettings::LoadFromXML(TiXmlElement *pRootElement, mapIter &it, bool advanced /* = false */)

0 notes on commit 6b99d90

Memphiz

Shouldn't this code be found somewhere else too? I have the feeling that its saving the wrong label for me for audiooutput.audiodevice on osx.

The sinkname is CoreAudio:HDMI ... the Label is HDMI ... saved setting in my guisettings.xml is "HDMI". Now when i enter the audio settings dialog it just shows me the first device - no matter what i have selected before. This is because it compares the sinknames with the label in my case (CoreAudio:HDMI != HDMI).

So what am i missing?

Obviously i didn't run into that code here and after that it just saved the label instead of the sink name.

Memphiz

http://pastebin.com/ww1R2npy <- this would fix it for me - but i don't know what is right and wrong here...

Please sign in to comment.
Something went wrong with that request. Please try again.