Hacker Guide/VLM Internals
VideoLAN Manager is a small media manager designed to control multiple streams with only one instance of VLC. It allows multiple streaming and video on demand (VoD). VLM can be controlled through the telnet and http interfaces of VLC as described in Documentation:Streaming_HowTo/VLM.
This document will describe the internals of VLM including data structures and functions, as well the the libvlc bindings for control of vlm.
In a running instance of VLC or libvlc only 1 instance of VLM can be running. This instance of VLM is represented by struct vlm_t as defined in src/input/vlm_internal.h. vlm_t contains a list of Medias, Schedules and vod servers, as well as a lock for the data structure, and a unique id. In essence, the vlm_t data structure is the global container for all VLM related data.
Medias and Instances
A Media is composed with a list of inputs (the video and audio streams you want to stream), an output (how and where you want to stream them) and some options.
There are two types of medias:
- vod: A vod media is commonly used for Video on Demand. It will be launched only if a vod client asks for it.
- broadcast: A broadcast media is very close to a TV program or channel. It is launched, stopped or paused by the administrator and may be repeated several times. The client has no control over this media.
A media is represented by the structure vlm_media_sys_t defined in src/input/vlm_internal.h. Each vlm_media_sys_t contains a configuration structure, a list of instances of the media, as well as a structure representing a vod server which is initialized only if the media is of type vod.
The configuration structure is of type vlm_media_t (a misnomer due to historical reasons) and contains the name of the media, as well as its type and a host of other details. It is defined in src/input/vlm_internal.h also.
A media instance is represented by the structure vlm_media_instance_sys_t defined in src/input/vlm_internal.h also. This structure contains a playlist index as well as the current input thread and output stream instance.
Vod servers will be discussed in the following section.
Each VOD server is represented by the struct vod_t. This structure contains a pointer to the module that will be loaded to help the vod server, as well as a pointer to an RTSP server. It also contains several function pointers to help create and delete vod medias of type vod_media_t. Each vod_media_t is actually referenced by a vlm_media_sys_t if that media is of vod type. vod_t is defined in include/vlc_vod.h and vod_media_t is defined in modules/misc/rtsp.c