1 /*
2  * Copyright (c) 2023 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 OHOS_MEDIA_INFO_HOLDER_H
17 #define OHOS_MEDIA_INFO_HOLDER_H
18 
19 #include <bitset>
20 #include <memory>
21 #include <string>
22 #include <map>
23 
24 #include "parcel.h"
25 #include "avqueue_item.h"
26 
27 namespace OHOS::AVSession {
28 class MediaInfoHolder : public Parcelable {
29 public:
30     enum {
31         MEDIA_INFO_HOLDER_KEY_CURRENT_INDEX = 0,
32         MEDIA_INFO_HOLDER_KEY_PLAY_INFOS = 1,
33         MEDIA_INFO_HOLDER_KEY_MAX = 2,
34     };
35 
36     MediaInfoHolder() = default;
37     ~MediaInfoHolder() = default;
38 
39     static MediaInfoHolder* Unmarshalling(Parcel& data);
40     bool Marshalling(Parcel& parcel) const override;
41 
42     void SetCurrentIndex(const int32_t& currentIndex);
43     int32_t GetCurrentIndex() const;
44 
45     void SetPlayInfos(const std::vector<AVQueueItem>& playInfos);
46     const std::vector<AVQueueItem>& GetPlayInfos() const;
47 
48     bool IsValid() const;
49 
50     void Reset();
51 
52 private:
53     int32_t currentIndex_ = 0;
54     std::vector<AVQueueItem> playInfos_ = {};
55 };
56 } // namespace OHOS::AVSession
57 #endif // OHOS_MEDIA_INFO_HOLDER_H
58