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_COMPONENTS_VIDEO_TYPES_H 6 #define ANDROID_V4L2_CODEC2_COMPONENTS_VIDEO_TYPES_H 7 8 #include <optional> 9 #include <string> 10 11 #include <C2Config.h> 12 #include <android/hardware/graphics/common/1.0/types.h> 13 14 namespace android { 15 16 // Enumeration of supported video codecs. 17 enum class VideoCodec { 18 H264, 19 VP8, 20 VP9, 21 HEVC, 22 }; 23 24 constexpr std::initializer_list<VideoCodec> kAllCodecs = {VideoCodec::H264, VideoCodec::VP8, 25 VideoCodec::VP9, VideoCodec::HEVC}; 26 27 const char* VideoCodecToString(VideoCodec codec); 28 const char* profileToString(C2Config::profile_t profile); 29 30 // Enumeration of supported pixel format. The value should be the same as 31 // ::android::hardware::graphics::common::V1_0::PixelFormat. 32 using HPixelFormat = ::android::hardware::graphics::common::V1_0::PixelFormat; 33 enum class HalPixelFormat : int32_t { 34 UNKNOWN = 0x0, 35 YCBCR_420_888 = static_cast<int32_t>(HPixelFormat::YCBCR_420_888), 36 YV12 = static_cast<int32_t>(HPixelFormat::YV12), 37 // NV12 is not defined at PixelFormat, follow the convention to use fourcc value. 38 NV12 = 0x3231564e, 39 }; 40 const char* HalPixelFormatToString(HalPixelFormat format); 41 42 } // namespace android 43 44 #endif // ANDROID_V4L2_CODEC2_COMPONENTS_VIDEO_TYPES_H 45