codec2 hal: type conversion refactoring, step 3

Implement BufferTypes.h and refactor HIDL type conversion to use it.

BufferTypes.h contains function templates to be reused for
both HIDL and AIDL interfaces. Use template specializations to handle
differences between the interfaces.

Bug: 251850069
Test: presubmit
Change-Id: I55b856ddd1163829bccde5d40e2a02d5cf9bcd7a
diff --git a/media/codec2/hal/aidl/Android.bp b/media/codec2/hal/aidl/Android.bp
index 01cd354..3bc7548 100644
--- a/media/codec2/hal/aidl/Android.bp
+++ b/media/codec2/hal/aidl/Android.bp
@@ -12,7 +12,6 @@
     ],
 
     header_libs: [
-        "libcodec2_hal_common",
         "libcodec2_internal", // private
         "libgui_headers",
     ],
@@ -23,6 +22,7 @@
         "libbinder_ndk",
         "libbase",
         "libcodec2",
+        "libcodec2_hal_common",
         "libcodec2_vndk",
         "libcutils",
         "liblog",
@@ -37,6 +37,7 @@
     export_shared_lib_headers: [
         "android.hardware.media.c2-V1-ndk",
         "libcodec2",
+        "libcodec2_hal_common",
     ],
 }