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
9 files changed