codec2: C2VDAComponentIntf implementation

C2VDAComponentIntf is the component interface class of C2VDAComponent (V4L2
codec 2.0 implementation). Framework could config and query codec parameters
via C2VDAComponentIntf interface. There is the correspondent native test of it.

This CL also includes C2ComponentStore implementation and factory functions for
creating C2VDAComponentIntf objects.

Bug: 63828275
Test: run native tests (on nyc branch, cheets_arm device). Steps:
1) mmm external/v4l2_codec2/tests/
2) adb push out/target/product/cheets_arm/data/nativetest/C2VDAComponent_test /data/local/tmp/
3) adb shell /data/local/tmp/C2VDAComponent_test/C2VDAComponent_test

Change-Id: Ibaea85bc2f157b8099544a5e38a812808e71405a
diff --git a/C2VDAAdaptor.cpp b/C2VDAAdaptor.cpp
index f15eb71..bc6b28d 100644
--- a/C2VDAAdaptor.cpp
+++ b/C2VDAAdaptor.cpp
@@ -8,7 +8,9 @@
 #include "C2VDAAdaptor.h"
 #include "bitstream_buffer.h"
 #include "native_pixmap_handle.h"
+#include "v4l2_device.h"
 #include "v4l2_slice_video_decode_accelerator.h"
+#include "videodev2.h"
 
 #include <system/graphics.h>
 #include <utils/Log.h>
@@ -104,6 +106,22 @@
     mPictureSize = media::Size();
 }
 
+//static
+media::VideoDecodeAccelerator::SupportedProfiles C2VDAAdaptor::GetSupportedProfiles(
+        uint32_t inputFormatFourcc) {
+    media::VideoDecodeAccelerator::SupportedProfiles supportedProfiles;
+    auto allProfiles = media::V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles();
+    bool isSliceBased = (inputFormatFourcc == V4L2_PIX_FMT_H264_SLICE) ||
+                        (inputFormatFourcc == V4L2_PIX_FMT_VP8_FRAME) ||
+                        (inputFormatFourcc == V4L2_PIX_FMT_VP9_FRAME);
+    for (const auto& profile : allProfiles) {
+        if (inputFormatFourcc == media::V4L2Device::VideoCodecProfileToV4L2PixFmt(
+                profile.profile, isSliceBased)) {
+            supportedProfiles.push_back(profile);
+        }
+    }
+    return supportedProfiles;
+}
 
 void C2VDAAdaptor::ProvidePictureBuffers(uint32_t requested_num_of_buffers,
                                          media::VideoPixelFormat output_format,
@@ -166,7 +184,7 @@
         case media::VideoDecodeAccelerator::PLATFORM_FAILURE:
             return VideoDecodeAcceleratorAdaptor::PLATFORM_FAILURE;
         default:
-            ALOGE("Unknown error code: %d", error);
+            ALOGE("Unknown error code: %d", static_cast<int>(error));
             return VideoDecodeAcceleratorAdaptor::PLATFORM_FAILURE;
     }
 }