libvdo
vdo-channel.h File Reference

A class representing a channel. More...

#include "vdo-map.h"
#include "vdo-types.h"
#include <unistd.h>
#include <glib-object.h>
Include dependency graph for vdo-channel.h:

Go to the source code of this file.

Macros

#define VDO_CHANNEL_GLOBAL   NULL
 Used for accessing info which is global for all channels.
 

Functions

VdoChannel * vdo_channel_get (guint channel_nbr, GError **error)
 Get an existing channel. More...
 
VdoChannel * vdo_channel_get_ex (VdoMap *desc, GError **error)
 Get an existing channel matching a description. More...
 
GList * vdo_channel_get_all (GError **error)
 Get all existing channels. More...
 
GList * vdo_channel_get_filtered (VdoMap *filter, GError **error)
 Get all existing channels matching a filter. More...
 
VdoMap * vdo_channel_get_info (VdoChannel *self, GError **error)
 Get the info for this channel. More...
 
VdoMap * vdo_channel_get_settings (VdoChannel *self, GError **error)
 Get the settings for this channel. More...
 
gboolean vdo_channel_set_settings (VdoChannel *self, VdoMap *settings, GError **error)
 Update the settings for this channel. More...
 
VdoMap * vdo_channel_get_stream_profile (VdoChannel *self, const gchar *profile, VdoFormat format, GError **error)
 Query stream profile for the specified name, format and channel. More...
 
VdoResolutionSet * vdo_channel_get_resolutions (VdoChannel *self, VdoMap *filter, GError **error)
 Fetch all valid resolutions for a channel with specified stream format. More...
 
guint vdo_channel_get_id (VdoChannel *self)
 Get the ID of a VdoChannel. More...
 
gboolean vdo_channel_set_framerate (VdoChannel *self, gdouble framerate, GError **error)
 Update the framerate for the specified channel. More...
 

Detailed Description

A class representing a channel.

A vdo channel represents the video from one sensor, or several sensors combined into a composite view. A channel usually corresponds to a "camera" in the VAPIX API. Every vdo stream has a channel as its source.

A VdoChannel object is created in order to retrieve or control a video channel from the VDO service. On ARTPEC-7, ARTPEC-8, Ambarella S6lm and Ambarella CV25 based cameras, the overview channel in the RTSP vapix API, corresponds to the VdoChannel with ID 0. On later platforms (starting with ARTPEC-9), the overview channel is instead the VdoChannel with ID 1. All other channels have sequentially increasing IDs.

The table below shows the supported generic settings for a channel. These settings can be read from a stream via vdo_channel_get_settings. Some settings can also be updated via vdo_channel_set_settings.

A VdoChannel provides the following info. Info is obtained by calling vdo_channel_get_info().

Name Type Description
"mirror.possible" boolean Whether mirroring is possible on this channel
"crop.possible" boolean Whether crop is possible on this channel
"dptz.possible" boolean Whether dptz is possible on this channel
"available_rotations" string Available rotations for this channel

Copyright (C) 2016-2025, Axis Communications AB, Lund

Function Documentation

◆ vdo_channel_get()

VdoChannel* vdo_channel_get ( guint  channel_nbr,
GError **  error 
)

Get an existing channel.

Create a new VdoChannel object representing an existing channel session with the specified channel number.

Parameters
channel_nbrA channel number
errorA location to return an error.
Returns
A VdoChannel or NULL on error. Free with g_object_unref().

◆ vdo_channel_get_all()

GList* vdo_channel_get_all ( GError **  error)

Get all existing channels.

Create new VdoChannel objects representing each existing channel and return those in a GList.

Parameters
errorA location to return an error.
Returns
A GList containing VdoChannel objects or NULL on error. Free with g_list_free_full(list, g_object_unref).

◆ vdo_channel_get_ex()

VdoChannel* vdo_channel_get_ex ( VdoMap *  desc,
GError **  error 
)

Get an existing channel matching a description.

Create a new VdoChannel object representing an existing channel session matching a description.

The description map must contain exactly one of the following keys:

  • view
  • warp
  • input
  • channel
  • virtual (deprecated)

where the value is the suffix for the specified type.

For example, get channel object for 'input1':

g_autoptr(VdoMap) desc = vdo_map_new();
vdo_map_set_uint32(desc, "input", 1);
g_autoptr(VdoChannel) channel = vdo_channel_get_ex(desc, &error);
A video channel.
A class representing a dictionary mapping keys to values.
VdoChannel * vdo_channel_get_ex(VdoMap *desc, GError **error)
Get an existing channel matching a description.
VdoMap * vdo_map_new(void)
Constructs a new empty VdoMap.
void vdo_map_set_uint32(VdoMap *self, const gchar *name, guint32 value)
Sets the value associated with the specified key.
Parameters
descA VdoMap specifying a description.
errorA location to return an error.
Returns
A VdoChannel or NULL on error. Free with g_object_unref() or g_autoptr.

◆ vdo_channel_get_filtered()

GList* vdo_channel_get_filtered ( VdoMap *  filter,
GError **  error 
)

Get all existing channels matching a filter.

Create new VdoChannel objects representing existing channels matching a filter and return those in a GList.

Parameters
filterA VdoMap specifying filter or NULL for all channels.
errorA location to return an error.
Returns
A GList containing VdoChannel objects or NULL on error. Free with g_list_free_full(list, g_object_unref).
Examples
vdo-example-channel-filter.cc.

◆ vdo_channel_get_id()

guint vdo_channel_get_id ( VdoChannel *  self)

Get the ID of a VdoChannel.

Parameters
selfThe VdoChannel to query.
Returns
The id of the channel.
Examples
vdo-example-channel-filter.cc.

◆ vdo_channel_get_info()

VdoMap* vdo_channel_get_info ( VdoChannel *  self,
GError **  error 
)

Get the info for this channel.

This function is called in order to get a pointer to the info map for this channel. The returned pointer is a pointer to a newly allocated VdoMap owned by the caller of this function. For example:

g_autoptr(VdoMap) info = vdo_channel_get_info(channel, &error);
guint value = vdo_map_get_uint32(info, "name", 0);
VdoMap * vdo_channel_get_info(VdoChannel *self, GError **error)
Get the info for this channel.
guint32 vdo_map_get_uint32(const VdoMap *self, const gchar *name, guint32 def)
Returns the value which the key name is associated with.

AXIS OS 12.1 supports VDO_CHANNEL_GLOBAL with the following info.

Name Type Description
"view.count" uint32 The amount of view area channels
"warp.count" uint32 The amount of warp/dewarp channels
"input.count" uint32 The amount of sensor/input channels
"channel.count" uint32 The total channel count
// AXIS OS 12.1
g_autoptr(VdoMap) info = vdo_channel_get_info(VDO_CHANNEL_GLOBAL, &error);
guint view_count = vdo_map_get_uint32(info, "view.count", 0);
guint warp_count = vdo_map_get_uint32(info, "warp.count", 0);
guint input_count = vdo_map_get_uint32(info, "input.count", 0);
guint channel_count = vdo_map_get_uint32(info, "channel.count", 0);
#define VDO_CHANNEL_GLOBAL
Used for accessing info which is global for all channels.
Definition: vdo-channel.h:60
Parameters
selfA VdoChannel.
errorA location to return an error.
Returns
A pointer to a VdoMap owned by this channel, or NULL on error. Free with g_object_unref().
Examples
vdo-example-channel-filter.cc.

◆ vdo_channel_get_resolutions()

VdoResolutionSet* vdo_channel_get_resolutions ( VdoChannel *  self,
VdoMap *  filter,
GError **  error 
)

Fetch all valid resolutions for a channel with specified stream format.

Get a VdoResolutionSet of valid resolutions.

Parameters
selfThe VdoChannel to query.
errorA location to return an error.
filterA VdoMap specifying filter or NULL for default.
Name Type Description
"format" uint32 Video stream format as VdoFormat.
"subformat" string The subformat for streams in YUV format.
"select" string Supports: "all", "min", "max", "minmax".
"aspect_ratio" string Supports: "1:1", "4:3", "5:4", "16:9", "16:10", "native".
"pixel.limit" uint32 The default pixel limit is tuned per platform (YUV Only).
Returns
A VdoResolutionSet on success, or NULL on error. Free with g_free.

◆ vdo_channel_get_settings()

VdoMap* vdo_channel_get_settings ( VdoChannel *  self,
GError **  error 
)

Get the settings for this channel.

This function is called in order to get a pointer to the settings map for this channel. The returned pointer is a pointer to a newly allocated VdoMap owned by the caller of this function. For example:

VdoMap* settings = vdo_channel_get_settings(channel, &error);
guint value = vdo_map_get_uint32(settings, "name", 0);
g_object_unref(settings);
VdoMap * vdo_channel_get_settings(VdoChannel *self, GError **error)
Get the settings for this channel.
Parameters
selfA VdoChannel.
errorA location to return an error.
Returns
A pointer to a VdoMap owned by this channel, or NULL on error. Free with g_object_unref().

◆ vdo_channel_get_stream_profile()

VdoMap* vdo_channel_get_stream_profile ( VdoChannel *  self,
const gchar *  profile,
VdoFormat  format,
GError **  error 
)

Query stream profile for the specified name, format and channel.

The combination of profile and format is unique and may have different stream settings.

Parameters
selfThe VdoChannel to query.
profileThe name of the stream profile
formatThe format of the stream profile.
errorA location to return an error.
Returns
A pointer to a VdoMap with profile settings, or NULL on error. Free with g_object_unref().

◆ vdo_channel_set_framerate()

gboolean vdo_channel_set_framerate ( VdoChannel *  self,
gdouble  framerate,
GError **  error 
)

Update the framerate for the specified channel.

This function is invoked in order to update the framerate of a channel. All streams that are connected to this channel may be changed. Only streams with a higher fps set than the channel framerate will be affected.

Parameters
selfThe VdoChannel to set framerate on.
framerateA framerate.
errorA location to return an error.
Returns
TRUE on success, FALSE on error.
Deprecated:

◆ vdo_channel_set_settings()

gboolean vdo_channel_set_settings ( VdoChannel *  self,
VdoMap *  settings,
GError **  error 
)

Update the settings for this channel.

This function is invoked in order to update the settings of a channel. The caller owns the VdoMap containing the new/updated settings.

VdoMap* settings = vdo_map_new();
vdo_map_set_uint32(settings, "name", value);
if (!vdo_channel_set_settings(channel, settings, &error)) {
g_error("Error: %s", error->message);
}
g_object_unref(settings);
gboolean vdo_channel_set_settings(VdoChannel *self, VdoMap *settings, GError **error)
Update the settings for this channel.
Parameters
selfA VdoChannel.
settingsA VdoMap containing new/updated settings.
errorA location to return an error.
Returns
TRUE on success, FALSE on error.