summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2019-04-15 19:18:30 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-04-22 12:51:34 +0800
commit613ca7b100acbce6728e9793cdb634c852d13900 (patch)
treebf6122eddec5ae40ccc5dc8e6bab82c1a69017c2
parentdf9ef925f97d744cf35f38282cff9a0e2f773bb4 (diff)
avformat/dashdec: add ProgramInformation parser
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
-rw-r--r--libavformat/dashdec.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index eed149cd1a..6e3e7e4f1e 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1161,6 +1161,34 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
return 0;
}
+static int parse_programinformation(AVFormatContext *s, xmlNodePtr node)
+{
+ xmlChar *val = NULL;
+
+ node = xmlFirstElementChild(node);
+ while (node) {
+ if (!av_strcasecmp(node->name, "Title")) {
+ val = xmlNodeGetContent(node);
+ if (val) {
+ av_dict_set(&s->metadata, "Title", val, 0);
+ }
+ } else if (!av_strcasecmp(node->name, "Source")) {
+ val = xmlNodeGetContent(node);
+ if (val) {
+ av_dict_set(&s->metadata, "Source", val, 0);
+ }
+ } else if (!av_strcasecmp(node->name, "Copyright")) {
+ val = xmlNodeGetContent(node);
+ if (val) {
+ av_dict_set(&s->metadata, "Copyright", val, 0);
+ }
+ }
+ node = xmlNextElementSibling(node);
+ xmlFree(val);
+ }
+ return 0;
+}
+
static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
{
DASHContext *c = s->priv_data;
@@ -1310,6 +1338,8 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
if (c->period_start > 0)
c->media_presentation_duration = c->period_duration;
}
+ } else if (!av_strcasecmp(node->name, "ProgramInformation")) {
+ parse_programinformation(s, node);
}
node = xmlNextElementSibling(node);
}