• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 };
22 
23 constexpr std::initializer_list<VideoCodec> kAllCodecs = {VideoCodec::H264, VideoCodec::VP8,
24                                                           VideoCodec::VP9};
25 
26 const char* VideoCodecToString(VideoCodec codec);
27 const char* profileToString(C2Config::profile_t profile);
28 
29 // Enumeration of supported pixel format. The value should be the same as
30 // ::android::hardware::graphics::common::V1_0::PixelFormat.
31 using HPixelFormat = ::android::hardware::graphics::common::V1_0::PixelFormat;
32 enum class HalPixelFormat : int32_t {
33     UNKNOWN = 0x0,
34     YCBCR_420_888 = static_cast<int32_t>(HPixelFormat::YCBCR_420_888),
35     YV12 = static_cast<int32_t>(HPixelFormat::YV12),
36     // NV12 is not defined at PixelFormat, follow the convention to use fourcc value.
37     NV12 = 0x3231564e,
38 };
39 const char* HalPixelFormatToString(HalPixelFormat format);
40 
41 }  // namespace android
42 
43 #endif  // ANDROID_V4L2_CODEC2_COMPONENTS_VIDEO_TYPES_H
44