Switch to unified view

a/libupnpp/control/mediarenderer.cxx b/libupnpp/control/mediarenderer.cxx
...
...
70
}
70
}
71
71
72
MediaRenderer::MediaRenderer(const UPnPDeviceDesc& desc)
72
MediaRenderer::MediaRenderer(const UPnPDeviceDesc& desc)
73
    : Device(desc)
73
    : Device(desc)
74
{
74
{
75
    bool found = false;
76
    for (auto& entry : desc.services) {
77
        if (RenderingControl::isRDCService(entry.serviceType)) {
78
            m_rdc = RDCH(new RenderingControl(desc, entry));
79
            found = true;
80
            break;
81
        }
82
    }
83
    if (!found) {
84
        LOGERR("MediaRenderer::MediaRenderer: RenderingControl service not "
85
               "found in device" << endl);
86
    }
87
88
    found = false;
89
    for (auto& entry : desc.services) {
90
        if (AVTransport::isAVTService(entry.serviceType)) {
91
            m_avt = AVTH(new AVTransport(desc, entry));
92
            found = true;
93
            break;
94
        }
95
    }
96
    if (!found) {
97
        LOGERR("MediaRenderer::MediaRenderer: AVTransport service not "
98
               "found in device" << endl);
99
    }
100
101
    found = false;
102
    for (auto& entry : desc.services) {
103
        if (OHProduct::isOHPrService(entry.serviceType)) {
104
            m_ohpr = OHPRH(new OHProduct(desc, entry));
105
            found = true;
106
            break;
107
        }
108
    }
109
    if (!found) {
110
        LOGINF("MediaRenderer::MediaRenderer: OHProduct service not " <<
111
               "found in device" << endl);
112
    }
113
114
    found = false;
115
    for (auto& entry : desc.services) {
116
        if (OHPlaylist::isOHPlService(entry.serviceType)) {
117
            m_ohpl = OHPLH(new OHPlaylist(desc, entry));
118
            found = true;
119
            break;
120
        }
121
    }
122
    if (!found) {
123
        LOGINF("MediaRenderer::MediaRenderer: OHPlaylist service not " <<
124
               "found in device" << endl);
125
    }
126
127
}
75
}
128
76
129
bool MediaRenderer::hasOpenHome()
77
bool MediaRenderer::hasOpenHome()
130
{
78
{
131
    return m_ohpr ? true : false;
79
    return ohpr() ? true : false;
80
}
81
82
83
RDCH MediaRenderer::rdc() 
84
{
85
    for (auto& entry : m_desc.services) {
86
        if (RenderingControl::isRDCService(entry.serviceType)) {
87
            m_rdc = RDCH(new RenderingControl(m_desc, entry));
88
            return m_rdc;
89
        }
90
    }
91
    LOGERR("MediaRenderer::rdc: RenderingControl service not found" << endl);
92
    return m_rdc;
93
}
94
95
AVTH MediaRenderer::avt() 
96
{
97
    for (auto& entry : m_desc.services) {
98
        if (AVTransport::isAVTService(entry.serviceType)) {
99
            return m_avt = AVTH(new AVTransport(m_desc, entry));
100
        }
101
    }
102
    LOGERR("MediaRenderer::avt: AVTransport service not found" << endl);
103
    return m_avt;
104
}
105
106
OHPRH MediaRenderer::ohpr() 
107
{
108
    for (auto& entry : m_desc.services) {
109
        if (OHProduct::isOHPrService(entry.serviceType)) {
110
            return m_ohpr = OHPRH(new OHProduct(m_desc, entry));
111
        }
112
    }
113
    LOGINF("MediaRenderer::ohpr: OHProduct service not found" << endl);
114
    return m_ohpr;
115
}
116
117
OHPLH MediaRenderer::ohpl() 
118
{
119
    for (auto& entry : m_desc.services) {
120
        if (OHPlaylist::isOHPlService(entry.serviceType)) {
121
            return m_ohpl = OHPLH(new OHPlaylist(m_desc, entry));
122
        }
123
    }
124
    LOGINF("MediaRenderer::ohpl: OHPlaylist service not found" << endl);
125
    return m_ohpl;
132
}
126
}
133
127
134
}
128
}
135
129