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 MPD_PARSER_DEF_H
17 #define MPD_PARSER_DEF_H
18 
19 #include <list>
20 #include <string>
21 #include <vector>
22 
23 namespace OHOS {
24 namespace Media {
25 namespace Plugins {
26 namespace HttpPlugin {
27 template <typename T, typename Alloc = std::allocator<T>>
28 using DashVector = std::vector<T, Alloc>;
29 
30 template <typename T, typename Alloc = std::allocator<T>>
31 using DashList = std::list<T, Alloc>;
32 
33 // xml base return value definition
34 enum class XmlBaseRtnValue { XML_BASE_ERR = -1, XML_BASE_OK = 0 };
35 
36 constexpr const char *MPD_LABEL_PSSH = "pssh";
37 constexpr const char *MPD_LABEL_DEFAULT_KID = "default_KID";
38 
39 struct NodeAttr {
40     std::string attr_;
41     std::string val_;
42 };
43 
44 /**
45  * synchronize client time with server time
46  */
47 struct TimeBase {
48     time_t server_;
49     time_t client_;
50 };
51 
52 class SubSegmentIndex {
53 public:
54     SubSegmentIndex() = default;
55     ~SubSegmentIndex() = default;
56 
57 public:
58     bool startsSap_{false};
59     int32_t sapType_{0};
60     int32_t referenceType_{0};
61     int32_t referencedSize_{0};
62     uint32_t duration_{0};
63     uint32_t timeScale_{1};
64     uint32_t sapDeltaTime_{0};
65     int64_t startPos_{0};
66     int64_t endPos_{0};
67 };
68 } // namespace HttpPluginLite
69 } // namespace Plugin
70 } // namespace Media
71 } // namespace OHOS
72 #endif // MPD_PARSER_DEF_H
73