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 AVCODEC_DUMP_UTILS_H
17#define AVCODEC_DUMP_UTILS_H
18
19#include <map>
20#include <string>
21#include <vector>
22#include "meta/format.h"
23
24namespace OHOS {
25namespace MediaAVCodec {
26class __attribute__((visibility("default"))) AVCodecDumpControler {
27public:
28    int32_t AddInfo(const uint32_t dumpIdx, const std::string &name, const std::string &value = "");
29    int32_t AddInfoFromFormat(const uint32_t dumpIdx, const Media::Format &format, const std::string_view &key,
30                              const std::string &name);
31    int32_t AddInfoFromFormatWithMapping(const uint32_t dumpIdx, const Media::Format &format,
32                                         const std::string_view &key, const std::string &name,
33                                         std::map<int32_t, const std::string> mapping);
34    int32_t GetDumpString(std::string &dumpString);
35
36private:
37    uint32_t GetLevel(const uint32_t dumpIdx);
38    std::map<uint32_t, std::pair<std::string, std::string>> dumpInfoMap_; // <dumpIdx, <name, value>>
39    std::vector<uint32_t> length_ = std::vector<uint32_t>(4, 0);
40};
41} // namespace MediaAVCodec
42} // namespace OHOS
43#endif // AVCODEC_DUMP_UTILS_H