| 884 | |
| 885 | |
| 886 | static int parse_manifest_representation(AVFormatContext *s, const char *url, |
| 887 | xmlNodePtr node, |
| 888 | xmlNodePtr adaptionset_node, |
| 889 | xmlNodePtr mpd_baseurl_node, |
| 890 | xmlNodePtr period_baseurl_node, |
| 891 | xmlNodePtr period_segmenttemplate_node, |
| 892 | xmlNodePtr period_segmentlist_node, |
| 893 | xmlNodePtr fragment_template_node, |
| 894 | xmlNodePtr content_component_node, |
| 895 | xmlNodePtr adaptionset_baseurl_node, |
| 896 | xmlNodePtr adaptionset_segmentlist_node, |
| 897 | xmlNodePtr adaptionset_supplementalproperty_node) |
| 898 | { |
| 899 | int32_t ret = 0; |
| 900 | DASHContext *c = s->priv_data; |
| 901 | struct representation *rep = NULL; |
| 902 | struct fragment *seg = NULL; |
| 903 | xmlNodePtr representation_segmenttemplate_node = NULL; |
| 904 | xmlNodePtr representation_baseurl_node = NULL; |
| 905 | xmlNodePtr representation_segmentlist_node = NULL; |
| 906 | xmlNodePtr segmentlists_tab[3]; |
| 907 | xmlNodePtr fragment_timeline_node = NULL; |
| 908 | xmlNodePtr fragment_templates_tab[5]; |
| 909 | char *val = NULL; |
| 910 | xmlNodePtr baseurl_nodes[4]; |
| 911 | xmlNodePtr representation_node = node; |
| 912 | char *rep_bandwidth_val; |
| 913 | enum AVMediaType type = AVMEDIA_TYPE_UNKNOWN; |
| 914 | |
| 915 | // try get information from representation |
| 916 | if (type == AVMEDIA_TYPE_UNKNOWN) |
| 917 | type = get_content_type(representation_node); |
| 918 | // try get information from contentComponen |
| 919 | if (type == AVMEDIA_TYPE_UNKNOWN) |
| 920 | type = get_content_type(content_component_node); |
| 921 | // try get information from adaption set |
| 922 | if (type == AVMEDIA_TYPE_UNKNOWN) |
| 923 | type = get_content_type(adaptionset_node); |
| 924 | if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO && |
| 925 | type != AVMEDIA_TYPE_SUBTITLE) { |
| 926 | av_log(s, AV_LOG_VERBOSE, "Parsing '%s' - skip not supported representation type\n", url); |
| 927 | return 0; |
| 928 | } |
| 929 | |
| 930 | // convert selected representation to our internal struct |
| 931 | rep = av_mallocz(sizeof(struct representation)); |
| 932 | if (!rep) |
| 933 | return AVERROR(ENOMEM); |
| 934 | if (c->adaptionset_lang) { |
| 935 | rep->lang = av_strdup(c->adaptionset_lang); |
| 936 | if (!rep->lang) { |
| 937 | av_log(s, AV_LOG_ERROR, "alloc language memory failure\n"); |
| 938 | av_freep(&rep); |
| 939 | return AVERROR(ENOMEM); |
| 940 | } |
| 941 | } |
| 942 | rep->parent = s; |
| 943 | representation_segmenttemplate_node = find_child_node_by_name(representation_node, "SegmentTemplate"); |
no test coverage detected