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 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 PARSECOMMAND_H 17 #define PARSECOMMAND_H 18 #include <cinttypes> 19 #include <string> 20 enum class CodecMime { AVC, HEVC, MPEG4, VP9 }; 21 enum class ColorFormat { YUV420SP = 0, RGBA8888, BGRA8888 }; 22 enum class MyOptIndex { 23 OPT_INDEX_UNKONWN = 0, 24 OPT_INDEX_HELP, 25 OPT_INDEX_HEIGHT = 'h', 26 OPT_INDEX_INPUT = 'i', 27 OPT_INDEX_OUTPUT = 'o', 28 OPT_INDEX_WIDTH = 'w', 29 }; 30 struct CommandOpt { 31 std::string fileInput = ""; 32 std::string fileOutput = ""; 33 uint32_t width = 0; 34 uint32_t height = 0; 35 }; 36 37 class CommandParse { 38 public: CommandParse()39 CommandParse() 40 {} ~CommandParse()41 ~CommandParse() 42 {} 43 bool Parse(int argc, char *argv[], CommandOpt &opt); 44 45 private: 46 void ShowUsage(); 47 }; 48 #endif // PARSE_COMMAND_H 49