VLC 4.0.0-dev
LibVLC Documentation

Introduction

libVLC is an embeddable engine for 3rd party applications and frameworks.

It runs on the same platforms as VLC (and sometimes on more) and can provide playback, streaming and conversion of multimedia files and streams.

libVLC has numerous bindings for other languages, such as C++, Python, java, Objective-C and C#.

The generated documentation can be browsed from here.

License

libVLC is released under the LGPLv2 (or later) license. This allows embedding the engine in 3rd party applications, while letting them to be licensed under other licenses.

However, note that some plugins are under more restrictive licenses, such as GPLv3 (or later).

Example

4#include <stdio.h>
5#include <stdlib.h>
6#include <inttypes.h>
7#include <unistd.h>
8#include <vlc/vlc.h>
9
10int main(int argc, char* argv[])
11{
12 libvlc_instance_t * inst;
15
16 /* Load the VLC engine */
17 inst = libvlc_new (0, NULL);
18
19 /* Create a new item */
20 m = libvlc_media_new_location("http://mycool.movie.com/test.mov");
21 //m = libvlc_media_new_path("/path/to/test.mov");
22
23 /* Create a media player playing environement */
25
26 /* No need to keep the media now */
28
29 /* play the media_player */
31
33 {
34 sleep (1);
35 int64_t milliseconds = libvlc_media_player_get_time(mp);
36 int64_t seconds = milliseconds / 1000;
37 int64_t minutes = seconds / 60;
38 milliseconds -= seconds * 1000;
39 seconds -= minutes * 60;
40
41 printf("Current time: %" PRId64 ":%" PRId64 ":%" PRId64 "\n",
42 minutes, seconds, milliseconds);
43 }
44
45 /* Stop playing */
47
48 /* Free the media_player */
50
51 libvlc_release (inst);
52
53 return 0;
54}
struct libvlc_instance_t libvlc_instance_t
This structure is opaque.
Definition: libvlc.h:76
libvlc_instance_t * libvlc_new(int argc, const char *const *argv)
Create and initialize a libvlc instance.
void libvlc_release(libvlc_instance_t *p_instance)
Decrement the reference count of a libvlc instance, and destroy it if it reaches zero.
LIBVLC_API libvlc_time_t libvlc_media_player_get_time(libvlc_media_player_t *p_mi)
Get the current movie time (in ms).
LIBVLC_API bool libvlc_media_player_is_playing(libvlc_media_player_t *p_mi)
is_playing
LIBVLC_API libvlc_media_player_t * libvlc_media_player_new_from_media(libvlc_instance_t *inst, libvlc_media_t *p_md)
Create a Media Player object from a Media.
struct libvlc_media_player_t libvlc_media_player_t
Definition: libvlc_media_player.h:42
LIBVLC_API int libvlc_media_player_play(libvlc_media_player_t *p_mi)
Play.
LIBVLC_API int libvlc_media_player_stop_async(libvlc_media_player_t *p_mi)
Stop asynchronously.
LIBVLC_API void libvlc_media_player_release(libvlc_media_player_t *p_mi)
Release a media_player after use Decrement the reference count of a media player object.
LIBVLC_API libvlc_media_t * libvlc_media_new_location(const char *psz_mrl)
Create a media with a certain given media resource location, for instance a valid URL.
struct libvlc_media_t libvlc_media_t
Definition: libvlc_media.h:46
LIBVLC_API void libvlc_media_release(libvlc_media_t *p_md)
Decrement the reference count of a media descriptor object.
int main(void)
Definition: test.c:309
This file defines libvlc new external API.