Skip to content

Latest commit

 

History

History
3446 lines (2669 loc) · 138 KB

api-sink.md

File metadata and controls

3446 lines (2669 loc) · 138 KB

Sink API Reference

Sinks are the end components for all DSL GStreamer Pipelines and Branches. A Pipeline or Branch must have at least one Sink in order to transition to a state of Playing.

All Sinks are derived from the "Component" class, therefore all component methods can be called with any Sink.

Hierarchy

component
 ╰── sink

DSL supports fifteen (15) different types of Sinks:

  • 3D Window Sink - renders/overlays video on a Parent XWindow (Jetson Platform Only)... based on the 3D graphics rendering API.
  • EGL Window Sink - renders/overlays video on a Parent XWindow... based on the EGL API.
  • V4L2 Sink - streams video to a V4L2 device or v4l2loopback.
  • File Sink - encodes video to a media container file
  • Record Sink - similar to the File sink but with Start/Stop/Duration control and a cache for pre-start buffering.
  • RTMP Sink - streams encoded video using the Real-time Messaging Protocol (RTMP) to social media networks, live streaming platforms, and media servers.
  • RTSP Client Sink - streams encoded video using the Real-time Streaming Protocol (RTSP) as a client of a media server.
  • RTSP Server Sink - streams encoded video via an RTSP (UDP) Server on a specified port.
  • WebRTC Sink - streams encoded video to a web browser or mobile application. (Requires GStreamer 1.18 or later)
  • Message Sink - converts Object Detection Event (ODE) metadata into a message payload and sends it to the server using a specified communication protocol.
  • Application Sink - allows the application to receive buffers or samples from a DSL Pipeline.
  • Interpipe Sink - allows pipeline buffers and events to flow to other independent pipelines, each with an Interpipe Source. Disabled by default, requires additional install/build steps.
  • Multi-Image Sink - encodes and saves video frames to JPEG files at specified dimensions and frame-rate.
  • Frame-Capture Sink - encodes and saves video frames to JPEG files on demand or on schedule. Disabled by default, requires additional install/build steps.
  • Fake Sink - consumes/drops all data.
  • Custom Sink - Used to create a Custom Video Sink using GStreamer (GST) Elements created from proprietary or released GStreamer plugins.

Sink Construction and Destruction

Sinks are created by calling one of the type-specific constructors. As with all components, Sinks must be uniquely named from all other components created.

The relationship between Pipelines and Sinks is one-to-many. The same relationship exists between Branches and Sinks. Once added to a Pipeline, a Sink must be removed before it can be used with another. Sinks are deleted by calling dsl_component_delete, dsl_component_delete_many, or dsl_component_delete_all

Adding and Removing

When adding a Sink(s) to a Pipeline or Branch, DSL automatically inserts a Splitter Tee between the last component and the Sink(s) as shown in the image below, even if there is only one. This ensures that additional Sinks can be added (and removed) once the Pipeline is playing.

Sinks are added to a Pipeline by calling dsl_pipeline_component_add or dsl_pipeline_component_add_many and removed with dsl_pipeline_component_remove, dsl_pipeline_component_remove_many, or dsl_pipeline_component_remove_all.

A similar set of Services are used when adding/removing a to/from a branch: dsl_branch_component_add, dsl_branch_component_add_many, dsl_branch_component_remove, dsl_branch_component_remove_many, and dsl_branch_component_remove_all.

IMPORTANT!: A Sink Component can be added as a branch to either a Splitter or Demuxer Tee.

Common Sink Properties

All Sinks -- except for the Smart Record and RTSP Client Sinks -- support the following common properties accessible through corresponding get/set base Sink Methods. (Note: the follow bullets are quotes from the GStreamer Documentation)

  • sync : Each Sink sets a timestamp for when a frame should be played, if sync=true it will block the pipeline and only play the frame after that time. This is useful for playing from a video file, or other non-live sources. If you play a video file with sync=false it will play back as fast as it can be read and processed. See dsl_sink_sync_enabled_get and dsl_sink_sync_enabled_set. As a general rule
    • Set sync=true if using non-live sources and/or if the stream is to be rendered and viewed.
    • Set sync=false if using live sources and/or if significantly processing the stream.
  • async : If async=true, the Sink will perform asynchronous state changes. When async=false, the Sink will not signal the parent when it prerolls. Use this option when dealing with sparse streams or when synchronization is not required. See dsl_sink_async_enabled_get and dsl_sink_async_enabled_set.
  • max-lateness : The max-lateness property affects how the Sink deals with buffers that arrive too late. A buffer arrives too late in the Sink when the presentation time (as a combination of the last segment, buffer timestamp and element base_time) plus the duration is before the current time of the clock. If the frame is later than max-lateness (in nanoseconds), the sink will drop the buffer without calling the render method. This feature is disabled if sync=false. See dsl_sink_max_lateness_get and dsl_sink_max_lateness_set.
  • qos :If qos=true, the property will enable the quality-of-service features of the Sink which gather statistics about the real-time performance of the clock synchronization. For each buffer received in the Sink, statistics are gathered and a QOS event is sent upstream with these numbers. This information can then be used by upstream elements to reduce their processing rate, for example. See dsl_sink_qos_enabled_get and dsl_sink_qos_enabled_set.

IMPORTANT! All DSL Sink Components use the default property values assigned to their GStreamer (GST) Sink Plugins, except for.

  1. All set their async property to false on construction. Synchronization is required to support multiple levels of multiple Secondary Inference
  2. All disable max-lateness by setting the property to -1`.
  3. All set their qos value to false (disabled).

Sink common property values

  • A single value indicates that the gstreamer-default is used.
  • a/b values define both the gstreamer-default/DSL-default values.
Sink GST Plugin sync async max-lateness qos
3D Window Sink nv3dsink true true/false 5000000/-1 true/false
EGL Window Sink nveglglessink true true/false 5000000/-1 true/false
V4L2 Sink v4l2sink true true/false 5000000/-1 true/false
File Sink filesink false true/false -1 false
Record Sink1 na na na na na
RTMP Sink rtmpsink true true/false -1 false
RTSP Client Sink2 rtspclientsink na na na na
RTSP Server Sink udpsink true true/false -1 false
WebRTC Sink fakesink false true/false -1 false
Message Sink nvmsgbroker true true/false -1 false
App Sink appsink true true/false -1 false
Interpipe Sink interpipesink false true/false -1 false
Multi-Image Sink multifilesink false true/false -1 false
Frame-Capture Sink appsink true true/false -1 false
Fake Sink fakesink false true/false -1 false
Custom Sink3 custom na na na na
  • 1 The NVIDIA Smart Recording Bin - used by the Record Sink - does not support/extern any of the common sink properties.
  • 2 The rtspclientsink plugin is not derived from the GStreamer basesink which implements the common sink properties.
  • 3 The sink plugin is selected by the user and is transparent to DSL.

Encode Sinks

There are currently five Encode Sinks; File Sink, Record Sink, RTMP Sink, RTSP Server Sink, and WebRTC Sink.

Hierarchy

component
 ╰── sink
    ╰── encode sink

The constructors for each of the Encode Sinks include three encoding parameters defined as.

  • encoder - [in] one of the Encoder Type symbolic constants.
  • bitrate - [in] bitrate for video encoding in units of bit/s.
  • iframe_interval - [in] intra frame (key-frame) occurrence interval.

See below for information on setting each of the parameters.

Encoder Parameter

All Encode Sinks, except for the RTMP Sink, support five types of encoders:

  • Two hardware; H.264, H.265
  • Three software; H.264, H.265, MP4

The RTMP Sink (currently) only supports H.264 encoding (software and hardware).

IMPORTANT! The NVIDIA® Jetson Orin Nano device does not support hardware encoding.

Bitrate Parameter

Each Sink's encoder bitrate can be set to 0 to use the encoder-plugin default values as follows.

  • HW-H264/H265 = 4000000 bit/s
  • SW-H264/H265 = 2048000 bit/s
  • SW-MPEG4 = 200000 bit/s

Or use the suggested bitrates of

H.264 - 1800 kbps for 480p videos, 3500 kbps for 720p videos, and 8500 kbps for 1080p videos. H.265 - 2500 kbps for 480p videos, 5000 kbps for 720p videos, and 8000 kbps for 1080p videos. MPEG4 - minimum 200000 bit/s

Note! There are numerous online bitrate calculators that can be used to select a bitrate based on file size or bandwidth requirements.

Intra-frame Interval Parameter.

When using the H.264 and H.265 software encoders, you may set the parameter to 0 for automatic interval selection or > 0 for maximum interval. When using the H.264 and H.265 hardware encoders as a rule of thumb you can set the interval to the same value as the frame-rate to insert an iframe once per second. For example,

frame-rate = 30/s, iframe-interval = 30 (frequency = 1/30 frames) == 1 iframe/s.

You can adjust the interval knowing that:

  • increasing the interval can increase the compression but decrease the quality.
  • decreasing the interval can increase the quality but decrease the compression.

Custom Video Sinks

The Custom Sink API is used to create custom DSL Video Sink Components using GStreamer (GST) Elements created from installed or proprietary GStreamer plugins. See also Custom Sources and Custom Components.

Using the V4L2 Sink with V4L2 Loopback

From the GStream documentation:

"The V4L2 Sink can be used to display video to V4L2 compatible video devices (screen overlays provided by the graphics hardware, tv-out, etc)."

V4L2 Loopback can be used to create "virtual V4L2 video devices" allowing applications to read the virtual devices as V4L2 input sources. See: https://github.com/umlaeute/v4l2loopback for more information.

Applicable DSL examples:

You can install v4l2loopback with the command below. Depending on your device, there may be extra steps to install a kernel module. Follow the prompts as directed.

   $ sudo apt-get install v4l2loopback-dkms

Run the following to setup '/dev/video3' (used by the examples above)

	$ sudo modprobe v4l2loopback video_nr=3

You can use the following GStreamer launch command to test the loopback device when the example pipeline is running.

   $ gst-launch-1.0 v4l2src device=/dev/video3 ! videoconvert  ! xvimagesink

Sink API

Types:

Callback Types:

Constructors:

Sink Methods

App Sink Methods

3D & EGL Window Sink Methods

EGL Window Sink Methods

V4L2 Sink Methods

Encode Sink Methods

Smart-Record Sink Methods

RTMP Sink Methods

RTSP Client Sink Methods

RTSP Server Sink Methods

WebRTC Sink Methods

IOT Message Converter Sink Methods

Interpipe Sink Methods

Multi-Image Sink Methods

Frame-Capture Sink Methods

Custom Sink Methods

Return Values

The following return codes are used by the Sink API

#define DSL_RESULT_SINK_RESULT                                  	0x00040000
#define DSL_RESULT_SINK_NAME_NOT_UNIQUE                         	0x00040001
#define DSL_RESULT_SINK_NAME_NOT_FOUND                          	0x00040002
#define DSL_RESULT_SINK_NAME_BAD_FORMAT                         	0x00040003
#define DSL_RESULT_SINK_THREW_EXCEPTION                         	0x00040004
#define DSL_RESULT_SINK_PATH_NOT_FOUND                          	0x00040005
#define DSL_RESULT_SINK_IS_IN_USE                               	0x00040007
#define DSL_RESULT_SINK_GET_FAILED                              	0x00040008
#define DSL_RESULT_SINK_SET_FAILED                              	0x00040009
#define DSL_RESULT_SINK_ENCODER_VALUE_INVALID                   	0x0004000A
#define DSL_RESULT_SINK_CONTAINER_VALUE_INVALID                 	0x0004000B
#define DSL_RESULT_SINK_COMPONENT_IS_NOT_SINK                   	0x0004000C
#define DSL_RESULT_SINK_COMPONENT_IS_NOT_ENCODE_SINK            	0x0004000D
#define DSL_RESULT_SINK_COMPONENT_IS_NOT_WINDOW_SINK            	0x0004000E
#define DSL_RESULT_SINK_OBJECT_CAPTURE_CLASS_ADD_FAILED         	0x0004000F
#define DSL_RESULT_SINK_OBJECT_CAPTURE_CLASS_REMOVE_FAILED      	0x00040010
#define DSL_RESULT_SINK_HANDLER_ADD_FAILED                      	0x00040011
#define DSL_RESULT_SINK_HANDLER_REMOVE_FAILED                   	0x00040012
#define DSL_RESULT_SINK_PLAYER_ADD_FAILED                       	0x00040013
#define DSL_RESULT_SINK_PLAYER_REMOVE_FAILED                    	0x00040014
#define DSL_RESULT_SINK_MAILER_ADD_FAILED                       	0x00040015
#define DSL_RESULT_SINK_MAILER_REMOVE_FAILED                    	0x00040016
#define DSL_RESULT_SINK_3D_NOT_SUPPORTED                        	0x00040017
#define DSL_RESULT_SINK_WEBRTC_CLIENT_LISTENER_ADD_FAILED       	0x00040018
#define DSL_RESULT_SINK_WEBRTC_CLIENT_LISTENER_REMOVE_FAILED    	0x00040019
#define DSL_RESULT_SINK_WEBRTC_CONNECTION_CLOSED_FAILED         	0x0004001A
#define DSL_RESULT_SINK_MESSAGE_CONFIG_FILE_NOT_FOUND           	0x0004001B
#define DSL_RESULT_SINK_COMPONENT_IS_NOT_MESSAGE_SINK           	0x0004001C
#define DSL_RESULT_SINK_ELEMENT_ADD_FAILED                      	0x0004001D
#define DSL_RESULT_SINK_ELEMENT_REMOVE_FAILED                   	0x0004001E
#define DSL_RESULT_SINK_ELEMENT_NOT_IN_USE                      	0x0004001F

Encoder Types

The following encoder types are used by the Encode Sink APIs

#define DSL_ENCODER_HW_H264                                     	0
#define DSL_ENCODER_HW_H265                                     	1
#define DSL_ENCODER_SW_H264                                     	2
#define DSL_ENCODER_SW_H265                                     	3
#define DSL_ENCODER_SW_MPEG4                                    	4

Video Container Types

The following video container types are used by the File Sink API

#define DSL_CONTAINER_MP4                                       	0
#define DSL_CONTAINER_MKV                                       	1

Recording Defaults

#define DSL_DEFAULT_VIDEO_RECORD_MAX_SIZE_IN_SEC                	600
#define DSL_DEFAULT_VIDEO_RECORD_CACHE_SIZE_IN_SEC              	60

Smart Recording Events

#define DSL_RECORDING_EVENT_START                               	0
#define DSL_RECORDING_EVENT_END                                 	1

Valid return values for the dsl_sink_app_new_data_handler_cb

#define DSL_FLOW_OK                                             	0
#define DSL_FLOW_EOS                                            	1
#define DSL_FLOW_ERROR                                          	2

Data Types provided by the APP Sink

#define DSL_SINK_APP_DATA_TYPE_SAMPLE                           	0
#define DSL_SINK_APP_DATA_TYPE_BUFFER                           	1

Buffer Format constants

#define DSL_VIDEO_FORMAT_YUY2                                   	L"YUY2"
#define DSL_VIDEO_FORMAT_YVYU                                   	L"YVYU"

V4L2 Device Type Flags

#define DSL_V4L2_DEVICE_TYPE_NONE                               	0x00000000
#define DSL_V4L2_DEVICE_TYPE_CAPTURE                            	0x00000001
#define DSL_V4L2_DEVICE_TYPE_OUTPUT                             	0x00000002
#define DSL_V4L2_DEVICE_TYPE_OVERLAY                            	0x00000004
#define DSL_V4L2_DEVICE_TYPE_VBI_CAPTURE                        	0x00000010
#define DSL_V4L2_DEVICE_TYPE_VBI_OUTPUT                         	0x00000020
#define DSL_V4L2_DEVICE_TYPE_TUNER                              	0x00010000
#define DSL_V4L2_DEVICE_TYPE_AUDIO                              	0x00020000

RTSP Profile constants

#define DSL_RTSP_PROFILE_UNKNOWN                                	0x00000000
#define DSL_RTSP_PROFILE_AVP                                    	0x00000001
#define DSL_RTSP_PROFILE_SAVP                                   	0x00000002
#define DSL_RTSP_PROFILE_AVPF                                   	0x00000004
#define DSL_RTSP_PROFILE_SAVPF                                  	0x00000008

RTSP Lower-Protocol constants

#define DSL_RTSP_LOWER_TRANS_UNKNOWN                            	0x00000000
#define DSL_RTSP_LOWER_TRANS_UDP                                	0x00000001
#define DSL_RTSP_LOWER_TRANS_UDP_MCAST                          	0x00000002
#define DSL_RTSP_LOWER_TRANS_TCP                                	0x00000004
#define DSL_RTSP_LOWER_TRANS_HTTP                               	0x00000010
#define DSL_RTSP_LOWER_TRANS_TLS                                	0x00000020

TLS certificate validation constants

Flags used to validate the RTSP server certificate.

#define DSL_TLS_CERTIFICATE_UNKNOWN_CA                          	0x00000001
#define DSL_TLS_CERTIFICATE_BAD_IDENTITY                        	0x00000002
#define DSL_TLS_CERTIFICATE_NOT_ACTIVATED                       	0x00000004
#define DSL_TLS_CERTIFICATE_EXPIRED                             	0x00000008
#define DSL_TLS_CERTIFICATE_REVOKED                             	0x00000010
#define DSL_TLS_CERTIFICATE_INSECURE                            	0x00000020
#define DSL_TLS_CERTIFICATE_GENERIC_ERROR                       	0x00000040
#define DSL_TLS_CERTIFICATE_VALIDATE_ALL                        	0x0000007f

WebRTC Connection States

Used by the WebRTC Sink to communicate its current state to listening clients

#define DSL_SOCKET_CONNECTION_STATE_CLOSED                      	0
#define DSL_SOCKET_CONNECTION_STATE_INITIATED                   	1
#define DSL_SOCKET_CONNECTION_STATE_OPENED                      	2
#define DSL_SOCKET_CONNECTION_STATE_FAILED                      	3

Message Converter Payload Schema Types

Defines the Payload schema types that can be used with the Message Sink

#define DSL_MSG_PAYLOAD_DEEPSTREAM                              	0
#define DSL_MSG_PAYLOAD_DEEPSTREAM_MINIMAL                      	1

NVIDIA Installed Protocol Adapter Paths

The following -D flags are defined in the DSL Makefile

-DNVDS_AZURE_PROTO_LIB='L"$(LIB_INSTALL_DIR)/libnvds_azure_proto.so"' \
-DNVDS_AZURE_EDGE_PROTO_LIB='L"$(LIB_INSTALL_DIR)/libnvds_azure_edge_proto.so"' \
-DNVDS_AMQP_PROTO_LIB='L"$(LIB_INSTALL_DIR)/libnvds_amqp_proto.so"' \
-DNVDS_KAFKA_PROTO_LIB='L"$(LIB_INSTALL_DIR)/libnvds_kafka_proto.so"' \
-DNVDS_REDIS_PROTO_LIB='L"$(LIB_INSTALL_DIR)/libnvds_redis_edge_proto.so"'


Types:

dsl_recording_info

typedef struct dsl_recording_info
{
	uint recording_event;
	uint sessionId;
	const wchar_t* filename;
	const wchar_t* dirpath;
	uint64_t duration;
	uint containerType;
	uint width;
	uint height;
} dsl_recording_info;

Structure typedef used to provide recording session information provided to the client on callback

Fields

  • recording_event - specifies which recording event has occurred. One of DSL_RECORDING_EVENT_START or DSL_RECORDING_EVENT_END
  • sessionId - the unique sessions id assigned on record start
  • filename - filename generated for the completed recording. Null on recording start.
  • directory - path for the completed recording. Null on recording start.
  • duration - duration of the recording in milliseconds. 0 on recording start.
  • containerType - DSL_CONTAINER_MP4 or DSL_CONTAINER_MP4
  • width - width of the recording in pixels
  • height - height of the recording in pixels

Python Example

##
# Function to be called on recording start and complete
##
def recording_event_listener(session_info_ptr, client_data):
	print(' ***  Recording Event  *** ')
   
	session_info = session_info_ptr.contents
	print('event type: ', session_info.recording_event)
	print('session_id: ', session_info.session_id)
	print('filename:   ', session_info.filename)
	print('dirpath:	', session_info.dirpath)
	print('duration:   ', session_info.duration)
	print('container:  ', session_info.container_type)
	print('width:  	', session_info.width)
	print('height: 	', session_info.height)

dsl_webrtc_connection_data

typedef struct _dsl_webrtc_connection_data
{
	uint current_state;

} dsl_webrtc_connection_data;

A structure typedef used to provide connection date for a given WebRTC Sink

Fields

  • current_state - the current state of the WebRTC Sink's WebSocket connection, one of the defined WebRTC Connection States.

Callback Types:

dsl_sink_app_new_data_handler_cb

typedef uint (*dsl_sink_app_new_data_handler_cb)(uint data_type,
	void* data, void* client_data);

Callback typedef for the App Sink Component. The function is registered when the App Sink is created with dsl_sink_app_new. Once the Pipeline is playing, the function will be called when new data is available to process. The type of data is specified with the App Sink constructor.

Parameters

  • data_type [in] either DSL_SINK_APP_DATA_TYPE_SAMPLE or DSL_SINK_APP_DATA_TYPE_BUFFER. See App Sink data-types.
  • client_data [in] opaque pointer to client's user data, provided by the client.

Returns


dsl_sink_window_key_event_handler_cb

typedef void (*dsl_sink_window_key_event_handler_cb)(const wchar_t* key, void* client_data);

Callback typedef for a client XWindow KeyRelease event handler function. Functions of this type are added to a Window Sink by calling dsl_sink_window_key_event_handler_add. Once added, the function will be called on every XWindow KeyRelease event. The handler function is removed by calling dsl_sink_window_key_event_handler_remove.

Parameters

  • key - [in] UNICODE key string for the key pressed
  • client_data - [in] opaque pointer to client's user data, passed into the Window Sink on callback add

dsl_sink_window_button_event_handler_cb

typedef void (*dsl_sink_window_button_event_handler_cb)(uint button, uint xpos, uint ypos, void* client_data);

Callback typedef for a client XWindow ButtonPress event handler function. Functions of this type are added to a Window Sink by calling dsl_sink_window_button_event_handler_add. Once added, the function will be called on every XWindow ButtonPress event. The handler function is removed by calling dsl_sink_window_button_event_handler_remove.

Parameters

  • button - [in] one of DSL_BUTTON_ID indicating which mouse button was pressed
  • xpos - [in] positional X-offset from the XWindow's upper left corner in pixels
  • ypos - [in] positional Y-offset from the XWindow's upper left corner in pixels
  • client_data - [in] opaque pointer to client's user data, passed into the Window Sink on callback add

dsl_sink_window_delete_event_handler_cb

typedef void (*dsl_sink_window_delete_event_handler_cb)(void* client_data);

Callback typedef for a client XWindow Delete event handler function. Functions of this type are added to a Pipeline by calling dsl_sink_window_delete_event_handler_add. Once added, the function will be called on XWindow Delete event. The handler function is removed by calling dsl_sink_window_button_event_handler_remove.

Parameters

  • client_data - [in] opaque pointer to client's user data, passed into the Window Sink on callback add

dsl_record_client_listener_cb

typedef void* (*dsl_record_client_listener_cb)(void* info, void* user_data);

Callback typedef for clients to listen for a notification that a Recording Session has started or ended.

Parameters

  • info [in] opaque pointer to the connection info, see... see dsl_capture_info.
  • client_data [in] opaque pointer to client's user data, provided by the client.

dsl_sink_webrtc_client_listener_cb

typedef void (*dsl_sink_webrtc_client_listener_cb)(dsl_webrtc_connection_data* data,
	void* client_data);

Callback typedef for a client to listen for WebRTC Sink connection events.

IMPORTANT: The WebRTC Sink implementation requires GStreamer 1.18 or later.

Parameters

  • info [in] opaque pointer to the session info, see dsl_webrtc_connection_data.
  • client_data [in] opaque pointer to client's user data, provided by the client.

Constructors

dsl_sink_app_new

DslReturnType dsl_sink_app_new(const wchar_t* name, uint data_type,
	dsl_sink_app_new_data_handler_cb client_handler, void* client_data);

The constructor creates a new, uniquely named App Sink component. Construction will fail if the name is currently in use.

Hierarchy

component
 ╰── sink
    ╰── app sink

Parameters

  • name - [in] unique name for the App Sink to create.
  • data_type - [in] either DSL_SINK_APP_DATA_TYPE_SAMPLE or DSL_SINK_APP_DATA_TYPE_BUFFER. See App Sink data-types.
  • client_handler - [in] client callback function to be called with each new buffer received.
  • client_data [in] opaque pointer to client data returned on callback to the client_handler function.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_app_new('my-app-sink', DSL_SINK_APP_DATA_TYPE_BUFFER,
	my_data_handler, NULL)

dsl_sink_window_3d_new

DslReturnType dsl_sink_window_3d_new(const wchar_t* name,
	uint offset_x, uint offset_y, uint width, uint height);

The constructor creates a uniquely named 3D Window Sink with given offsets and dimensions. Construction will fail if the name is currently in use. Window Sinks are used to render video onto an XWindow Display.

IMPORTANT: The 3D Window Sink is only available on the Jetson platform.

Hierarchy

component
 ╰── sink
    ╰── window sink
       ╰── 3d window sink

Parameters

  • name - [in] unique name for the 3D Window Sink to create.
  • x_offset - [in] offset in the X direction from the upper left corner of the display in pixels.
  • y_offset - [in] offset in the Y direction from the upper left corner of the display in pixels.
  • width - [in] width of the 3D Window Sink in pixels.
  • height - [in] height of the 3D Window Sink in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_3d_new('my-window-sink', 200, 100, 1280, 720)

dsl_sink_window_egl_new

DslReturnType dsl_sink_window_egl_new(const wchar_t* name,
	uint offset_x, uint offset_y, uint width, uint height);

The constructor creates a uniquely named EGL Window Sink with given offsets and dimensions. Construction will fail if the name is currently in use. Window Sinks are used to render video onto an XWindow Display.

Hierarchy

component
 ╰── sink
    ╰── window sink
       ╰── egl window sink

Parameters

  • name - [in] unique name for the EGL Window Sink to create.
  • x_offset - [out] offset in the X direction in pixels from the upper left most corner of the display.
  • y_offset - [out] offset in the Y direction in pixels from the upper left most corner of the display.
  • width - [in] width of the EGL Window Sink in pixels.
  • height - [in] height of the EGL Window Sink in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_egl_new('my-window-sink', 0, 0, 1280, 720)

dsl_sink_v4l2_new

DslReturnType dsl_sink_v4l2_new(const wchar_t* name,
	const wchar_t* device_location);

The constructor creates a uniquely named V4L2 Sink that streams to any compatible V4L2 Device or v4l2loopback. Construction will fail if the name is currently in use.

Hierarchy

component
 ╰── sink
    ╰── v4l2 sink

Parameters

  • name - [in] unique name for the V4L2 Sink to create.
  • device_location - [in] device-location setting for the V4L2 Sink.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_v4l2_new('my-v4l2-sink', '/dev/video0')

dsl_sink_file_new

DslReturnType dsl_sink_file_new(const wchar_t* name, const wchar_t* filepath,
 	uint codec, uint container, uint bit_rate, uint iframe_interval);

The constructor creates a uniquely named File Sink. Construction will fail if the name is currently in use.

IMPORTANT! See the Encode Sink Overview for information on setting the encoder, bitrate, and iframe_interval parameters.

Hierarchy

component
 ╰── sink
    ╰── encode sink
       ╰── file sink

Parameters

  • name - [in] unique name for the File Sink to create.
  • filepath - [in] absolute or relative filespec for the media file to write to.
  • encoder - [in] one of the Encoder Types defined above.
  • container - [in] one of the Video Container Types defined above.
  • bitrate - [in] bitrate for video encoding in units of bit/s. Set to 0 to use the encoder's default.
  • iframe_interval - [in] intra frame (key-frame) occurrence interval.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_file_new('my-file-sink',
	'./my-video.mp4', DSL_ENCODER_HW_H264, DSL_CONTAINER_MPEG, 0, 30)

dsl_sink_record_new

DslReturnType dsl_sink_record_new(const wchar_t* name,
	const wchar_t* outdir, uint encoder, uint container, uint bitrate,
	uint iframe_interval, dsl_record_client_listener_cb  client_listener);

The constructor creates a uniquely named Record Sink. Construction will fail if the name is currently in use.

IMPORTANT! See the Encode Sink Overview for information on setting the encoder, bitrate, and iframe_interval parameters.

Note: the Sink name is used as the filename prefix, followed by session id and NTP time.

Hierarchy

component
 ╰── sink
    ╰── encode sink
       ╰── record sink

Parameters

  • name - [in] unique name for the Record Sink to create.
  • outdir - [in] absolute or relative pathspec for the directory to save the recorded video streams.
  • encoder - [in] one of the Encoder Types defined above.
  • container - [in] one of the Video Container Types defined above.
  • bitrate - [in] bitrate for video encoding in units of bit/s. Set to 0 to use the encoder's default.
  • iframe_interval - [in] intra frame (key-frame) occurrence interval.
  • client_listener - [in] client callback function of type dsl_record_client_listener_cb to be called when a Recording Event occurs.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_new('my-record-sink',
	'./', DSL_ENCODER_HW_H265, DSL_CONTAINER_MPEG, 0, 30, my-client-recording-event-cb)

dsl_sink_rtmp_new

DslReturnType dsl_sink_rtmp_new(const wchar_t* name, const wchar_t* uri,
	uint bitrate, uint iframe_interval);

The constructor creates a uniquely named RTMP Sink. Construction will fail if the name is currently in use. There is only one Encoder format supported; H.264.

IMPORTANT! See the Encode Sink Overview for information on setting the bitrate and iframe_interval parameters.

Hierarchy

component
 ╰── sink
    ╰── encode sink
       ╰── rtmp sink

Parameters

  • name - [in] unique name for the RTMP Sink to create.
  • uri - [in] the RTMP URI to stream to.
  • bitrate - [in] bitrate for video encoding in units of bit/s. Set to 0 to use the encoder's default.
  • iframe_interval - [in] intra frame (key-frame) occurrence interval.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtmp_new('my-rtmp-sink',
	'rtmp://localhost/path/to/stream/to', 0, 30)

dsl_sink_rtsp_client_new

DslReturnType dsl_sink_rtsp_client_new(const wchar_t* name, const wchar_t* uri,
 	uint encoder, uint bitrate, uint iframe_interval);

The constructor creates a uniquely named RTSP Client Sink. Construction will fail if the name is currently in use.

IMPORTANT! See the Encode Sink Overview for information on setting the encoder, bitrate, and iframe_interval parameters.

Hierarchy

component
 ╰── sink
    ╰── encode sink
       ╰── rtsp client sink

Parameters

  • name - [in] unique name for the RTSP Client Sink to create.
  • uri - [in] the RTSP URI to stream to.
  • encoder - [in] one of the Encoder Types defined above.
  • bitrate - [in] bitrate for video encoding in units of bit/s. Set to 0 to use the encoder's default (4Mbps).
  • iframe_interval - [in] intra frame (key-frame) occurrence interval.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtsp_client_new('my-rtsp-client-sink',
	'rtsp://server_endpoint/stream', DSL_ENCODER_HW_H264, 0, 30)

dsl_sink_rtsp_server_new

DslReturnType dsl_sink_rtsp_server_new(const wchar_t* name, const wchar_t* host,
 	uint udp_port, uint rtmp_port, uint encoder, uint bitrate, uint iframe_interval);

The constructor creates a uniquely named RTSP Server Sink. Construction will fail if the name is currently in use. The RTSP server is configured when the Pipeline is called to Play. The server is then started and attached to the g-main-loop context once dsl_main_loop_run is called. Once attached, the server can accept connections.

Important Note: the URI is derived from the device identification, rtmp_port, and server mount point which is derived from the unique RTSP Server Sink name,

When the client and DSL application are both running locally:

rtsp://<device-name>.local:<rtmp-port-number>/<rtsp-server-sink-name>

examples:

rtsp://my-jetson-device.local:8554/my-rtsp-server-sink
rtsp://0.0.0.0:8554/my-rtsp-server-sink

When the client is running remotely from the DSL application:

rtsp://<device-name>:<password>@<ip-address>:<rtmp-port-number>/<rtsp-server-sink-name>

for example:

rtsp://my-jetson-device:[email protected]:8554/my-rtsp-server-sink

IMPORTANT! See the Encode Sink Overview for information on setting the encoder, bitrate, and iframe_interval parameters.

Hierarchy

component
 ╰── sink
    ╰── encode sink
       ╰── rtsp sink

Parameters

  • name - [in] unique name for the RTSP Server Sink to create.
  • host - [in] host name
  • udp_port - [in] UDP port setting for the RTSP server.
  • rtsp_port - [in] RTSP port setting for the RTSP server.
  • encoder - [in] one of the Encoder Types defined above.
  • bitrate - [in] bitrate for video encoding in units of bit/s. Set to 0 to use the encoder's default.
  • iframe_interval - [in] intra frame (key-frame) occurrence interval.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

 retVal = dsl_sink_rtsp_server_new('my-rtsp-server-sink',
 	host_uri, 5400, 8554, DSL_ENCODER_HW_H264, 0, 30)

dsl_sink_webrtc_new

DslReturnType dsl_sink_webrtc_new(const wchar_t* name, const wchar_t* stun_server,
	const wchar_t* turn_server, uint encoder, uint bitrate, uint iframe_interval);

The constructor creates a uniquely named WebRTC Sink. Construction will fail if the name is currently in use. The WebRTC Sink Implements a Signaling Transceiver which is automatically added and removed from the WebSocket Server when added and removed from a Pipeline or Branch. Refer to the WebSocket Server API Reference for more information.

IMPORTANT: The WebRTC Sink implementation requires GStreamer 1.18 or later.

IMPORTANT! See the Encode Sink Overview for information on setting the encoder, bitrate, and iframe_interval parameters.

Hierarchy

component
 ╰── sink
    ╰── encode sink
       ╰── webrtc sink

Parameters

  • name - [in] unique name for the WebRTC Sink to create.
  • stun_server - [in] STUN server to use - of the form stun://hostname:port. Set to NULL to omit if using TURN server(s).
  • turn_server - [in] TURN server(s) to use - of the form turn(s)://username:password@host:port. Set to NULL to omit if using a STUN server.
  • encoder - [in] one of the Encoder Types defined above.
  • bitrate - [in] bitrate for video encoding in units of bit/s. Set to 0 to use the encoder's default.
  • iframe_interval - [in] intra frame (key-frame) occurrence interval.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

STUN_SERVER = "stun://stun.l.google.com:19302"
retval = dsl_sink_webrtc_new('my-webrtc-sink',
	STUN_SERVER, DSL_ENCODER_HW_H264, 0, 30)

dsl_sink_message_new

DslReturnType dsl_sink_message_new(const wchar_t* name,
	const wchar_t* converter_config_file, uint payload_type,
	const wchar_t* broker_config_file, const wchar_t* protocol_lib,
	const wchar_t* connection_string, const wchar_t* topic);

The constructor creates a uniquely named Message Sink. Construction will fail if the name is currently in use. The Message Sink converts ODE metadata -- generated by an Add Message Meta ODE Action -- into a message payload and sends it to the server using a specified communication protocol.

Important: refer to the DeepStream Plugin Guide for information on the Message Converter and Message Broker, and for information on configuration and use of the different Protocol Adapters.

Note: refer to DSL Message Broker API reference and DSL - Azure MQTT Protocol Adapter Libraries for additional information.

Hierarchy

component
 ╰── sink
    ╰── message sink

Parameters

  • name - [in] unique name for the Message Sink to create.
  • converter_config_file - [in] absolute or relative path to a message-converter configuration file of type text or csv.
  • payload_type - [in] one of the Message Converter payload schema type constants defined above.
  • broker_config_file - [in] broker_config_file absolute or relative path to a message-broker configuration file required by nvds_msgapi_* interface.
  • protocol_lib - [in] absolute or relative path to the protocol adapter that implements the nvds_msgapi_* interface. See the NVIDIA Installed Protocol Adapter Paths defined above.
  • connection_string - [in] endpoint for communication with server of the format <name>;<port>;<specifier>
  • topic - [in] (optional) message topic for each message sent to the server.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

CONNECTION_STRING = 'HostName=my-hub.azure-devices.net;DeviceId=nano-1;SharedAccessKey=abcd1234EFGH5678ijkl'
retval = dsl_sink_message_new('my-message-sink', converter_config_file, DSL_MSG_PAYLOAD_DEEPSTREAM,
	broker_config_file, NVDS_AZURE_PROTO_LIB, CONNECTION_STRING, '/ode/data')

dsl_sink_interpipe_new

DslReturnType dsl_sink_interpipe_new(const wchar_t* name,
	boolean forward_eos, boolean forward_events);

The constructor creates a new, uniquely named Inter-Pipe Sink component. Construction will fail if the name is currently in use.

Important! The Interpipe Services are disabled by default and require additional install/build steps.

Refer to the Interpipe Services overview for more information.

Hierarchy

component
 ╰── sink
    ╰── interpipe sink

Parameters

  • name - [in] unique name for the Interpipe Sink to create.
  • forward_eos - [in] set to true to forward the EOS event to all listeners. False to not forward.
  • forward_events - [in] set to true to forward downstream events to all listeners (except for EOS). False to not forward.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retVal = dsl_sink_interpipe_new('my-interpipe-sink',
	True, True)

dsl_sink_image_multi_new

DslReturnType dsl_sink_image_multi_new(const wchar_t* name,
	const wchar_t* file_path, uint width, uint height,
	uint fps_n, uint fps_d);

The constructor creates a new, uniquely named Multi-Image Sink. Construction will fail if the name is currently in use.

The Sink Encodes each frame into a JPEG image and saves it to a file specified by a given folder/filename-pattern. The size can be scaled by setting the width and height to non-zero values. The rate can be controlled by setting the fps_n and fps_d to non-zero values as well. The maximum rate at which the sink can encode and save is hardware/platform dependent. It is up to the user to manage the maximum setting. Exceeding the limit may lead to corrupted files.

Hierarchy

component
 ╰── sink
    ╰── multi-image sink

Parameters

  • name - [in] unique name for the Multi-Image Sink to create.
  • file_path - [in] use the printf style %d in the absolute or relative path. Example: "./my_images/image.%04d.jpg", will create files in "./my_images/" named "image.0000.jpg", "image.0001.jpg", "image.0002.jpg" etc.
  • width - [in] width of the images to save in pixels. Set to 0 for no transcode.
  • height - [in] height of the images to save in pixels. Set to 0 for no transcode.
  • fps_n - [in] fps_n frames/second fraction numerator. Set to 0 for no rate-change.
  • fps_d - [in] fps_d frames/second fraction denominator. Set to 0 for no rate-change.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retVal = dsl_sink_image_multi_new('my-multi-image-sink',
	'./frame_%04d.jpg', 640, 360, 1, 10)

dsl_sink_frame_capture_new

DslReturnType dsl_sink_frame_capture_new(const wchar_t* name,
	const wchar_t* frame_capture_action);

The constructor creates a new, uniquely named Frame-Capture Sink. Construction will fail if the name is currently in use. The Sink is created with an ODE Frame-Capture Action which performs the image encoding and saving. All captured frames are copied and buffered in the Sink's processing thread. The encoding and saving of each buffered frame is done in the g-idle-thread context.

There are two methods for capturing frames:

  1. The Application initiates a frame-capture of the next buffer by calling dsl_sink_frame_capture_initiate.
  2. An upstream Custom PPH schedules a frame-capture for a specific frame-number by calling dsl_sink_frame_capture_schedule.

Capture-complete-listeners (to notify on completion), Image Players (to auto-play the new image) and SMTP Mailers (to mail the new image) can be added to the Capture Action as well.

Important! The Frame-Capture Sink Services are disabled by default and require additional install/build steps to use.

Note: The first capture may cause a noticeable short pause to the stream while cuda dependencies are loaded and cached.

Hierarchy

component
 ╰── sink
    ╰── frame-capture sink

Parameters

  • name - [in] unique name for the Frame-Capture Sink to create.
  • frame_capture_action - [in] unique name of the ODE Frame-Capture Action to use.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retVal = dsl_sink_frame_capture_new('my-frame-capture-sink',
	'my-frame-capture-action')

dsl_sink_fake_new

DslReturnType dsl_sink_fake_new(const wchar_t* name);

The constructor creates a uniquely named Fake Sink. Construction will fail if the name is currently in use.

Hierarchy

component
 ╰── sink
    ╰── fake sink

Parameters

  • name - [in] unique name for the Fake Sink to create.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure.

Python Example

retVal = dsl_sink_fake_new('my-fake-sink')

dsl_sink_custom_new

DslReturnType dsl_sink_custom_new(const wchar_t* name);

This service creates a new, uniquely named Custom Sink component.

Hierarchy

component
 ╰── sink
    ╰── custom sink

Parameters

  • name - [in] unique name for the new Sink

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure

Python Example

retval = dsl_sink_custom_new('my-custom-sink')

dsl_sink_custom_new_element_add

DslReturnType dsl_sink_custom_new_element_add(const wchar_t* name,
	const wchar_t* element);

This service creates a new, uniquely named Custom Sink component and adds a GST Element to it.

IMPORTANT! Elements added to Custom Sink will be linked in the order they are added.

Hierarchy

component
 ╰── sink
    ╰── custom sink

Parameters

  • name - [in] unique name for the new Sink
  • element [in] name of the GST Element to add..

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure

Python Example

retval = dsl_sink_custom_new_element_add('my-custom-sink',
	'my-element')

dsl_sink_custom_new_element_add_many

DslReturnType dsl_sink_custom_new_element_add_many(const wchar_t* name,
	const wchar_t** elements);

This service creates a new, uniquely named Custom Sink component and adds a NULL terminated list of named GST Elements to it.

IMPORTANT! Elements added to Custom Sink will be linked in the order they are added.

Hierarchy

component
 ╰── sink
    ╰── custom sink

Parameters

  • name - [in] unique name for the new Sink
  • elements [in] NULL terminated array of GST Element names to add.

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure

Python Example

retval = dsl_sink_custom_new_element_add_many('my-custom-sink',
	['my-element-1', 'my-element-2', 'my-element-3', None)


Destructors

As with all Pipeline components, Sinks are deleted by calling dsl_component_delete, dsl_component_delete_many, or dsl_component_delete_all.



Sink Methods

dsl_sink_sync_enabled_get

DslReturnType dsl_sink_sync_enabled_get(const wchar_t* name, boolean* enabled);

This service gets the current sync enabled property in use by the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Sink to query.
  • enabled - [out] true if the sync property for the named Sink is enabled, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, enabled = dsl_sink_sync_enabled_get('my-overlay-sink')

dsl_sink_sync_enabled_set

DslReturnType dsl_sink_sync_enabled_set(const wchar_t* name, boolean enabled);

This service sets the sync enabled property for the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Message Sink to update.
  • enabled - [in] set to true to enable the async property, false to disable.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_sync_enabled_set('my-overlay-sink', False)

dsl_sink_async_enabled_get

DslReturnType dsl_sink_async_enabled_get(const wchar_t* name, boolean* enabled);

This service gets the current sync enabled property in use by the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Sink to query.
  • enabled - [out] true if the async property for the named Sink is enabled, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, enabled = dsl_sink_async_enabled_get('my-overlay-sink')

dsl_sink_async_enabled_set

DslReturnType dsl_sink_async_enabled_set(const wchar_t* name, boolean enabled);

This service sets the async enabled property for the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Message Sink to update.
  • enabled - [in] set to true to enable the async property, false to disable.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_async_enabled_set('my-overlay-sink', False)

dsl_sink_max_lateness_get

DslReturnType dsl_sink_max_lateness_get(const wchar_t* name, int64_t* max_lateness);

This service gets the current value of the max_lateness property in use by the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Sink to query.
  • max_lateness - [out] the maximum number of nanoseconds a buffer can be late. -1 equals unlimited lateness.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, max_lateness = dsl_sink_max_lateness_get('my-overlay-sink')

dsl_sink_max_lateness_set

DslReturnType dsl_sink_max_lateness_set(const wchar_t* name, int64_t max_lateness);

This service sets the max_lateness property for the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Message Sink to update.
  • max_lateness - [in] the maximum number of nanoseconds a buffer can be late. Set to -1 for unlimited lateness.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_max_lateness_set('my-overlay-sink', -1)

dsl_sink_qos_enabled_get

DslReturnType dsl_sink_qos_enabled_get(const wchar_t* name, boolean* enabled);

This service gets the current qos enabled property in use by the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Sink to query.
  • enabled - [out] true if the qos property for the named Sink is enabled, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, enabled = dsl_sink_qos_enabled_get('my-overlay-sink')

dsl_sink_qos_enabled_set

DslReturnType dsl_sink_qos_enabled_set(const wchar_t* name, boolean enabled);

This service sets the qos enabled property for the named Sink. See the Common Sink Properties for more information.

Parameters

  • name - [in] unique name of the Message Sink to update.
  • enabled - [in] set to true to enable the qos property, false to disable.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_qos_enabled_set('my-overlay-sink', False)

dsl_sink_pph_add

DslReturnType dsl_sink_pph_add(const wchar_t* name, const wchar_t* handler);

This service adds a Pad-Probe-Handler (PPH) to the sink pad of the Named Sink component. The PPH will be invoked on every buffer-ready event for the sink pad. More than one PPH can be added to a single Sink Component.

Parameters

  • name [in] unique name of the Tee to update.
  • handler [in] unique name of the PPH to add.

Returns

  • DSL_RESULT_SUCCESS on successful add. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_pph_add('my-window-sink', 'my-meter-pph')

dsl_sink_pph_remove

DslReturnType dsl_sink_pph_remove(const wchar_t* name, const wchar_t* handler);

This service removes a Pad-Probe-Handler from a named Sink

Parameters

  • name [in] unique name of the Sink to update.
  • handler [in] unique name of the Pad probe handler to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_pph_remove('my-window-sink', 'my-meter-pph')

dsl_sink_app_data_type_get

DslReturnType dsl_sink_app_data_type_get(const wchar_t* name, uint* data_type);

This service gets the current data-type setting in use by a named App Sink Component.

Parameters

  • name - [in] unique name of the App Sink to query.
  • data_type - [out] either DSL_SINK_APP_DATA_TYPE_SAMPLE or DSL_SINK_APP_DATA_TYPE_BUFFER. See App Sink data-types.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, data_type = dsl_sink_app_data_type_get('my-app-sink')

App Sink Methods

dsl_sink_app_data_type_set

DslReturnType dsl_sink_app_data_type_set(const wchar_t* name, uint data_type);

This service sets the data-type setting for the named App Sink Component to use.

Parameters

  • name - [in] unique name of the App Sink to update.
  • data_type - [in] either DSL_SINK_APP_DATA_TYPE_SAMPLE or DSL_SINK_APP_DATA_TYPE_BUFFER. See App Sink data-types.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_app_data_type_set('my-app-sink', DSL_SINK_APP_DATA_TYPE_BUFFER)

3D & EGL Window Sink Methods

dsl_sink_window_offsets_get

DslReturnType dsl_sink_window_offsets_get(const wchar_t* name,
	uint* x_offset, uint* y_offsetY);

This service returns the current X and Y offsets for the named Window Sink; 3D or EGL.

Parameters

  • name - [in] unique name of the Window Sink to query.
  • x_offset - [out] offset in the X direction in pixels from the upper left most corner of the Display.
  • y_offset - [out] offset in the Y direction in pixels from the upper left most corner of the Display.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, x_offset, y_offset = dsl_sink_window_offsets_get('my-window-sink')

dsl_sink_window_offsets_set

DslReturnType dsl_sink_window_offsets_set(const wchar_t* name,
	uint x_offset, uint y_offset);

This service updates the X and Y offsets for the named Window Sink; 3D or EGL.

IMPORTANT! This service may be called while the Pipeline is playing.

Parameters

  • name - [in] unique name of the Window Sink to update.
  • x_offset - [in] new offset in the X direction in pixels from the upper left most corner of the Display.
  • y_offset - [in] new offset in the Y direction in pixels from the upper left most corner of the Display.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_offests_set('my-window-sink', 100, 100)

dsl_sink_window_dimensions_get

DslReturnType dsl_sink_window_dimensions_get(const wchar_t* name,
	uint* width, uint* height);

This service returns the current dimensions for the named Window Sink; 3D or EGL.

Parameters

  • name - [in] unique name of the Window Sink to query.
  • width - [out] current width of the Window Sink in pixels.
  • height - [out] current height of the Window Sink in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, width, height = dsl_sink_window_dimensions_get('my-window-sink')

dsl_sink_window_dimensions_set

DslReturnType dsl_sink_window_dimensions_set(const wchar_t* name,
	uint width, uint height);

This service updates the dimensions of a named Window Sink; 3D or EGL.

IMPORTANT! This service may be called while the Pipeline is playing.

Parameters

  • name - [in] unique name of the Window Sink to update.
  • width - [in] new width setting for the Window Sink in pixels.
  • height - [in] new height setting for the Window Sink in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_dimensions_set('my-window-sink', 1280, 720)

dsl_sink_window_handle_get

DslReturnType dsl_sink_window_handle_get(const wchar_t* name, uint64_t* handle);

This service returns the current XWindow handle in use by the named Window Sink. The handle is set to Null on Sink creation and will remain Null until,

  1. The Sink creates an internal XWindow synchronized on Transition to a state of playing, or
  2. The Client Application passes an XWindow handle into the Pipeline by calling dsl_sink_window_handle_set.

Parameters

  • name - [in] unique name for the Window Sink to query.
  • handle - [out] XWindow handle in use by the named Window Sink

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, handle = dsl_sink_window_handle_get('my-window-sink')

dsl_sink_window_handle_set

DslReturnType dsl_sink_window_handle_set(const wchar_t* name, uint64_t handle);

This service sets the XWindow for the named 3D or EGL Window Sink to use. Setting the handle to 0 will clear any previously provided handle. The Window Sink will create its own XWindow if the handle is set to 0.

Parameters

  • name - [in] unique name for the Window Sink to update.
  • handle - [in] XWindow handle for the Window-Sink to use, or 0 to clear the value.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure

Python Example

retval = dsl_sink_window_handle_set('my-window-sink', handle)

dsl_sink_window_fullscreen_enabled_get

DslReturnType dsl_sink_window_fullscreen_enabled_get(const wchar_t* name,
	boolean* enabled);

This service gets the current full-screen-enabled setting for the named Window Sink's XWindow.

Parameters

  • name - [in] unique name of the Window Sink to query
  • enabled - [out] true if the XWindow's full-screen mode is enabled, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, enabled = dsl_sink_window_fullscreen_enabled_get('my-window-sink')

dsl_sink_window_fullscreen_enabled_set

DslReturnType dsl_sink_window_fullscreen_enabled_set(const wchar_t* name,
	boolean enabled);

This service sets the full-screen-enabled setting for the Window Sink's XWindow. The service will fail if called while the Pipeline is playing.

Parameters

  • name - [in] unique name of the Window Sink to update
  • enabled - [in] set to true to enable the XWindow's full-screen mode, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_fullscreen_enabled_set('my-window-sink', enabled=True)

dsl_sink_window_key_event_handler_add

DslReturnType dsl_sink_window_key_event_handler_add(const wchar_t* name,
	dsl_sink_window_key_event_handler_cb handler, void* client_data);

This service adds a callback function of type dsl_sink_window_key_event_handler_cb to a named Window Sink. The function will be called on every XWindow KeyReleased event with Key string and the client provided client_data. Multiple callback functions can be registered with one Window Sink, and one callback function can be registered with multiple Window Sinks.

Parameters

  • name - [in] unique name of the Window Sink to update.
  • handler - [in] XWindow event handler callback function to add.
  • client_data - [in] opaque pointer to user data returned to the handler when called back

Returns

  • DSL_RESULT_SUCCESS on successful addition. One of the Return Values defined above on failure.

Python Example

def key_event_handler(key_string, client_data):
	print('key pressed = ', key_string)
   
retval = dsl_sink_window_key_event_handler_add('my-window-sink',
	key_event_handler, None)

dsl_sink_window_key_event_handler_remove

DslReturnType dsl_sink_window_key_event_handler_remove(const wchar_t* name,
	dsl_sink_window_key_event_handler_cb handler);

This service removes a function of type dsl_sink_window_key_event_handler_cb that was previously added with dsl_sink_window_key_event_handler_add.

Parameters

  • name - [in] unique name of the Window Sink to update
  • handler - [in] XWindow event handler callback function to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_key_event_handler_remove('my-window-sink',
	key_event_handler)

dsl_sink_window_button_event_handler_add

DslReturnType dsl_sink_window_button_event_handler_add(const wchar_t* name,
	dsl_sink_window_button_event_handler_cb handler, void* client_data);

This service adds a callback function of type dsl_sink_window_button_event_handler_cb to a named Window Sink. The function will be called on every XWindow ButtonPressed event with Button ID, X and Y positional offsets, and the client provided client_data. Multiple callback functions can be registered with one Window Sink, and one callback function can be registered with multiple Window Sinks.

Parameters

  • name - [in] unique name of the Window Sink to update.
  • handler - [in] XWindow event handler callback function to add.
  • client_data - [in] opaque pointer to user data returned to the handler when called back

Returns

  • DSL_RESULT_SUCCESS on successful addition . One of the Return Values defined above on failure.

Python Example

def button_event_handler(button, xpos, ypos, client_data):
	print('button = ', button)
	print('xpos = ', xpos)
	print('ypos = ', ypos)
   
retval = dsl_sink_window_button_event_handler_add('my-window-sink',
	button_event_handler, None)

dsl_sink_window_button_event_handler_remove

DslReturnType dsl_sink_window_button_event_handler_remove(const wchar_t* name,
	dsl_sink_window_button_event_handler_cb handler);

This service removes a function of type dsl_sink_window_button_event_handler_cb that was previously added with dsl_sink_window_button_event_handler_add.

Parameters

  • name - [in] unique name of the Window Sink to update.
  • handler - [in] XWindow event handler callback function to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_button_event_handler_remove('my-window-sink',
	button_event_handler)

dsl_sink_window_delete_event_handler_add

DslReturnType dsl_sink_window_delete_event_handler_add(const wchar_t* name,
	dsl_sink_window_delete_event_handler_cb handler, void* client_data);

This service adds a callback function of type dsl_sink_window_delete_event_handler_cb to a named Window Sink; 3D or EGL. The function will be called on when the XWindow is closed/deleted. Multiple callback functions can be registered with one Window Sink, and one callback function can be registered with multiple Window Sink.

Parameters

  • name - [in] unique name of the Window Sink to update.
  • handler - [in] XWindow event handler callback function to add.
  • client_data - [in] opaque pointer to user data returned to the handler when called back

Returns

  • DSL_RESULT_SUCCESS on successful addition. One of the Return Values defined above on failure.

Python Example

def xwindow_delete_event_handler(client_data):
	dsl_pipeline_stop('my-pipeline')
	dsl_main_loop_quit()

retval = dsl_sink_window_delete_event_handler_add('my-window-sink',
	xwindow_delete_event_handler, None)

dsl_sink_window_delete_event_handler_remove

DslReturnType dsl_sink_window_delete_event_handler_remove(const wchar_t* name,
	dsl_sink_window_delete_event_handler_cb handler);

This service removes a function of type dsl_sink_window_delete_event_handler_cb that was previously added with dsl_sink_window_delete_event_handler_add.

Parameters

  • name - [in] unique name of the Window Sink to update
  • handler - [in] XWindow event handler callback function to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_delete_event_handler_remove('my-pipeline',
	xwindow_delete_event_handler)

EGL Window Sink Methods

dsl_sink_window_egl_force_aspect_ratio_get

DslReturnType dsl_sink_window_force_aspect_ratio_get(const wchar_t* name,
	boolean* force);

This service returns the force-aspect-ratio property setting for the named EGL Window Sink. The Sink's aspect ratio will be maintained on Window resize if set.

Parameters

  • name - [in] unique name of the EGL Window Sink to query.
  • force - [out] true if the property is set, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, force = dsl_sink_window_egl_force_aspect_ratio_get('my-window-sink')

dsl_sink_window_egl_force_aspect_ratio_set

DslReturnType dsl_sink_window_egl_force_aspect_ratio_set(const wchar_t* name,
	boolean force);

This service sets the force-aspect-ratio property for the named EGL Window Sink. The Sink's aspect ratio will be maintained on Window resize if set. This service will fail if the Sink is currently linked.

Parameters

  • name - [in] unique name of the Window Sink to update.
  • force - [in] set true to force the aspect ratio on window resize., false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_window_egl_force_aspect_ratio_get('my-window-sink', True)

V4L2 Sink Methods

dsl_sink_v4l2_device_location_get

DslReturnType dsl_sink_v4l2_device_location_get(const wchar_t* name,
	const wchar_t** device_location);

This service gets the device-location setting for the named V4L2 Sink.

Parameters

  • name - [in] unique name of the V4L2 Sink to query.
  • device_location - [out] current device-location setting.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, device_location = dsl_sink_v4l2_device_location_get('my-v4l2-sink')

dsl_sink_v4l2_device_location_set

DslReturnType dsl_sink_v4l2_device_location_set(const wchar_t* name,
	const wchar_t* device_location);

This service sets the device-location for the named V4L2 Sink to use.

Parameters

  • name - [in] unique name of the V4L2 Sink to update.
  • device_location - [in] new device-location setting to use.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_v4l2_device_location_set('my-v4l2-sink', '/dev/video10')

dsl_sink_v4l2_device_name_get

DslReturnType dsl_sink_v4l2_device_name_get(const wchar_t* name,
	const wchar_t** device_name);

This service gets the device-name setting for the named V4L2 Sink.

IMPORTANT! The default value = "" on Sink creation. The value is updated after negotiation with the V4L2 device.

Parameters

  • name - [in] unique name of the V4L2 Sink to query.
  • device_name - [out] device-name of the v4l2 device once connected.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, device_name = dsl_sink_v4l2_device_name_get('my-v4l2-sink')

dsl_sink_v4l2_device_fd_get

DslReturnType dsl_sink_v4l2_device_fd_get(const wchar_t* name,
	int* device_fd);

This service gets the device-file-descriptor setting for the named V4L2 Sink.

IMPORTANT! The default-file-descriptor = 0 on Sink creation. The value is updated after negotiation with the V4L2 device.

Parameters

  • name - [in] unique name of the V4L2 Sink to query.
  • device_fd - [out] file-descriptor of the v4l2 device once connected.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, device_fd = dsl_sink_v4l2_device_fd_get('my-v4l2-sink')

dsl_sink_v4l2_device_flags_get

DslReturnType dsl_sink_v4l2_device_flags_get(const wchar_t* name,
	uint* device_flags);

This service gets the device-flags setting for the named V4L2 Sink.

IMPORTANT! The default-flags = DSL_V4L2_DEVICE_TYPE_NONE on Sink creation. The value is updated after negotiation with the V4L2 device.

Parameters

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, device_flags = dsl_sink_v4l2_device_flags_get('my-v4l2-sink')

dsl_sink_v4l2_buffer_in_format_get

DslReturnType dsl_sink_v4l2_buffer_in_format_get(const wchar_t* name,
	const wchar_t** format);

This service gets the current buffer-in-format -- the format set on input to the v4l2sink plugin -- for the named V4L2 Sink.

Parameters

  • name - [in] unique name of the V4L2 Sink to query.
  • format - [out] current buffer-in-format setting defined as one of the Buffer Format constants. Default = DSL_VIDEO_FORMAT_YUY2.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, format = dsl_sink_v4l2_buffer_in_format_get('my-v4l2-sink')

dsl_sink_v4l2_buffer_in_format_set

DslReturnType dsl_sink_v4l2_buffer_in_format_set(const wchar_t* name,
	const wchar_t* format);

This service sets the buffer-in-format -- the format set on input to the v4l2sink plugin -- for the named V4L2 Sink to use.

Parameters

  • name - [in] unique name of the V4L2 Sink to update.
  • format - [in] new format setting to use. A string value or one of the Buffer Format constants

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_v4l2_buffer_in_format_set('my-v4l2-sink', DSL_VIDEO_FORMAT_YVYU)

dsl_sink_v4l2_picture_settings_get

DslReturnType dsl_sink_v4l2_picture_settings_get(const wchar_t* name,
	int* brightness, int* contrast, int* saturation);

This service gets the current picture brightness, contrast, and saturation settings for the named V4L2 Sink.

Parameters

  • name - [in] unique name of the V4L2 Sink to query.
  • brightness - [out] current picture brightness level, or more precisely, the black level. Default = 0.
  • contrast - [out] current picture color contrast setting or luma gain. Default = 0.
  • saturation - [out] current picture color saturation setting or chroma gain. Default = 0.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, brightness, contrast, saturation = dsl_sink_v4l2_picture_settings_get('my-v4l2-sink')

dsl_sink_v4l2_picture_settings_set

DslReturnType dsl_sink_v4l2_picture_settings_set(const wchar_t* name,
	int brightness, int contrast, int saturation);

This service sets the current picture brightness, contrast, and saturation settings for the named V4L2 Sink to use.

Parameters

  • name - [in] unique name of the V4L2 Sink to update.
  • brightness - [in] new picture brightness level, or more precisely, the black level to use.
  • contrast - [in] new picture contrast setting, or luma gain, to use.
  • saturation - [in] new color saturation setting, or chroma gain, to use.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_v4l2_picture_settings_set('my-v4l2-sink', -10, 14, 0)

Encode Sink Methods

dsl_sink_encode_settings_get

DslReturnType dsl_sink_encode_settings_get(const wchar_t* name,
	uint* encoder, uint* bitrate, uint* interval);

This service returns the current bitrate and interval settings for the named Encode Sink; File Sink, Smart-Record Sink, RTMP Sink, RTSP Client Sink, RTSP Server Sink, or WebRTC Sink.

Parameters

  • name - [in] unique name of the Encode Sink to query.
  • encoder - [out] current encoder in use, one of the Encoder Types defined above.
  • bitrate - [out] current bit rate at which to code the video.
  • iframe_interval - [out] current frame interval at which to encode the video. 0 equals code every frame

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, bitrate, interval = dsl_sink_encode_settings_get('my-file-sink')

dsl_sink_encode_dimensions_get

DslReturnType dsl_sink_encode_dimensions_get(const wchar_t* name,
	uint* width, uint* height);

This service gets the current input dimensions for the named Encode Sink; File Sink, Smart-Record Sink, RTMP Sink, RTSP Client Sink, RTSP Server Sink, or WebRTC Sink. Values of 0 indicate NO scaling.

The dimensions, if non-zero, are used to scale the video input into the Sinks's encoder element.

Parameters

  • name - [in] unique name of the Encode Sink to query.
  • width - [out] current width of the Encode Sink input in pixels.
  • height - [out] current height of the Encode Sink input pixels.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, width, height = dsl_sink_encode_dimensions_get('my-rtsp-server-sink')

dsl_sink_encode_dimensions_set

DslReturnType dsl_sink_encode_dimensions_set(const wchar_t* name,
	uint width, uint height);

This service updates the dimensions of a named Encode Sink; File Sink, Smart-Record Sink, RTMP Sink, RTSP Client Sink, RTSP Server Sink, or WebRTC Sink. Set the values to 0 to indicate NO scaling.

Parameters

  • name - [in] unique name of the Encode Sink to update.
  • width - [in] new width setting for the Encode Sink in pixels.
  • height - [in] new height setting for the Encode Sink in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_encode_dimensions_set('my-rtsp-server-sink', 1280, 720)

Smart-Record Sink Methods

dsl_sink_record_session_start

DslReturnType dsl_sink_record_session_start(const wchar_t* name,
	uint start, uint duration, void* client_data);

This service starts a new recording session for the named Record Sink. There are two parameters that control the amount of video recorded

  1. start: the number of seconds before the current time -- i.e.the amount of cache/history to include.
  2. duration: the number of seconds after the current time -- i.e. the amount of time to record after session start is called.

Therefore, a total of start + duration seconds of data will be recorded as long as the default values are not exceeded.

IMPORTANT!

  1. The default max_size for all Smart Recordings is set to 600 seconds. The recording will be truncated if start + duration is greater than (>)max_size See dsl_sink_record_max_size_set to update max_size.
  2. The default cache-size for all recordings is set to 60 seconds. The recording will be truncated if start is greater than (>) cache_size. See dsl_sink_record_cache_size_set to update cache_size.

Warning messages will be logged if either of the above conditions are not met. See the Recording Defaults above.

Parameters

  • name [in] unique name of the Record Sink to start the session.
  • start [in] start time in seconds before the current time should be less than the video cache size.
  • duration [in] duration of time to record in seconds including the start time.
  • client_data [in] opaque pointer to client data returned on callback to the client listener function provided on Sink creation.

Returns

  • DSL_RESULT_SUCCESS on successful start. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_session_start('my-record-sink', 15, 900, None)

dsl_sink_record_session_stop

DslReturnType dsl_sink_record_session_stop(const wchar_t* name);

This service stops a current recording in session.

Parameters

  • name [in] unique name of the Record Sink to stop.

Returns

  • DSL_RESULT_SUCCESS on successful Stop. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_session_stop('my-record-sink')

dsl_sink_record_outdir_get

DslReturnType dsl_sink_record_outdir_get(const wchar_t* name, const wchar_t** outdir);

This service returns the video recording output directory.

Parameters

  • name [in] name of the Record Sink to query.
  • outdir - [out] absolute pathspec for the directory to save the recorded video streams.

Returns

  • DSL_RESULT_SUCCESS on successful Query. One of the Return Values defined above on failure.

Python Example

retval, outdir = dsl_sink_record_outdir_get('my-record-sink')

dsl_sink_record_outdir_set

DslReturnType dsl_sink_record_outdir_set(const wchar_t* name, const wchar_t* outdir);

This service sets the video recording output directory.

Parameters

  • name [in] name of the Record Sink to update.
  • outdir - [in] absolute or relative pathspec for the directory to save the recorded video streams.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_outdir_set('my-record-sink', './recordings')

dsl_sink_record_container_get

DslReturnType dsl_sink_record_container_get(const wchar_t* name, uint* container);

This service returns the media container type used when recording.

Parameters

  • name [in] name of the Record Sink to query.
  • container - [out] one of the Video Container Types defined above.

Returns

  • DSL_RESULT_SUCCESS on successful Query. One of the Return Values defined above on failure.

Python Example

retval, container_type = dsl_sink_record_container_get('my-record-sink')

dsl_sink_record_container_set

DslReturnType dsl_sink_record_container_set(const wchar_t* name,  uint container);

This service sets the media container type to use when recording.

Parameters

  • name [in] name of the Record Sink to update.
  • container - [in] on of the Video Container Types defined above.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_container_set('my-record-sink', DSL_CONTAINER_MP4)

dsl_sink_record_max_size_get

DslReturnType dsl_sink_record_max_size_get(const wchar_t* name, uint* max_size);

This service returns the video recording max size in units of seconds for the named Record Sink. The default max size is set to DSL_DEFAULT_VIDEO_RECORD_MAX_IN_SEC.

IMPORTANT! The max_size must be greater than start + duration when starting a recording. See dsl_sink_record_session_start.

Parameters

  • name [in] name of the Record Sink to query.
  • max_size [out] current cache size setting in units of seconds.

Returns

  • DSL_RESULT_SUCCESS on successful Query. One of the Return Values defined above on failure.

Python Example

retval, max_size = dsl_sink_record_cache_size_get('my-record-sink')

dsl_sink_record_max_size_set

DslReturnType dsl_sink_record_max_size_set(const wchar_t* name, uint cache_size);

This service sets the video recording max size in units of seconds for the named Record Sink. The default max size is set to DSL_DEFAULT_VIDEO_RECORD_MAX_IN_SEC.

IMPORTANT! The max_size must be greater than start + duration when starting a recording. See dsl_sink_record_session_start.

Parameters

  • name [in] name of the Record Sink to query.
  • max_size [in] new cache size setting in units of seconds.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_max_size_set('my-record-sink', 1200)

dsl_sink_record_cache_size_get

DslReturnType dsl_sink_record_cache_size_get(const wchar_t* name, uint* cache_size);

This service returns the video recording cache size in units of seconds for the named Record Sink. The default cache size is set to DSL_DEFAULT_VIDEO_RECORD_CACHE_IN_SEC.

IMPORTANT! The cache_size must be greater than start when starting a recording. See dsl_sink_record_session_start.

Parameters

  • name [in] name of the Record Sink to query.
  • cache_size [out] current cache size setting.

Returns

  • DSL_RESULT_SUCCESS on successful Query. One of the Return Values defined above on failure.

Python Example

retval, cache_size = dsl_sink_record_cache_size_get('my-record-sink')

dsl_sink_record_cache_size_set

DslReturnType dsl_sink_record_cache_size_set(const wchar_t* name, uint cache_size);

This service sets the video recording cache size in units of seconds for the named Record Sink. The default cache size is set to DSL_DEFAULT_VIDEO_RECORD_CACHE_IN_SEC.

IMPORTANT! The cache_size must be greater than start when starting a recording. See dsl_sink_record_session_start.

Parameters

  • name [in] name of the Record Sink to query.
  • cache_size [in] new cache size setting to use on Pipeline play.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_cache_size_set('my-record-sink', 15)

dsl_sink_record_dimensions_get

DslReturnType dsl_sink_record_dimensions_get(const wchar_t* name, uint* width, uint* height);

This service returns the dimensions, width and height, used for the video recordings. Values of zero (default) indicate no-transcode.

Parameters

  • name[in] name of the Record Sink to query.
  • width[out] current width of the video recording in pixels.
  • height [out] current height of the video recording in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, width, height = dsl_sink_record_dimensions_get('my-record-sink')

dsl_sink_record_dimensions_set

DslReturnType dsl_sink_record_dimensions_set(const wchar_t* name, uint width, uint height);

This service sets the dimensions, width and height, for the video recordings created. Values of zero (default) indicate no-transcode.

Parameters

  • name [in] name of the Record Sink to update.
  • width [in] width to set the video recording in pixels.
  • height [in] height to set the video in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_dimensions_set('my-record-sink', 1280, 720)

dsl_sink_record_is_on_get

DslReturnType dsl_sink_record_is_on_get(const wchar_t* name, boolean* is_on);

This service returns the current recording state of the Record Sink.

Parameters

  • name [in] name of the Record Sink to query.
  • is_on [out] true if the Record Sink is currently recording a session, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, is_on = dsl_sink_record_is_on_get('my-record-sink')

dsl_sink_record_reset_done_get

DslReturnType dsl_sink_record_reset_done_get(const wchar_t* name, boolean* reset_done);

This service returns the current state of the Reset Done flag.

Parameters

  • name [in] name of the Record Sink to query.
  • reset_done [out] true if Reset has been done, false otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, reset_done = dsl_sink_record_reset_done_get('my-record-sink')

dsl_sink_record_video_player_add

DslReturnType dsl_sink_record_video_player_add(const wchar_t* name,
	const wchar_t* player)

This service adds a Video Player, Render or RTSP type, to a named Recording Sink. Once added, each recorded video's file_path will be added (or queued) with the Video Player to be played according to the Players settings.

Parameters

  • name [in] name of the Record Sink to update.
  • player [in] name of the Video Player to add.

Returns

  • DSL_RESULT_SUCCESS on successful add. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_video_player_add('my-record-sink, 'my-video-render-player')

dsl_sink_record_video_player_remove

DslReturnType dsl_sink_record_video_player_remove(const wchar_t* name,
	const wchar_t* player)

This service removes a Video Player, Render or RTSP type, from a named Recording Sink.

Parameters

  • name [in] name of the Record Sink to update
  • player [in] player name of the Video Player to remove

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_video_player_remove('my-record-sink', 'my-video-render-player'

dsl_sink_record_mailer_add

DslReturnType dsl_sink_record_mailer_add(const wchar_t* name,
	const wchar_t* mailer, const wchar_t* subject);

This service adds a Mailer to a named Recording Sink. Once added, the file_name, location, and specifics of each recorded video will be emailed by the Mailer according to its current settings.

Parameters

  • name [in] name of the Record Sink to update.
  • mailer [in] name of the Mailer to add.
  • subject [in] subject line to use for all outgoing mail.

Returns

  • DSL_RESULT_SUCCESS on successful add. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_mailer_add('my-record-sink, 'my-mailer', "New Recording Complete!")

dsl_sink_record_mailer_remove

DslReturnType dsl_sink_record_mailer_remove(const wchar_t* name,
	const wchar_t* mailer)

This service removes a Mailer from a named Recording Sink.

Parameters

  • name [in] name of the Record Sink to update.
  • mailer [in] name of the Mailer to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_record_mailer_remove('my-record-sink', 'my-mailer')

RTMP Sink Methods

dsl_sink_rtmp_uri_get

DslReturnType dsl_sink_rtmp_uri_get(const wchar_t* name, const wchar_t** uri);

This service gets the current RTMP URI in use for the named RTMP Sink.

Parameters

  • name - [in] unique name of the RTMP Sink to query.
  • uri - [out] uniform resource identifier (URI) in use.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, uri = dsl_sink_rtmp_uri_get('my-rtmp-sink')

dsl_sink_rtmp_uri_set

DslReturnType dsl_sink_rtmp_uri_set(const wchar_t* name, const wchar_t* uri);

This service sets the RTMP URI for the named RTMP Sink to use.

Parameters

  • name - [in] unique name of the RTMP Sink to update.
  • uri - [in] uniform resource identifier (URI) for the RTMP Sink to use.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtmp_uri_set('my-rtmp-sink', 'rtmp://0.0.0.0/new/path/to/stream/to')

RTSP Client Sink Methods

dsl_sink_rtsp_client_credentials_set

DslReturnType dsl_sink_rtsp_client_credentials_set(const wchar_t* name,
	const wchar_t* user_id, const wchar_t* user_pw);

This service sets the user credentials for the named RTSP Client Sink to use.

IMPORTANT!: For security purposes, credentials are NOT logged or saved as a result of this call by DSL. In addition, there is no corresponding "Get" service for user credentials, meaning there is no way of reading the current credentials once set.

Parameters

  • name - [in] unique name of the RTSP Client to update.
  • user_id - [in] user identification for client authentication.
  • user_pw - [in] user password for client authentication.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtsp_client_credentials_set('my-rtsp-client-sink',
	'admin', '12345678')

dsl_sink_rtsp_client_latency_get

DslReturnType dsl_sink_rtsp_client_latency_get(const wchar_t* name, uint* latency);

This service gets the current latency setting for the named RTSP Client Sink.

Parameters

  • name - [in] unique name of the RTSP Client Sink to query.
  • latency - [out] current latency -- the amount of data to buffer -- in units of ms. Default = 2000ms.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, latency = dsl_sink_rtsp_client_latency_get('my-rtsp-client-sink')

dsl_sink_rtsp_client_latency_set

DslReturnType dsl_sink_rtsp_client_latency_set(const wchar_t* name, uint latency);

This service sets the latency setting for the named RTSP Client to use.

Parameters

  • name - [in] unique name of the RTSP Client to update.
  • latency - [in] new latency -- the amount of data to buffer -- in units of ms..

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtsp_client_latency_set('my-rtsp-client-sink', 1000)

dsl_sink_rtsp_client_profiles_get

DslReturnType dsl_sink_rtsp_client_profiles_get(const wchar_t* name,
	uint* profiles);

This service gets the current allowed RTSP profiles for the named RTSP Client Sink.

Parameters

  • name - [in] unique name of the RTSP Client Sink to query.
  • profiles - [out] mask of RTSP Profile constant values. Default = DSL_RTSP_PROFILE_AVP.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, profiles = dsl_sink_rtsp_client_profiles_get('my-rtsp-client-sink')

dsl_sink_rtsp_client_profiles_set

DslReturnType dsl_sink_rtsp_client_profiles_set(const wchar_t* name,
	uint profiles);

This service sets the allowed RTSP profiles for the named RTSP Client to use.

Parameters

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtsp_client_profiles_set('my-rtsp-client-sink',
	DSL_RTSP_PROFILE_SAV)

dsl_sink_rtsp_client_protocols_get

DslReturnType dsl_sink_rtsp_client_protocols_set(const wchar_t* name,
	uint protocols);

This service gets the current allowed RTSP lower-protocols for the named RTSP Client Sink.

Default = DSL_RTSP_LOWER_TRANS_TCP | DSL_RTSP_LOWER_TRANS_UDP_MCAST | DSL_RTSP_LOWER_TRANS_UDP

Parameters

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, protocols = dsl_sink_rtsp_client_protocols_get('my-rtsp-client-sink')

dsl_sink_rtsp_client_protocols_set

DslReturnType dsl_sink_rtsp_client_protocols_set(const wchar_t* name,
	uint protocols);

This service sets the allowed lower-protocols for the named RTSP Client to use.

Parameters

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtsp_client_profiles_set('my-rtsp-client-sink',
	DSL_RTSP_LOWER_TRANS_HTTP)

dsl_sink_rtsp_client_tls_validation_flags_get

DslReturnType dsl_sink_rtsp_client_tls_validation_flags_get(const wchar_t* name,
	uint* flags);

This service gets the current TLS connection validation flags for the named RTSP Client Sink.

Parameters

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, flags = dsl_sink_rtsp_client_tls_validation_flags_get('my-rtsp-client-sink')

dsl_sink_rtsp_client_tls_validation_flags_set

DslReturnType dsl_sink_rtsp_client_tls_validation_flags_set(const wchar_t* name,
	uint flags);

This service sets the TLS connection validation flags for the named RTSP Client to use.

Parameters

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_rtsp_client_tls_validation_flags_set('my-rtsp-client-sink',
	DSL_TLS_CERTIFICATE_NOT_ACTIVATED)

RTSP Server Sink Methods

dsl_sink_rtsp_server_settings_get

This service returns the current RTSP video encoder and Port settings for the named RTSP Sink.

DslReturnType dsl_sink_rtsp_server_settings_get(const wchar_t* name,
	uint* udp_port, uint* rtsp_port);

Parameters

  • name - [in] unique name of the RTSP Sink to query.
  • udp_port - [out] the current UDP Port number in use.
  • rtsp_port - [out] the current RTSP Port number in use.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, udp_port, rtsp_port = dsl_sink_rtsp_server_settings_get('my-rtsp-sink')

WebRTC Sink Methods

dsl_sink_webrtc_connection_close

DslReturnType dsl_sink_webrtc_connection_close(const wchar_t* name);

This service closes a currently open WebSocket connection for the named WebRTC Sink.

IMPORTANT: The WebRTC Sink implementation requires GStreamer 1.18 or later.

Parameters

  • name [in] unique name of the WebRTC Sink to update.

Returns DSL_RESULT_SUCCESS on successful close. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_webrtc_connection_close('my-webrtc-sink')

dsl_sink_webrtc_servers_get

DslReturnType dsl_sink_webrtc_servers_get(const wchar_t* name,
	const wchar_t** stun_server, const wchar_t** turn_server);

This service queries a named WebRTC Sink component for its current STUN or TURN server(s) in use.

IMPORTANT: The WebRTC Sink implementation requires DS 1.18.0 or later.

Parameters

  • name [in] unique name of the WebRTC Sink to query.
  • stun_server [out] current STUN server in use, NULL if omitted.
  • turn_server [out] current TURN server in use, NULL if omitted.

Returns DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, stun_server, turn_server = dsl_sink_webrtc_servers_get('my-webrtc-sink')

dsl_sink_webrtc_servers_set

DslReturnType dsl_sink_webrtc_servers_set(const wchar_t* name,
	const wchar_t* stun_server, const wchar_t* turn_server);

This service updates a named WebRTC Sink component with either a new STUN or TURN server(s) to use.

IMPORTANT: The WebRTC Sink implementation requires GStreamer 1.18 or later.

Parameters

  • name [in] unique name of the WebRTC Sink to query.
  • stun_server - [in] STUN server to use - of the form stun://hostname:port. Set to NULL to omit if using TURN server(s).
  • turn_server - [in] TURN server(s) to use - of the form turn(s)://username:password@host:port. Set to NULL to omit if using a STUN server.

Returns DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_webrtc_servers_get('my-webrtc-sink', NULL, turn_server)

dsl_sink_webrtc_client_listener_add

DslReturnType dsl_sink_webrtc_client_listener_add(const wchar_t* name,
	dsl_sink_webrtc_client_listener_cb listener, void* client_data);

This service adds a callback function of type dsl_sink_webrtc_client_listener_cb to the WebRTC Sink. The function will be called on all changes of WebSocket connection state. Multiple callback functions can be added to the WebRTC Sink.

IMPORTANT: The WebRTC Sink implementation requires GStreamer 1.18 or later.

Parameters

  • name [in] unique name of the WebRTC Sink to update.
  • listener - [in] listener callback function to add.
  • client_data - [in] opaque pointer to user data, returned to the listener on call back

Returns DSL_RESULT_SUCCESS on successful add. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_webrtc_client_listener_add('my-webrtc-sink', client_listener_cb, None)

dsl_sink_webrtc_client_listener_remove

DslReturnType dsl_sink_webrtc_client_listener_remove(const wchar_t* name,
	dsl_sink_webrtc_client_listener_cb listener);

This service removes a callback function of type dsl_sink_webrtc_client_listener_cb from the WebRTC Sink.

IMPORTANT: The WebRTC Sink implementation requires GStreamer 1.18 or later.

Parameters

  • name [in] unique name of the WebRTC Sink to update.
  • listener - [in] listener callback function to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_webrtc_client_listener_remove('my-webrtc-sink', client_listener_cb)

IOT Message Converter Sink Methods

dsl_sink_message_converter_settings_get

DslReturnType dsl_sink_message_converter_settings_get(const wchar_t* name,
	const wchar_t** converter_config_file, uint* payload_type);

This service gets the current Message Converter settings in use by the named Message Sink.

Important refer to the Deepstream Plugin Guide for information on the Message Converter configuration file settings.

Parameters

  • name - [in] unique name of the Encode Sink to query.
  • converter_config_file - [out] absolute file-path to the current Message Converter config file in use.
  • payload_type - [out] the current payload schema type in use, one of the Message Converter payload schema type constants defined above.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, converter_config_file, payload_type = dsl_sink_message_converter_settings_get('my-message-sink')

dsl_sink_message_converter_settings_set

DslReturnType dsl_sink_message_converter_settings_set(const wchar_t* name,
	const wchar_t* converter_config_file, uint payload_type);

This service sets the Message Converter settings to be used by the named Message Sink.

Important refer to the DeepStream Plugin Guide for information on the Message Converter configuration file settings.

Parameters

  • name - [in] unique name of the Encode Sink to update.
  • converter_config_file - [in] relative or absolute file-path to a Message Converter config file to use.
  • payload_type - [in] the current payload schema type in use, one of the Message Converter payload schema type constants defined above.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_message_converter_settings_get('my-message-sink',
	converter_config_file, DSL_MSG_PAYLOAD_DEEPSTREAM)

dsl_sink_message_broker_settings_get

DslReturnType dsl_sink_message_broker_settings_get(const wchar_t* name,
	const wchar_t** broker_config_file, const wchar_t** protocol_lib,
	const wchar_t** connection_string, const wchar_t** topic);

This service gets the current Message Broker settings in use by the named Message Sink.

Important refer to the DeepStream Plugin Guide for information on the Message Broker configuration file and connection string, and for information on configuration and use of the different Protocol Adapters.

Parameters

  • name - [in] unique name of the Message Sink to query.
  • broker_config_file - [out] absolute file-path to the current Message Broker config file in use.
  • protocol_lib - [out] absolute file-path to the current protocol adapter library in use.
  • connection_string - [out] current connection string in use.
  • topic - [out] (optional) current message topic in use.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, broker_config_file, protocol_lib, connection_string, topic =
    	dsl_sink_message_broker_settings_get('my-message-sink')

dsl_sink_message_broker_settings_set

DslReturnType dsl_sink_message_broker_settings_set(const wchar_t* name,
	const wchar_t* broker_config_file, const wchar_t* protocol_lib,
	const wchar_t* connection_string, const wchar_t* topic);

This service sets the Message Broker settings to be used by the named Message Sink.

Important refer to the DeepStream Plugin Guide for information on the Message Broker configuration file and connection string, and for information on configuration and use of the different Protocol Adapters.

Parameters

  • name - [in] unique name of the Message Sink to update.
  • broker_config_file - [in] absolute or relative file-path to a new Message Broker config file to use.
  • protocol_lib - [in] absolute or relative file-path to a new protocol adapter library to use.
  • connection_string - [in] new connection string to use.
  • topic - [in] (optional) new message topic to use for all messages sent.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_message_broker_settings_get('my-message-sink',
	broker_config_file, protocol_lib, connection_string, new_topic)

dsl_sink_message_payload_debug_dir_get

DslReturnType dsl_sink_message_payload_debug_dir_get(const wchar_t* name,
	const wchar_t** debug_dir);

This service gets the current payload dumping/debugging directory for the named Message Sink. Null string indicates that payload dumping is disabled.

Parameters

  • name - [in] unique name of the Message Sink to query.
  • debug_dir - [out] absolute or relative path to the directory to dump payload data.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, debug_dir = dsl_sink_message_payload_debug_dir_get('my-message-sink')

dsl_sink_message_payload_debug_dir_set

DslReturnType dsl_sink_message_payload_debug_dir_set(const wchar_t* name,
	const wchar_t* debug_dir);

This service sets the payload dumping/debugging directory for the named Message Sink.

Parameters

  • name - [in] unique name of the Message Sink to update.
  • debug_dir - [in] absolute or relative path to the directory to dump payload data.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_message_payload_debug_dir_set('my-message-sink', './dump')

Interpipe Sink Methods

dsl_sink_interpipe_forward_settings_get

DslReturnType dsl_sink_interpipe_forward_settings_get(const wchar_t* name,
	boolean* forward_eos, boolean* forward_events);

This service gets the current forward settings in use for the named Interpipe Sink component.

Parameters

  • name - [in] unique name of the Interpipe Sink to query.
  • forward_eos - [out] if true, the EOS event will be forwarded to all listeners. False otherwise.
  • forward_events - [out] if true, all downstream events will be forwarded to all the listeners (except for EOS). False otherwise.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, forward_eos, forward_events = dsl_sink_interpipe_forward_settings_get(
	'my-interpipe-sink')

dsl_sink_interpipe_forward_settings_set

DslReturnType dsl_sink_interpipe_forward_settings_set(const wchar_t* name,
	boolean forward_eos, boolean forward_events);

This service sets the forward settings for the named Interpipe Sink component.

Parameters

  • name - [in] unique name of the Interpipe Sink to update.
  • forward_eos - [in] set to true to forward the EOS event to all listeners. False to not forward.
  • forward_events - [in] set to true to forward downstream events to all listeners (except for EOS). False to not forward.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_interpipe_forward_settings_set('my-interpipe-sink',
	True, True)

dsl_sink_interpipe_num_listeners_get

DslReturnType dsl_sink_interpipe_num_listeners_get(const wchar_t* name,
	uint* num_listeners);

This service gets the current number of Interpipe Sources listening to the named Interpipe Sink component.

Parameters

  • name - [in] unique name of the Interpipe Sink to query.
  • num_listeners - [out] current number of Interpipe Sources listening.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, num_listeners = dsl_sink_interpipe_num_listeners_get('my-interpipe-sink')

Multi-Image Sink Methods

dsl_sink_image_multi_file_path_get

DslReturnType dsl_sink_image_multi_file_path_get(const wchar_t* name,
	const wchar_t** file_path);

This service gets the current output file-path in use by the named Multi-Image Sink component.

Parameters

  • name - [in] unique name of the Interpipe Sink to query.
  • file_path - [out] current file-path in use by the Multi-Image Sink.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, file_path = dsl_sink_image_multi_file_path_get('my-multi-image-sink')

dsl_sink_image_multi_file_path_set

DslReturnType dsl_sink_image_multi_file_path_set(const wchar_t* name,
	const wchar_t* file_path);

This service sets the output file-path for the named Multi-Image Sink to use.

Parameters

  • name - [in] unique name of the Multi-Image Sink to update.
  • file_path - [in] use the printf style %d in the absolute or relative path. Example: "./my_images/image.%04d.jpg", will create files in "./my_images/" named "image.0000.jpg", "image.0001.jpg", "image.0002.jpg" etc.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_image_multi_file_path_set('my-multi-image-sink',
	"./my_images/image.%04d.jpg")

dsl_sink_image_multi_dimensions_get

DslReturnType dsl_sink_image_multi_dimensions_get(const wchar_t* name,
	uint* width, uint* height);

This service gets the current dimensions in use by the named Multi-Image Sink component. Values of 0 indicate no transcode.

Parameters

  • name - [in] unique name of the Interpipe Sink to query.
  • width - [out] current width to save images in pixels.
  • height - [out] current height to save images in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, width, height = dsl_sink_image_multi_dimensions_get(
	'my-multi-image-sink')

dsl_sink_image_multi_dimensions_set

DslReturnType dsl_sink_image_multi_dimensions_set(const wchar_t* name,
	uint width, uint height);

This service sets the dimensions for the named Multi-Image Sink to use.

Parameters

  • name - [in] unique name of the Multi-Image Sink to update.
  • width - [in] new width setting in units of pixels. Set to 0 for no transcode.
  • height - [in] new width setting in units of pixels. Set to 0 for no transcode.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_image_multi_dimensions_set('my-multi-image-sink',
	640, 360)

dsl_sink_image_multi_frame_rate_get

DslReturnType dsl_sink_image_multi_frame_rate_get(const wchar_t* name,
	uint* fps_n, uint* fps_d);

This service gets the current frame-rate in use by the named Multi-Image Sink component. Values of 0 indicate no rate-change.

Parameters

  • name - [in] unique name of the Interpipe Sink to query.
  • fps_n - [out] current frames per second numerator.
  • fps_d - [out] current frames per second denominator.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, fps_n, fps_d = dsl_sink_image_multi_frame_rate_get(
	'my-multi-image-sink')

dsl_sink_image_multi_frame_rate_set

DslReturnType dsl_sink_image_multi_frame_rate_set(const wchar_t* name,
	uint fps_n, uint fps_d);

This service sets the frame-rate for the named Multi-Image Sink to use.

Parameters

  • name - [in] unique name of the Multi-Image Sink to update.
  • fps_n - [in] new frames per second numerator. Set to 0 for no rate-change.
  • fps_d - [in] new frames per second denominator. Set to 0 for no rate-change.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_image_multi_frame_rate_set(my-multi-image-sink',
	1, 30)

dsl_sink_image_multi_file_max_get

DslReturnType dsl_sink_image_multi_file_max_get(const wchar_t* name,
	uint* max);

This service gets the current max-file setting in use by the named Multi-Image Sink component. Once the maximum is reached, old files start to be deleted to make room for new ones. Default = 0 - no max.

Parameters

  • name - [in] unique name of the Interpipe Sink to query.
  • max - [out] current max-file setting in use.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure.

Python Example

retval, max = dsl_sink_image_multi_file_max_get(
	'my-multi-image-sink')

dsl_sink_image_multi_file_max_set

DslReturnType dsl_sink_image_multi_file_max_set(const wchar_t* name,
	uint max);

This service sets the max-file setting for named Multi-Image Sink to use. Once the maximum is reached, old files start to be deleted to make room for new ones. Default = 0 - no max.

Parameters

  • name - [in] unique name of the Multi-Image Sink to update.
  • max - [in] new max-files setting to use. Set to 0 for no maximum.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_image_multi_file_max_set('my-multi-image-sink', 100)

Frame-Capture Sink Methods

dsl_sink_frame_capture_initiate

DslReturnType dsl_sink_frame_capture_initiate(const wchar_t* name);

This service initiates a "frame-capture action" to capture the next buffer processed by the named Frame-Capture Sink.

All captured frames are copied and buffered in the Sink's processing thread. The encoding and saving of each buffered frame is done in the g-idle-thread context.

Note: The first capture may cause a noticeable short pause to the stream while cuda dependencies are loaded and cached.

Parameters

  • name - [in] unique name of the Frame-Capture Sink to update.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_frame_capture_initiate('my-frame-capture-sink')

dsl_sink_frame_capture_schedule

DslReturnType dsl_sink_frame_capture_schedule(const wchar_t* name,
	uint64_t frame_number);

This service schedules a "frame-capture action" for a specific frame-number to be processed by the named Frame-Capture Sink once the frame arrives. Multiple frames can be scheduled (queued) for processing. The Sink will log an ERROR message during buffer processing if the scheduled frame-number(s) is less (earlier in time) than the current frame-number.

All captured frames are copied and buffered in the Sink's processing thread. The encoding and saving of each buffered frame is done in the g-idle-thread context.

Note: The first capture may cause a noticeable short pause to the stream while cuda dependencies are loaded and cached.

Parameters

  • name - [in] unique name of the Frame-Capture Sink to update.
  • frame_num - [in] unique frame-number of the frame to capture.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_frame_capture_schedule('my-frame-capture-sink', frame_meta.frame_num)

Custom Sink Methods

dsl_sink_custom_element_add

DslReturnType dsl_sink_custom_element_add(const wchar_t* name,
   const wchar_t* element);

This service adds a single named GST Element to a named Custom Sink. The add service will fail if the Element is currently in-use by any other Component. The Element's in-use state will be set to true on successful add.

IMPORTANT! Elements added to Custom Sink will be linked in the order they are added.

Parameters

  • name - [in] unique name of the Custom Sink to update.
  • element - [in] unique name of the GST Element to add.

Returns

  • DSL_RESULT_SUCCESS on successful addition. One of the Return Values defined above on failure

Python Example

retval = dsl_sink_custom_element_add('my-custom-sink', 'my-element')

dsl_sink_custom_element_add_many

DslReturnType dsl_sink_custom_element_add_many(const wchar_t* name, const wchar_t** elements);

Adds a list of named GST Elements to a named Custom Sink. The add service will fail if any of the Elements are currently in-use by any other Component. All of the Element's in-use state will be set to true on successful add.

IMPORTANT! Elements added to Custom Sink will be linked in the order they are added.

  • name - [in] unique name of the Custom Sink to update.
  • elements - [in] a NULL terminated array of uniquely named GST Elements to add.

Returns

  • DSL_RESULT_SUCCESS on successful addition. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_custom_element_add_many('my-custom-sink',
  ['my-element-1', 'my-element-2', None])


dsl_sink_custom_element_remove

DslReturnType dsl_sink_custom_element_remove(const wchar_t* name, const wchar_t* element);

This service removes a single named GST Element from a named Custom Sink.

Parameters

  • name - [in] unique name of the Custom Sink to update.
  • element - [in] unique name of the GST Element to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure

Python Example

retval = dsl_sink_custom_element_remove('my-custom-sink', 'my-element')

dsl_sink_custom_element_remove_many

DslReturnType dsl_sink_custom_element_remove_many(const wchar_t* name, const wchar_t** elements);

This service removes a list of named Elements from a named Custom Sink.

  • name - [in] unique name for the Custom Sink to update.
  • elements - [in] a NULL terminated array of uniquely named GST Elements to remove.

Returns

  • DSL_RESULT_SUCCESS on successful removal. One of the Return Values defined above on failure.

Python Example

retval = dsl_sink_custom_element_remove_many('my-custom-sink',
  ['my-element-1', 'my-element-2', None])


API Reference