Switch to unified view

a/src/ohreceiver.cxx b/src/ohreceiver.cxx
...
...
25
#include <iostream>                     // for endl, etc
25
#include <iostream>                     // for endl, etc
26
#include <string>                       // for string, allocator, etc
26
#include <string>                       // for string, allocator, etc
27
#include <utility>                      // for pair
27
#include <utility>                      // for pair
28
#include <vector>                       // for vector
28
#include <vector>                       // for vector
29
29
30
#define LOCAL_LOGINC 4
31
#include "libupnpp/log.hxx"             // for LOGDEB, LOGERR
30
#include "libupnpp/log.hxx"             // for LOGDEB, LOGERR
32
#include "libupnpp/soaphelp.hxx"        // for SoapArgs, SoapData, i2s, etc
31
#include "libupnpp/soaphelp.hxx"        // for SoapArgs, SoapData, i2s, etc
33
32
34
#include "mpdcli.hxx"                   // for MpdStatus, UpSong, MPDCli, etc
33
#include "mpdcli.hxx"                   // for MpdStatus, UpSong, MPDCli, etc
35
#include "upmpd.hxx"                    // for UpMpd, etc
34
#include "upmpd.hxx"                    // for UpMpd, etc
...
...
100
        changed = diffmaps(m_state, state);
99
        changed = diffmaps(m_state, state);
101
    }
100
    }
102
    m_state = state;
101
    m_state = state;
103
102
104
    for (auto it = changed.begin(); it != changed.end(); it++) {
103
    for (auto it = changed.begin(); it != changed.end(); it++) {
105
        LOGDEB("OHReceiver::getEventData: changed: " << it->first <<
104
        //LOGDEB("OHReceiver::getEventData: changed: " << it->first <<
106
               " = " << it->second << endl);
105
        // " = " << it->second << endl);
107
        names.push_back(it->first);
106
        names.push_back(it->first);
108
        values.push_back(it->second);
107
        values.push_back(it->second);
109
    }
108
    }
110
109
111
    return true;
110
    return true;
...
...
158
    } else {
157
    } else {
159
        LOGDEB("OHReceiver::play: scmpdcli pid "<< m_cmd->getChildPid()<< endl);
158
        LOGDEB("OHReceiver::play: scmpdcli pid "<< m_cmd->getChildPid()<< endl);
160
    }
159
    }
161
    // Wait for scmpdcli to signal ready, then play
160
    // Wait for scmpdcli to signal ready, then play
162
    m_cmd->getline(line);
161
    m_cmd->getline(line);
163
    LOGDEB("OHReceiver got " << line << " from scmpdcli" << endl);
162
    LOGDEB("OHReceiver: scmpdcli sent: " << line);
164
163
165
    // And insert the appropriate uri in the mpd playlist
164
    // And insert the appropriate uri in the mpd playlist
166
    if (!m_pl->urlMap(urlmap)) {
165
    if (!m_pl->urlMap(urlmap)) {
167
        LOGERR("OHReceiver::play: urlMap() failed" <<endl);
166
        LOGERR("OHReceiver::play: urlMap() failed" <<endl);
168
        goto out;
167
        goto out;
...
...
185
    if (!ok) {
184
    if (!ok) {
186
        LOGERR("OHReceiver::play: play() failed\n");
185
        LOGERR("OHReceiver::play: play() failed\n");
187
        goto out;
186
        goto out;
188
    }
187
    }
189
188
190
    maybeWakeUp(ok);
191
192
out:
189
out:
193
    if (!ok) {
190
    if (!ok) {
194
        iStop();
191
        iStop();
195
    }
192
    }
193
    maybeWakeUp(ok);
196
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
194
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
197
}
195
}
198
196
199
bool OHReceiver::iStop()
197
bool OHReceiver::iStop()
200
{
198
{
201
    if (m_cmd) {
199
    if (m_cmd) {
202
        m_cmd->zapChild();
200
        m_cmd->zapChild();
203
        m_cmd = shared_ptr<ExecCmd>(0);
201
        m_cmd = shared_ptr<ExecCmd>(0);
204
    }
202
    }
205
    return m_dev->m_mpdcli->stop();
203
    m_dev->m_mpdcli->stop();
204
205
    unordered_map<int, string> urlmap;
206
    // Remove our bogus URi from the playlist
207
    if (!m_pl->urlMap(urlmap)) {
208
        LOGERR("OHReceiver::stop: urlMap() failed" <<endl);
209
        return false;
210
    }
211
    for (auto it = urlmap.begin(); it != urlmap.end(); it++) {
212
        if (it->second == m_httpuri) {
213
            m_dev->m_mpdcli->deleteId(it->first);
214
        }
215
    }
216
    return true;
206
}
217
}
207
218
208
int OHReceiver::stop(const SoapArgs& sc, SoapData& data)
219
int OHReceiver::stop(const SoapArgs& sc, SoapData& data)
209
{
220
{
210
    LOGDEB("OHReceiver::stop" << endl);
221
    LOGDEB("OHReceiver::stop" << endl);