• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * Description: header of HCode System test command parse
16  */
17 
18 #ifndef HCODEC_TEST_COMMAND_PARSE_H
19 #define HCODEC_TEST_COMMAND_PARSE_H
20 
21 #include <string>
22 #include "av_common.h"
23 #include "avcodec_info.h"
24 #include "media_description.h"
25 #include "start_code_detector.h"
26 
27 namespace OHOS::MediaAVCodec {
28 struct CommandOpt {
29     bool testCodecBaseApi = true;
30     bool isEncoder = false;
31     uint32_t repeatCnt = 1;
32     std::string inputFile;
33     uint32_t inputCnt = 0;  // 0 means read whole file, else means read inputCnt frames
34     uint32_t dispW = 0;
35     uint32_t dispH = 0;
36     CodeType protocol = H264;
37     VideoPixelFormat pixFmt = NV12;
38     uint32_t frameRate = 30;
39     int32_t timeout = -1;
40     bool isBufferMode = false;
41     // encoder only
42     bool rangeFlag = false;
43     ColorPrimary primary = COLOR_PRIMARY_UNSPECIFIED;
44     TransferCharacteristic transfer = TRANSFER_CHARACTERISTIC_UNSPECIFIED;
45     MatrixCoefficient matrix = MATRIX_COEFFICIENT_UNSPECIFIED;
46     int iFrameInterval = 100; // 100ms
47     uint32_t numIdrFrame = 0;
48     int profile = 0;
49     VideoEncodeBitrateMode rateMode = CBR;
50     int64_t bitRate = 200'000;  // 200000bps = 200kbps
51     uint32_t quality = 50;
52     // decoder only
53     VideoRotation rotation = VIDEO_ROTATION_0;
54     int flushCnt = 0;
55 
56     void Print() const;
57 };
58 
59 CommandOpt Parse(int argc, char *argv[]);
60 void ShowUsage();
61 }
62 #endif