v4l2_codec2: Add support for HEVC/H265 to the V4L2 decoder.

This adds support for the HEVC/H265 codec to the Android codec2 V4L2
decode component.

Bug: 215043150
Bug: 183217901
Test: ExoPlayer works with HEVC on guybrush w/ codecs added and
corresponding ChromeOS CLs for crosvm/libvda

Change-Id: I3707e9730d245871b74982527edfebe81b484e8a
(cherry picked from commit 05bacef7fa53541f21c85f26f6f8351dcdfd7f0e)
diff --git a/components/V4L2DecodeInterface.cpp b/components/V4L2DecodeInterface.cpp
index 4bc4121..d22f77b 100644
--- a/components/V4L2DecodeInterface.cpp
+++ b/components/V4L2DecodeInterface.cpp
@@ -34,6 +34,8 @@
         return VideoCodec::VP8;
     if (name == V4L2ComponentName::kVP9Decoder || name == V4L2ComponentName::kVP9SecureDecoder)
         return VideoCodec::VP9;
+    if (name == V4L2ComponentName::kHEVCDecoder || name == V4L2ComponentName::kHEVCSecureDecoder)
+        return VideoCodec::HEVC;
 
     ALOGE("Unknown name: %s", name.c_str());
     return std::nullopt;
@@ -179,6 +181,35 @@
                         .withSetter(ProfileLevelSetter)
                         .build());
         break;
+
+    case VideoCodec::HEVC:
+        inputMime = MEDIA_MIMETYPE_VIDEO_HEVC;
+        addParameter(
+                DefineParam(mProfileLevel, C2_PARAMKEY_PROFILE_LEVEL)
+                        .withDefault(new C2StreamProfileLevelInfo::input(
+                                0u, C2Config::PROFILE_HEVC_MAIN, C2Config::LEVEL_HEVC_MAIN_5_1))
+                        .withFields({C2F(mProfileLevel, profile)
+                                             .oneOf({C2Config::PROFILE_HEVC_MAIN,
+                                                     C2Config::PROFILE_HEVC_MAIN_STILL}),
+                                     C2F(mProfileLevel, level)
+                                             .oneOf({C2Config::LEVEL_HEVC_MAIN_1,
+                                                     C2Config::LEVEL_HEVC_MAIN_2,
+                                                     C2Config::LEVEL_HEVC_MAIN_2_1,
+                                                     C2Config::LEVEL_HEVC_MAIN_3,
+                                                     C2Config::LEVEL_HEVC_MAIN_3_1,
+                                                     C2Config::LEVEL_HEVC_MAIN_4,
+                                                     C2Config::LEVEL_HEVC_MAIN_4_1,
+                                                     C2Config::LEVEL_HEVC_MAIN_5,
+                                                     C2Config::LEVEL_HEVC_MAIN_5_1,
+                                                     C2Config::LEVEL_HEVC_MAIN_5_2,
+                                                     C2Config::LEVEL_HEVC_HIGH_4,
+                                                     C2Config::LEVEL_HEVC_HIGH_4_1,
+                                                     C2Config::LEVEL_HEVC_HIGH_5,
+                                                     C2Config::LEVEL_HEVC_HIGH_5_1,
+                                                     C2Config::LEVEL_HEVC_HIGH_5_2})})
+                        .withSetter(ProfileLevelSetter)
+                        .build());
+        break;
     }
 
     addParameter(
@@ -346,6 +377,8 @@
         // codec2 framework that it should not stop queuing new work items until the maximum number
         // of frame reordering is reached, to avoid stalling the decoder.
         return 16;
+    case VideoCodec::HEVC:
+        return 16;
     case VideoCodec::VP8:
         return 0;
     case VideoCodec::VP9: