libvdo
Overview

Introduction

VDO is a package that consists of two primary components:

  • vdo service: A video streaming service/daemon. The VDO service acts as an abstraction for the video hardware, providing a unified API for streaming video to clients, used on all SoCs.
  • vdo library: A C library, for communicating with the service.

Library

The vdo package provides a C compatible library for communicating with the vdo service. The library provides two objects, each having its own header file:

VDO Objects

The vdo library API is divided into objects. Every API call from a client is done via an object, or a static function from an object's class. The most common objects are:

  • VdoStream: Represents a video stream owned by a client. The stream output can be configured to various formats, either unencoded (e.g. YUV), or encoded (e.g. H.264). See VdoFormat for all available stream formats.
  • VdoChannel: A vdo channel typically represents the video from one image sensor, or several image 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 client can use a channel object to query vdo for the stream properties the channel supports, such as the available resolutions for each stream format.

Each object has its own header file, with the same name, e.g. vdo-stream.h and vdo-channel.h.

GLib and error handling

The vdo library it built on top of GLib, which is a general-purpose, portable utility library for C. This library provides functionality, for implementing the VDO objects above, but also useful macros. GError is used for error handling. Read GLib and error handling page for more info, and examples on best practice when using vdo objects.

VdoMap

Many vdo library functions use the VdoMap as a parameter. It is a hash map with a variant value type, and provides a flexible way of setting and getting properties on vdo objects. Read here for more info.

Example code

The vdo repository contains some examples, on how to use vdo library to stream video to a client. When creating a new application that uses vdo, it is recommended to use the examples to get started.

For a non-blocking streaming example, see vdo-example.cc. This is the recommended way to use the vdo library in a single threaded or event loop driven application. There is also an example on how to use the blocking API, see vdo-example-blocking.cc.

The vdo-example-rgb.cc shows how to stream non encoded RGB video from vdo, not supported on all platforms.

The vdo-example-nv12.cc shows how to stream non encoded YUV NV12 video from vdo.