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

VdoChannelvdo_channel_get (guint channel_nbr, GError **error)
 Get an existing channel. More...
 
VdoChannelvdo_channel_get_ex (VdoMap *desc, GError **error)
 Get an existing channel matching a description. More...
 
GList * vdo_channel_get_all (GError **error)
 Gets all existing channels. More...
 
GList * vdo_channel_get_filtered (VdoMap *filter, GError **error)
 Gets all existing channels matching a filter. More...
 
VdoMapvdo_channel_get_info (VdoChannel *self, GError **error)
 Get the info for this channel. More...
 
VdoMapvdo_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...
 
VdoMapvdo_channel_get_stream_profile (VdoChannel *self, const gchar *profile, VdoFormat format, GError **error)
 Query stream profile for the specified name, format and channel. More...
 
VdoResolutionSetvdo_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)
 

Detailed Description

A class representing a channel.

A VdoChannel object is created in order to retrieve or control a video channel from the Vdo video service.

A VdoChannel represents the video from one sensor, or several sensors combined into a composite view. Every vdo stream has a channel as its source.

A VdoChannel supports the following generic settings. Settings are accessed by calling vdo_channel_get_settings() and vdo_channel_set_settings().

Deprecated:
Crop Settings
Name Type Description
"crop.max_width" uint32 The width of the buffer we crop from, (crop.x + crop.width must be less than this)
"crop.max_height" uint32 The height of the buffer we crop from, (crop.y + crop.height must be less than this)
"crop.x" uint32 The x position of the crop
"crop.y" uint32 The y position of the crop
"crop.width" uint32 The width of the crop
"crop.height" uint32 The height of the crop
Deprecated:
User video settings
Name Type Description
"yuv.input.path" string Path to user video input file

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-2024, 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)

Gets 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 VdoStream 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 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 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 an 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 
)

Gets 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 VdoStream objects or NULL on error. Free with g_list_free_full(list, g_object_unref).

◆ vdo_channel_get_id()

guint vdo_channel_get_id ( VdoChannel self)

vdo_channel_get_id:

Parameters
selfThe VdoChannel to query.

Returns: The id of the channel

◆ 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:65
Parameters
selfA VdoChannel.
errorA location to return an error.
Returns
A pointer to a VdoMap owned by this channel, or NULL if error is set. Free with g_object_unref().

◆ 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. NULL if error is set. 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 if error is set. 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 if error is set. Free with g_object_unref().

◆ 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 if error is set.