Switch to unified view

a/src/ohproduct.cxx b/src/ohproduct.cxx
...
...
272
        return UPNP_E_SUCCESS;
272
        return UPNP_E_SUCCESS;
273
    }
273
    }
274
274
275
    m_dev->m_ohif->setMetatext("");
275
    m_dev->m_ohif->setMetatext("");
276
276
277
    bool ok = true;
277
    string curtp = o_sources[m_sourceIndex].first;
278
    string curtp = o_sources[m_sourceIndex].first;
278
    string curnm = o_sources[m_sourceIndex].second;
279
    string curnm = o_sources[m_sourceIndex].second;
279
    if (m_dev->m_ohpl && !curtp.compare("Playlist") &&
280
    if (m_dev->m_ohpl && !curtp.compare("Playlist") &&
280
        !curnm.compare("Playlist")) {
281
        !curnm.compare("Playlist")) {
281
        m_dev->m_ohpl->setActive(false);
282
        m_dev->m_ohpl->setActive(false);
...
...
288
        m_dev->m_ohrd->setActive(false);
289
        m_dev->m_ohrd->setActive(false);
289
    } else if (m_dev->m_sndrcv && m_dev->m_ohpl &&
290
    } else if (m_dev->m_sndrcv && m_dev->m_ohpl &&
290
               !curtp.compare("Playlist") &&
291
               !curtp.compare("Playlist") &&
291
               !curnm.compare(SndRcvPLName)) {
292
               !curnm.compare(SndRcvPLName)) {
292
        m_dev->m_ohpl->setActive(false);
293
        m_dev->m_ohpl->setActive(false);
293
        m_dev->m_sndrcv->stop();
294
        ok = m_dev->m_sndrcv->stop();
294
    } else if (m_dev->m_sndrcv && m_dev->m_ohrd &&
295
    } else if (m_dev->m_sndrcv && m_dev->m_ohrd &&
295
               !curtp.compare("Radio") &&
296
               !curtp.compare("Radio") &&
296
               !curnm.compare(SndRcvRDName)) {
297
               !curnm.compare(SndRcvRDName)) {
297
        m_dev->setRadio(false);
298
        m_dev->setRadio(false);
298
        m_dev->m_ohrd->setActive(false);
299
        m_dev->m_ohrd->setActive(false);
299
        m_dev->m_sndrcv->stop();
300
        ok = m_dev->m_sndrcv->stop();
300
    } else {
301
    } else {
301
        // External inputs managed by scripts Analog/Digital/Hdmi etc.
302
        // External inputs managed by scripts Analog/Digital/Hdmi etc.
302
        m_dev->m_sndrcv->stop();
303
        ok = m_dev->m_sndrcv->stop();
303
    }
304
    }
305
306
    if (!ok)
307
        return UPNP_E_INTERNAL_ERROR;
304
308
305
    string newtp = o_sources[sindex].first;
309
    string newtp = o_sources[sindex].first;
306
    string newnm = o_sources[sindex].second;
310
    string newnm = o_sources[sindex].second;
307
    if (m_dev->m_ohpl && !newnm.compare("Playlist")) {
311
    if (m_dev->m_ohpl && !newnm.compare("Playlist")) {
308
        m_dev->m_ohpl->setActive(true);
312
        m_dev->m_ohpl->setActive(true);
...
...
311
    } else if (m_dev->m_ohrd && !newnm.compare("Radio")) {
315
    } else if (m_dev->m_ohrd && !newnm.compare("Radio")) {
312
        m_dev->setRadio(true);
316
        m_dev->setRadio(true);
313
        m_dev->m_ohrd->setActive(true);
317
        m_dev->m_ohrd->setActive(true);
314
    } else if (m_dev->m_ohpl && m_dev->m_sndrcv &&
318
    } else if (m_dev->m_ohpl && m_dev->m_sndrcv &&
315
               !newnm.compare(SndRcvPLName)) {
319
               !newnm.compare(SndRcvPLName)) {
316
        m_dev->m_sndrcv->start(string(), 0 /*savedms*/);
320
        ok = m_dev->m_sndrcv->start(string(), 0 /*savedms*/);
317
        m_dev->m_ohpl->setActive(true);
321
        m_dev->m_ohpl->setActive(true);
318
    } else if (m_dev->m_ohrd && m_dev->m_sndrcv &&
322
    } else if (m_dev->m_ohrd && m_dev->m_sndrcv &&
319
               !newnm.compare(SndRcvRDName)) {
323
               !newnm.compare(SndRcvRDName)) {
320
        m_dev->m_sndrcv->start(string());
324
        ok = m_dev->m_sndrcv->start(string());
321
        m_dev->m_ohrd->setActive(true);
325
        m_dev->m_ohrd->setActive(true);
322
    } else {
326
    } else {
323
        string sname = newtp + "-" + newnm;
327
        string sname = newtp + "-" + newnm;
324
        string spath = path_cat(scripts_dir, sname);
328
        string spath = path_cat(scripts_dir, sname);
325
        m_dev->m_sndrcv->start(spath);
329
        ok = m_dev->m_sndrcv->start(spath);
326
    }
330
    }
327
    m_sourceIndex = sindex;
331
    m_sourceIndex = sindex;
328
332
329
    m_dev->loopWakeup();
333
    m_dev->loopWakeup();
330
334
331
    return UPNP_E_SUCCESS;
335
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
332
}
336
}
333
337
334
int OHProduct::setSourceIndex(const SoapIncoming& sc, SoapOutgoing&)
338
int OHProduct::setSourceIndex(const SoapIncoming& sc, SoapOutgoing&)
335
{
339
{
336
    LOGDEB("OHProduct::setSourceIndex" << endl);
340
    LOGDEB("OHProduct::setSourceIndex" << endl);