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_DCAMERA_SINK_FRAME_INFO_H
17 #define OHOS_DCAMERA_SINK_FRAME_INFO_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace DistributedHardware {
23 class DCameraSinkFrameInfo {
24 public:
DCameraSinkFrameInfo()25     DCameraSinkFrameInfo()
26         : type_(-1), index_(-1), pts_(0), startEncodeT_(0), finishEncodeT_(0), sendT_(0), ver_("1.0")
27     {}
28     ~DCameraSinkFrameInfo() = default;
29     int8_t type_;
30     int32_t index_;
31     int64_t pts_;
32     int64_t startEncodeT_;
33     int64_t finishEncodeT_;
34     int64_t sendT_;
35     std::string ver_;
36 
37 public:
38     const std::string FRAME_INFO_TYPE = "type";
39     const std::string FRAME_INFO_INDEX = "index";
40     const std::string FRAME_INFO_PTS = "pts";
41     const std::string FRAME_INFO_START_ENCODE = "startEncodeT";
42     const std::string FRAME_INFO_FINISH_ENCODE = "finishEncodeT";
43     const std::string FRAME_INFO_ENCODET = "encodeT";
44     const std::string FRAME_INFO_SENDT = "sendT";
45     const std::string FRAME_INFO_VERSION = "ver";
46 
47 public:
48     void Marshal(std::string& jsonStr);
49     int32_t Unmarshal(const std::string& jsonStr);
50 };
51 } // namespace DistributedHardware
52 } // namespace OHOS
53 #endif // OHOS_DCAMERA_SINK_FRAME_INFO_H
54