1 /* 2 * Copyright (c) 2024-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "i_dash_mpd_node.h" 17 #include "dash_mpd_node.h" 18 #include "dash_period_node.h" 19 #include "dash_adpt_set_node.h" 20 #include "dash_content_comp_node.h" 21 #include "dash_representation_node.h" 22 #include "dash_seg_base_node.h" 23 #include "dash_mult_seg_base_node.h" 24 #include "dash_seg_list_node.h" 25 #include "dash_seg_template_node.h" 26 #include "dash_url_type_node.h" 27 #include "dash_seg_tmline_node.h" 28 #include "dash_descriptor_node.h" 29 #include "dash_seg_url_node.h" 30 31 namespace OHOS { 32 namespace Media { 33 namespace Plugins { 34 namespace HttpPlugin { 35 // ISO/IEC 23009-1 define MPD node CreateNode(const std::string & nodeName)36IDashMpdNode *IDashMpdNode::CreateNode(const std::string &nodeName) 37 { 38 if (nodeName == "MPD") { 39 return new DashMpdNode(); 40 } 41 42 if (nodeName == "Period") { 43 return new DashPeriodNode(); 44 } 45 46 if (nodeName == "AdaptationSet") { 47 return new DashAdptSetNode(); 48 } 49 50 if (nodeName == "ContentComponent") { 51 return new DashContentCompNode(); 52 } 53 54 if (nodeName == "Representation") { 55 return new DashRepresentationNode(); 56 } 57 58 if (nodeName == "SegmentBase") { 59 return new DashSegBaseNode(); 60 } 61 62 if (nodeName == "MultipleSegmentBase") { 63 return new DashMultSegBaseNode(); 64 } 65 66 if (nodeName == "SegmentList") { 67 return new DashSegListNode(); 68 } 69 70 if (nodeName == "SegmentTemplate") { 71 return new DashSegTemplateNode(); 72 } 73 74 if (nodeName == "Initialization" || nodeName == "RepresentationIndex" || nodeName == "BitstreamSwitching") { 75 return new DashUrlTypeNode(); 76 } 77 78 if (nodeName == "SegmentTimeline") { 79 return new DashSegTmlineNode(); 80 } 81 82 if (nodeName == "ContentProtection" || nodeName == "Role" || nodeName == "EssentialProperty" || 83 nodeName == "AudioChannelConfiguration") { 84 return new DashDescriptorNode(); 85 } 86 87 if (nodeName == "SegmentURL") { 88 return new DashSegUrlNode(); 89 } 90 91 return nullptr; 92 } 93 DestroyNode(IDashMpdNode * node)94void IDashMpdNode::DestroyNode(IDashMpdNode *node) 95 { 96 if (node != nullptr) { 97 delete node; 98 } 99 } 100 } // namespace HttpPluginLite 101 } // namespace Plugin 102 } // namespace Media 103 } // namespace OHOS