MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / get_content_url

Function get_content_url

libavformat/dashdec.c:474–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474static char *get_content_url(xmlNodePtr *baseurl_nodes,
475 int n_baseurl_nodes,
476 int max_url_size,
477 char *rep_id_val,
478 char *rep_bandwidth_val,
479 char *val)
480{
481 int i;
482 char *text;
483 char *url = NULL;
484 char *tmp_str = av_mallocz(max_url_size);
485
486 if (!tmp_str)
487 return NULL;
488
489 for (i = 0; i < n_baseurl_nodes; ++i) {
490 if (baseurl_nodes[i] &&
491 baseurl_nodes[i]->children &&
492 baseurl_nodes[i]->children->type == XML_TEXT_NODE) {
493 text = xmlNodeGetContent(baseurl_nodes[i]->children);
494 if (text) {
495 memset(tmp_str, 0, max_url_size);
496 ff_make_absolute_url(tmp_str, max_url_size, "", text);
497 xmlFree(text);
498 }
499 }
500 }
501
502 if (val)
503 ff_make_absolute_url(tmp_str, max_url_size, tmp_str, val);
504
505 if (rep_id_val) {
506 url = av_strireplace(tmp_str, "$RepresentationID$", rep_id_val);
507 if (!url) {
508 goto end;
509 }
510 av_strlcpy(tmp_str, url, max_url_size);
511 }
512 if (rep_bandwidth_val && tmp_str[0] != '\0') {
513 // free any previously assigned url before reassigning
514 av_free(url);
515 url = av_strireplace(tmp_str, "$Bandwidth$", rep_bandwidth_val);
516 if (!url) {
517 goto end;
518 }
519 }
520end:
521 av_free(tmp_str);
522 return url;
523}
524
525static char *get_val_from_nodes_tab(xmlNodePtr *nodes, const int n_nodes, const char *attrname)
526{

Callers 2

Calls 5

ff_make_absolute_urlFunction · 0.85
av_strireplaceFunction · 0.85
av_strlcpyFunction · 0.85
av_malloczFunction · 0.50
av_freeFunction · 0.50

Tested by

no test coverage detected