1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ANDROID_V4L2_CODEC2_V4L2_V4L2_COMPONENT_COMMON_H 6 #define ANDROID_V4L2_CODEC2_V4L2_V4L2_COMPONENT_COMMON_H 7 8 #include <v4l2_codec2/common/VideoTypes.h> 9 #include <optional> 10 #include <string> 11 12 namespace android { 13 14 // Defines the names of all supported components. 15 struct V4L2ComponentName { 16 static const std::string kH264Encoder; 17 static const std::string kVP8Encoder; 18 static const std::string kVP9Encoder; 19 20 static const std::string kH264Decoder; 21 static const std::string kVP8Decoder; 22 static const std::string kVP9Decoder; 23 static const std::string kHEVCDecoder; 24 static const std::string kH264SecureDecoder; 25 static const std::string kVP8SecureDecoder; 26 static const std::string kVP9SecureDecoder; 27 static const std::string kHEVCSecureDecoder; 28 29 // Return true if |name| is a valid component name. 30 static bool isValid(const std::string& name); 31 32 // Return true if |name| is a encoder name. 33 // Note that |name| should be a valid component name. 34 static bool isEncoder(const std::string& name); 35 36 // Return true if |name| is a decoder name. 37 // Note that |name| should be a valid component name. 38 static bool isDecoder(const std::string& name); 39 40 // Returns VideoCodec for |name| component 41 static std::optional<VideoCodec> getCodec(const std::string& name); 42 }; 43 44 } // namespace android 45 46 #endif // ANDROID_V4L2_CODEC2_V4L2_V4L2_COMPONENT_COMMON_H 47