Switch to side-by-side view

--- a/src/ohproduct.cxx
+++ b/src/ohproduct.cxx
@@ -57,7 +57,9 @@
 {
     // Playlist must stay first.
     o_sources.push_back(pair<string,string>("Playlist","Playlist"));
-    o_sources.push_back(pair<string, string>("Radio", "Radio"));
+    if (m_dev->m_ohrd) {
+        o_sources.push_back(pair<string, string>("Radio", "Radio"));
+    }
     if (m_dev->m_ohrcv) {
         o_sources.push_back(pair<string,string>("Receiver", "Receiver"));
         if (m_dev->m_sndrcv &&
@@ -70,8 +72,10 @@
             // tell ohreceiver about using the right one.
             o_sources.push_back(pair<string,string>("Playlist",
                                                     "SenderReceiverPL"));
-            o_sources.push_back(pair<string,string>("Radio",
-                                                    "SenderReceiverRD"));
+            if (m_dev->m_ohrd) {
+                o_sources.push_back(pair<string,string>("Radio",
+                                                        "SenderReceiverRD"));
+            }
         }
     }
 
@@ -269,44 +273,51 @@
         int savedms = mpds.songelapsedms;
 
         m_dev->m_ohif->setMetatext("");
+
         string curnm = o_sources[m_sourceIndex].second;
-        if (!curnm.compare("Playlist") && m_dev->m_ohpl) {
+        if (m_dev->m_ohpl && !curnm.compare("Playlist")) {
             m_dev->m_ohpl->iStop();
             m_dev->m_ohpl->setActive(false);
-        } else if (!curnm.compare("Receiver") && m_dev->m_ohrcv) {
+        } else if (m_dev->m_ohrcv && !curnm.compare("Receiver")) {
             m_dev->m_ohrcv->iStop();
             m_dev->m_ohrcv->setActive(false);
-        } else if (!curnm.compare("Radio") && m_dev->m_ohrd) {
+        } else if (m_dev->m_ohrd && !curnm.compare("Radio")) {
             m_dev->m_ohrd->iStop();
             m_dev->m_ohrd->setActive(false);
-        } else if (m_dev->m_sndrcv && !curnm.compare("SenderReceiverPL")) {
-            m_dev->m_ohpl->iStop();
+        } else if (m_dev->m_sndrcv && m_dev->m_ohpl &&
+                   !curnm.compare("SenderReceiverPL")) {
+            m_dev->m_sndrcv->stop();
             m_dev->m_ohpl->setActive(false);
-            m_dev->m_sndrcv->stop();
-        } else if (m_dev->m_sndrcv && !curnm.compare("SenderReceiverRD")) {
-            m_dev->m_ohrd->iStop();
+        } else if (m_dev->m_sndrcv && m_dev->m_ohrd &&
+                   !curnm.compare("SenderReceiverRD")) {
             m_dev->m_ohrd->setActive(false);
             m_dev->m_sndrcv->stop();
         }
 
         string newnm = o_sources[sindex].second;
-        if (!newnm.compare("Playlist")) {
+        if (m_dev->m_ohpl && !newnm.compare("Playlist")) {
             m_dev->m_ohpl->setActive(true);
-        } else if (!newnm.compare("Receiver")) {
+            m_sourceIndex = sindex;
+        } else if (m_dev->m_ohrcv && !newnm.compare("Receiver")) {
             m_dev->m_ohrcv->setActive(true);
-        } else if (!newnm.compare("Radio")) {
+            m_sourceIndex = sindex;
+        } else if (m_dev->m_ohrd && !newnm.compare("Radio")) {
             m_dev->m_ohrd->setActive(true);
-        } else if (!newnm.compare("SenderReceiverPL")) {
+            m_sourceIndex = sindex;
+        } else if (m_dev->m_ohpl && m_dev->m_sndrcv &&
+                   !newnm.compare("SenderReceiverPL")) {
             // Events are generated by playlist
             m_dev->m_ohpl->setActive(true);
             m_dev->m_sndrcv->start(false, savedms);
-        } else if (!newnm.compare("SenderReceiverRD")) {
+            m_sourceIndex = sindex;
+        } else if (m_dev->m_ohrd && m_dev->m_sndrcv &&
+                   !newnm.compare("SenderReceiverRD")) {
             // Events are generated by radio
             m_dev->m_ohrd->setActive(true);
             m_dev->m_sndrcv->start(true, 0);
+            m_sourceIndex = sindex;
         }
 
-        m_sourceIndex = sindex;
         m_dev->loopWakeup();
     }
     return UPNP_E_SUCCESS;
@@ -359,7 +370,8 @@
     data.addarg("SystemName", m_roomOrName);
     data.addarg("Type", o_sources[sindex].first);
     data.addarg("Name", o_sources[sindex].second);
-    data.addarg("Visible", "1");
+    string visible = o_sources[sindex].first.compare("Receiver") ? "1" : "0";
+    data.addarg("Visible", visible);
     return UPNP_E_SUCCESS;
 }