• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_IMAGE_COMMON_TYPE_H
17 #define OHOS_IMAGE_COMMON_TYPE_H
18 
19 #include <cstdlib>
20 #include <cstdint>
21 
22 namespace OHOS {
23 namespace DistributedHardware {
24 enum class PipelineType : int32_t {
25     VIDEO = 0,
26     PHOTO_JPEG = 1,
27 };
28 
29 enum class VideoCodecType : int32_t {
30     NO_CODEC = 0,
31     CODEC_H264 = 1,
32     CODEC_H265 = 2,
33     CODEC_MPEG4 = 3,
34 };
35 
36 enum class Videoformat : int32_t {
37     YUVI420 = 0,
38     NV12 = 1,
39     NV21 = 2,
40     RGBA_8888 = 3,
41 };
42 
43 class VideoConfigParams {
44 public:
VideoConfigParams()45     VideoConfigParams() : videoCodec_(VideoCodecType::NO_CODEC), pixelFormat_(Videoformat::YUVI420),
46         frameRate_(0), width_ (0), height_(0)
47         {}
VideoConfigParams(VideoCodecType videoCodec,Videoformat pixelFormat,int32_t frameRate,int32_t width,int32_t height)48     VideoConfigParams(VideoCodecType videoCodec, Videoformat pixelFormat, int32_t frameRate, int32_t width,
49         int32_t height)
50         : videoCodec_(videoCodec), pixelFormat_(pixelFormat), frameRate_(frameRate), width_ (width), height_(height)
51         {}
52     ~VideoConfigParams() = default;
53 
54     void SetVideoCodecType(VideoCodecType videoCodec);
55     void SetVideoformat(Videoformat pixelFormat);
56     void SetFrameRate(int32_t frameRate);
57     void SetWidthAndHeight(int32_t width, int32_t height);
58     VideoCodecType GetVideoCodecType() const;
59     Videoformat GetVideoformat() const;
60     int32_t GetFrameRate() const;
61     int32_t GetWidth() const;
62     int32_t GetHeight() const;
63 
64 private:
65     VideoCodecType videoCodec_;
66     Videoformat pixelFormat_;
67     int32_t frameRate_;
68     int32_t width_;
69     int32_t height_;
70 };
71 
72 struct ImageUnitInfo {
73     Videoformat colorFormat;
74     int32_t width;
75     int32_t height;
76     int32_t alignedWidth;
77     int32_t alignedHeight;
78     size_t chromaOffset;
79     size_t imgSize;
80     uint8_t *imgData;
81 };
82 } // namespace DistributedHardware
83 } // namespace OHOS
84 #endif // OHOS_IMAGE_COMMON_TYPE_H
85