1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include "Media.h"
namespace plexclient
{
Media::Media(Poco::XML::Node* pNode)
{
NodeIterator it(pNode, Poco::XML::NodeFilter::SHOW_ALL);
Poco::XML::Node* pChildNode = it.nextNode();
while(pChildNode) {
if(Poco::icompare(pChildNode->nodeName(), "Media") == 0) {
Poco::XML::AutoPtr<Poco::XML::NamedNodeMap> pAttribs = pChildNode->attributes();
m_sVideoResolution = GetNodeValue(pAttribs->getNamedItem("videoResolution"));
m_iId = GetNodeValueAsInt(pAttribs->getNamedItem("id"));
m_lDuration = GetNodeValueAsLong(pAttribs->getNamedItem("duration"));
m_iBitrate = GetNodeValueAsInt(pAttribs->getNamedItem("bitrate"));
m_iWidth = GetNodeValueAsInt(pAttribs->getNamedItem("width"));
m_iHeight = GetNodeValueAsInt(pAttribs->getNamedItem("height"));
m_sAspectRatio = GetNodeValue(pAttribs->getNamedItem("aspectRatio"));
m_iAudioChannels = GetNodeValueAsInt(pAttribs->getNamedItem("audioChannels"));
m_sAudioCodec = GetNodeValue(pAttribs->getNamedItem("audioCodec"));
m_sVideoCodec = GetNodeValue(pAttribs->getNamedItem("videoCodec"));
m_sContainer = GetNodeValue(pAttribs->getNamedItem("container"));
m_VideoFrameRate = GetNodeValue(pAttribs->getNamedItem("videoFrameRate"));
pAttribs->release();
}
if(Poco::icompare(pChildNode->nodeName(), "Part") == 0) {
Poco::XML::AutoPtr<Poco::XML::NamedNodeMap> pAttribs = pChildNode->attributes();
m_sPartKey = GetNodeValue(pAttribs->getNamedItem("key"));
m_iPartId = GetNodeValueAsInt(pAttribs->getNamedItem("id"));
m_lPartDuration = GetNodeValueAsLong(pAttribs->getNamedItem("duration"));
m_sPartFile = GetNodeValue(pAttribs->getNamedItem("file"));
m_lPartSize = GetNodeValueAsLong(pAttribs->getNamedItem("size"));
m_sPartContainer = GetNodeValue(pAttribs->getNamedItem("container"));
pAttribs->release();
}
if(Poco::icompare(pChildNode->nodeName(), "Stream") == 0) {
m_vStreams.push_back(Stream(pChildNode));
}
pChildNode = it.nextNode();
}
}
void Media::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid)
{
grid->AddStringToken("videoResolution", m_sVideoResolution);
grid->AddIntToken("bitrate", m_iBitrate);
grid->AddIntToken("width", m_iWidth);
grid->AddIntToken("height", m_iHeight);
grid->AddIntToken("audioChannels", m_iAudioChannels);
grid->AddStringToken("aspectRatio", m_sAspectRatio);
grid->AddStringToken("audioCodec", m_sAudioCodec);
grid->AddStringToken("videoCodec", m_sVideoCodec);
grid->AddStringToken("container", m_sContainer);
grid->AddStringToken("videoFrameRate", m_VideoFrameRate);
}
}
|