# GstMLFrame

Source: [https://docs.qualcomm.com/doc/80-70014-50Y/topic/ml-api-gstmlframe.html](https://docs.qualcomm.com/doc/80-70014-50Y/topic/ml-api-gstmlframe.html)

GstMLFrame 是从 gst\_ml\_frame\_map（）获取的一种方便的结构，包含指向张量的映射指针以及有关张量的所需信息。

Table : GstMLFrame 的结构

| 字段 | 说明 |
| --- | --- |
| info（GstMLInfo） | GstMLInfo |
| buffer（[GstBuffer](https://gstreamer.freedesktop.org/documentation/gstreamer/gstbuffer.html?gi-language=c)） | 包含张量内存块的映射缓冲区 |
| map（[GstMapInfo](https://gstreamer.freedesktop.org/documentation/gstreamer/gstmemory.html?gi-language=c#GstMapInfo)） | 张量内存块的映射 |

## gst\_ml\_frame\_map

使用 GstMLInfo 和 GstBuffer 更新帧值，然后在堆栈上分配帧。

1. 地址将传递给在堆栈上分配的 GstMLFrame 结构。
2. gst\_ml\_frame\_map（）函数使用访问 ML 缓冲区数据所需的各种 ML tensor-specific 的信息填充 GstMLFrame 结构。所有缓冲区视频张量都已映射，指针已设置在帧数据中。

**原型**

    gboolean
    gst_ml_frame_map (GstMLFrame * frame, const GstMLInfo * info, GstBuffer * buffer, GstMapFlags flags)
    Copy to clipboard

**参数**

| [in] | `frame` | 指向 GstMLFrame 的指针 |
| :--- | :--- | :--- |
| [in] | `info` | 一个 GstMLInfo |
| [in] | `buffer` | 一个 GstBuffer |
| [in] | `flags` | 一个 GstMap 标志 |

**返回结果**

如果映射操作成功，则为 TRUE。

## gst\_ml\_frame\_unmap

unmap 之前使用 gst\_ml\_frame\_map（）映射的内存。

**原型**

    void
    gst_ml_frame_unmap (GstMLFrame * frame)Copy to clipboard

**参数**

| [in] | `frame` | 指向 GstMLFrame 的指针 |
| :--- | :--- | :--- |

**返回结果**

无

**Parent Topic:** [机器学习 API](https://docs.qualcomm.com/doc/80-70014-50Y/topic/machine-learning-apis.html)

Last Published: Nov 11, 2025

[Previous Topic
GstMLTensorMeta](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/ml-api-gstmltensormeta.md) [Next Topic
GstMLBufferPool](https://docs.qualcomm.com/bundle/publicresource/80-70014-50Y/topics/ml-api-gstmlbufferpool.md)