[FFmpeg-devel] [PATCH 1/5] lavf/dashdec: fix 'adaption' typo

rcombs rcombs at rcombs.me
Thu Jun 11 07:43:08 EEST 2020


---
 libavformat/dashdec.c | 96 +++++++++++++++++++++----------------------
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 1bd070c7cb..c94ce2caca 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -148,7 +148,7 @@ typedef struct DASHContext {
     uint64_t period_start;
 
     /* AdaptationSet Attribute */
-    char *adaptionset_lang;
+    char *adaptationset_lang;
 
     int is_live;
     AVIOInterruptCB *interrupt_callback;
@@ -822,16 +822,16 @@ end:
 
 static int parse_manifest_representation(AVFormatContext *s, const char *url,
                                          xmlNodePtr node,
-                                         xmlNodePtr adaptionset_node,
+                                         xmlNodePtr adaptationset_node,
                                          xmlNodePtr mpd_baseurl_node,
                                          xmlNodePtr period_baseurl_node,
                                          xmlNodePtr period_segmenttemplate_node,
                                          xmlNodePtr period_segmentlist_node,
                                          xmlNodePtr fragment_template_node,
                                          xmlNodePtr content_component_node,
-                                         xmlNodePtr adaptionset_baseurl_node,
-                                         xmlNodePtr adaptionset_segmentlist_node,
-                                         xmlNodePtr adaptionset_supplementalproperty_node)
+                                         xmlNodePtr adaptationset_baseurl_node,
+                                         xmlNodePtr adaptationset_segmentlist_node,
+                                         xmlNodePtr adaptationset_supplementalproperty_node)
 {
     int32_t ret = 0;
     int32_t subtitle_rep_idx = 0;
@@ -866,9 +866,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
     // try get information from contentComponen
     if (type == AVMEDIA_TYPE_UNKNOWN)
         type = get_content_type(content_component_node);
-    // try get information from adaption set
+    // try get information from adaptation set
     if (type == AVMEDIA_TYPE_UNKNOWN)
-        type = get_content_type(adaptionset_node);
+        type = get_content_type(adaptationset_node);
     if (type == AVMEDIA_TYPE_UNKNOWN) {
         av_log(s, AV_LOG_VERBOSE, "Parsing '%s' - skipp not supported representation type\n", url);
     } else if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO || type == AVMEDIA_TYPE_SUBTITLE) {
@@ -878,8 +878,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
             ret = AVERROR(ENOMEM);
             goto end;
         }
-        if (c->adaptionset_lang) {
-            rep->lang = av_strdup(c->adaptionset_lang);
+        if (c->adaptationset_lang) {
+            rep->lang = av_strdup(c->adaptationset_lang);
             if (!rep->lang) {
                 av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
                 av_freep(&rep);
@@ -894,7 +894,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
 
         baseurl_nodes[0] = mpd_baseurl_node;
         baseurl_nodes[1] = period_baseurl_node;
-        baseurl_nodes[2] = adaptionset_baseurl_node;
+        baseurl_nodes[2] = adaptationset_baseurl_node;
         baseurl_nodes[3] = representation_baseurl_node;
 
         ret = resolve_content_path(s, url, &c->max_url_size, baseurl_nodes, 4);
@@ -907,7 +907,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
         if (representation_segmenttemplate_node || fragment_template_node || period_segmenttemplate_node) {
             fragment_timeline_node = NULL;
             fragment_templates_tab[0] = representation_segmenttemplate_node;
-            fragment_templates_tab[1] = adaptionset_segmentlist_node;
+            fragment_templates_tab[1] = adaptationset_segmentlist_node;
             fragment_templates_tab[2] = fragment_template_node;
             fragment_templates_tab[3] = period_segmenttemplate_node;
             fragment_templates_tab[4] = period_segmentlist_node;
@@ -964,11 +964,11 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
                 av_log(s, AV_LOG_TRACE, "rep->first_seq_no = [%"PRId64"]\n", rep->first_seq_no);
                 xmlFree(startnumber_val);
             }
-            if (adaptionset_supplementalproperty_node) {
-                if (!av_strcasecmp(xmlGetProp(adaptionset_supplementalproperty_node,"schemeIdUri"), "http://dashif.org/guidelines/last-segment-number")) {
-                    val = xmlGetProp(adaptionset_supplementalproperty_node,"value");
+            if (adaptationset_supplementalproperty_node) {
+                if (!av_strcasecmp(xmlGetProp(adaptationset_supplementalproperty_node,"schemeIdUri"), "http://dashif.org/guidelines/last-segment-number")) {
+                    val = xmlGetProp(adaptationset_supplementalproperty_node,"value");
                     if (!val) {
-                        av_log(s, AV_LOG_ERROR, "Missing value attribute in adaptionset_supplementalproperty_node\n");
+                        av_log(s, AV_LOG_ERROR, "Missing value attribute in adaptationset_supplementalproperty_node\n");
                     } else {
                         rep->last_seq_no =(int64_t) strtoll(val, NULL, 10) - 1;
                         xmlFree(val);
@@ -981,7 +981,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
             if (!fragment_timeline_node)
                 fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline");
             if (!fragment_timeline_node)
-                fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline");
+                fragment_timeline_node = find_child_node_by_name(adaptationset_segmentlist_node, "SegmentTimeline");
             if (!fragment_timeline_node)
                 fragment_timeline_node = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline");
             if (fragment_timeline_node) {
@@ -1013,7 +1013,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
             // http://www-itec.uni-klu.ac.at/dash/ddash/mpdGenerator.php?fragmentlength=15&type=full
             xmlNodePtr fragmenturl_node = NULL;
             segmentlists_tab[0] = representation_segmentlist_node;
-            segmentlists_tab[1] = adaptionset_segmentlist_node;
+            segmentlists_tab[1] = adaptationset_segmentlist_node;
             segmentlists_tab[2] = period_segmentlist_node;
 
             duration_val = get_val_from_nodes_tab(segmentlists_tab, 3, "duration");
@@ -1052,7 +1052,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
             if (!fragment_timeline_node)
                 fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline");
             if (!fragment_timeline_node)
-                fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline");
+                fragment_timeline_node = find_child_node_by_name(adaptationset_segmentlist_node, "SegmentTimeline");
             if (!fragment_timeline_node)
                 fragment_timeline_node = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline");
             if (fragment_timeline_node) {
@@ -1118,21 +1118,21 @@ end:
     return ret;
 }
 
-static int parse_manifest_adaptationset_attr(AVFormatContext *s, xmlNodePtr adaptionset_node)
+static int parse_manifest_adaptationset_attr(AVFormatContext *s, xmlNodePtr adaptationset_node)
 {
     DASHContext *c = s->priv_data;
 
-    if (!adaptionset_node) {
-        av_log(s, AV_LOG_WARNING, "Cannot get AdaptionSet\n");
+    if (!adaptationset_node) {
+        av_log(s, AV_LOG_WARNING, "Cannot get AdaptationSet\n");
         return AVERROR(EINVAL);
     }
-    c->adaptionset_lang = xmlGetProp(adaptionset_node, "lang");
+    c->adaptationset_lang = xmlGetProp(adaptationset_node, "lang");
 
     return 0;
 }
 
 static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
-                                        xmlNodePtr adaptionset_node,
+                                        xmlNodePtr adaptationset_node,
                                         xmlNodePtr mpd_baseurl_node,
                                         xmlNodePtr period_baseurl_node,
                                         xmlNodePtr period_segmenttemplate_node,
@@ -1142,39 +1142,39 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
     DASHContext *c = s->priv_data;
     xmlNodePtr fragment_template_node = NULL;
     xmlNodePtr content_component_node = NULL;
-    xmlNodePtr adaptionset_baseurl_node = NULL;
-    xmlNodePtr adaptionset_segmentlist_node = NULL;
-    xmlNodePtr adaptionset_supplementalproperty_node = NULL;
+    xmlNodePtr adaptationset_baseurl_node = NULL;
+    xmlNodePtr adaptationset_segmentlist_node = NULL;
+    xmlNodePtr adaptationset_supplementalproperty_node = NULL;
     xmlNodePtr node = NULL;
 
-    ret = parse_manifest_adaptationset_attr(s, adaptionset_node);
+    ret = parse_manifest_adaptationset_attr(s, adaptationset_node);
     if (ret < 0)
         return ret;
 
-    node = xmlFirstElementChild(adaptionset_node);
+    node = xmlFirstElementChild(adaptationset_node);
     while (node) {
         if (!av_strcasecmp(node->name, (const char *)"SegmentTemplate")) {
             fragment_template_node = node;
         } else if (!av_strcasecmp(node->name, (const char *)"ContentComponent")) {
             content_component_node = node;
         } else if (!av_strcasecmp(node->name, (const char *)"BaseURL")) {
-            adaptionset_baseurl_node = node;
+            adaptationset_baseurl_node = node;
         } else if (!av_strcasecmp(node->name, (const char *)"SegmentList")) {
-            adaptionset_segmentlist_node = node;
+            adaptationset_segmentlist_node = node;
         } else if (!av_strcasecmp(node->name, (const char *)"SupplementalProperty")) {
-            adaptionset_supplementalproperty_node = node;
+            adaptationset_supplementalproperty_node = node;
         } else if (!av_strcasecmp(node->name, (const char *)"Representation")) {
             ret = parse_manifest_representation(s, url, node,
-                                                adaptionset_node,
+                                                adaptationset_node,
                                                 mpd_baseurl_node,
                                                 period_baseurl_node,
                                                 period_segmenttemplate_node,
                                                 period_segmentlist_node,
                                                 fragment_template_node,
                                                 content_component_node,
-                                                adaptionset_baseurl_node,
-                                                adaptionset_segmentlist_node,
-                                                adaptionset_supplementalproperty_node);
+                                                adaptationset_baseurl_node,
+                                                adaptationset_segmentlist_node,
+                                                adaptationset_supplementalproperty_node);
             if (ret < 0)
                 goto err;
         }
@@ -1182,7 +1182,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
     }
 
 err:
-    av_freep(&c->adaptionset_lang);
+    av_freep(&c->adaptationset_lang);
     return ret;
 }
 
@@ -1233,7 +1233,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
     xmlNodePtr period_baseurl_node = NULL;
     xmlNodePtr period_segmenttemplate_node = NULL;
     xmlNodePtr period_segmentlist_node = NULL;
-    xmlNodePtr adaptionset_node = NULL;
+    xmlNodePtr adaptationset_node = NULL;
     xmlAttrPtr attr = NULL;
     char *val  = NULL;
     uint32_t period_duration_sec = 0;
@@ -1374,18 +1374,18 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
             goto cleanup;
         }
 
-        adaptionset_node = xmlFirstElementChild(period_node);
-        while (adaptionset_node) {
-            if (!av_strcasecmp(adaptionset_node->name, (const char *)"BaseURL")) {
-                period_baseurl_node = adaptionset_node;
-            } else if (!av_strcasecmp(adaptionset_node->name, (const char *)"SegmentTemplate")) {
-                period_segmenttemplate_node = adaptionset_node;
-            } else if (!av_strcasecmp(adaptionset_node->name, (const char *)"SegmentList")) {
-                period_segmentlist_node = adaptionset_node;
-            } else if (!av_strcasecmp(adaptionset_node->name, (const char *)"AdaptationSet")) {
-                parse_manifest_adaptationset(s, url, adaptionset_node, mpd_baseurl_node, period_baseurl_node, period_segmenttemplate_node, period_segmentlist_node);
+        adaptationset_node = xmlFirstElementChild(period_node);
+        while (adaptationset_node) {
+            if (!av_strcasecmp(adaptationset_node->name, (const char *)"BaseURL")) {
+                period_baseurl_node = adaptationset_node;
+            } else if (!av_strcasecmp(adaptationset_node->name, (const char *)"SegmentTemplate")) {
+                period_segmenttemplate_node = adaptationset_node;
+            } else if (!av_strcasecmp(adaptationset_node->name, (const char *)"SegmentList")) {
+                period_segmentlist_node = adaptationset_node;
+            } else if (!av_strcasecmp(adaptationset_node->name, (const char *)"AdaptationSet")) {
+                parse_manifest_adaptationset(s, url, adaptationset_node, mpd_baseurl_node, period_baseurl_node, period_segmenttemplate_node, period_segmentlist_node);
             }
-            adaptionset_node = xmlNextElementSibling(adaptionset_node);
+            adaptationset_node = xmlNextElementSibling(adaptationset_node);
         }
 cleanup:
         /*free the document */
-- 
2.26.2



More information about the ffmpeg-devel mailing list