Switch to unified view

a/src/ohsndrcv.cxx b/src/ohsndrcv.cxx
...
...
45
    // uninvolved
45
    // uninvolved
46
    Internal(UpMpd *dv, const string& starterpath, int port)
46
    Internal(UpMpd *dv, const string& starterpath, int port)
47
        : dev(dv), makeisendercmd(starterpath), mpdport(port) {
47
        : dev(dv), makeisendercmd(starterpath), mpdport(port) {
48
        // Stream volume control ? This decides if the aux mpd has
48
        // Stream volume control ? This decides if the aux mpd has
49
        // mixer "software" or "none"
49
        // mixer "software" or "none"
50
        std::unique_lock<std::mutex>(g_configlock);
51
        string value;
50
        string value;
52
        if (g_config->get("scstreamscaled", value)) {
51
        if (g_config->get("scstreamscaled", value)) {
53
            scalestream = atoi(value.c_str()) != 0;
52
            scalestream = atoi(value.c_str()) != 0;
53
        }
54
        if (g_config->get("scscriptgracesecs", value)) {
55
            graceperiodms = atoi(value.c_str()) * 1000;
54
        }
56
        }
55
    }
57
    }
56
    ~Internal() {
58
    ~Internal() {
57
        clear();
59
        clear();
58
    }
60
    }
...
...
76
    string iuri;
78
    string iuri;
77
    string imeta;
79
    string imeta;
78
    string makeisendercmd;
80
    string makeisendercmd;
79
    int mpdport;
81
    int mpdport;
80
    bool scalestream{true};
82
    bool scalestream{true};
83
    int graceperiodms{0};
81
};
84
};
82
85
83
86
84
SenderReceiver::SenderReceiver(UpMpd *dev, const string& starterpath, int port)
87
SenderReceiver::SenderReceiver(UpMpd *dev, const string& starterpath, int port)
85
{
88
{
...
...
124
    ExecCmd *sndcmd = nullptr;
127
    ExecCmd *sndcmd = nullptr;
125
128
126
    if (script.empty() && !m->isender) {
129
    if (script.empty() && !m->isender) {
127
        // Internal source, first time: Start fifo MPD and Sender
130
        // Internal source, first time: Start fifo MPD and Sender
128
        m->isender = sndcmd = new ExecCmd();
131
        m->isender = sndcmd = new ExecCmd();
132
        if (m->graceperiodms) {
133
            sndcmd->setKillTimeout(m->graceperiodms);
134
        }
129
        vector<string> args;
135
        vector<string> args;
130
        args.push_back("-p");
136
        args.push_back("-p");
131
        args.push_back(SoapHelp::i2s(m->mpdport));
137
        args.push_back(SoapHelp::i2s(m->mpdport));
132
        args.push_back("-f");
138
        args.push_back("-f");
133
        args.push_back(m->dev->m_friendlyname);
139
        args.push_back(m->dev->m_friendlyname);
...
...
137
    } else if (!script.empty()) {
143
    } else if (!script.empty()) {
138
        // External source. ssender should already be zero, we delete
144
        // External source. ssender should already be zero, we delete
139
        // it just in case
145
        // it just in case
140
        deleteZ(m->ssender);
146
        deleteZ(m->ssender);
141
        m->ssender = sndcmd = new ExecCmd();
147
        m->ssender = sndcmd = new ExecCmd();
148
        if (m->graceperiodms) {
149
            sndcmd->setKillTimeout(m->graceperiodms);
150
        }
142
        vector<string> args;
151
        vector<string> args;
143
        args.push_back("-f");
152
        args.push_back("-f");
144
        args.push_back(m->dev->m_friendlyname);
153
        args.push_back(m->dev->m_friendlyname);
145
        // This does nothing, just for consistence.
154
        // This does nothing, just for consistence.
146
        if (!m->scalestream)
155
        if (!m->scalestream)