VLC 4.0.0-dev
Loading...
Searching...
No Matches
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 (void) argc; (void) argv;
13 libvlc_instance_t * inst;
16
17 /* Load the VLC engine */
18 inst = libvlc_new (0, NULL);
19
20 /* Create a new item */
21 m = libvlc_media_new_location("http://mycool.movie.com/test.mov");
22 //m = libvlc_media_new_path("/path/to/test.mov");
23
24 /* Create a media player playing environement */
26
27 /* No need to keep the media now */
29
30 /* play the media_player */
32
34 {
35 sleep (1);
36 int64_t milliseconds = libvlc_media_player_get_time(mp);
37 int64_t seconds = milliseconds / 1000;
38 int64_t minutes = seconds / 60;
39 milliseconds -= seconds * 1000;
40 seconds -= minutes * 60;
41
42 printf("Current time: %" PRId64 ":%" PRId64 ":%" PRId64 "\n",
43 minutes, seconds, milliseconds);
44 }
45
46 /* Stop playing */
48
49 /* Free the media_player */
51
52 libvlc_release (inst);
53
54 return 0;
55}
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.
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.
LIBVLC_API void libvlc_media_release(libvlc_media_t *p_md)
Decrement the reference count of a media descriptor object.
struct libvlc_media_t libvlc_media_t
Definition libvlc_events.h:47
struct libvlc_media_player_t libvlc_media_player_t
Definition libvlc_media_list_player.h:34
int main(void)
Definition test.c:309
This file defines libvlc new external API.