Westeros-sink-soc Module
The Westeros Sink Soc module is a component of the Westeros project that is designed to work with various soc platforms. It provides a mechanism for rendering and displaying multimedia content on the target device. It is responsible for interacting with the display hardware on the SoC platform, using the Direct Rendering Manager (DRM) module to access the graphics and multimedia resources. It provides a mechanism for displaying graphical content and video streams and also handles audio output through the audio subsystem on the target device.
Public API’s Exposed
Sl. no. | API | Return Type | Parameters | Description |
1 | gst_westeros_sink_soc_class_init | void | GstWesterosSinkClass * | It is a class initialization function that initializes the class structure and takes a pointer to the GstWesterosSinkClass structure as a parameter. |
2 | gst_westeros_sink_soc_init | gboolean | GstWesterosSink * | This function takes a pointer to the GstWesterosSink object as a parameter, which represents the instance of the GstWesterosSink that is being initialized. During initialization, the function sets up the hardware-specific state of the GstWesterosSink object, by setting up the underlying hardware resources needed for playback. |
3 | gst_westeros_sink_soc_term | void | GstWesterosSink * | It is responsible for cleaning up the hardware-specific state of the GstWesterosSink object and freeing any resources that were allocated during the initialization process. |
4 | gst_westeros_sink_soc_set_property | void | GObject * guint prop_id const Gvalue * GParamSpec * | It is a callback function that is called when a property of a GstWesterosSink object is being set. It takes four parameters: a pointer to the GObject, an unsigned integer that represents the ID of the property that is being set, a pointer to a Gvalue that represents the new value of the property, and a pointer GParamSpec that represents the property specification. |
5 | gst_westeros_sink_soc_get_property | void | GObject * guint prop_id Gvalue * GParamSpec * | It is a callback function that is called when a property of a GstWesterosSink object is being retrieved. |
6 | gst_westeros_sink_soc_null_to_ready | gboolean | GstWesterosSink * gboolean *passToDefault | This function is called when the GstWesterosSink object transitions from the null state to the ready state. |
7 | gst_westeros_sink_soc_ready_to_paused | gboolean | GstWesterosSink *sink, gboolean *passToDefault | This function is called when the GstWesterosSink object transitions from the ready state to the paused state. |
8 | gst_westeros_sink_soc_paused_to_playing | gboolean | GstWesterosSink *sink, gboolean *passToDefault | This function is called when the GstWesterosSink object is transitioning from the paused to the playing state. |
9 | gst_westeros_sink_soc_playing_to_paused | gboolean | GstWesterosSink *sink, gboolean *passToDefault | This function is called when the GstWesterosSink object is transitioning from the playing to the paused state. |
10 | gst_westeros_sink_soc_paused_to_ready | gboolean | GstWesterosSink *sink, gboolean *passToDefault | This function is called when the GstWesterosSink object is transitioning from the paused to the ready state. |
11 | gst_westeros_sink_soc_ready_to_null | gboolean | GstWesterosSink *sink, gboolean *passToDefault | This function is called when the GstWesterosSink object is transitioning from the ready to the null state. |
12 | gst_westeros_sink_soc_registryHandleGlobal | void | GstWesterosSink *sink, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) | The function takes several parameters: a pointer to the GstWesterosSink instance, a pointer to the Wayland registry object, an ID for the new global object, the name of the interface, and its version. This function is a callback that is called when the Wayland registry receives a new global object. |
13 | gst_westeros_sink_soc_registryHandleGlobalRemove | void | GstWesterosSink *sink, struct wl_registry *registry, uint32_t name | This function takes in a pointer to GstWesterosSink structure, a pointer to the Wayland registry object, and the ID of the removed object. It is a callback that gets called when a global object is removed from the Wayland registry. |
14 | gst_westeros_sink_soc_accept_caps | gboolean | GstWesterosSink *sink, GstCaps *caps | This function takes two parameters: a pointer to the GstWesterosSink instance and a pointer to the caps to be checked. It returns a boolean value indicating whether the caps are supported by the GstWesterosSink. |
15 | gst_westeros_sink_soc_set_startPTS | void | GstWesterosSink *sink, gint64 pts | This function sets the start presentation time stamp (PTS) for the media pipeline of the given GstWesterosSink instance. |
16 | gst_westeros_sink_soc_render | void | GstWesterosSink *sink, GstBuffer *buffer | This function is responsible for rendering the video frames to the display and it takes a pointer to the GstWesterosSink object and a pointer to the GstBuffer containing the video frame data as input. |
17 | gst_westeros_sink_soc_flush | void | GstWesterosSink *sink | This function is used to reset and flush the state of the Westeros sink element. It is typically called when the pipeline is being reset or when there is a need to discard all buffered frames and start fresh. |
18 | ean gst_westeros_sink_soc_start_video | gboolean | GstWesterosSink *sink | This function is used to start the video playback in the Westeros sink. It returns a boolean indicating whether the start operation was successful. |
19 | gst_westeros_sink_soc_eos_event | void | GstWesterosSink *sink | This function handles an end-of-stream (eos) event for the Westeros sink element and takes a pointer to the GstWesterosSink object as a parameter. |
20 | gst_westeros_sink_soc_set_video_path | void | GstWesterosSink *sink, bool useGfxPath | The function is used to set the video path for a given GstWesterosSink object. It takes a boolean argument useGFXPath which indicates whether to use the graphics path or not. |
21 | gst_westeros_sink_soc_update_video_position | void | GstWesterosSink *sink | This function updates the position and size of the video display in the window. |
22 | gst_westeros_sink_soc_query | gboolean | GstWesterosSink *sink, GstQuery *query | This function is a callback function that is used by GStreamer to handle queries related to the GstWesterosSink element and takes a pointer to the GstQuery. |
23 | gst_westeros_sink_soc_set_compositor_lock | void | GstWesterosSink *sink, bool lock | This function takes a pointer to the GstWesterosSink and lock parameter, to set the compositor lock state. |
24 | gst_westeros_sink_soc_set_speed | void | GstWesterosSink *sink, const GValue *value | This function takes a pointer to the GstWesterosSink and a pointer to the GValue, to set the playback speed of a video to the specified value. |
Events exposed
Sl. no. | Signal | Event | Description | Signal Emit Function Name | Signal Emit Conditions | How to use this signal from the Application |
1 | SIGNAL_FIRSTFRAME | first-video-frame-callback | The signal emitted by this API will be emitted when the first video frame is ready and available for processing. | gst_westeros_sink_soc_render | 1. when gst_westeros_sink_soc_init() is called, the sink calls on the display function, with that to generate the first frame thread it checks if the sink is not NULL, the signal is called. | g_signal_connect (decoder_instance, “first-video-frame-callback”, G_CALLBACK(callback_fnc), Callback_fnc_data) |
gst_westeros_sink_soc_start_video | ||||||
gst_westeros_sink_soc_init | ||||||
2 | SIGNAL_UNDERFLOW | buffer-underflow-callback | The signal emitted by this API will be emitted when there is a buffer underflow condition in the element. A buffer underflow occurs when the element is unable to produce or process data quickly enough to keep up with the data flow rate, resulting in a depletion of the buffer. When it happens, this signal is emitted. | gst_westeros_sink_soc_start_video | 1. when the gst_westeros_sink_soc_start_video() is called, with the capture_start event, a no. of functions is called to check the condition and collect data related to buffer, plane and get frame-related data like frame rate, frame size, frame width, frame height, under this condition: sink->soc.emitUnderflowSignal is set to TRUE; signal is called. | g_signal_connect (decoder_instance, “buffer-underflow-callback”, G_CALLBACK(callback_fnc), Callback_fnc_data) |
gst_westeros_sink_soc_render | ||||||
3 | SIGNAL_NEWTEXTURE | new-video-texture-callback | The signal emitted by this API will be emitted when a new video texture is ready and available for processing. The callback function associated with this signal may need to parse and interpret the various arguments in order to properly process the new video texture data related to the video texture format, dimensions, and planes. | gst_westeros_sink_soc_start_video | 1. This signal is emitted when a new texture is ready to be displayed by the video sink. Various parameters are passed based on whether the texture is multi-planar or not and sets the appropriate values for the file descriptor, length, stride, and pointer of each plane of the texture buffer. | g_signal_connect (decoder_instance, “new-video-texture-callback”, G_CALLBACK(callback_fnc), Callback_fnc_data) |
gst_westeros_sink_soc_render | ||||||
gst_westeros_sink_soc_init | ||||||
4 | SIGNAL_DECODEERROR | decode-error-callback | The signal emitted by this API will be emitted when there is a decoding error in the element. A decoding error occurs when the element is unable to decode the input data stream properly, resulting in a failure to produce valid output data. When this happens, this signal is emitted. | 1. This signal can be emitted under the conditions where if the video decoder captures any error related to video decoding status and any respective flag is set, this signal can be generated and to further handle the decode errors. | g_signal_connect (decoder_instance, “decode-error-callback”, G_CALLBACK(callback_fnc), Callback_fnc_data) | |
5 | SIGNAL_TIMECODE | timecode-callback | The signal emitted by this API will be emitted when a new timecode is available. It is used to indicate the current timecode of the media being processed by the element which can be helpful in synchronizing multiple elements. | gst_westeros_sink_soc_start_video | 1. This signal can be emitted under the condition that if a set position from the frame currently is being presented by the video server | g_signal_connect (decoder_instance, “timecode-callback”, G_CALLBACK(callback_fnc), Callback_fnc_data) |
gst_westeros_sink_soc_render |
V4L2 IOCTL for SOC Implementation
Sl. no. | IOCTL Call | About | Description | Synopsis | IOCTL Definition file |
1 | VIDIOC_QUERYCAP | Query device capabilities | All V4L2 devices support the VIDIOC_QUERYCAP ioctl. It is used to identify kernel devices compatible with this specification and to obtain information about driver and hardware capabilities. The ioctl takes a pointer to a struct v4l2_capability which is filled by the driver. When the driver is not compatible with this specification the ioctl returns an EINVAL error code. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-querycap.html#_CPPv25ioctliiP15v4l2_capability | linux/videodev2.h |
2 | VIDIOC_ENUM_FMT | Enumerate image formats | To enumerate image formats applications initialize the type and index field of struct v4l2_fmtdesc and call the ioctl VIDIOC_ENUM_FMT ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an EINVAL error code. All formats are enumerable by beginning at index zero and incrementing by one until EINVAL is returned. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-enum-fmt.html | linux/videodev2.h |
3 | VIDIOC_G_FMT | Get the data format (typically image format) exchanged b/w driver & application. | To query the current parameters applications set the type field of a struct struct v4l2_format to the respective buffer (stream) type. For example, video capture devices use V4L2_BUF_TYPE_VIDEO_CAPTURE or V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE . When the application calls the VIDIOC_G_FMT ioctl with a pointer to this structure the driver fills the respective member of the fmt union. When the requested buffer type is not supported drivers return an EINVAL error code. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-fmt.html | linux/videodev2.h |
4 | VIDIOC_S_FMT | Set the data format (typically image format) exchanged b/w driver & application | When the application calls the VIDIOC_S_FMT ioctl with a pointer to a struct v4l2_format structure the driver checks and adjusts the parameters against hardware abilities. Drivers should not return an error code unless the type field is invalid, this is a mechanism to fathom device capabilities and to approach parameters acceptable for both the application and driver. On success, the driver may program the hardware, allocate resources, and generally prepare for data exchange. Finally, the VIDIOC_S_FMT ioctl returns the current format parameters as VIDIOC_G_FMT does. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-fmt.html | linux/videodev2.h |
5 | VIDIOC_REQBUFS | Initiate Memory Mapping, User Pointer I/O or DMA buffer I/O | To allocate device buffers applications initialize all fields of the struct v4l2_requestbuffers structure. They set the type field to the respective stream or buffer type, the count field to the desired number of buffers, memory must be set to the requested I/O method and the reserved array must be zeroed. When the ioctl is called with a pointer to this structure the driver will attempt to allocate the requested number of buffers and it stores the actual number allocated in the count field. For example, video output requires at least two buffers, one displayed and one filled by the application. When the I/O method is not supported the ioctl returns an EINVAL error code. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-reqbufs.html | linux/videodev2.h |
6 | VIDIOC_QUERYBUF | Query the status of a buffer. | Applications set the type field of a struct v4l2_buffer to the same buffer type as was previously used with struct v4l2_format type and struct v4l2_requestbuffers type , and the index field. Valid index numbers range from zero to the number of buffers allocated with ioctl VIDIOC_REQBUFS (struct v4l2_requestbuffers count ) minus one. The reserved and reserved2 fields must be set to 0. After calling ioctl VIDIOC_QUERYBUF with a pointer to this structure drivers return an error code or fill the rest of the structure. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-querybuf.html | linux/videodev2.h |
7 | VIDIOC_G_FBUF | Get frame buffer overlay parameters. | To get the current parameters applications call the VIDIOC_G_FBUF ioctl with a pointer to a struct v4l2_framebuffer structure. The driver fills all fields of the structure or returns an EINVAL error code when overlays are not supported. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-fbuf.html | linux/videodev2.h |
8 | VIDIOC_S_FBUF | Set frame buffer overlay parameters. | To set the parameters for a Video Output Overlay, applications must initialize the To set the parameters for a non-destructive Video Overlay, applications must initialize the For a destructive Video Overlay applications must additionally provide a | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-fbuf.html | linux/videodev2.h |
9 | VIDIOC_OVERLAY | Start or stop video overlay | This ioctl is part of the video overlay I/O method. Applications call ioctl VIDIOC_OVERLAY to start or stop the overlay. It takes a pointer to an integer which must be set to zero by the application to stop overlay, to one to start. Drivers do not support ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF or VIDIOC_STREAMOFF with | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-overlay.html | linux/videodev2.h |
10 | VIDIOC_QBUF | Exchange a buffer with the driver | Applications call the To enqueue a memory mapped buffer applications set the To enqueue a user pointer buffer applications set the | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-qbuf.html | linux/videodev2.h |
11 | VIDIOC_EXPBUF | Export a buffer as a DMABUF file descriptor | This ioctl is an extension to the memory mapping I/O method, hence it is available only for | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-expbuf.html | linux/videodev2.h |
12 | VIDIOC_DQBUF | Exchange a buffer with the driver | Applications call the | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-qbuf.html | linux/videodev2.h |
13 | VIDIOC_STREAMON | Start streaming I/O | This ioctl start the capture or output process during streaming (memory mapping, user pointer or DMABUF) I/O. Capture hardware is disabled and no input buffers are filled (if there are any empty buffers in the incoming queue) until If | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-streamon.html | linux/videodev2.h |
14 | VIDIOC_STREAMOFF | Stop streaming I/O | The VIDIOC_STREAMOFF ioctl, apart from aborting or finishing any DMA in progress, unlocks any user pointer buffers locked in physical memory, and it removes all buffers from the incoming and outgoing queues. That means all images captured but not dequeued yet will be lost, likewise, all images enqueued for output but not transmitted yet. I/O returns to the same state as after calling ioctl VIDIOC_REQBUFS and can be restarted accordingly. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-streamon.html | linux/videodev2.h |
15 | VIDIOC_G_PARM | Get streaming parameters. | The current video standard determines a nominal number of frames per second. If less than this number of frames is to be captured or output, applications can request frame skipping or duplicating on the driver side. This is especially useful when using the read() or write(), which are not augmented by timestamps or sequence counters, and to avoid unnecessary data copying. Further, get/set can be used to determine the number of buffers used internally by a driver in read/write mode. For implications see the section discussing the read() function. To get the streaming parameters applications call the VIDIOC_G_PARM ioctl. It takes a pointer to a struct struct v4l2_streamparm which contains a union holding separate parameters for input and output devices. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-parm.html | linux/videodev2.h |
16 | VIDIOC_S_PARM | Set streaming parameters. | To set the streaming parameters applications call the VIDIOC_S_PARM ioctl. It takes a pointer to a struct struct v4l2_streamparm which contains a union holding separate parameters for input and output devices. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-parm.html | linux/videodev2.h |
17 | VIDIOC_G_STD | Query the video standard of the current input | It takes a pointer to a v4l2_std_id type as an argument. VIDIOC_G_STD can return a single flag or a set of flags as in the struct v4l2_standard field | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-std.html | linux/videodev2.h |
18 | VIDIOC_S_STD | Select the video standard of the current input. | It takes a pointer to a v4l2_std_id type as an argument. VIDIOC_G_STD can return a single flag or a set of flags as in the struct v4l2_standard field VIDIOC_S_STD accepts one or more flags, being a write-only ioctl it does not return the actual new standard as VIDIOC_G_STD does. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-std.html | linux/videodev2.h |
19 | VIDIOC_ENUMSTD | Enumerate supported video standards | To query the attributes of a video standard, especially a custom (driver-defined) one, applications initialize the index field of struct v4l2_standard and call the ioctl VIDIOC_ENUMSTD ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an EINVAL error code when the index is out of bounds. To enumerate all standards applications shall begin at index zero, incrementing by one until the driver returns EINVAL . Drivers may enumerate a different set of standards after switching the video input or output. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-enumstd.html | linux/videodev2.h |
20 | VIDIOC_ENUMINPUT | Enumerate video inputs | To query the attributes of a video input application initialize the index field of struct v4l2_input and call the ioctl VIDIOC_ENUMINPUT ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an EINVAL error code when the index is out of bounds. To enumerate all inputs applications shall begin at index zero, incrementing by one until the driver returns EINVAL . | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-enuminput.html | linux/videodev2.h |
21 | VIDIOC_G_CTRL | Get the value of a control. | To get the current value of control applications initialize the id field of a struct struct v4l2_control and call the VIDIOC_G_CTRL ioctl with a pointer to this structure. Works only with user controls. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-ctrl.html | linux/videodev2.h |
22 | VIDIOC_S_CTRL | Set the value of a control. | To change the value of a control applications, initialize the id and value fields of a struct struct v4l2_control and call the VIDIOC_S_CTRL ioctl. VIDIOC_S_CTRL is a write-only ioctl, it does not return the actual new value. Works only with user controls. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-ctrl.html | linux/videodev2.h |
23 | VIDIOC_QUERYCTRL | Enumerate controls | To query the attributes of a control applications set the id field of a struct v4l2_queryctrl and call the VIDIOC_QUERYCTRL ioctl with a pointer to this structure. The driver fills the rest of the structure or returns an EINVAL error code when the id is invalid. It is possible to enumerate controls by calling VIDIOC_QUERYCTRL with successive id values starting from V4L2_CID_BASE up to and exclusive V4L2_CID_LASTP1 . Drivers may return EINVAL if control in this range is not supported. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-queryctrl.html | linux/videodev2.h |
24 | VIDIOC_ENUM_ FRAMESIZES | Enumerate frame sizes. | This ioctl allows applications to enumerate all frame sizes (i. e. width and height in pixels) that the device supports for the given pixel format. The supported pixel formats can be obtained by using the ioctl VIDIOC_ENUM_FMT function. The return value and the content of the | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-enum-framesizes.html | linux/videodev2.h |
25 | VIDIOC_TRY_FMT | Try a data format. | The VIDIOC_TRY_FMT ioctl is equivalent to VIDIOC_S_FMT with 1 exception: it does not change the driver state. It can also be called at any time, never returning | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-fmt.html | linux/videodev2.h |
26 | VIDIOC_CROPCAP | Information about the video cropping and scaling abilities | Applications use this function to query the cropping limits, the pixel aspect of images and to calculate scale factors. They set the | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-cropcap.html | linux/videodev2.h |
27 | VIDIOC_CREATE_BUFS | Create buffers for Memory Mapped or User Pointer or DMA Buffer I/O | This can be used as an alternative or in addition to the ioctl VIDIOC_REQBUFS ioctl, when tighter control over buffers is required. This ioctl can be called multiple times to create buffers of different sizes. To allocate the device buffers applications must initialize the relevant fields of the struct v4l2_create_buffers structure. The When the ioctl is called with a pointer to this structure the driver will attempt to allocate up to the requested number of buffers and store the actual number allocated and the starting index in the | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-create-bufs.html | linux/videodev2.h |
28 | VIDIOC_G_SELECTION | Get one of the selection rectangles. | To query the cropping (composing) rectangle set the struct v4l2_selection type field to the respective buffer type. Do not use the multiplanar buffer types. The next step is setting the value of the struct v4l2_selection target field to V4L2_SEL_TGT_CROP (V4L2_SEL_TGT_COMPOSE ). The flags and reserved fields of struct v4l2_selection are ignored, and they must be filled with zeros. The driver fills the rest of the structure or returns EINVAL error code if an incorrect buffer type or target was used. If cropping (composing) is not supported, then the active rectangle is not mutable, and it is always equal to the bounds rectangle. Finally, the struct v4l2_rect rectangle is filled with the current cropping (composing) coordinates. | https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-g-selection.html | linux/videodev2.h |