2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
フレーム メタデータ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
フレーム メタデータは、Android 11 で BufferDesc データ構造体のメンバーとして導入されました。この新しいフィールドは、顧客定義のデータ形式に対応する vec<uint8_t>
として宣言され、EVS Manager からは不透明です。
struct BufferDesc {
/**
* HIDL counterpart of AHardwareBuffer_Desc. Please see
* hardware/interfaces/graphics/common/1.2/types.hal for more details.
*/
HardwareBuffer buffer;
...
/**
* Time that this buffer is being filled.
*/
int64_t timestamp;
/**
* Frame metadata field. This is opaque to EVS manager.
*/
vec<uint8_t> metadata;
};
HIDL vec<T>
は、別のバッファに格納されたデータによって動的にサイズ変更される配列を表します。このようなインスタンスは、構造体の vec<T>
インスタンスで表されます。つまり、EVS Camera HAL ドライバの実装はこのメタデータを所有し、メタデータを適切にクリーンアップする必要があります。メタデータには次の 2 つの入力方法があります。
- コンテナのサイズを変更し、
operator[]
を使用してデータを入力する struct BufferDesc desc = {};
...
desc.metadata.resize(10);
for (auto i = 0; i < 10; ++i) {
desc.metadata[i] = frameInfo[i];
}
...
setToExternal()
を使用して、vec<T>
がカスタムデータ構造を指すようにするstruct BufferDesc desc = {};
struct FrameMetadata metadata = {
...
}; // this is in vendor-defined format.
desc.metadata.setToExternal(&metadata, sizeof(metadata));
...
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-08-08 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-08 UTC。"],[],[],null,["# Frame metadata is introduced in Android 11 as a member of the BufferDesc data\nstructure. This new field is declared as `vec\u003cuint8_t\u003e` to accommodate\na customer-defined data format and is opaque to EVS manager. \n\n```carbon\nstruct BufferDesc {\n /**\n * HIDL counterpart of AHardwareBuffer_Desc. Please see\n * hardware/interfaces/graphics/common/1.2/types.hal for more details.\n */\n HardwareBuffer buffer;\n ...\n\n /**\n * Time that this buffer is being filled.\n */\n int64_t timestamp;\n\n /**\n * Frame metadata field. This is opaque to EVS manager.\n */\n vec\u003cuint8_t\u003e metadata;\n};\n```\n\nHIDL `vec\u003cT\u003e` represents dynamically sized arrays with the data\nstored in a separate buffer. Such instances are represented with an instance of the\n`vec\u003cT\u003e` in the [struct](/devices/architecture/hidl/types#struct),\nwhich means the EVS Camera HAL driver implementation owns this metadata and should clean\nit up properly. There are two ways to fill metadata:\n\n- Resize the container and fill data by using [operator[]](https://android.googlesource.com/platform/system/libhwbinder/+/8539c12501d835979c853a249f8925ef64ecd042/include/hwbinder/HidlSupport.h#115) \n\n ```transact-sql\n struct BufferDesc desc = {};\n ...\n desc.metadata.resize(10);\n for (auto i = 0; i \u003c 10; ++i) {\n desc.metadata[i] = frameInfo[i];\n }\n ...\n \n ```\n- Use [setToExternal()](https://android.googlesource.com/platform/system/libhwbinder/+/8539c12501d835979c853a249f8925ef64ecd042/include/hwbinder/HidlSupport.h#83)`\n ` to make `vec\u003cT\u003e` point to your custom data structure. \n\n ```text\n struct BufferDesc desc = {};\n struct FrameMetadata metadata = {\n ...\n }; // this is in vendor-defined format.\n\n\n desc.metadata.setToExternal(&metadata, sizeof(metadata));\n ...\n ```"]]