VLC 4.0.0-dev
Loading...
Searching...
No Matches
LibVLC asynchronous events

LibVLC emits asynchronous events. More...

Collaboration diagram for LibVLC asynchronous events:

Typedefs

typedef struct libvlc_event_manager_t libvlc_event_manager_t
 Event manager that belongs to a libvlc object, and from whom events can be received.
 
typedef int libvlc_event_type_t
 Type of a LibVLC event.
 
typedef void(* libvlc_callback_t) (const struct libvlc_event_t *p_event, void *p_data)
 Callback function notification.
 

Functions

int libvlc_event_attach (libvlc_event_manager_t *p_event_manager, libvlc_event_type_t i_event_type, libvlc_callback_t f_callback, void *user_data)
 Register for an event notification.
 
void libvlc_event_detach (libvlc_event_manager_t *p_event_manager, libvlc_event_type_t i_event_type, libvlc_callback_t f_callback, void *p_user_data)
 Unregister an event notification.
 
enum  libvlc_event_e {
  libvlc_MediaMetaChanged =0 , libvlc_MediaSubItemAdded , libvlc_MediaDurationChanged , libvlc_MediaParsedChanged ,
  libvlc_MediaSubItemTreeAdded = libvlc_MediaParsedChanged + 3 , libvlc_MediaThumbnailGenerated , libvlc_MediaAttachedThumbnailsFound , libvlc_MediaPlayerMediaChanged =0x100 ,
  libvlc_MediaPlayerNothingSpecial , libvlc_MediaPlayerOpening , libvlc_MediaPlayerBuffering , libvlc_MediaPlayerPlaying ,
  libvlc_MediaPlayerPaused , libvlc_MediaPlayerStopped , libvlc_MediaPlayerForward , libvlc_MediaPlayerBackward ,
  libvlc_MediaPlayerStopping , libvlc_MediaPlayerEncounteredError , libvlc_MediaPlayerTimeChanged , libvlc_MediaPlayerPositionChanged ,
  libvlc_MediaPlayerSeekableChanged , libvlc_MediaPlayerPausableChanged , libvlc_MediaPlayerSnapshotTaken = libvlc_MediaPlayerPausableChanged + 2 , libvlc_MediaPlayerLengthChanged ,
  libvlc_MediaPlayerVout , libvlc_MediaPlayerESAdded = libvlc_MediaPlayerVout + 2 , libvlc_MediaPlayerESDeleted , libvlc_MediaPlayerESSelected ,
  libvlc_MediaPlayerCorked , libvlc_MediaPlayerUncorked , libvlc_MediaPlayerMuted , libvlc_MediaPlayerUnmuted ,
  libvlc_MediaPlayerAudioVolume , libvlc_MediaPlayerAudioDevice , libvlc_MediaPlayerESUpdated , libvlc_MediaPlayerProgramAdded ,
  libvlc_MediaPlayerProgramDeleted , libvlc_MediaPlayerProgramSelected , libvlc_MediaPlayerProgramUpdated , libvlc_MediaPlayerTitleListChanged ,
  libvlc_MediaPlayerTitleSelectionChanged , libvlc_MediaPlayerChapterChanged , libvlc_MediaPlayerRecordChanged , libvlc_MediaListItemAdded =0x200 ,
  libvlc_MediaListWillAddItem , libvlc_MediaListItemDeleted , libvlc_MediaListWillDeleteItem , libvlc_MediaListEndReached ,
  libvlc_MediaListViewItemAdded =0x300 , libvlc_MediaListViewWillAddItem , libvlc_MediaListViewItemDeleted , libvlc_MediaListViewWillDeleteItem ,
  libvlc_MediaListPlayerPlayed =0x400 , libvlc_MediaListPlayerNextItemSet , libvlc_MediaListPlayerStopped , libvlc_RendererDiscovererItemAdded =0x502 ,
  libvlc_RendererDiscovererItemDeleted , libvlc_MediaPlayerMediaStopping
}
 Event types. More...
 
typedef struct libvlc_event_t libvlc_event_t
 A LibVLC event.
 

Detailed Description

LibVLC emits asynchronous events.

Several LibVLC objects (such libvlc_instance_t as libvlc_media_player_t) generate events asynchronously. Each of them provides libvlc_event_manager_t event manager. You can subscribe to events with libvlc_event_attach() and unsubscribe with libvlc_event_detach().

Typedef Documentation

◆ libvlc_callback_t

typedef void(* libvlc_callback_t) (const struct libvlc_event_t *p_event, void *p_data)

Callback function notification.

Parameters
p_eventthe event triggering the callback

◆ libvlc_event_manager_t

Event manager that belongs to a libvlc object, and from whom events can be received.

◆ libvlc_event_t

A LibVLC event.

◆ libvlc_event_type_t

typedef int libvlc_event_type_t

Type of a LibVLC event.

Enumeration Type Documentation

◆ libvlc_event_e

Event types.

Enumerator
libvlc_MediaMetaChanged 

1 or several Metadata of a media item changed

libvlc_MediaSubItemAdded 

Subitem was added to a media item.

See also
libvlc_media_subitems()
libvlc_MediaDurationChanged 

Deprecated, use libvlc_MediaParsedChanged or libvlc_MediaPlayerLengthChanged.

libvlc_MediaParsedChanged 

Parsing state of a media item changed.

See also
libvlc_media_parse_request(), libvlc_media_get_parsed_status(), libvlc_media_parse_stop()
libvlc_MediaSubItemTreeAdded 

Subitem tree was added to a media item.

libvlc_MediaThumbnailGenerated 

A thumbnail generation for this media completed.

See also
libvlc_media_thumbnail_request_by_time()
libvlc_media_thumbnail_request_by_pos()
libvlc_MediaAttachedThumbnailsFound 

One or more embedded thumbnails were found during the media preparsing The user can hold these picture(s) using libvlc_picture_retain if they wish to use them.

libvlc_MediaPlayerMediaChanged 
libvlc_MediaPlayerNothingSpecial 
libvlc_MediaPlayerOpening 
libvlc_MediaPlayerBuffering 
libvlc_MediaPlayerPlaying 
libvlc_MediaPlayerPaused 
libvlc_MediaPlayerStopped 
libvlc_MediaPlayerForward 
libvlc_MediaPlayerBackward 
libvlc_MediaPlayerStopping 
libvlc_MediaPlayerEncounteredError 
libvlc_MediaPlayerTimeChanged 
libvlc_MediaPlayerPositionChanged 
libvlc_MediaPlayerSeekableChanged 
libvlc_MediaPlayerPausableChanged 
libvlc_MediaPlayerSnapshotTaken 
libvlc_MediaPlayerLengthChanged 
libvlc_MediaPlayerVout 
libvlc_MediaPlayerESAdded 

A track was added, cf.

media_player_es_changed in libvlc_event_t::u to get the id of the new track.

libvlc_MediaPlayerESDeleted 

A track was removed, cf.

media_player_es_changed in libvlc_event_t::u to get the id of the removed track.

libvlc_MediaPlayerESSelected 

Tracks were selected or unselected, cf.

media_player_es_selection_changed in libvlc_event_t::u to get the unselected and/or the selected track ids.

libvlc_MediaPlayerCorked 
libvlc_MediaPlayerUncorked 
libvlc_MediaPlayerMuted 
libvlc_MediaPlayerUnmuted 
libvlc_MediaPlayerAudioVolume 
libvlc_MediaPlayerAudioDevice 
libvlc_MediaPlayerESUpdated 

A track was updated, cf.

media_player_es_changed in libvlc_event_t::u to get the id of the updated track.

libvlc_MediaPlayerProgramAdded 
libvlc_MediaPlayerProgramDeleted 
libvlc_MediaPlayerProgramSelected 
libvlc_MediaPlayerProgramUpdated 
libvlc_MediaPlayerTitleListChanged 

The title list changed, call libvlc_media_player_get_full_title_descriptions() to get the new list.

libvlc_MediaPlayerTitleSelectionChanged 

The title selection changed, cf media_player_title_selection_changed in libvlc_event_t::u.

libvlc_MediaPlayerChapterChanged 
libvlc_MediaPlayerRecordChanged 
libvlc_MediaListItemAdded 

A media item was added to a media list.

libvlc_MediaListWillAddItem 

A media item is about to get added to a media list.

libvlc_MediaListItemDeleted 

A media item was deleted from a media list.

libvlc_MediaListWillDeleteItem 

A media item is about to get deleted from a media list.

libvlc_MediaListEndReached 

A media list has reached the end.

All items were either added (in case of a libvlc_media_discoverer_t) or parsed (preparser).

libvlc_MediaListViewItemAdded 
Deprecated:
No longer used. This belonged to the removed libvlc_media_list_view_t
libvlc_MediaListViewWillAddItem 
Deprecated:
No longer used. This belonged to the removed libvlc_media_list_view_t
libvlc_MediaListViewItemDeleted 
Deprecated:
No longer used. This belonged to the removed libvlc_media_list_view_t
libvlc_MediaListViewWillDeleteItem 
Deprecated:
No longer used. This belonged to the removed libvlc_media_list_view_t
libvlc_MediaListPlayerPlayed 

Playback of a media list player has started.

libvlc_MediaListPlayerNextItemSet 

The current item of a media list player has changed to a different item.

libvlc_MediaListPlayerStopped 

Playback of a media list player has stopped.

libvlc_RendererDiscovererItemAdded 

A new renderer item was found by a renderer discoverer.

The renderer item is valid until deleted.

libvlc_RendererDiscovererItemDeleted 

A previously discovered renderer item was deleted by a renderer discoverer.

The renderer item is no longer valid.

libvlc_MediaPlayerMediaStopping 

The current media set into the libvlc_media_player_t is stopping.

This event can be used to notify when the media callbacks, initialized from libvlc_media_new_callbacks, should be interrupted, and in particular the libvlc_media_read_cb. It can also be used to signal the application state that any input resource (webserver, file mounting, etc) can be discarded. Output resources still need to be active until the player switches to the libvlc_Stopped state.

Function Documentation

◆ libvlc_event_attach()

int libvlc_event_attach ( libvlc_event_manager_t p_event_manager,
libvlc_event_type_t  i_event_type,
libvlc_callback_t  f_callback,
void *  user_data 
)

Register for an event notification.

Parameters
p_event_managerthe event manager to which you want to attach to. Generally it is obtained by vlc_my_object_event_manager() where my_object is the object you want to listen to.
i_event_typethe desired event to which we want to listen
f_callbackthe function to call when i_event_type occurs
user_datauser provided data to carry with the event
Returns
0 on success, ENOMEM on error

◆ libvlc_event_detach()

void libvlc_event_detach ( libvlc_event_manager_t p_event_manager,
libvlc_event_type_t  i_event_type,
libvlc_callback_t  f_callback,
void *  p_user_data 
)

Unregister an event notification.

Parameters
p_event_managerthe event manager
i_event_typethe desired event to which we want to unregister
f_callbackthe function to call when i_event_type occurs
p_user_datauser provided data to carry with the event