# Interfaces 

Source: [https://docs.qualcomm.com/doc/80-70014-20/topic/interfaces.html](https://docs.qualcomm.com/doc/80-70014-20/topic/interfaces.html)

The Qualcomm Linux platform supports the following video APIs:
- **[V4L2                            APIs](https://docs.qualcomm.com/doc/80-70014-20/topic/interfaces.html#concept_bpj_kg3_bzb__section_nss_w1z_k1c_eputla_02-14-24-2315-20-633)**: The Adreno VPU driver follows a standard V4L2-compliant
                    call flow. You can find information on V4L2 APIs, commands, controls, and events
                    here.
- **[GStreamer                            APIs](https://docs.qualcomm.com/doc/80-70014-20/topic/interfaces.html#concept_bpj_kg3_bzb__section_r53_mv3_n1c_eputla_02-23-24-1111-38-601)**: The Qualcomm GStreamer plugins are open-source
                    GStreamer framework compliant. You can find information about various GStreamer
                    based plugins in the QIM SDK.

## V4L2 APIs

The Adreno VPU driver is based on the V4L2 interface and supports video encode and
                decode for all clients that adhere to the V4L2 guidance.

This section describes V4L2 device nodes, file operations, commands, controls, and
                events for decoder and encoder.

**VPU driver nodes**

The VPU driver is registered during the bootup process and assigns the device node
                number. Following is the information on VPU driver nodes for decoder and
                encoder:

- VPU driver node for decoder: `/dev/video32`
- VPU driver node for encoder: `/dev/video33`

**V4L2 file operations**

The Adreno VPU driver supports the following V4L2 file operations:

| Operation | Description |
| --- | --- |
| `open` | Opens the video device file descriptor (FD) that helps<br>                                        communicate with the VPU driver using the ioctl commands |
| `close` | Closes the video device at the completion of a video use<br>                                    case, and releases all the VPU driver resources related to the<br>                                    video device |
| `poll` | Waits for the events from the VPU driver |
| `ioctl` | Sends commands or controls to the VPU device |

**V4L2 video decoder**

The Adreno VPU decoder device node, supported controls, commands, and events are
                described here. For the steps to open a VPU decoder node, you can refer to the [VPU driver nodes](https://docs.qualcomm.com/doc/80-70014-20/topic/interfaces.html#concept_bpj_kg3_bzb__p_lg1_3cs_s1c_eputla_03-13-24-1448-52-615)
                topic.

**V4L2 ioctl commands for decoder**

The descriptions for the standard ioctl commands are available at [Video for Linux API Function
                Reference](https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/user-func.html).

A list of supported ioctl commands available in the VPU driver for the video decoder
                use case is as follows:
- VIDIOC_ENUM_FMTCopy to clipboard
- VIDIOC_TRY_FMTCopy to clipboard
- VIDIOC_G_FMTCopy to clipboard
- VIDIOC_S_FMTCopy to clipboard
- VIDIOC_ENUM_FRAMESIZESCopy to clipboard
- VIDIOC_REQBUFSCopy to clipboard
- VIDIOC_QUERY_BUFCopy to clipboard
- VIDIOC_CREATE_BUFSCopy to clipboard
- VIDIOC_PREPARE_BUFCopy to clipboard
- VIDIOC_QBUFCopy to clipboard
- VIDIOC_DQBUFCopy to clipboard
- VIDIOC_STREAMONCopy to clipboard
- VIDIOC_STREAMOFFCopy to clipboard
- VIDIOC_QUERYCAPCopy to clipboard
- VIDIOC_QUERYCTRLCopy to clipboard
- VIDIOC_QUERYMENUCopy to clipboard
- VIDIOC_SUBSCRIBE_EVENTCopy to clipboard
- VIDIOC_UNSUBSCRIBE_EVENTCopy to clipboard
- VIDIOC_G_SELECTIONCopy to clipboard
- VIDIOC_TRY_DECODER_CMDCopy to clipboard
- VIDIOC_DECODER_CMDCopy to clipboard
- VIDIOC_G_CTRLCopy to clipboard
- VIDIOC_S_CTRLCopy to clipboard

All the mandatory commands necessary for video decoder use cases mentioned at [Video Decoder Interface](https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-decoder.html) are supported.

**V4L2 open-source controls for decoder**

The descriptions for the standard open-source controls are available at [Codec Control Reference](https://www.kernel.org/doc/html/v5.5/media/uapi/v4l/ext-ctrls-codec.html).

The following table lists the supported open-source controls available in the VPU
                driver for the video decoder use cases:

| Control ID | Purpose | Dynamic/Static |
| --- | --- | --- |
| V4L2_CID_MPEG_VIDEO_H264_PROFILECopy to clipboard | H.264 decoder profile | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_PROFILECopy to clipboard | HEVC decoder profile | Static |
| V4L2_CID_MPEG_VIDEO_VP9_PROFILECopy to clipboard | VP9 decoder profile | Static |
| V4L2_CID_MPEG_VIDEO_H264_LEVELCopy to clipboard | H.264 decoder level | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_LEVELCopy to clipboard | HEVC decoder level | Static |
| V4L2_CID_MPEG_VIDEO_VP9_LEVELCopy to clipboard | VP9 decoder level | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_TIERCopy to clipboard | HEVC decoder tier | Static |

A list of supported V4L2 open-source events for the decoder is as follows:
- V4L2_EVENT_EOSCopy to clipboard
- V4L2_EVENT_SOURCE_CHANGECopy to clipboard
- V4L2_EVENT_CTRLCopy to clipboard

A list of supported V4L2 commands for the decoder is as follows:
- V4L2_DEC_CMD_STARTCopy to clipboard
- V4L2_DEC_CMD_STOPCopy to clipboard

**V4L2 video encoder**

The Adreno VPU encoder device node, supported controls, commands, and events are
                described here. For the steps to open a VPU encoder node, you can refer to the [VPU driver nodes](https://docs.qualcomm.com/doc/80-70014-20/topic/interfaces.html#concept_bpj_kg3_bzb__p_lg1_3cs_s1c_eputla_03-13-24-1448-52-615)
                topic.

**V4l2 ioctl commands for encoder**

The descriptions for the standard ioctl commands are available at [Video for Linux API Function
                Reference](https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/user-func.html).

A list of supported ioctl commands available in the VPU driver for the encode use
                cases is as follows:
- VIDIOC_ENUM_FMTCopy to clipboard
- VIDIOC_TRY_FMTCopy to clipboard
- VIDIOC_G_FMTCopy to clipboard
- VIDIOC_S_FMTCopy to clipboard
- VIDIOC_ENUM_FRAMESIZESCopy to clipboard
- VIDIOC_ENUM_FRAMEINTERVALSCopy to clipboard
- VIDIOC_REQBUFSCopy to clipboard
- VIDIOC_QUERY_BUFCopy to clipboard
- VIDIOC_CREATE_BUFCopy to clipboard
- VIDIOC_PREPARE_BUFCopy to clipboard
- VIDIOC_QBUFCopy to clipboard
- VIDIOC_DQBUFCopy to clipboard
- VIDIOC_STREAMONCopy to clipboard
- VIDIOC_STREAMOFFCopy to clipboard
- VIDIOC_QUERYCAPCopy to clipboard
- VIDIOC_QUERYCTRLCopy to clipboard
- VIDIOC_QUERYMENUCopy to clipboard
- VIDIOC_SUBSCRIBE_EVENTCopy to clipboard
- VIDIOC_UNSUBSCRIBE_EVENTCopy to clipboard
- VIDIOC_G_SELECTIONCopy to clipboard
- VIDIOC_S_SELECTIONCopy to clipboard
- VIDIOC_S_PARMCopy to clipboard
- VIDIOC_G_PARMCopy to clipboard
- VIDIOC_TRY_ENCODER_CMDCopy to clipboard
- VIDIOC_ENCODER_CMDCopy to clipboard
- VIDIOC_G_CTRLCopy to clipboard
- VIDIOC_S_CTRLCopy to clipboard

All the mandatory commands necessary for video encoder use cases mentioned at [Video Encoder Interface](https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-encoder.html) are supported.

**V4L2 open-source controls for encoder**

The descriptions for the standard open-source controls are available at [Codec Control Reference](https://www.kernel.org/doc/html/v5.5/media/uapi/v4l/ext-ctrls-codec.html).

The following table lists the supported open-source controls available in the VPU
                driver for the video encoder use cases:

| Control ID | Purpose | Dynamic/Static |
| --- | --- | --- |
| V4L2_CID_MPEG_VIDEO_H264_PROFILECopy to clipboard | H.264 encoder profile | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_PROFILECopy to clipboard | HEVC encoder profile | Static |
| V4L2_CID_MPEG_VIDEO_H264_LEVELCopy to clipboard | H.264 encoder level | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_LEVELCopy to clipboard | HEVC encoder level | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_TIERCopy to clipboard | H.264 encoder tier | Static |
| V4L2_CID_HFLIPCopy to clipboard | Horizontal flip | Both |
| V4L2_CID_VFLIPCopy to clipboard | Vertical flip | Both |
| V4L2_CID_ROTATECopy to clipboard | Rotation | Static |
| V4L2_CID_MPEG_VIDEO_HEADER_MODECopy to clipboard | Header mode | Static |
| V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDRCopy to clipboard | SPS/PPS with IDR frame | Static |
| V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAMECopy to clipboard | Request force sync frame | Both |
| V4L2_CID_MPEG_VIDEO_BITRATECopy to clipboard | Average bit rate | Both |
| V4L2_CID_MPEG_VIDEO_BITRATE_PEAKCopy to clipboard | Peak bit rate | Both |
| V4L2_CID_MPEG_VIDEO_BITRATE_MODECopy to clipboard | Rate control | Static |
| V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODECopy to clipboard | Frame skip mode | Static |
| V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLECopy to clipboard | RC enable/disable | Static |
| V4L2_CID_MPEG_VIDEO_GOP_SIZECopy to clipboard | Group-of-pictures size | Both |
| V4L2_CID_MPEG_VIDEO_B_FRAMESCopy to clipboard | B-frames | Static |
| V4L2_CID_MPEG_VIDEO_LTR_COUNTCopy to clipboard | LTR frame count | Static |
| V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMESCopy to clipboard | Use LTR | Both |
| V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEXCopy to clipboard | Mark LTR | Both |
| V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_IDCopy to clipboard | Set base layer ID for layer encode | Static |
| V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPECopy to clipboard | Intra refresh | Static |
| V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIODCopy to clipboard | Intra refresh period | Both |
| V4L2_CID_MPEG_VIDEO_H264_MIN_QPCopy to clipboard | H.264 minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_MIN_QPCopy to clipboard | HEVC minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_H264_MAX_QPCopy to clipboard | H.264 maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_MAX_QPCopy to clipboard | HEVC maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QPCopy to clipboard | H.264 I-frame minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MIN_QPCopy to clipboard | HEVC I-frame minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QPCopy to clipboard | H.264 P-frame minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MIN_QPCopy to clipboard | HEVC P-frame minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MIN_QPCopy to clipboard | H.264 B-frame minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MIN_QPCopy to clipboard | HEVC B-frame minimum QP | Static |
| V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QPCopy to clipboard | H.264 I-frame maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MAX_QPCopy to clipboard | HEVC I-frame maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QPCopy to clipboard | H.264 P-frame maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MAX_QPCopy to clipboard | HEVC P-frame maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MAX_QPCopy to clipboard | H.264 B-frame maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MAX_QPCopy to clipboard | HEVC B-frame maximum QP | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QPCopy to clipboard | HEVC I-frame QP | Both |
| V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QPCopy to clipboard | H.264 I-frame QP | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QPCopy to clipboard | HEVC P-frame QP | Both |
| V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QPCopy to clipboard | H.264 P-frame QP | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QPCopy to clipboard | HEVC B-frame QP | Both |
| V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QPCopy to clipboard | H.264 B-frame QP | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPECopy to clipboard | HEVC Hier coding type | Static |
| V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPECopy to clipboard | H.264 Hier coding type | Static |
| V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODINGCopy to clipboard | Enables H.264 Hier coding | Static |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYERCopy to clipboard | HEVC Hier layer count | Both |
| V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYERCopy to clipboard | H.264 Hier layer count | Both |
| V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L0_BRCopy to clipboard | H.264 layer 0‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_BRCopy to clipboard | HEVC layer 0‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L1_BRCopy to clipboard | H.264 layer 1‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_BRCopy to clipboard | HEVC layer 1‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L2_BRCopy to clipboard | H.264 layer 2‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_BRCopy to clipboard | HEVC layer 2‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L3_BRCopy to clipboard | H.264 layer 3‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_BRCopy to clipboard | HEVC layer 3‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L4_BRCopy to clipboard | H.264 layer 4‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_BRCopy to clipboard | HEVC layer 4‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L5_BRCopy to clipboard | H.264 layer 5‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_BRCopy to clipboard | HEVC layer 5‑bit rate | Both |
| V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODECopy to clipboard | H.264 entropy mode | Static |
| V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODECopy to clipboard | Encode slice mode | Static |
| V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTESCopy to clipboard | Maximum bytes in slice | Static |
| V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MBCopy to clipboard | Maximum macroblocks in slice | Static |

All static configuration options must be set after setting the formats on both the
                planes and before requesting buffers on either of the planes. The dynamic parameters
                can be called after setting the formats on both the planes.

For more information on the V4L2 controls for encoder, see [Codec Control Reference](https://www.kernel.org/doc/html/v5.5/media/uapi/v4l/ext-ctrls-codec.html).

A list of supported open-source events for the encoder is as follows:
- V4L2_EVENT_EOSCopy to clipboard
- V4L2_EVENT_CTRLCopy to clipboard

A list of supported open-source commands for the encoder is as follows:
- V4L2_ENC_CMD_STARTCopy to clipboard
- V4L2_ENC_CMD_STOPCopy to clipboard

## GStreamer APIs

Qualcomm provides you with the GStreamer-based plugins. You can add these plugins to
                your media pipeline. For more information on the Qualcomm provided GStreamer-based
                plugins, see [Qualcomm GST plugins](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-50/qim-sdk-plugins.html).

For more information on the GStreamer application development and pipeline creation,
                see [Building an Application](https://gstreamer.freedesktop.org/documentation/application-development/basics/index.html).

Last Published: Jul 12, 2024

[Previous Topic
Architecture](https://docs.qualcomm.com/bundle/publicresource/80-70014-20/topics/architecture.md) [Next Topic
Software](https://docs.qualcomm.com/bundle/publicresource/80-70014-20/topics/software.md)