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 #ifndef DASH_MPD_UTIL_H 17 #define DASH_MPD_UTIL_H 18 19 #include <cstdint> 20 #include "mpd_parser_def.h" 21 #include "dash_mpd_def.h" 22 23 namespace OHOS { 24 namespace Media { 25 namespace Plugins { 26 namespace HttpPlugin { 27 bool DashUrlIsAbsolute(const std::string &url); 28 void DashAppendBaseUrl(std::string &srcUrl, DashList<std::string> baseUrlList); 29 void DashAppendBaseUrl(std::string &srcUrl, std::string baseUrl); 30 void BuildSrcUrl(std::string &srcUrl, std::string &baseUrl); 31 32 /** 33 * @brief Replace SegmentTemplate Identifier By Substitute Parameter 34 * 35 * @param segTmpltStr SegmentTemplate Url String 36 * @param segTmpltIdentifier SegmentTemplate Identifer 37 * @param substitutionStr substitute paramter 38 * 39 * @return 0 -- success or -1 -- failed 40 */ 41 int32_t DashSubstituteTmpltStr(std::string &segTmpltStr, const std::string &segTmpltIdentifier, 42 std::string substitutionStr); 43 44 int32_t DashStrToDuration(const std::string &str, uint32_t &duration); 45 uint32_t DashGetAttrIndex(const std::string &attrName, const char *const *nodeAttrs, uint32_t attrNums); 46 void DashParseRange(const std::string &rangeStr, int64_t &startRange, int64_t &endRange); 47 bool DashStreamIsHdr(DashList<DashDescriptor*> essentialPropertyList); 48 void GetSubstitutionStr(std::string &substitutionStr, std::string &str); 49 } // namespace HttpPluginLite 50 } // namespace Plugin 51 } // namespace Media 52 } // namespace OHOS 53 #endif // DASH_MPD_UTIL_H 54