[vlc-commits] demux: dash: parse program info
Francois Cartegnie
git at videolan.org
Wed Dec 24 22:38:14 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 24 20:04:39 2014 +0100| [98df0fd92e104713d4a00ee34b68353960063346] | committer: Francois Cartegnie
demux: dash: parse program info
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=98df0fd92e104713d4a00ee34b68353960063346
---
modules/stream_filter/dash/mpd/IsoffMainParser.cpp | 29 ++++++++++++++++++++
modules/stream_filter/dash/mpd/IsoffMainParser.h | 1 +
2 files changed, 30 insertions(+)
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index 8da7adf..7e9ba65 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -29,6 +29,7 @@
#include "IsoffMainParser.h"
#include "SegmentTemplate.h"
#include "SegmentInfoDefault.h"
+#include "ProgramInformation.h"
#include "xml/DOMHelper.h"
#include <vlc_strings.h>
#include <vlc_stream.h>
@@ -50,6 +51,7 @@ bool IsoffMainParser::parse (Profile profile)
{
mpd = new MPD(p_stream, profile);
setMPDAttributes();
+ parseProgramInformation(DOMHelper::getFirstChildElementByName(root, "ProgramInformation"), mpd);
setMPDBaseUrl(root);
parsePeriods(root);
@@ -329,6 +331,33 @@ void IsoffMainParser::setInitSegment (dash::xml::Node *segBaseNode, Segme
}
}
+void IsoffMainParser::parseProgramInformation(Node * node, MPD *mpd)
+{
+ if(!node)
+ return;
+
+ ProgramInformation *info = new (std::nothrow) ProgramInformation();
+ if (info)
+ {
+ Node *child = DOMHelper::getFirstChildElementByName(node, "Title");
+ if(child)
+ info->setTitle(child->getText());
+
+ child = DOMHelper::getFirstChildElementByName(node, "Source");
+ if(child)
+ info->setSource(child->getText());
+
+ child = DOMHelper::getFirstChildElementByName(node, "Copyright");
+ if(child)
+ info->setCopyright(child->getText());
+
+ if(node->hasAttribute("moreInformationURL"))
+ info->setMoreInformationUrl(node->getAttributeValue("moreInformationURL"));
+
+ mpd->setProgramInformation(info);
+ }
+}
+
void IsoffMainParser::print ()
{
if(mpd)
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.h b/modules/stream_filter/dash/mpd/IsoffMainParser.h
index f8212d3..0c98b46 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.h
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.h
@@ -59,6 +59,7 @@ namespace dash
void parseSegmentBase (dash::xml::Node *, SegmentInformation *);
size_t parseSegmentList (dash::xml::Node *, SegmentInformation *);
size_t parseSegmentTemplate(dash::xml::Node *, SegmentInformation *);
+ void parseProgramInformation(dash::xml::Node *, MPD *);
};
class IsoTime
More information about the vlc-commits
mailing list