GStreamer samples
The Qualcomm IM SDK includes sample GStreamer applications for video playback. Note For information on sample GStreamer applications supported on different SoCs, see Multimedia sample applications. For information about the prerequisites for the GStreamer applications, see Run sample applications for video and audio. The following table lists the methods and the corresponding sample video test cases:V4L2 samples
Theiris_v4l2_test sample video test application uses Linux V4L2 interfaces to simulate several basic encoder and decoder behaviors. For more information, see sample V4L2 application.
Qualcomm Linux supports the following video APIs:
- GStreamer APIs: The Qualcomm GStreamer plugins are open-source GStreamer framework compliant. For more information about the GStreamer based plugins, see Qualcomm IM SDK.
- V4L2 APIs: The Adreno VPU driver follows a standard V4L2-compliant call flow. The V4L2 APIs section provides information related to V4L2 APIs, commands, controls, and events.
Configure GStreamer and V4L2 APIs
- Qualcomm offers GStreamer-based plugins that you can integrate into your media pipeline. For information on the GStreamer-based plugins, see Configure Qualcomm GStreamer plugins.
- The Adreno VPU driver uses the V4L2 interface to support video encoding and decoding for all clients that follow the V4L2 guidance.
GStreamer APIs
For information on the GStreamer application development and pipeline creation, see Building an Application.Configure GStreamer APIs
For information on configuring the GStreamer element property for different features and respective plugins, see Configure Qualcomm GStreamer plugins.V4L2 APIs
This section describes V4L2 device nodes, file operations, commands, controls, and events for the decoder and encoder.VPU driver nodes
The device registers the VPU driver during the boot-up process and assigns the device node number to the qcom-multimedia-proprietary-image.- VPU driver node for decoder:
/dev/video32 - VPU driver node for encoder:
/dev/video33
Note:
For qcom-multimedia-image, the VPU driver assigns the device node to any of the two device nodes starting from video0 to video27.
V4L2 file operations
The Adreno VPU driver supports the following V4L2 file operations:V4L2 common commands for decoder and encoder
The VPU driver supports the followingioctl commands for the video decoder and encoder use cases:
VIDIOC_ENUM_FMTVIDIOC_TRY_FMTVIDIOC_G_FMTVIDIOC_S_FMTVIDIOC_ENUM_FRAMESIZESVIDIOC_REQBUFSVIDIOC_QUERY_BUFVIDIOC_CREATE_BUFVIDIOC_PREPARE_BUFVIDIOC_QBUFVIDIOC_DQBUFVIDIOC_STREAMONVIDIOC_STREAMOFFVIDIOC_QUERYCAPVIDIOC_QUERYCTRLVIDIOC_QUERYMENUVIDIOC_SUBSCRIBE_EVENTVIDIOC_UNSUBSCRIBE_EVENTVIDIOC_G_SELECTIONVIDIOC_G_CTRLVIDIOC_S_CTRL
V4L2 video decoder
This section provides information on the Adreno VPU decoder device nodes, supported controls, commands, and events. For the procedure to open a VPU decoder node, see VPU driver nodes. V4L2 ioctl commands for decoder For descriptions of the standardioctl commands, see Video for Linux API Function Reference.
Apart from the common commands, the VPU driver also supports the following ioctl commands for the video decoder use cases:
VIDIOC_TRY_DECODER_CMDVIDIOC_DECODER_CMD
The decoder supports the following V4L2 open-source events:
V4L2_EVENT_EOSV4L2_EVENT_SOURCE_CHANGEV4L2_EVENT_CTRL
V4L2_DEC_CMD_STARTV4L2_DEC_CMD_STOP
V4L2 video encoder
This section provides the information on the Adreno VPU encoder device nodes, supported controls, commands, and events. For the procedure to open a VPU encoder node, see VPU driver nodes. V4L2 ioctl commands for encoder For descriptions of the standardioctl commands, see Function Reference.
Apart from the common commands, the VPU driver also supports the following ioctl commands for the encode use cases:
VIDIOC_ENUM_FRAMEINTERVALSVIDIOC_S_SELECTIONVIDIOC_S_PARMVIDIOC_G_PARMVIDIOC_TRY_ENCODER_CMDVIDIOC_ENCODER_CMD
Set all static configuration options after setting the formats on both the planes and before requesting buffers on either of the plane. Call the dynamic parameters after setting the formats on both planes.
For information on the V4L2 controls for encoder, see Codec Control Reference.
The supported open-source events for encoder are:
V4L2_EVENT_EOSV4L2_EVENT_CTRL
V4L2_ENC_CMD_STARTV4L2_ENC_CMD_STOP
Configure V4L2 APIs
Use the V4L2 control IDs, accepted format, accepted ranges, and sample code information, provided in this section, to configure and manage different video features on your device. B-Frame encode You can configure the VPU driver to set up B-Frames in an encoder session using theVIDIOC_S_CTRL ioctl system call. Set the B-Frame encode configuration before setting the VIDIOC_STREAMON on an output plane. The VPU driver supports B-Frame encode only with Hierarchical coding. This feature doesn’t support dynamic configuration.
The following code sample shows the static configuration for a single B-Frame:
VIDIOC_S_CTRL ioctl system call. The QP override provides the flexibility to set the initial frame QP for I-Frame only, or P-Frame only, or B-Frame only, or I-frame and P-Frame only, or P-Frame and B-Frame only, or combinations of these frames. Set the encoder initial QP override configuration before the VIDIOC_STREAMON on an output plane and is only applicable to an encoder session.
The following code sample shows the static configuration parameters to set:
- 40 as an initial QP for the I-Frame
- 35 as an initial QP for the P-Frame
- B-Frame for the H.264 session
VIDIOC_S_CTRL ioctl system call. The number of bits per slice or the number of macroblocks per slice is a slice boundary. Set the slice-encode configuration before VIDIOC_STREAMON on an output plane. The slice-encode feature doesn’t support dynamic configuration, and this configuration is applicable only to an encoder session.
The following code sample shows the static configuration to encode frames with many slices and with the maximum number of macroblocks per slice set to 400:
VIDIOC_S_CTRL ioctl system call. Set the intra-refresh configuration before issuing VIDIOC_STREAMON on an output plane. You can change the intra-refresh period dynamically during the session, and this feature is applicable only to an encoder session.
The following code sample shows the static configuration to activate the random intra-refresh for every 10 frames:
VIDIOC_S_CTRL ioctl system call. Set the rotation configuration before the VIDIOC_STREAMON on an output plane. The rotation feature doesn’t support dynamic configuration and is applicable only to an encoder session.
The following code sample shows the static configuration for rotating an input frame to 90 degrees:
VIDIOC_S_CTRL ioctl system call. Set the frame QP range configuration before the VIDIOC_STREAMON on an output plane. The values are valid for an entire session. Dynamic configuration isn’t supported, and the frame QP feature is applicable only to an encoder session.
The following code sample shows the static configuration parameter to choose 40 as the maximum QP and 10 as the minimum QP for an I-Frame, P-Frame, and B-Frame in an H.264 session:

