VLC 4.0.0-dev
vlc_player_cbs Struct Reference

Player callbacks. More...

#include <vlc_player.h>

Data Fields

void(* on_current_media_changed )(vlc_player_t *player, input_item_t *new_media, void *data)
 Called when the current media has changed. More...
 
void(* on_state_changed )(vlc_player_t *player, enum vlc_player_state new_state, void *data)
 Called when the player state has changed. More...
 
void(* on_error_changed )(vlc_player_t *player, enum vlc_player_error error, void *data)
 Called when a media triggered an error. More...
 
void(* on_buffering_changed )(vlc_player_t *player, float new_buffering, void *data)
 Called when the player buffering (or cache) has changed. More...
 
void(* on_rate_changed )(vlc_player_t *player, float new_rate, void *data)
 Called when the player rate has changed. More...
 
void(* on_capabilities_changed )(vlc_player_t *player, int old_caps, int new_caps, void *data)
 Called when the media capabilities has changed. More...
 
void(* on_position_changed )(vlc_player_t *player, vlc_tick_t new_time, double new_pos, void *data)
 Called when the player position has changed. More...
 
void(* on_length_changed )(vlc_player_t *player, vlc_tick_t new_length, void *data)
 Called when the media length has changed. More...
 
void(* on_track_list_changed )(vlc_player_t *player, enum vlc_player_list_action action, const struct vlc_player_track *track, void *data)
 Called when a track is added, removed, or updated. More...
 
void(* on_track_selection_changed )(vlc_player_t *player, vlc_es_id_t *unselected_id, vlc_es_id_t *selected_id, void *data)
 Called when a new track is selected and/or unselected. More...
 
void(* on_track_delay_changed )(vlc_player_t *player, vlc_es_id_t *es_id, vlc_tick_t delay, void *data)
 Called when a track delay has changed. More...
 
void(* on_program_list_changed )(vlc_player_t *player, enum vlc_player_list_action action, const struct vlc_player_program *prgm, void *data)
 Called when a new program is added, removed or updated. More...
 
void(* on_program_selection_changed )(vlc_player_t *player, int unselected_id, int selected_id, void *data)
 Called when a new program is selected and/or unselected. More...
 
void(* on_titles_changed )(vlc_player_t *player, vlc_player_title_list *titles, void *data)
 Called when the media titles has changed. More...
 
void(* on_title_selection_changed )(vlc_player_t *player, const struct vlc_player_title *new_title, size_t new_idx, void *data)
 Called when a new title is selected. More...
 
void(* on_chapter_selection_changed )(vlc_player_t *player, const struct vlc_player_title *title, size_t title_idx, const struct vlc_player_chapter *new_chapter, size_t new_chapter_idx, void *data)
 Called when a new chapter is selected. More...
 
void(* on_teletext_menu_changed )(vlc_player_t *player, bool has_teletext_menu, void *data)
 Called when the media has a teletext menu. More...
 
void(* on_teletext_enabled_changed )(vlc_player_t *player, bool enabled, void *data)
 Called when teletext is enabled or disabled. More...
 
void(* on_teletext_page_changed )(vlc_player_t *player, unsigned new_page, void *data)
 Called when the teletext page has changed. More...
 
void(* on_teletext_transparency_changed )(vlc_player_t *player, bool enabled, void *data)
 Called when the teletext transparency has changed. More...
 
void(* on_category_delay_changed )(vlc_player_t *player, enum es_format_category_e cat, vlc_tick_t new_delay, void *data)
 Called when the player category delay has changed for the current media. More...
 
void(* on_associated_subs_fps_changed )(vlc_player_t *player, float subs_fps, void *data)
 Called when associated subtitle has changed. More...
 
void(* on_renderer_changed )(vlc_player_t *player, vlc_renderer_item_t *new_item, void *data)
 Called when a new renderer item is set. More...
 
void(* on_recording_changed )(vlc_player_t *player, bool recording, void *data)
 Called when the player recording state has changed. More...
 
void(* on_signal_changed )(vlc_player_t *player, float quality, float strength, void *data)
 Called when the media signal has changed. More...
 
void(* on_statistics_changed )(vlc_player_t *player, const struct input_stats_t *stats, void *data)
 Called when the player has new statisics. More...
 
void(* on_atobloop_changed )(vlc_player_t *player, enum vlc_player_abloop new_state, vlc_tick_t time, double pos, void *data)
 Called when the A to B loop has changed. More...
 
void(* on_media_stopped_action_changed )(vlc_player_t *player, enum vlc_player_media_stopped_action new_action, void *data)
 Called when media stopped action has changed. More...
 
void(* on_media_meta_changed )(vlc_player_t *player, input_item_t *media, void *data)
 Called when the media meta has changed. More...
 
void(* on_media_epg_changed )(vlc_player_t *player, input_item_t *media, void *data)
 Called when media epg has changed. More...
 
void(* on_media_subitems_changed )(vlc_player_t *player, input_item_t *media, input_item_node_t *new_subitems, void *data)
 Called when the media has new subitems. More...
 
void(* on_vout_changed )(vlc_player_t *player, enum vlc_player_vout_action action, vout_thread_t *vout, enum vlc_vout_order order, vlc_es_id_t *es_id, void *data)
 Called when a vout is started or stopped. More...
 
void(* on_cork_changed )(vlc_player_t *player, unsigned cork_count, void *data)
 Called when the player is corked. More...
 
void(* on_playback_restore_queried )(vlc_player_t *player, void *data)
 Called to query the user about restoring the previous playback position. More...
 

Detailed Description

Player callbacks.

Can be registered with vlc_player_AddListener().

All callbacks are called with the player locked (cf. vlc_player_Lock()) and from any threads (and even synchronously from a vlc_player function in some cases). It is safe to call any vlc_player functions from these callbacks except vlc_player_Delete().

Warning
To avoid deadlocks, users should never call vlc_player functions with an external mutex locked and lock this same mutex from a player callback.

Field Documentation

◆ on_associated_subs_fps_changed

void(* vlc_player_cbs::on_associated_subs_fps_changed) (vlc_player_t *player, float subs_fps, void *data)

Called when associated subtitle has changed.

See also
vlc_player_SetAssociatedSubsFPS()
Parameters
playerlocked player instance
sub_fpssubtitle fps
dataopaque pointer set by vlc_player_AddListener()

◆ on_atobloop_changed

void(* vlc_player_cbs::on_atobloop_changed) (vlc_player_t *player, enum vlc_player_abloop new_state, vlc_tick_t time, double pos, void *data)

Called when the A to B loop has changed.

See also
vlc_player_SetAtoBLoop()
Parameters
playerlocked player instance
stateA, when only A is set, B when both A and B are set, None by default
timevalid time or VLC_TICK_INVALID of the current state
posvalid pos of the current state
dataopaque pointer set by vlc_player_AddListener()

◆ on_buffering_changed

void(* vlc_player_cbs::on_buffering_changed) (vlc_player_t *player, float new_buffering, void *data)

Called when the player buffering (or cache) has changed.

This event is always called with the 0 and 1 values before a playback (in case of success). Values in between depends on the media type.

Parameters
playerlocked player instance
new_bufferingbuffering in the range [0:1]
dataopaque pointer set by vlc_player_AddListener()

◆ on_capabilities_changed

void(* vlc_player_cbs::on_capabilities_changed) (vlc_player_t *player, int old_caps, int new_caps, void *data)

Called when the media capabilities has changed.

Always called when the media is opening or stopping. Can be called during playback.

Parameters
playerlocked player instance
old_capsold player capabilities
new_capsnew player capabilities
dataopaque pointer set by vlc_player_AddListener()

◆ on_category_delay_changed

void(* vlc_player_cbs::on_category_delay_changed) (vlc_player_t *player, enum es_format_category_e cat, vlc_tick_t new_delay, void *data)

Called when the player category delay has changed for the current media.

See also
vlc_player_SetCategoryDelay()
Parameters
playerlocked player instance
catAUDIO_ES or SPU_ES
new_delayaudio delay
dataopaque pointer set by vlc_player_AddListener()

◆ on_chapter_selection_changed

void(* vlc_player_cbs::on_chapter_selection_changed) (vlc_player_t *player, const struct vlc_player_title *title, size_t title_idx, const struct vlc_player_chapter *new_chapter, size_t new_chapter_idx, void *data)

Called when a new chapter is selected.

There are no events when a chapter is unselected. Chapters are automatically unselected when the title list changes. Titles, chapters and indexes are always valid inside the vlc_player_title_list sent by vlc_player_cbs.on_titles_changed.

Parameters
playerlocked player instance
titleselected title
title_idxselected title index
chapternew selected chapter
chapter_idxnew selected chapter index
dataopaque pointer set by vlc_player_AddListener()

◆ on_cork_changed

void(* vlc_player_cbs::on_cork_changed) (vlc_player_t *player, unsigned cork_count, void *data)

Called when the player is corked.

The player can be corked when the audio output loose focus or when a renderer was paused from the outside.

Note
called only if pause on cork was not set to true (by vlc_player_SetPauseOnCork())
a cork_count higher than 0 means the player is corked. In that case, the user should pause the player and release all external resource needed by the player. A value higher than 1 mean that the player was corked more than one time (for different reasons). A value of 0 means the player is no longer corked. In that case, the user could resume the player.
Parameters
playerlocked player instance
cork_count0 for uncorked, > 0 for corked
dataopaque pointer set by vlc_player_AddListener()

◆ on_current_media_changed

void(* vlc_player_cbs::on_current_media_changed) (vlc_player_t *player, input_item_t *new_media, void *data)

Called when the current media has changed.

Note
This can be called from the PLAYING state (when the player plays the next media internally) or from the STOPPED state (from vlc_player_SetCurrentMedia() or from an internal transition).
See also
vlc_player_SetCurrentMedia()
vlc_player_InvalidateNextMedia()
Parameters
playerlocked player instance
new_medianew media currently played or NULL (when there is no more media to play)
dataopaque pointer set by vlc_player_AddListener()

◆ on_error_changed

void(* vlc_player_cbs::on_error_changed) (vlc_player_t *player, enum vlc_player_error error, void *data)

Called when a media triggered an error.

Can be called from any states. When it happens the player will stop itself. It is safe to play an other media or event restart the player (This will reset the error state).

Parameters
playerlocked player instance
errorplayer error
dataopaque pointer set by vlc_player_AddListener()

◆ on_length_changed

void(* vlc_player_cbs::on_length_changed) (vlc_player_t *player, vlc_tick_t new_length, void *data)

Called when the media length has changed.

May be called when the media is opening or during playback.

Note
A started and playing media doesn't have necessarily a valid length.
Parameters
playerlocked player instance
new_lengtha valid time or VLC_TICK_INVALID
dataopaque pointer set by vlc_player_AddListener()

◆ on_media_epg_changed

void(* vlc_player_cbs::on_media_epg_changed) (vlc_player_t *player, input_item_t *media, void *data)

Called when media epg has changed.

Parameters
playerlocked player instance
mediacurrent media
dataopaque pointer set by vlc_player_AddListener()

◆ on_media_meta_changed

void(* vlc_player_cbs::on_media_meta_changed) (vlc_player_t *player, input_item_t *media, void *data)

Called when the media meta has changed.

Parameters
playerlocked player instance
mediacurrent media
dataopaque pointer set by vlc_player_AddListener()

◆ on_media_stopped_action_changed

void(* vlc_player_cbs::on_media_stopped_action_changed) (vlc_player_t *player, enum vlc_player_media_stopped_action new_action, void *data)

Called when media stopped action has changed.

See also
vlc_player_SetMediaStoppedAction()
Parameters
playerlocked player instance
new_actionaction to execute when a media is stopped
dataopaque pointer set by vlc_player_AddListener()

◆ on_media_subitems_changed

void(* vlc_player_cbs::on_media_subitems_changed) (vlc_player_t *player, input_item_t *media, input_item_node_t *new_subitems, void *data)

Called when the media has new subitems.

Parameters
playerlocked player instance
mediacurrent media
new_subitemsnode representing all media subitems
dataopaque pointer set by vlc_player_AddListener()

◆ on_playback_restore_queried

void(* vlc_player_cbs::on_playback_restore_queried) (vlc_player_t *player, void *data)

Called to query the user about restoring the previous playback position.

If this callback isn't provided, the user won't be asked to restore the previous playback position, effectively causing VLC_PLAYER_RESTORE_PLAYBACK_POS_ASK to be handled as VLC_PLAYER_RESTORE_PLAYBACK_POS_NEVER

The implementation can react to this callback by calling vlc_player_RestorePlaybackPos(), or by discarding the event.

Parameters
playerlocked player instance
dataopaque pointer set by vlc_player_AddListener()

◆ on_position_changed

void(* vlc_player_cbs::on_position_changed) (vlc_player_t *player, vlc_tick_t new_time, double new_pos, void *data)

Called when the player position has changed.

Note
A started and playing media doesn't have necessarily a valid time.
Parameters
playerlocked player instance
new_timea valid time or VLC_TICK_INVALID
new_posa valid position
dataopaque pointer set by vlc_player_AddListener()

◆ on_program_list_changed

void(* vlc_player_cbs::on_program_list_changed) (vlc_player_t *player, enum vlc_player_list_action action, const struct vlc_player_program *prgm, void *data)

Called when a new program is added, removed or updated.

Note
The program is only valid from this callback context. Users should duplicate this program via vlc_player_program_Dup() if they want to use it from an other context.
Parameters
playerlocked player instance
actionadded, removed or updated
prgmvalid program
dataopaque pointer set by vlc_player_AddListener()

◆ on_program_selection_changed

void(* vlc_player_cbs::on_program_selection_changed) (vlc_player_t *player, int unselected_id, int selected_id, void *data)

Called when a new program is selected and/or unselected.

Note
This event can be called with both unselected_id and selected_id valid. This mean that a new program is replacing the old one.
Parameters
playerlocked player instance
unselected_idvalid program id or -1 (when nothing is unselected)
selected_idvalid program id or -1 (when nothing is selected)
dataopaque pointer set by vlc_player_AddListener()

◆ on_rate_changed

void(* vlc_player_cbs::on_rate_changed) (vlc_player_t *player, float new_rate, void *data)

Called when the player rate has changed.

Triggered by vlc_player_ChangeRate(), not sent when the media starts with the default rate (1.f)

Parameters
playerlocked player instance
new_rateplayer
dataopaque pointer set by vlc_player_AddListener()

◆ on_recording_changed

void(* vlc_player_cbs::on_recording_changed) (vlc_player_t *player, bool recording, void *data)

Called when the player recording state has changed.

See also
vlc_player_SetRecordingEnabled()
Parameters
playerlocked player instance
recordingtrue if recording is enabled
dataopaque pointer set by vlc_player_AddListener()

◆ on_renderer_changed

void(* vlc_player_cbs::on_renderer_changed) (vlc_player_t *player, vlc_renderer_item_t *new_item, void *data)

Called when a new renderer item is set.

See also
vlc_player_SetRenderer()
Parameters
playerlocked player instance
new_itema valid renderer item or NULL (if unset)
dataopaque pointer set by vlc_player_AddListener()

◆ on_signal_changed

void(* vlc_player_cbs::on_signal_changed) (vlc_player_t *player, float quality, float strength, void *data)

Called when the media signal has changed.

Parameters
playerlocked player instance
new_qualitysignal quality
new_strengthsignal strength,
dataopaque pointer set by vlc_player_AddListener()

◆ on_state_changed

void(* vlc_player_cbs::on_state_changed) (vlc_player_t *player, enum vlc_player_state new_state, void *data)

Called when the player state has changed.

See also
vlc_player_state
Parameters
playerlocked player instance
new_statenew player state
dataopaque pointer set by vlc_player_AddListener()

Referenced by vlm_MediaInstanceNew().

◆ on_statistics_changed

void(* vlc_player_cbs::on_statistics_changed) (vlc_player_t *player, const struct input_stats_t *stats, void *data)

Called when the player has new statisics.

Note
The stats structure is only valid from this callback context. It can be copied in order to use it from an other context.
Parameters
playerlocked player instance
statsvalid stats, only valid from this context
dataopaque pointer set by vlc_player_AddListener()

◆ on_teletext_enabled_changed

void(* vlc_player_cbs::on_teletext_enabled_changed) (vlc_player_t *player, bool enabled, void *data)

Called when teletext is enabled or disabled.

See also
vlc_player_SetTeletextEnabled()
Parameters
playerlocked player instance
enabledtrue if teletext is enabled
dataopaque pointer set by vlc_player_AddListener()

◆ on_teletext_menu_changed

void(* vlc_player_cbs::on_teletext_menu_changed) (vlc_player_t *player, bool has_teletext_menu, void *data)

Called when the media has a teletext menu.

Parameters
playerlocked player instance
has_teletext_menutrue if the media has a teletext menu
dataopaque pointer set by vlc_player_AddListener()

◆ on_teletext_page_changed

void(* vlc_player_cbs::on_teletext_page_changed) (vlc_player_t *player, unsigned new_page, void *data)

Called when the teletext page has changed.

See also
vlc_player_SelectTeletextPage()
Parameters
playerlocked player instance
new_pagepage in the range ]0;888]
dataopaque pointer set by vlc_player_AddListener()

◆ on_teletext_transparency_changed

void(* vlc_player_cbs::on_teletext_transparency_changed) (vlc_player_t *player, bool enabled, void *data)

Called when the teletext transparency has changed.

See also
vlc_player_SetTeletextTransparency()
Parameters
playerlocked player instance
enabledtrue is the teletext overlay is transparent
dataopaque pointer set by vlc_player_AddListener()

◆ on_title_selection_changed

void(* vlc_player_cbs::on_title_selection_changed) (vlc_player_t *player, const struct vlc_player_title *new_title, size_t new_idx, void *data)

Called when a new title is selected.

There are no events when a title is unselected. Titles are automatically unselected when the title list changes. Titles and indexes are always valid inside the vlc_player_title_list sent by vlc_player_cbs.on_titles_changed.

Parameters
playerlocked player instance
new_titlenew selected title
new_idxindex of this title
dataopaque pointer set by vlc_player_AddListener()

◆ on_titles_changed

void(* vlc_player_cbs::on_titles_changed) (vlc_player_t *player, vlc_player_title_list *titles, void *data)

Called when the media titles has changed.

This event is not called when the opening media doesn't have any titles. This title list and all its elements are constant. If an element is to be updated, a new list will be sent from this callback.

Note
Users should hold this list with vlc_player_title_list_Hold() if they want to use it from an other context.
Parameters
playerlocked player instance
titlesvalid title list or NULL
dataopaque pointer set by vlc_player_AddListener()

◆ on_track_delay_changed

void(* vlc_player_cbs::on_track_delay_changed) (vlc_player_t *player, vlc_es_id_t *es_id, vlc_tick_t delay, void *data)

Called when a track delay has changed.

Parameters
playerlocked player instance
es_idvalid track id
delaya valid delay or INT64_MAX if the delay of this track is canceled

◆ on_track_list_changed

void(* vlc_player_cbs::on_track_list_changed) (vlc_player_t *player, enum vlc_player_list_action action, const struct vlc_player_track *track, void *data)

Called when a track is added, removed, or updated.

Note
The track is only valid from this callback context. Users should duplicate this track via vlc_player_track_Dup() if they want to use it from an other context.
Parameters
playerlocked player instance
actionadded, removed or updated
trackvalid track
dataopaque pointer set by vlc_player_AddListener()

◆ on_track_selection_changed

void(* vlc_player_cbs::on_track_selection_changed) (vlc_player_t *player, vlc_es_id_t *unselected_id, vlc_es_id_t *selected_id, void *data)

Called when a new track is selected and/or unselected.

Note
This event can be called with both unselected_id and selected_id valid. This mean that a new track is replacing the old one.
Parameters
playerlocked player instance
unselected_idvalid track id or NULL (when nothing is unselected)
selected_idvalid track id or NULL (when nothing is selected)
dataopaque pointer set by vlc_player_AddListener()

◆ on_vout_changed

void(* vlc_player_cbs::on_vout_changed) (vlc_player_t *player, enum vlc_player_vout_action action, vout_thread_t *vout, enum vlc_vout_order order, vlc_es_id_t *es_id, void *data)

Called when a vout is started or stopped.

Note
In case, several media with only one video track are played successively, the same vout instance will be started and stopped several time.
Parameters
playerlocked player instance
actionstarted or stopped
voutvout (can't be NULL)
ordervout order
es_idthe ES id associated with this vout
dataopaque pointer set by vlc_player_AddListener()

The documentation for this struct was generated from the following file: