[vlc-devel] [PATCH] player: expose as a vlc_object_t
Thomas Guillem
thomas at gllm.fr
Tue Apr 2 10:14:48 CEST 2019
This will allow interfaces modules and libvlc to setup variables.
---
include/vlc_player.h | 4 +-
src/input/player.c | 1038 +++++++++++++++++++++++-------------------
2 files changed, 566 insertions(+), 476 deletions(-)
diff --git a/include/vlc_player.h b/include/vlc_player.h
index ad170f3306..ef4fcade5f 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -57,7 +57,9 @@ digraph player_states {
/**
* Player opaque structure.
*/
-typedef struct vlc_player_t vlc_player_t;
+typedef struct vlc_player_t {
+ struct vlc_common_members obj;
+} vlc_player_t;
/**
* Player listener opaque structure.
diff --git a/src/input/player.c b/src/input/player.c
index 22284418e4..fe37dd50b5 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -141,9 +141,10 @@ struct vlc_player_input
} abloop_state[2];
};
-struct vlc_player_t
+struct vlc_player_priv
{
- struct vlc_common_members obj;
+ vlc_player_t public;
+
vlc_mutex_t lock;
vlc_mutex_t aout_listeners_lock;
vlc_mutex_t vout_listeners_lock;
@@ -189,39 +190,42 @@ struct vlc_player_t
} destructor;
};
-#define vlc_player_SendEvent(player, event, ...) do { \
+#define vlc_player_SendEvent(player_, event, ...) do { \
+ struct vlc_player_priv *priv = vlc_player_priv(player_); \
vlc_player_listener_id *listener; \
- vlc_list_foreach(listener, &player->listeners, node) \
+ vlc_list_foreach(listener, &priv->listeners, node) \
{ \
if (listener->cbs->event) \
- listener->cbs->event(player, ##__VA_ARGS__, listener->cbs_data); \
+ listener->cbs->event(player_, ##__VA_ARGS__, listener->cbs_data); \
} \
} while(0)
-#define vlc_player_aout_SendEvent(player, event, ...) do { \
- vlc_mutex_lock(&player->aout_listeners_lock); \
+#define vlc_player_aout_SendEvent(player_, event, ...) do { \
+ struct vlc_player_priv *priv = vlc_player_priv(player_); \
+ vlc_mutex_lock(&priv->aout_listeners_lock); \
vlc_player_aout_listener_id *listener; \
- vlc_list_foreach(listener, &player->aout_listeners, node) \
+ vlc_list_foreach(listener, &priv->aout_listeners, node) \
{ \
if (listener->cbs->event) \
- listener->cbs->event(player, ##__VA_ARGS__, listener->cbs_data); \
+ listener->cbs->event(player_, ##__VA_ARGS__, listener->cbs_data); \
} \
- vlc_mutex_unlock(&player->aout_listeners_lock); \
+ vlc_mutex_unlock(&priv->aout_listeners_lock); \
} while(0)
-#define vlc_player_vout_SendEvent(player, event, ...) do { \
- vlc_mutex_lock(&player->vout_listeners_lock); \
+#define vlc_player_vout_SendEvent(player_, event, ...) do { \
+ struct vlc_player_priv *priv = vlc_player_priv(player_); \
+ vlc_mutex_lock(&priv->vout_listeners_lock); \
vlc_player_vout_listener_id *listener; \
- vlc_list_foreach(listener, &player->vout_listeners, node) \
+ vlc_list_foreach(listener, &priv->vout_listeners, node) \
{ \
if (listener->cbs->event) \
- listener->cbs->event(player, ##__VA_ARGS__, listener->cbs_data); \
+ listener->cbs->event(player_, ##__VA_ARGS__, listener->cbs_data); \
} \
- vlc_mutex_unlock(&player->vout_listeners_lock); \
+ vlc_mutex_unlock(&priv->vout_listeners_lock); \
} while(0)
#define vlc_player_foreach_inputs(it) \
- for (struct vlc_player_input *it = player->input; it != NULL; it = NULL)
+ for (struct vlc_player_input *it = vlc_player_priv(player_)->input; it != NULL; it = NULL)
static void
input_thread_Events(input_thread_t *, const struct vlc_input_event *, void *);
@@ -234,24 +238,30 @@ static int
vlc_player_VoutOSDCallback(vlc_object_t *this, const char *var,
vlc_value_t oldval, vlc_value_t newval, void *data);
+static struct vlc_player_priv *vlc_player_priv(vlc_player_t *player_)
+{
+ assert(player_);
+ return container_of(player_, struct vlc_player_priv, public);
+}
+
void
-vlc_player_assert_locked(vlc_player_t *player)
+vlc_player_assert_locked(vlc_player_t *player_)
{
- assert(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
vlc_mutex_assert(&player->lock);
}
static inline struct vlc_player_input *
-vlc_player_get_input_locked(vlc_player_t *player)
+vlc_player_get_input_locked(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
- return player->input;
+ vlc_player_assert_locked(player_);
+ return vlc_player_priv(player_)->input;
}
static vout_thread_t **
-vlc_player_vout_OSDHoldAll(vlc_player_t *player, size_t *count)
+vlc_player_vout_OSDHoldAll(vlc_player_t *player_, size_t *count)
{
- vout_thread_t **vouts = vlc_player_vout_HoldAll(player, count);
+ vout_thread_t **vouts = vlc_player_vout_HoldAll(player_, count);
for (size_t i = 0; i < *count; ++i)
{
@@ -263,13 +273,13 @@ vlc_player_vout_OSDHoldAll(vlc_player_t *player, size_t *count)
}
static void
-vlc_player_vout_OSDReleaseAll(vlc_player_t *player, vout_thread_t **vouts,
+vlc_player_vout_OSDReleaseAll(vlc_player_t *player_, vout_thread_t **vouts,
size_t count)
{
for (size_t i = 0; i < count; ++i)
vout_Release(vouts[i]);
free(vouts);
- (void) player;
+ (void) player_;
}
static inline void
@@ -304,10 +314,10 @@ vouts_osd_Slider(vout_thread_t **vouts, size_t count, int position, short type)
}
void
-vlc_player_vout_OSDMessage(vlc_player_t *player, const char *fmt, ...)
+vlc_player_vout_OSDMessage(vlc_player_t *player_, const char *fmt, ...)
{
size_t count;
- vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player, &count);
+ vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player_, &count);
va_list args;
va_start(args, fmt);
@@ -320,18 +330,18 @@ vlc_player_vout_OSDMessage(vlc_player_t *player, const char *fmt, ...)
}
va_end(args);
- vlc_player_vout_OSDReleaseAll(player, vouts, count);
+ vlc_player_vout_OSDReleaseAll(player_, vouts, count);
}
static void
-vlc_player_vout_OSDIcon(vlc_player_t *player, short type)
+vlc_player_vout_OSDIcon(vlc_player_t *player_, short type)
{
size_t count;
- vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player, &count);
+ vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player_, &count);
vouts_osd_Icon(vouts, count, type);
- vlc_player_vout_OSDReleaseAll(player, vouts, count);
+ vlc_player_vout_OSDReleaseAll(player_, vouts, count);
}
static char *
@@ -626,13 +636,14 @@ vlc_player_title_list_GetCount(struct vlc_player_title_list *titles)
}
static struct vlc_player_input *
-vlc_player_input_New(vlc_player_t *player, input_item_t *item)
+vlc_player_input_New(vlc_player_t *player_, input_item_t *item)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
struct vlc_player_input *input = malloc(sizeof(*input));
if (!input)
return NULL;
- input->player = player;
+ input->player = player_;
input->started = false;
input->state = VLC_PLAYER_STATE_STOPPED;
@@ -668,7 +679,7 @@ vlc_player_input_New(vlc_player_t *player, input_item_t *item)
input->abloop_state[0].set = input->abloop_state[1].set = false;
- input->thread = input_Create(player, input_thread_Events, input, item,
+ input->thread = input_Create(player_, input_thread_Events, input, item,
player->resource, player->renderer);
if (!input->thread)
{
@@ -708,9 +719,11 @@ vlc_player_input_Start(struct vlc_player_input *input)
}
static void
-vlc_player_PrepareNextMedia(vlc_player_t *player)
+vlc_player_PrepareNextMedia(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
if (!player->media_provider
|| player->media_stopped_action != VLC_PLAYER_MEDIA_STOPPED_CONTINUE
@@ -719,13 +732,15 @@ vlc_player_PrepareNextMedia(vlc_player_t *player)
assert(player->next_media == NULL);
player->next_media =
- player->media_provider->get_next(player, player->media_provider_data);
+ player->media_provider->get_next(player_, player->media_provider_data);
player->next_media_requested = true;
}
static int
-vlc_player_OpenNextMedia(vlc_player_t *player)
+vlc_player_OpenNextMedia(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
assert(player->input == NULL);
player->next_media_requested = false;
@@ -748,7 +763,7 @@ vlc_player_OpenNextMedia(vlc_player_t *player)
player->media = player->next_media;
player->next_media = NULL;
- player->input = vlc_player_input_New(player, player->media);
+ player->input = vlc_player_input_New(player_, player->media);
if (!player->input)
{
input_item_Release(player->media);
@@ -756,13 +771,15 @@ vlc_player_OpenNextMedia(vlc_player_t *player)
ret = VLC_ENOMEM;
}
}
- vlc_player_SendEvent(player, on_current_media_changed, player->media);
+ vlc_player_SendEvent(player_, on_current_media_changed, player->media);
return ret;
}
static void
-vlc_player_CancelWaitError(vlc_player_t *player)
+vlc_player_CancelWaitError(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
if (player->error_count != 0)
{
player->error_count = 0;
@@ -783,9 +800,11 @@ vlc_list_HasInput(struct vlc_list *list, struct vlc_player_input *input)
}
static void
-vlc_player_destructor_AddInput(vlc_player_t *player,
+vlc_player_destructor_AddInput(vlc_player_t *player_,
struct vlc_player_input *input)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
if (input->started)
{
input->started = false;
@@ -804,36 +823,42 @@ vlc_player_destructor_AddInput(vlc_player_t *player,
vlc_list_append(&input->node, &player->destructor.joinable_inputs);
}
- vlc_cond_signal(&input->player->destructor.wait);
+ vlc_cond_signal(&player->destructor.wait);
}
static void
-vlc_player_destructor_AddStoppingInput(vlc_player_t *player,
+vlc_player_destructor_AddStoppingInput(vlc_player_t *player_,
struct vlc_player_input *input)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
/* Add this input to the stopping list */
if (vlc_list_HasInput(&player->destructor.inputs, input))
vlc_list_remove(&input->node);
if (!vlc_list_HasInput(&player->destructor.stopping_inputs, input))
{
vlc_list_append(&input->node, &player->destructor.stopping_inputs);
- vlc_cond_signal(&input->player->destructor.wait);
+ vlc_cond_signal(&player->destructor.wait);
}
}
static void
-vlc_player_destructor_AddJoinableInput(vlc_player_t *player,
+vlc_player_destructor_AddJoinableInput(vlc_player_t *player_,
struct vlc_player_input *input)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
if (vlc_list_HasInput(&player->destructor.stopping_inputs, input))
vlc_list_remove(&input->node);
assert(!input->started);
- vlc_player_destructor_AddInput(player, input);
+ vlc_player_destructor_AddInput(player_, input);
}
-static bool vlc_player_destructor_IsEmpty(vlc_player_t *player)
+static bool vlc_player_destructor_IsEmpty(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
return vlc_list_is_empty(&player->destructor.inputs)
&& vlc_list_is_empty(&player->destructor.stopping_inputs)
&& vlc_list_is_empty(&player->destructor.joinable_inputs);
@@ -842,14 +867,15 @@ static bool vlc_player_destructor_IsEmpty(vlc_player_t *player)
static void *
vlc_player_destructor_Thread(void *data)
{
- vlc_player_t *player = data;
+ vlc_player_t *player_ = data;
+ struct vlc_player_priv *player = vlc_player_priv(player_);
vlc_mutex_lock(&player->lock);
/* Terminate this thread when the player is deleting (vlc_player_Delete()
* was called) and when all input_thread_t all stopped and released. */
while (!player->deleting
- || !vlc_player_destructor_IsEmpty(player))
+ || !vlc_player_destructor_IsEmpty(player_))
{
/* Wait for an input to stop or close. No while loop here since we want
* to leave this code path when the player is deleting. */
@@ -861,7 +887,7 @@ vlc_player_destructor_Thread(void *data)
vlc_list_foreach(input, &player->destructor.inputs, node)
{
vlc_player_input_HandleState(input, VLC_PLAYER_STATE_STOPPING);
- vlc_player_destructor_AddStoppingInput(player, input);
+ vlc_player_destructor_AddStoppingInput(player_, input);
input_Stop(input->thread);
}
@@ -883,12 +909,12 @@ vlc_player_destructor_Thread(void *data)
if (inputs_changed)
{
const bool started = player->started;
- vlc_player_Unlock(player);
+ vlc_player_Unlock(player_);
if (!started)
input_resource_TerminateVout(player->resource);
if (!keep_sout)
input_resource_TerminateSout(player->resource);
- vlc_player_Lock(player);
+ vlc_player_Lock(player_);
}
}
vlc_mutex_unlock(&player->lock);
@@ -896,8 +922,10 @@ vlc_player_destructor_Thread(void *data)
}
static bool
-vlc_player_WaitRetryDelay(vlc_player_t *player)
+vlc_player_WaitRetryDelay(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
if (player->error_count)
{
/* Delay the next opening in case of error to avoid busy loops */
@@ -920,7 +948,8 @@ static void
vlc_player_input_HandleState(struct vlc_player_input *input,
enum vlc_player_state state)
{
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
+ struct vlc_player_priv *player = vlc_player_priv(player_);
/* The STOPPING state can be set earlier by the player. In that case,
* ignore all future events except the STOPPED one */
@@ -943,7 +972,7 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
{
vlc_player_title_list_Release(input->titles);
input->titles = NULL;
- vlc_player_SendEvent(player, on_titles_changed, NULL);
+ vlc_player_SendEvent(player_, on_titles_changed, NULL);
}
if (input->error != VLC_PLAYER_ERROR_NONE)
@@ -951,10 +980,10 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
else
player->error_count = 0;
- vlc_player_WaitRetryDelay(player);
+ vlc_player_WaitRetryDelay(player_);
if (!player->deleting)
- vlc_player_OpenNextMedia(player);
+ vlc_player_OpenNextMedia(player_);
if (!player->input)
player->started = false;
@@ -964,7 +993,7 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
if (player->input && player->started)
vlc_player_input_Start(player->input);
else
- libvlc_Quit(vlc_object_instance(player));
+ libvlc_Quit(vlc_object_instance(player_));
break;
case VLC_PLAYER_MEDIA_STOPPED_CONTINUE:
if (player->input && player->started)
@@ -983,7 +1012,7 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
if (player->started)
{
- vlc_player_PrepareNextMedia(player);
+ vlc_player_PrepareNextMedia(player_);
if (!player->next_media)
player->started = false;
}
@@ -1006,22 +1035,22 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
if (send_event)
{
player->global_state = input->state;
- vlc_player_SendEvent(player, on_state_changed, player->global_state);
+ vlc_player_SendEvent(player_, on_state_changed, player->global_state);
}
}
size_t
-vlc_player_GetProgramCount(vlc_player_t *player)
+vlc_player_GetProgramCount(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->program_vector.size : 0;
}
const struct vlc_player_program *
-vlc_player_GetProgramAt(vlc_player_t *player, size_t index)
+vlc_player_GetProgramAt(vlc_player_t *player_, size_t index)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return NULL;
@@ -1031,9 +1060,9 @@ vlc_player_GetProgramAt(vlc_player_t *player, size_t index)
}
const struct vlc_player_program *
-vlc_player_GetProgram(vlc_player_t *player, int id)
+vlc_player_GetProgram(vlc_player_t *player_, int id)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return NULL;
@@ -1044,15 +1073,15 @@ vlc_player_GetProgram(vlc_player_t *player, int id)
}
static inline void
-vlc_player_vout_OSDProgram(vlc_player_t *player, const char *name)
+vlc_player_vout_OSDProgram(vlc_player_t *player_, const char *name)
{
- vlc_player_vout_OSDMessage(player, _("Program Service ID: %s"), name);
+ vlc_player_vout_OSDMessage(player_, _("Program Service ID: %s"), name);
}
void
-vlc_player_SelectProgram(vlc_player_t *player, int id)
+vlc_player_SelectProgram(vlc_player_t *player_, int id)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
@@ -1063,14 +1092,14 @@ vlc_player_SelectProgram(vlc_player_t *player, int id)
{
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_PROGRAM,
&(vlc_value_t) { .i_int = id });
- vlc_player_vout_OSDProgram(player, prgm->name);
+ vlc_player_vout_OSDProgram(player_, prgm->name);
}
}
static void
-vlc_player_CycleProgram(vlc_player_t *player, bool next)
+vlc_player_CycleProgram(vlc_player_t *player_, bool next)
{
- size_t count = vlc_player_GetProgramCount(player);
+ size_t count = vlc_player_GetProgramCount(player_);
if (!count)
return;
size_t index = 0;
@@ -1078,7 +1107,7 @@ vlc_player_CycleProgram(vlc_player_t *player, bool next)
for (size_t i = 0; i < count; ++i)
{
const struct vlc_player_program *prgm =
- vlc_player_GetProgramAt(player, i);
+ vlc_player_GetProgramAt(player_, i);
if (prgm->selected)
{
/* Only one program can be selected at a time */
@@ -1096,28 +1125,28 @@ vlc_player_CycleProgram(vlc_player_t *player, bool next)
index = index + (next ? 1 : -1);
const struct vlc_player_program *prgm =
- vlc_player_GetProgramAt(player, index);
+ vlc_player_GetProgramAt(player_, index);
assert(prgm);
- vlc_player_SelectProgram(player, prgm->group_id);
+ vlc_player_SelectProgram(player_, prgm->group_id);
}
void
-vlc_player_SelectNextProgram(vlc_player_t *player)
+vlc_player_SelectNextProgram(vlc_player_t *player_)
{
- vlc_player_CycleProgram(player, true);
+ vlc_player_CycleProgram(player_, true);
}
void
-vlc_player_SelectPrevProgram(vlc_player_t *player)
+vlc_player_SelectPrevProgram(vlc_player_t *player_)
{
- vlc_player_CycleProgram(player, false);
+ vlc_player_CycleProgram(player_, false);
}
static void
vlc_player_input_HandleProgramEvent(struct vlc_player_input *input,
const struct vlc_input_event_program *ev)
{
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
struct vlc_player_program *prgm;
vlc_player_program_vector *vec = &input->program_vector;
@@ -1133,7 +1162,7 @@ vlc_player_input_HandleProgramEvent(struct vlc_player_input *input,
vlc_player_program_Delete(prgm);
break;
}
- vlc_player_SendEvent(player, on_program_list_changed,
+ vlc_player_SendEvent(player_, on_program_list_changed,
VLC_PLAYER_LIST_ADDED, prgm);
break;
case VLC_INPUT_PROGRAM_DELETED:
@@ -1142,7 +1171,7 @@ vlc_player_input_HandleProgramEvent(struct vlc_player_input *input,
prgm = vlc_player_program_vector_FindById(vec, ev->id, &idx);
if (prgm)
{
- vlc_player_SendEvent(player, on_program_list_changed,
+ vlc_player_SendEvent(player_, on_program_list_changed,
VLC_PLAYER_LIST_REMOVED, prgm);
vlc_vector_remove(vec, idx);
vlc_player_program_Delete(prgm);
@@ -1161,7 +1190,7 @@ vlc_player_input_HandleProgramEvent(struct vlc_player_input *input,
}
else
prgm->scrambled = ev->scrambled;
- vlc_player_SendEvent(player, on_program_list_changed,
+ vlc_player_SendEvent(player_, on_program_list_changed,
VLC_PLAYER_LIST_UPDATED, prgm);
break;
case VLC_INPUT_PROGRAM_SELECTED:
@@ -1189,7 +1218,7 @@ vlc_player_input_HandleProgramEvent(struct vlc_player_input *input,
}
}
if (unselected_id != -1 || selected_id != -1)
- vlc_player_SendEvent(player, on_program_selection_changed,
+ vlc_player_SendEvent(player_, on_program_selection_changed,
unselected_id, selected_id);
break;
}
@@ -1233,9 +1262,9 @@ vlc_player_track_vector_FindById(vlc_player_track_vector *vec, vlc_es_id_t *id,
}
size_t
-vlc_player_GetTrackCount(vlc_player_t *player, enum es_format_category_e cat)
+vlc_player_GetTrackCount(vlc_player_t *player_, enum es_format_category_e cat)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return 0;
@@ -1246,10 +1275,10 @@ vlc_player_GetTrackCount(vlc_player_t *player, enum es_format_category_e cat)
}
const struct vlc_player_track *
-vlc_player_GetTrackAt(vlc_player_t *player, enum es_format_category_e cat,
+vlc_player_GetTrackAt(vlc_player_t *player_, enum es_format_category_e cat,
size_t index)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return NULL;
@@ -1261,9 +1290,9 @@ vlc_player_GetTrackAt(vlc_player_t *player, enum es_format_category_e cat,
}
const struct vlc_player_track *
-vlc_player_GetTrack(vlc_player_t *player, vlc_es_id_t *id)
+vlc_player_GetTrack(vlc_player_t *player_, vlc_es_id_t *id)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return NULL;
@@ -1287,35 +1316,35 @@ es_format_category_to_string(enum es_format_category_e cat)
}
static void
-vlc_player_vout_OSDTrack(vlc_player_t *player, vlc_es_id_t *id, bool select)
+vlc_player_vout_OSDTrack(vlc_player_t *player_, vlc_es_id_t *id, bool select)
{
enum es_format_category_e cat = vlc_es_id_GetCat(id);
- const struct vlc_player_track *track = vlc_player_GetTrack(player, id);
+ const struct vlc_player_track *track = vlc_player_GetTrack(player_, id);
if (!track && select)
return;
const char *cat_name = es_format_category_to_string(cat);
assert(cat_name);
const char *track_name = select ? track->name : _("N/A");
- vlc_player_vout_OSDMessage(player, _("%s track: %s"), cat_name, track_name);
+ vlc_player_vout_OSDMessage(player_, _("%s track: %s"), cat_name, track_name);
}
void
-vlc_player_SelectTrack(vlc_player_t *player, vlc_es_id_t *id)
+vlc_player_SelectTrack(vlc_player_t *player_, vlc_es_id_t *id)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPushEsHelper(input->thread, INPUT_CONTROL_SET_ES, id);
- vlc_player_vout_OSDTrack(player, id, true);
+ vlc_player_vout_OSDTrack(player_, id, true);
}
static void
-vlc_player_CycleTrack(vlc_player_t *player, enum es_format_category_e cat,
+vlc_player_CycleTrack(vlc_player_t *player_, enum es_format_category_e cat,
bool next)
{
- size_t count = vlc_player_GetTrackCount(player, cat);
+ size_t count = vlc_player_GetTrackCount(player_, cat);
if (!count)
return;
@@ -1324,7 +1353,7 @@ vlc_player_CycleTrack(vlc_player_t *player, enum es_format_category_e cat,
for (size_t i = 0; i < count; ++i)
{
const struct vlc_player_track *track =
- vlc_player_GetTrackAt(player, cat, i);
+ vlc_player_GetTrackAt(player_, cat, i);
assert(track);
if (track->selected)
{
@@ -1355,52 +1384,52 @@ vlc_player_CycleTrack(vlc_player_t *player, enum es_format_category_e cat,
}
const struct vlc_player_track *track =
- vlc_player_GetTrackAt(player, cat, index);
+ vlc_player_GetTrackAt(player_, cat, index);
if (selected)
- vlc_player_SelectTrack(player, track->es_id);
+ vlc_player_SelectTrack(player_, track->es_id);
else
- vlc_player_UnselectTrack(player, track->es_id);
+ vlc_player_UnselectTrack(player_, track->es_id);
}
void
-vlc_player_SelectNextTrack(vlc_player_t *player,
+vlc_player_SelectNextTrack(vlc_player_t *player_,
enum es_format_category_e cat)
{
- vlc_player_CycleTrack(player, cat, true);
+ vlc_player_CycleTrack(player_, cat, true);
}
void
-vlc_player_SelectPrevTrack(vlc_player_t *player,
+vlc_player_SelectPrevTrack(vlc_player_t *player_,
enum es_format_category_e cat)
{
- vlc_player_CycleTrack(player, cat, false);
+ vlc_player_CycleTrack(player_, cat, false);
}
void
-vlc_player_UnselectTrack(vlc_player_t *player, vlc_es_id_t *id)
+vlc_player_UnselectTrack(vlc_player_t *player_, vlc_es_id_t *id)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPushEsHelper(input->thread, INPUT_CONTROL_UNSET_ES, id);
- vlc_player_vout_OSDTrack(player, id, false);
+ vlc_player_vout_OSDTrack(player_, id, false);
}
void
-vlc_player_RestartTrack(vlc_player_t *player, vlc_es_id_t *id)
+vlc_player_RestartTrack(vlc_player_t *player_, vlc_es_id_t *id)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (input)
input_ControlPushEsHelper(input->thread, INPUT_CONTROL_RESTART_ES, id);
}
void
-vlc_player_SelectDefaultTrack(vlc_player_t *player,
+vlc_player_SelectDefaultTrack(vlc_player_t *player_,
enum es_format_category_e cat, const char *lang)
{
- vlc_player_assert_locked(player);
+ vlc_player_assert_locked(player_);
/* TODO */ (void) cat; (void) lang;
}
@@ -1408,13 +1437,14 @@ static void
vlc_player_input_HandleTeletextMenu(struct vlc_player_input *input,
const struct vlc_input_event_es *ev)
{
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
+
switch (ev->action)
{
case VLC_INPUT_ES_ADDED:
if (input->teletext_menu)
{
- msg_Warn(player, "Can't handle more than one teletext menu "
+ msg_Warn(player_, "Can't handle more than one teletext menu "
"track. Using the last one.");
vlc_player_track_Delete(input->teletext_menu);
}
@@ -1423,7 +1453,7 @@ vlc_player_input_HandleTeletextMenu(struct vlc_player_input *input,
if (!input->teletext_menu)
return;
- vlc_player_SendEvent(player, on_teletext_menu_changed, true);
+ vlc_player_SendEvent(player_, on_teletext_menu_changed, true);
break;
case VLC_INPUT_ES_DELETED:
{
@@ -1433,7 +1463,7 @@ vlc_player_input_HandleTeletextMenu(struct vlc_player_input *input,
vlc_player_track_Delete(input->teletext_menu);
input->teletext_menu = NULL;
- vlc_player_SendEvent(player, on_teletext_menu_changed, false);
+ vlc_player_SendEvent(player_, on_teletext_menu_changed, false);
}
break;
}
@@ -1444,7 +1474,7 @@ vlc_player_input_HandleTeletextMenu(struct vlc_player_input *input,
if (input->teletext_menu->es_id == ev->id)
{
input->teletext_enabled = ev->action == VLC_INPUT_ES_SELECTED;
- vlc_player_SendEvent(player, on_teletext_enabled_changed,
+ vlc_player_SendEvent(player_, on_teletext_enabled_changed,
input->teletext_enabled);
}
break;
@@ -1454,21 +1484,21 @@ vlc_player_input_HandleTeletextMenu(struct vlc_player_input *input,
}
void
-vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled)
+vlc_player_SetTeletextEnabled(vlc_player_t *player_, bool enabled)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input || !input->teletext_menu)
return;
if (enabled)
- vlc_player_SelectTrack(player, input->teletext_menu->es_id);
+ vlc_player_SelectTrack(player_, input->teletext_menu->es_id);
else
- vlc_player_UnselectTrack(player, input->teletext_menu->es_id);
+ vlc_player_UnselectTrack(player_, input->teletext_menu->es_id);
}
void
-vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page)
+vlc_player_SelectTeletextPage(vlc_player_t *player_, unsigned page)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input || !input->teletext_menu)
return;
@@ -1480,9 +1510,9 @@ vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page)
}
void
-vlc_player_SetTeletextTransparency(vlc_player_t *player, bool enabled)
+vlc_player_SetTeletextTransparency(vlc_player_t *player_, bool enabled)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input || !input->teletext_menu)
return;
@@ -1494,16 +1524,16 @@ vlc_player_SetTeletextTransparency(vlc_player_t *player, bool enabled)
}
bool
-vlc_player_HasTeletextMenu(vlc_player_t *player)
+vlc_player_HasTeletextMenu(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input && input->teletext_menu;
}
bool
-vlc_player_IsTeletextEnabled(vlc_player_t *player)
+vlc_player_IsTeletextEnabled(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (input && input->teletext_enabled)
{
assert(input->teletext_menu);
@@ -1513,17 +1543,17 @@ vlc_player_IsTeletextEnabled(vlc_player_t *player)
}
unsigned
-vlc_player_GetTeletextPage(vlc_player_t *player)
+vlc_player_GetTeletextPage(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
- return vlc_player_IsTeletextEnabled(player) ? input->teletext_page : 0;
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
+ return vlc_player_IsTeletextEnabled(player_) ? input->teletext_page : 0;
}
bool
-vlc_player_IsTeletextTransparent(vlc_player_t *player)
+vlc_player_IsTeletextTransparent(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
- return vlc_player_IsTeletextEnabled(player) && input->teletext_transparent;
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
+ return vlc_player_IsTeletextEnabled(player_) && input->teletext_transparent;
}
static void
@@ -1545,7 +1575,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
if (!vec)
return; /* UNKNOWN_ES or DATA_ES not handled */
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
struct vlc_player_track *track;
switch (ev->action)
{
@@ -1559,7 +1589,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
vlc_player_track_Delete(track);
break;
}
- vlc_player_SendEvent(player, on_track_list_changed,
+ vlc_player_SendEvent(player_, on_track_list_changed,
VLC_PLAYER_LIST_ADDED, track);
break;
case VLC_INPUT_ES_DELETED:
@@ -1568,7 +1598,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
track = vlc_player_track_vector_FindById(vec, ev->id, &idx);
if (track)
{
- vlc_player_SendEvent(player, on_track_list_changed,
+ vlc_player_SendEvent(player_, on_track_list_changed,
VLC_PLAYER_LIST_REMOVED, track);
vlc_vector_remove(vec, idx);
vlc_player_track_Delete(track);
@@ -1581,7 +1611,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
break;
if (vlc_player_track_Update(track, ev->title, ev->fmt) != 0)
break;
- vlc_player_SendEvent(player, on_track_list_changed,
+ vlc_player_SendEvent(player_, on_track_list_changed,
VLC_PLAYER_LIST_UPDATED, track);
break;
case VLC_INPUT_ES_SELECTED:
@@ -1589,7 +1619,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
if (track)
{
track->selected = true;
- vlc_player_SendEvent(player, on_track_selection_changed,
+ vlc_player_SendEvent(player_, on_track_selection_changed,
NULL, track->es_id);
}
break;
@@ -1598,7 +1628,7 @@ vlc_player_input_HandleEsEvent(struct vlc_player_input *input,
if (track)
{
track->selected = false;
- vlc_player_SendEvent(player, on_track_selection_changed,
+ vlc_player_SendEvent(player_, on_track_selection_changed,
track->es_id, NULL);
}
break;
@@ -1611,7 +1641,8 @@ static void
vlc_player_input_HandleTitleEvent(struct vlc_player_input *input,
const struct vlc_input_event_title *ev)
{
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
+
switch (ev->action)
{
case VLC_INPUT_TITLE_NEW_LIST:
@@ -1626,9 +1657,9 @@ vlc_player_input_HandleTitleEvent(struct vlc_player_input *input,
input->titles =
vlc_player_title_list_Create(ev->list.array, ev->list.count,
title_offset, chapter_offset);
- vlc_player_SendEvent(player, on_titles_changed, input->titles);
+ vlc_player_SendEvent(player_, on_titles_changed, input->titles);
if (input->titles)
- vlc_player_SendEvent(player, on_title_selection_changed,
+ vlc_player_SendEvent(player_, on_title_selection_changed,
&input->titles->array[0], 0);
break;
}
@@ -1637,7 +1668,7 @@ vlc_player_input_HandleTitleEvent(struct vlc_player_input *input,
return; /* a previous VLC_INPUT_TITLE_NEW_LIST failed */
assert(ev->selected_idx < input->titles->count);
input->title_selected = ev->selected_idx;
- vlc_player_SendEvent(player, on_title_selection_changed,
+ vlc_player_SendEvent(player_, on_title_selection_changed,
&input->titles->array[input->title_selected],
input->title_selected);
break;
@@ -1650,7 +1681,7 @@ static void
vlc_player_input_HandleChapterEvent(struct vlc_player_input *input,
const struct vlc_input_event_chapter *ev)
{
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
if (!input->titles || ev->title < 0 || ev->seekpoint < 0)
return; /* a previous VLC_INPUT_TITLE_NEW_LIST failed */
@@ -1664,21 +1695,21 @@ vlc_player_input_HandleChapterEvent(struct vlc_player_input *input,
input->chapter_selected = ev->seekpoint;
const struct vlc_player_chapter *chapter = &title->chapters[ev->seekpoint];
- vlc_player_SendEvent(player, on_chapter_selection_changed, title, ev->title,
+ vlc_player_SendEvent(player_, on_chapter_selection_changed, title, ev->title,
chapter, ev->seekpoint);
}
struct vlc_player_title_list *
-vlc_player_GetTitleList(vlc_player_t *player)
+vlc_player_GetTitleList(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->titles : NULL;
}
ssize_t
-vlc_player_GetSelectedTitleIdx(vlc_player_t *player)
+vlc_player_GetSelectedTitleIdx(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return -1;
@@ -1686,10 +1717,10 @@ vlc_player_GetSelectedTitleIdx(vlc_player_t *player)
}
static ssize_t
-vlc_player_GetTitleIdx(vlc_player_t *player,
+vlc_player_GetTitleIdx(vlc_player_t *player_,
const struct vlc_player_title *title)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (input && input->titles)
for (size_t i = 0; i < input->titles->count; ++i)
if (&input->titles->array[i] == title)
@@ -1698,57 +1729,57 @@ vlc_player_GetTitleIdx(vlc_player_t *player,
}
void
-vlc_player_SelectTitleIdx(vlc_player_t *player, size_t index)
+vlc_player_SelectTitleIdx(vlc_player_t *player_, size_t index)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (input)
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_TITLE,
&(vlc_value_t){ .i_int = index });
}
void
-vlc_player_SelectTitle(vlc_player_t *player,
+vlc_player_SelectTitle(vlc_player_t *player_,
const struct vlc_player_title *title)
{
- ssize_t idx = vlc_player_GetTitleIdx(player, title);
+ ssize_t idx = vlc_player_GetTitleIdx(player_, title);
if (idx != -1)
- vlc_player_SelectTitleIdx(player, idx);
+ vlc_player_SelectTitleIdx(player_, idx);
}
void
-vlc_player_SelectChapter(vlc_player_t *player,
+vlc_player_SelectChapter(vlc_player_t *player_,
const struct vlc_player_title *title,
size_t chapter_idx)
{
- ssize_t idx = vlc_player_GetTitleIdx(player, title);
- if (idx != -1 && idx == vlc_player_GetSelectedTitleIdx(player))
- vlc_player_SelectChapterIdx(player, chapter_idx);
+ ssize_t idx = vlc_player_GetTitleIdx(player_, title);
+ if (idx != -1 && idx == vlc_player_GetSelectedTitleIdx(player_))
+ vlc_player_SelectChapterIdx(player_, chapter_idx);
}
void
-vlc_player_SelectNextTitle(vlc_player_t *player)
+vlc_player_SelectNextTitle(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPush(input->thread, INPUT_CONTROL_SET_TITLE_NEXT, NULL);
- vlc_player_vout_OSDMessage(player, _("Next title"));
+ vlc_player_vout_OSDMessage(player_, _("Next title"));
}
void
-vlc_player_SelectPrevTitle(vlc_player_t *player)
+vlc_player_SelectPrevTitle(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPush(input->thread, INPUT_CONTROL_SET_TITLE_PREV, NULL);
- vlc_player_vout_OSDMessage(player, _("Previous title"));
+ vlc_player_vout_OSDMessage(player_, _("Previous title"));
}
ssize_t
-vlc_player_GetSelectedChapterIdx(vlc_player_t *player)
+vlc_player_GetSelectedChapterIdx(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return -1;
@@ -1756,34 +1787,34 @@ vlc_player_GetSelectedChapterIdx(vlc_player_t *player)
}
void
-vlc_player_SelectChapterIdx(vlc_player_t *player, size_t index)
+vlc_player_SelectChapterIdx(vlc_player_t *player_, size_t index)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_SEEKPOINT,
&(vlc_value_t){ .i_int = index });
- vlc_player_vout_OSDMessage(player, _("Chapter %ld"), index);
+ vlc_player_vout_OSDMessage(player_, _("Chapter %ld"), index);
}
void
-vlc_player_SelectNextChapter(vlc_player_t *player)
+vlc_player_SelectNextChapter(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPush(input->thread, INPUT_CONTROL_SET_SEEKPOINT_NEXT, NULL);
- vlc_player_vout_OSDMessage(player, _("Next chapter"));
+ vlc_player_vout_OSDMessage(player_, _("Next chapter"));
}
void
-vlc_player_SelectPrevChapter(vlc_player_t *player)
+vlc_player_SelectPrevChapter(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPush(input->thread, INPUT_CONTROL_SET_SEEKPOINT_PREV, NULL);
- vlc_player_vout_OSDMessage(player, _("Previous chapter"));
+ vlc_player_vout_OSDMessage(player_, _("Previous chapter"));
}
static void
@@ -1798,33 +1829,33 @@ vlc_player_input_HandleVoutEvent(struct vlc_player_input *input,
"deinterlace-mode", "sub-margin", "zoom"
};
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
switch (ev->action)
{
case VLC_INPUT_EVENT_VOUT_ADDED:
- vlc_player_SendEvent(player, on_vout_list_changed,
+ vlc_player_SendEvent(player_, on_vout_list_changed,
VLC_PLAYER_LIST_ADDED, ev->vout);
/* Register vout callbacks after the vout list event */
var_AddCallback(ev->vout, "fullscreen",
- vlc_player_VoutCallback, player);
+ vlc_player_VoutCallback, player_);
var_AddCallback(ev->vout, "video-wallpaper",
- vlc_player_VoutCallback, player);
+ vlc_player_VoutCallback, player_);
for (size_t i = 0; i < ARRAY_SIZE(osd_vars); ++i)
var_AddCallback(ev->vout, osd_vars[i],
- vlc_player_VoutOSDCallback, player);
+ vlc_player_VoutOSDCallback, player_);
break;
case VLC_INPUT_EVENT_VOUT_DELETED:
/* Un-register vout callbacks before the vout list event */
var_DelCallback(ev->vout, "fullscreen",
- vlc_player_VoutCallback, player);
+ vlc_player_VoutCallback, player_);
var_DelCallback(ev->vout, "video-wallpaper",
- vlc_player_VoutCallback, player);
+ vlc_player_VoutCallback, player_);
for (size_t i = 0; i < ARRAY_SIZE(osd_vars); ++i)
var_DelCallback(ev->vout, osd_vars[i],
- vlc_player_VoutOSDCallback, player);
+ vlc_player_VoutOSDCallback, player_);
- vlc_player_SendEvent(player, on_vout_list_changed,
+ vlc_player_SendEvent(player_, on_vout_list_changed,
VLC_PLAYER_LIST_REMOVED, ev->vout);
break;
default:
@@ -1836,6 +1867,8 @@ static void
vlc_player_input_HandleStateEvent(struct vlc_player_input *input,
input_state_e state)
{
+ vlc_player_t *player_ = input->player;
+
switch (state)
{
case OPENING_S:
@@ -1849,7 +1882,7 @@ vlc_player_input_HandleStateEvent(struct vlc_player_input *input,
break;
case END_S:
vlc_player_input_HandleState(input, VLC_PLAYER_STATE_STOPPING);
- vlc_player_destructor_AddStoppingInput(input->player, input);
+ vlc_player_destructor_AddStoppingInput(player_, input);
break;
case ERROR_S:
/* Don't send errors if the input is stopped by the user */
@@ -1857,7 +1890,7 @@ vlc_player_input_HandleStateEvent(struct vlc_player_input *input,
{
/* Contrary to the input_thead_t, an error is not a state */
input->error = VLC_PLAYER_ERROR_GENERIC;
- vlc_player_SendEvent(input->player, on_error_changed, input->error);
+ vlc_player_SendEvent(player_, on_error_changed, input->error);
}
break;
default:
@@ -1866,9 +1899,9 @@ vlc_player_input_HandleStateEvent(struct vlc_player_input *input,
}
static void
-vlc_player_HandleAtoBLoop(vlc_player_t *player)
+vlc_player_HandleAtoBLoop(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
assert(input);
assert(input->abloop_state[0].set && input->abloop_state[1].set);
@@ -1877,10 +1910,10 @@ vlc_player_HandleAtoBLoop(vlc_player_t *player)
&& input->abloop_state[1].time != VLC_TICK_INVALID)
{
if (input->time >= input->abloop_state[1].time)
- vlc_player_SetTime(player, input->abloop_state[0].time);
+ vlc_player_SetTime(player_, input->abloop_state[0].time);
}
else if (input->position >= input->abloop_state[1].pos)
- vlc_player_SetPosition(player, input->abloop_state[0].pos);
+ vlc_player_SetPosition(player_, input->abloop_state[0].pos);
}
static void
@@ -1888,7 +1921,8 @@ input_thread_Events(input_thread_t *input_thread,
const struct vlc_input_event *event, void *user_data)
{
struct vlc_player_input *input = user_data;
- vlc_player_t *player = input->player;
+ vlc_player_t *player_ = input->player;
+ struct vlc_player_priv *player = vlc_player_priv(player_);
assert(input_thread == input->thread);
@@ -1901,11 +1935,11 @@ input_thread_Events(input_thread_t *input_thread,
break;
case INPUT_EVENT_RATE:
input->rate = event->rate;
- vlc_player_SendEvent(player, on_rate_changed, input->rate);
+ vlc_player_SendEvent(player_, on_rate_changed, input->rate);
break;
case INPUT_EVENT_CAPABILITIES:
input->capabilities = event->capabilities;
- vlc_player_SendEvent(player, on_capabilities_changed,
+ vlc_player_SendEvent(player_, on_capabilities_changed,
input->capabilities);
break;
case INPUT_EVENT_POSITION:
@@ -1914,20 +1948,20 @@ input_thread_Events(input_thread_t *input_thread,
{
input->time = event->position.ms;
input->position = event->position.percentage;
- vlc_player_SendEvent(player, on_position_changed,
+ vlc_player_SendEvent(player_, on_position_changed,
input->time,
input->position);
if (input->abloop_state[0].set && input->abloop_state[1].set
&& input == player->input)
- vlc_player_HandleAtoBLoop(player);
+ vlc_player_HandleAtoBLoop(player_);
}
break;
case INPUT_EVENT_LENGTH:
if (input->length != event->length)
{
input->length = event->length;
- vlc_player_SendEvent(player, on_length_changed, input->length);
+ vlc_player_SendEvent(player_, on_length_changed, input->length);
}
break;
case INPUT_EVENT_PROGRAM:
@@ -1944,60 +1978,60 @@ input_thread_Events(input_thread_t *input_thread,
break;
case INPUT_EVENT_RECORD:
input->recording = event->record;
- vlc_player_SendEvent(player, on_recording_changed, input->recording);
+ vlc_player_SendEvent(player_, on_recording_changed, input->recording);
break;
case INPUT_EVENT_STATISTICS:
input->stats = *event->stats;
- vlc_player_SendEvent(player, on_statistics_changed, &input->stats);
+ vlc_player_SendEvent(player_, on_statistics_changed, &input->stats);
break;
case INPUT_EVENT_SIGNAL:
input->signal_quality = event->signal.quality;
input->signal_strength = event->signal.strength;
- vlc_player_SendEvent(player, on_signal_changed,
+ vlc_player_SendEvent(player_, on_signal_changed,
input->signal_quality, input->signal_strength);
break;
case INPUT_EVENT_AUDIO_DELAY:
input->audio_delay = event->audio_delay;
- vlc_player_SendEvent(player, on_audio_delay_changed,
+ vlc_player_SendEvent(player_, on_audio_delay_changed,
input->audio_delay);
break;
case INPUT_EVENT_SUBTITLE_DELAY:
input->subtitle_delay = event->subtitle_delay;
- vlc_player_SendEvent(player, on_subtitle_delay_changed,
+ vlc_player_SendEvent(player_, on_subtitle_delay_changed,
input->subtitle_delay);
break;
case INPUT_EVENT_CACHE:
input->cache = event->cache;
- vlc_player_SendEvent(player, on_buffering_changed, event->cache);
+ vlc_player_SendEvent(player_, on_buffering_changed, event->cache);
break;
case INPUT_EVENT_VOUT:
vlc_player_input_HandleVoutEvent(input, &event->vout);
break;
case INPUT_EVENT_ITEM_META:
- vlc_player_SendEvent(player, on_media_meta_changed,
+ vlc_player_SendEvent(player_, on_media_meta_changed,
input_GetItem(input->thread));
break;
case INPUT_EVENT_ITEM_EPG:
- vlc_player_SendEvent(player, on_media_epg_changed,
+ vlc_player_SendEvent(player_, on_media_epg_changed,
input_GetItem(input->thread));
break;
case INPUT_EVENT_SUBITEMS:
- vlc_player_SendEvent(player, on_media_subitems_changed,
+ vlc_player_SendEvent(player_, on_media_subitems_changed,
input_GetItem(input->thread), event->subitems);
break;
case INPUT_EVENT_DEAD:
if (input->started) /* Can happen with early input_thread fails */
vlc_player_input_HandleState(input, VLC_PLAYER_STATE_STOPPING);
- vlc_player_destructor_AddJoinableInput(player, input);
+ vlc_player_destructor_AddJoinableInput(player_, input);
break;
case INPUT_EVENT_VBI_PAGE:
input->teletext_page = event->vbi_page < 999 ? event->vbi_page : 100;
- vlc_player_SendEvent(player, on_teletext_page_changed,
+ vlc_player_SendEvent(player_, on_teletext_page_changed,
input->teletext_page);
break;
case INPUT_EVENT_VBI_TRANSPARENCY:
input->teletext_transparent = event->vbi_transparent;
- vlc_player_SendEvent(player, on_teletext_transparency_changed,
+ vlc_player_SendEvent(player_, on_teletext_transparency_changed,
input->teletext_transparent);
break;
default:
@@ -2008,30 +2042,38 @@ input_thread_Events(input_thread_t *input_thread,
}
void
-vlc_player_Lock(vlc_player_t *player)
+vlc_player_Lock(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
vlc_mutex_lock(&player->lock);
}
void
-vlc_player_Unlock(vlc_player_t *player)
+vlc_player_Unlock(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
vlc_mutex_unlock(&player->lock);
}
void
-vlc_player_CondWait(vlc_player_t *player, vlc_cond_t *cond)
+vlc_player_CondWait(vlc_player_t *player_, vlc_cond_t *cond)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
vlc_cond_wait(cond, &player->lock);
}
vlc_player_listener_id *
-vlc_player_AddListener(vlc_player_t *player,
+vlc_player_AddListener(vlc_player_t *player_,
const struct vlc_player_cbs *cbs, void *cbs_data)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
assert(cbs);
- vlc_player_assert_locked(player);
+ vlc_player_assert_locked(player_);
vlc_player_listener_id *listener = malloc(sizeof(*listener));
if (!listener)
@@ -2046,24 +2088,26 @@ vlc_player_AddListener(vlc_player_t *player,
}
void
-vlc_player_RemoveListener(vlc_player_t *player,
+vlc_player_RemoveListener(vlc_player_t *player_,
vlc_player_listener_id *id)
{
assert(id);
- vlc_player_assert_locked(player);
+ vlc_player_assert_locked(player_);
vlc_list_remove(&id->node);
free(id);
}
int
-vlc_player_SetCurrentMedia(vlc_player_t *player, input_item_t *media)
+vlc_player_SetCurrentMedia(vlc_player_t *player_, input_item_t *media)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
- vlc_player_CancelWaitError(player);
+ vlc_player_CancelWaitError(player_);
- vlc_player_InvalidateNextMedia(player);
+ vlc_player_InvalidateNextMedia(player_);
if (media)
{
@@ -2084,35 +2128,37 @@ vlc_player_SetCurrentMedia(vlc_player_t *player, input_item_t *media)
if (player->input)
{
- vlc_player_destructor_AddInput(player, player->input);
+ vlc_player_destructor_AddInput(player_, player->input);
player->input = NULL;
}
assert(media == player->next_media);
- if (!vlc_player_destructor_IsEmpty(player))
+ if (!vlc_player_destructor_IsEmpty(player_))
{
/* This media will be opened when the input is finally stopped */
return VLC_SUCCESS;
}
/* We can switch to the next media directly */
- return vlc_player_OpenNextMedia(player);
+ return vlc_player_OpenNextMedia(player_);
}
input_item_t *
-vlc_player_GetCurrentMedia(vlc_player_t *player)
+vlc_player_GetCurrentMedia(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
return player->media;
}
int
-vlc_player_AddAssociatedMedia(vlc_player_t *player,
+vlc_player_AddAssociatedMedia(vlc_player_t *player_,
enum es_format_category_e cat, const char *uri,
bool select, bool notify, bool check_ext)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return VLC_EGENERIC;
@@ -2133,28 +2179,31 @@ vlc_player_AddAssociatedMedia(vlc_player_t *player,
}
void
-vlc_player_SetAssociatedSubsFPS(vlc_player_t *player, float fps)
+vlc_player_SetAssociatedSubsFPS(vlc_player_t *player_, float fps)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
- var_SetFloat(player, "sub-fps", fps);
+ var_SetFloat(player_, "sub-fps", fps);
if (input)
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_SUBS_FPS,
&(vlc_value_t) { .f_float = fps });
- vlc_player_SendEvent(player, on_associated_subs_fps_changed, fps);
+ vlc_player_SendEvent(player_, on_associated_subs_fps_changed, fps);
}
float
-vlc_player_GetAssociatedSubsFPS(vlc_player_t *player)
+vlc_player_GetAssociatedSubsFPS(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
- return var_GetFloat(player, "sub-fps");
+ vlc_player_assert_locked(player_);
+ return var_GetFloat(player_, "sub-fps");
}
void
-vlc_player_InvalidateNextMedia(vlc_player_t *player)
+vlc_player_InvalidateNextMedia(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
+
if (player->next_media)
{
input_item_Release(player->next_media);
@@ -2165,16 +2214,18 @@ vlc_player_InvalidateNextMedia(vlc_player_t *player)
}
int
-vlc_player_Start(vlc_player_t *player)
+vlc_player_Start(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
- vlc_player_CancelWaitError(player);
+ vlc_player_assert_locked(player_);
+
+ vlc_player_CancelWaitError(player_);
if (player->started)
return VLC_SUCCESS;
- if (!vlc_player_destructor_IsEmpty(player))
+ if (!vlc_player_destructor_IsEmpty(player_))
{
if (player->next_media)
{
@@ -2191,7 +2242,7 @@ vlc_player_Start(vlc_player_t *player)
if (!player->input)
{
/* Possible if the player was stopped by the user */
- player->input = vlc_player_input_New(player, player->media);
+ player->input = vlc_player_input_New(player_, player->media);
if (!player->input)
return VLC_ENOMEM;
@@ -2208,50 +2259,57 @@ vlc_player_Start(vlc_player_t *player)
if (ret == VLC_SUCCESS)
player->started = true;
- vlc_player_vout_OSDIcon(player, OSD_PLAY_ICON);
+ vlc_player_vout_OSDIcon(player_, OSD_PLAY_ICON);
return ret;
}
void
-vlc_player_Stop(vlc_player_t *player)
+vlc_player_Stop(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
- vlc_player_CancelWaitError(player);
+ vlc_player_CancelWaitError(player_);
- vlc_player_InvalidateNextMedia(player);
+ vlc_player_InvalidateNextMedia(player_);
if (!input || !player->started)
return;
player->started = false;
- vlc_player_destructor_AddInput(player, input);
+ vlc_player_destructor_AddInput(player_, input);
player->input = NULL;
}
void
-vlc_player_SetMediaStoppedAction(vlc_player_t *player,
+vlc_player_SetMediaStoppedAction(vlc_player_t *player_,
enum vlc_player_media_stopped_action action)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
+
player->media_stopped_action = action;
- var_SetBool(player, "play-and-pause",
+ var_SetBool(player_, "play-and-pause",
action == VLC_PLAYER_MEDIA_STOPPED_PAUSE);
- vlc_player_SendEvent(player, on_media_stopped_action_changed, action);
+ vlc_player_SendEvent(player_, on_media_stopped_action_changed, action);
}
void
-vlc_player_SetStartPaused(vlc_player_t *player, bool start_paused)
+vlc_player_SetStartPaused(vlc_player_t *player_, bool start_paused)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
+
player->start_paused = start_paused;
}
static void
-vlc_player_SetPause(vlc_player_t *player, bool pause)
+vlc_player_SetPause(vlc_player_t *player_, bool pause)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input || !input->started)
return;
@@ -2259,72 +2317,75 @@ vlc_player_SetPause(vlc_player_t *player, bool pause)
vlc_value_t val = { .i_int = pause ? PAUSE_S : PLAYING_S };
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_STATE, &val);
- vlc_player_vout_OSDIcon(player, pause ? OSD_PAUSE_ICON : OSD_PLAY_ICON);
+ vlc_player_vout_OSDIcon(player_, pause ? OSD_PAUSE_ICON : OSD_PLAY_ICON);
}
void
-vlc_player_Pause(vlc_player_t *player)
+vlc_player_Pause(vlc_player_t *player_)
{
- vlc_player_SetPause(player, true);
+ vlc_player_SetPause(player_, true);
}
void
-vlc_player_Resume(vlc_player_t *player)
+vlc_player_Resume(vlc_player_t *player_)
{
- vlc_player_SetPause(player, false);
+ vlc_player_SetPause(player_, false);
}
void
-vlc_player_NextVideoFrame(vlc_player_t *player)
+vlc_player_NextVideoFrame(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_FRAME_NEXT, NULL);
- vlc_player_vout_OSDMessage(player, _("Next frame"));
+ vlc_player_vout_OSDMessage(player_, _("Next frame"));
}
enum vlc_player_state
-vlc_player_GetState(vlc_player_t *player)
+vlc_player_GetState(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
+
return player->global_state;
}
enum vlc_player_error
-vlc_player_GetError(vlc_player_t *player)
+vlc_player_GetError(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->error : VLC_PLAYER_ERROR_NONE;
}
int
-vlc_player_GetCapabilities(vlc_player_t *player)
+vlc_player_GetCapabilities(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->capabilities : 0;
}
float
-vlc_player_GetRate(vlc_player_t *player)
+vlc_player_GetRate(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (input)
return input->rate;
else
- return var_GetFloat(player, "rate");
+ return var_GetFloat(player_, "rate");
}
void
-vlc_player_ChangeRate(vlc_player_t *player, float rate)
+vlc_player_ChangeRate(vlc_player_t *player_, float rate)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (rate == 0.0)
return;
/* Save rate accross inputs */
- var_SetFloat(player, "rate", rate);
+ var_SetFloat(player_, "rate", rate);
if (input)
{
@@ -2332,20 +2393,20 @@ vlc_player_ChangeRate(vlc_player_t *player, float rate)
&(vlc_value_t) { .f_float = rate });
}
else
- vlc_player_SendEvent(player, on_rate_changed, rate);
+ vlc_player_SendEvent(player_, on_rate_changed, rate);
- vlc_player_vout_OSDMessage(player, ("Speed: %.2fx"), rate);
+ vlc_player_vout_OSDMessage(player_, ("Speed: %.2fx"), rate);
}
static void
-vlc_player_ChangeRateOffset(vlc_player_t *player, bool increment)
+vlc_player_ChangeRateOffset(vlc_player_t *player_, bool increment)
{
static const float rates[] = {
1.0/64, 1.0/32, 1.0/16, 1.0/8, 1.0/4, 1.0/3, 1.0/2, 2.0/3,
1.0/1,
3.0/2, 2.0/1, 3.0/1, 4.0/1, 8.0/1, 16.0/1, 32.0/1, 64.0/1,
};
- float rate = vlc_player_GetRate(player) * (increment ? 1.1f : 0.9f);
+ float rate = vlc_player_GetRate(player_) * (increment ? 1.1f : 0.9f);
/* find closest rate (if any) in the desired direction */
for (size_t i = 0; i < ARRAY_SIZE(rates); ++i)
@@ -2358,32 +2419,32 @@ vlc_player_ChangeRateOffset(vlc_player_t *player, bool increment)
}
}
- vlc_player_ChangeRate(player, rate);
+ vlc_player_ChangeRate(player_, rate);
}
void
-vlc_player_IncrementRate(vlc_player_t *player)
+vlc_player_IncrementRate(vlc_player_t *player_)
{
- vlc_player_ChangeRateOffset(player, true);
+ vlc_player_ChangeRateOffset(player_, true);
}
void
-vlc_player_DecrementRate(vlc_player_t *player)
+vlc_player_DecrementRate(vlc_player_t *player_)
{
- vlc_player_ChangeRateOffset(player, false);
+ vlc_player_ChangeRateOffset(player_, false);
}
vlc_tick_t
-vlc_player_GetLength(vlc_player_t *player)
+vlc_player_GetLength(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->length : VLC_TICK_INVALID;
}
vlc_tick_t
-vlc_player_GetTime(vlc_player_t *player)
+vlc_player_GetTime(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input || input->time == VLC_TICK_INVALID)
return VLC_TICK_INVALID;
@@ -2392,9 +2453,9 @@ vlc_player_GetTime(vlc_player_t *player)
}
float
-vlc_player_GetPosition(vlc_player_t *player)
+vlc_player_GetPosition(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->position : -1.f;
}
@@ -2411,7 +2472,7 @@ vlc_player_assert_seek_params(enum vlc_player_seek_speed speed,
}
static inline void
-vlc_player_vout_OSDPosition(vlc_player_t *player,
+vlc_player_vout_OSDPosition(vlc_player_t *player_,
struct vlc_player_input *input, vlc_tick_t time,
float position, enum vlc_player_whence whence)
{
@@ -2424,7 +2485,7 @@ vlc_player_vout_OSDPosition(vlc_player_t *player,
}
size_t count;
- vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player, &count);
+ vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player_, &count);
if (time != VLC_TICK_INVALID)
{
@@ -2447,7 +2508,7 @@ vlc_player_vout_OSDPosition(vlc_player_t *player,
vouts_osd_Message(vouts, count, "%s", time_text);
}
- if (vlc_player_vout_IsFullscreen(player))
+ if (vlc_player_vout_IsFullscreen(player_))
{
if (whence == VLC_PLAYER_WHENCE_RELATIVE)
{
@@ -2457,27 +2518,27 @@ vlc_player_vout_OSDPosition(vlc_player_t *player,
}
vouts_osd_Slider(vouts, count, position * 100, OSD_HOR_SLIDER);
}
- vlc_player_vout_OSDReleaseAll(player, vouts, count);
+ vlc_player_vout_OSDReleaseAll(player_, vouts, count);
}
void
-vlc_player_DisplayPosition(vlc_player_t *player)
+vlc_player_DisplayPosition(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
- vlc_player_vout_OSDPosition(player, input, input->time, input->position,
+ vlc_player_vout_OSDPosition(player_, input, input->time, input->position,
VLC_PLAYER_WHENCE_ABSOLUTE);
}
void
-vlc_player_SeekByPos(vlc_player_t *player, float position,
+vlc_player_SeekByPos(vlc_player_t *player_, float position,
enum vlc_player_seek_speed speed,
enum vlc_player_whence whence)
{
vlc_player_assert_seek_params(speed, whence);
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
@@ -2490,18 +2551,18 @@ vlc_player_SeekByPos(vlc_player_t *player, float position,
.pos.b_fast_seek = speed == VLC_PLAYER_SEEK_FAST,
});
- vlc_player_vout_OSDPosition(player, input, VLC_TICK_INVALID, position,
+ vlc_player_vout_OSDPosition(player_, input, VLC_TICK_INVALID, position,
whence);
}
void
-vlc_player_SeekByTime(vlc_player_t *player, vlc_tick_t time,
+vlc_player_SeekByTime(vlc_player_t *player_, vlc_tick_t time,
enum vlc_player_seek_speed speed,
enum vlc_player_whence whence)
{
vlc_player_assert_seek_params(speed, whence);
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
@@ -2514,13 +2575,15 @@ vlc_player_SeekByTime(vlc_player_t *player, vlc_tick_t time,
.time.b_fast_seek = speed == VLC_PLAYER_SEEK_FAST,
});
- vlc_player_vout_OSDPosition(player, input, time, -1, whence);
+ vlc_player_vout_OSDPosition(player_, input, time, -1, whence);
}
void
-vlc_player_SetRenderer(vlc_player_t *player, vlc_renderer_item_t *renderer)
+vlc_player_SetRenderer(vlc_player_t *player_, vlc_renderer_item_t *renderer)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
if (player->renderer)
vlc_renderer_item_release(player->renderer);
@@ -2534,26 +2597,29 @@ vlc_player_SetRenderer(vlc_player_t *player, vlc_renderer_item_t *renderer)
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_RENDERER,
&val);
}
- vlc_player_SendEvent(player, on_renderer_changed, player->renderer);
+ vlc_player_SendEvent(player_, on_renderer_changed, player->renderer);
}
vlc_renderer_item_t *
-vlc_player_GetRenderer(vlc_player_t *player)
+vlc_player_GetRenderer(vlc_player_t *player_)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
+
return player->renderer;
}
int
-vlc_player_SetAtoBLoop(vlc_player_t *player, enum vlc_player_abloop abloop)
+vlc_player_SetAtoBLoop(vlc_player_t *player_, enum vlc_player_abloop abloop)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
- if (!input || !vlc_player_CanSeek(player))
+ if (!input || !vlc_player_CanSeek(player_))
return VLC_EGENERIC;
- vlc_tick_t time = vlc_player_GetTime(player);
- float pos = vlc_player_GetPosition(player);
+ vlc_tick_t time = vlc_player_GetTime(player_);
+ float pos = vlc_player_GetPosition(player_);
int ret = VLC_SUCCESS;
switch (abloop)
{
@@ -2575,13 +2641,13 @@ vlc_player_SetAtoBLoop(vlc_player_t *player, enum vlc_player_abloop abloop)
{
if (time > input->abloop_state[0].time)
{
- vlc_player_SetTime(player, input->abloop_state[0].time);
+ vlc_player_SetTime(player_, input->abloop_state[0].time);
break;
}
}
else if (pos > input->abloop_state[0].pos)
{
- vlc_player_SetPosition(player, input->abloop_state[0].pos);
+ vlc_player_SetPosition(player_, input->abloop_state[0].pos);
break;
}
@@ -2597,17 +2663,17 @@ vlc_player_SetAtoBLoop(vlc_player_t *player, enum vlc_player_abloop abloop)
default:
vlc_assert_unreachable();
}
- vlc_player_SendEvent(player, on_atobloop_changed, abloop, time, pos);
+ vlc_player_SendEvent(player_, on_atobloop_changed, abloop, time, pos);
return ret;
}
enum vlc_player_abloop
-vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, float *a_pos,
+vlc_player_GetAtoBLoop(vlc_player_t *player_, vlc_tick_t *a_time, float *a_pos,
vlc_tick_t *b_time, float *b_pos)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
- if (!input || !vlc_player_CanSeek(player) || !input->abloop_state[0].set)
+ if (!input || !vlc_player_CanSeek(player_) || !input->abloop_state[0].set)
return VLC_PLAYER_ABLOOP_NONE;
if (a_time)
@@ -2625,9 +2691,9 @@ vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, float *a_pos,
}
void
-vlc_player_Navigate(vlc_player_t *player, enum vlc_player_nav nav)
+vlc_player_Navigate(vlc_player_t *player_, enum vlc_player_nav nav)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
@@ -2663,43 +2729,43 @@ vlc_player_Navigate(vlc_player_t *player, enum vlc_player_nav nav)
}
void
-vlc_player_UpdateViewpoint(vlc_player_t *player,
+vlc_player_UpdateViewpoint(vlc_player_t *player_,
const vlc_viewpoint_t *viewpoint,
enum vlc_player_whence whence)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (input)
input_UpdateViewpoint(input->thread, viewpoint,
whence == VLC_PLAYER_WHENCE_ABSOLUTE);
}
bool
-vlc_player_IsRecording(vlc_player_t *player)
+vlc_player_IsRecording(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->recording : false;
}
void
-vlc_player_SetRecordingEnabled(vlc_player_t *player, bool enable)
+vlc_player_SetRecordingEnabled(vlc_player_t *player_, bool enable)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input_ControlPushHelper(input->thread, INPUT_CONTROL_SET_RECORD_STATE,
&(vlc_value_t) { .b_bool = enable });
- vlc_player_vout_OSDMessage(player, enable ?
+ vlc_player_vout_OSDMessage(player_, enable ?
_("Recording") : _("Recording done"));
}
void
-vlc_player_SetAudioDelay(vlc_player_t *player, vlc_tick_t delay,
+vlc_player_SetAudioDelay(vlc_player_t *player_, vlc_tick_t delay,
enum vlc_player_whence whence)
{
bool absolute = whence == VLC_PLAYER_WHENCE_ABSOLUTE;
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
@@ -2713,23 +2779,23 @@ vlc_player_SetAudioDelay(vlc_player_t *player, vlc_tick_t delay,
if (!absolute)
delay += input->audio_delay;
- vlc_player_vout_OSDMessage(player, _("Audio delay: %i ms"),
+ vlc_player_vout_OSDMessage(player_, _("Audio delay: %i ms"),
(int)MS_FROM_VLC_TICK(delay));
}
vlc_tick_t
-vlc_player_GetAudioDelay(vlc_player_t *player)
+vlc_player_GetAudioDelay(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->audio_delay : 0;
}
static void
-vlc_player_SetSubtitleDelayInternal(vlc_player_t *player, vlc_tick_t delay,
+vlc_player_SetSubtitleDelayInternal(vlc_player_t *player_, vlc_tick_t delay,
enum vlc_player_whence whence)
{
bool absolute = whence == VLC_PLAYER_WHENCE_ABSOLUTE;
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
@@ -2743,11 +2809,11 @@ vlc_player_SetSubtitleDelayInternal(vlc_player_t *player, vlc_tick_t delay,
}
void
-vlc_player_SetSubtitleDelay(vlc_player_t *player, vlc_tick_t delay,
+vlc_player_SetSubtitleDelay(vlc_player_t *player_, vlc_tick_t delay,
enum vlc_player_whence whence)
{
- vlc_player_SetSubtitleDelayInternal(player, delay, whence);
- vlc_player_vout_OSDMessage(player, _("Subtitle delay: %s%i ms"),
+ vlc_player_SetSubtitleDelayInternal(player_, delay, whence);
+ vlc_player_vout_OSDMessage(player_, _("Subtitle delay: %s%i ms"),
whence == VLC_PLAYER_WHENCE_ABSOLUTE ? "" : "+",
(int)MS_FROM_VLC_TICK(delay));
}
@@ -2762,14 +2828,14 @@ static struct {
};
void
-vlc_player_SetTrackCategoryEnabled(vlc_player_t *player,
+vlc_player_SetTrackCategoryEnabled(vlc_player_t *player_,
enum es_format_category_e cat, bool enabled)
{
assert(cat >= UNKNOWN_ES && cat <= DATA_ES);
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
- var_SetBool(player, cat2vars[cat].var, enabled);
- var_SetBool(player, cat2vars[cat].sout_var, enabled);
+ var_SetBool(player_, cat2vars[cat].var, enabled);
+ var_SetBool(player_, cat2vars[cat].sout_var, enabled);
if (input)
{
@@ -2777,106 +2843,106 @@ vlc_player_SetTrackCategoryEnabled(vlc_player_t *player,
var_SetBool(input->thread, cat2vars[cat].sout_var, enabled);
if (!enabled)
- vlc_player_UnselectTrackCategory(player, cat);
+ vlc_player_UnselectTrackCategory(player_, cat);
}
}
bool
-vlc_player_IsTrackCategoryEnabled(vlc_player_t *player,
+vlc_player_IsTrackCategoryEnabled(vlc_player_t *player_,
enum es_format_category_e cat)
{
assert(cat >= UNKNOWN_ES && cat <= DATA_ES);
- return var_GetBool(player, cat2vars[cat].var);
+ return var_GetBool(player_, cat2vars[cat].var);
}
void
-vlc_player_SetSubtitleTextScale(vlc_player_t *player, unsigned scale)
+vlc_player_SetSubtitleTextScale(vlc_player_t *player_, unsigned scale)
{
assert(scale >= 10 && scale <= 500);
- var_SetInteger(player, "sub-text-scale", scale);
+ var_SetInteger(player_, "sub-text-scale", scale);
}
unsigned
-vlc_player_GetSubtitleTextScale(vlc_player_t *player)
+vlc_player_GetSubtitleTextScale(vlc_player_t *player_)
{
- return var_GetInteger(player, "sub-text-scale");
+ return var_GetInteger(player_, "sub-text-scale");
}
static void
-vlc_player_SubtitleSyncMarkAudio(vlc_player_t *player)
+vlc_player_SubtitleSyncMarkAudio(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input->subsync.audio_time = vlc_tick_now();
- vlc_player_vout_OSDMessage(player, _("Sub sync: bookmarked audio time"));
+ vlc_player_vout_OSDMessage(player_, _("Sub sync: bookmarked audio time"));
}
static void
-vlc_player_SubtitleSyncMarkSubtitle(vlc_player_t *player)
+vlc_player_SubtitleSyncMarkSubtitle(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
input->subsync.subtitle_time = vlc_tick_now();
- vlc_player_vout_OSDMessage(player, _("Sub sync: bookmarked subtitle time"));
+ vlc_player_vout_OSDMessage(player_, _("Sub sync: bookmarked subtitle time"));
}
static void
-vlc_player_SubtitleSyncApply(vlc_player_t *player)
+vlc_player_SubtitleSyncApply(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
if (input->subsync.audio_time == VLC_TICK_INVALID ||
input->subsync.subtitle_time == VLC_TICK_INVALID)
{
- vlc_player_vout_OSDMessage(player, _("Sub sync: set bookmarks first!"));
+ vlc_player_vout_OSDMessage(player_, _("Sub sync: set bookmarks first!"));
return;
}
vlc_tick_t delay =
input->subsync.audio_time - input->subsync.subtitle_time;
input->subsync.audio_time = VLC_TICK_INVALID;
input->subsync.subtitle_time = VLC_TICK_INVALID;
- vlc_player_SetSubtitleDelayInternal(player, delay,
+ vlc_player_SetSubtitleDelayInternal(player_, delay,
VLC_PLAYER_WHENCE_RELATIVE);
long long delay_ms = MS_FROM_VLC_TICK(delay);
long long totdelay_ms = MS_FROM_VLC_TICK(input->subtitle_delay + delay);
- vlc_player_vout_OSDMessage(player, _("Sub sync: corrected %"PRId64
+ vlc_player_vout_OSDMessage(player_, _("Sub sync: corrected %"PRId64
" ms (total delay = %"PRId64" ms)"),
delay_ms, totdelay_ms);
}
static void
-vlc_player_SubtitleSyncReset(vlc_player_t *player)
+vlc_player_SubtitleSyncReset(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
- vlc_player_SetSubtitleDelayInternal(player, 0, VLC_PLAYER_WHENCE_ABSOLUTE);
+ vlc_player_SetSubtitleDelayInternal(player_, 0, VLC_PLAYER_WHENCE_ABSOLUTE);
input->subsync.audio_time = VLC_TICK_INVALID;
input->subsync.subtitle_time = VLC_TICK_INVALID;
- vlc_player_vout_OSDMessage(player, _("Sub sync: delay reset"));
+ vlc_player_vout_OSDMessage(player_, _("Sub sync: delay reset"));
}
void
-vlc_player_SetSubtitleSync(vlc_player_t *player,
+vlc_player_SetSubtitleSync(vlc_player_t *player_,
enum vlc_player_subtitle_sync sync)
{
switch (sync)
{
case VLC_PLAYER_SUBTITLE_SYNC_RESET:
- vlc_player_SubtitleSyncReset(player);
+ vlc_player_SubtitleSyncReset(player_);
break;
case VLC_PLAYER_SUBTITLE_SYNC_MARK_AUDIO:
- vlc_player_SubtitleSyncMarkAudio(player);
+ vlc_player_SubtitleSyncMarkAudio(player_);
break;
case VLC_PLAYER_SUBTITLE_SYNC_MARK_SUBTITLE:
- vlc_player_SubtitleSyncMarkSubtitle(player);
+ vlc_player_SubtitleSyncMarkSubtitle(player_);
break;
case VLC_PLAYER_SUBTITLE_SYNC_APPLY:
- vlc_player_SubtitleSyncApply(player);
+ vlc_player_SubtitleSyncApply(player_);
break;
default:
vlc_assert_unreachable();
@@ -2884,17 +2950,17 @@ vlc_player_SetSubtitleSync(vlc_player_t *player,
}
vlc_tick_t
-vlc_player_GetSubtitleDelay(vlc_player_t *player)
+vlc_player_GetSubtitleDelay(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? input->subtitle_delay : 0;
}
int
-vlc_player_GetSignal(vlc_player_t *player, float *quality, float *strength)
+vlc_player_GetSignal(vlc_player_t *player_, float *quality, float *strength)
{
assert(quality && strength);
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (input && input->signal_quality >= 0 && input->signal_strength >= 0)
{
@@ -2906,17 +2972,20 @@ vlc_player_GetSignal(vlc_player_t *player, float *quality, float *strength)
}
const struct input_stats_t *
-vlc_player_GetStatistics(vlc_player_t *player)
+vlc_player_GetStatistics(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input ? &input->stats : NULL;
}
void
-vlc_player_SetPauseOnCork(vlc_player_t *player, bool enabled)
+vlc_player_SetPauseOnCork(vlc_player_t *player_, bool enabled)
{
- vlc_player_assert_locked(player);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
+ vlc_player_assert_locked(player_);
+
player->pause_on_cork = enabled;
}
@@ -2924,12 +2993,13 @@ static int
vlc_player_CorkCallback(vlc_object_t *this, const char *var,
vlc_value_t oldval, vlc_value_t newval, void *data)
{
- vlc_player_t *player = data;
+ vlc_player_t *player_ = data;
+ struct vlc_player_priv *player = vlc_player_priv(player_);
if (oldval.i_int == newval.i_int )
return VLC_SUCCESS;
- vlc_player_Lock(player);
+ vlc_player_Lock(player_);
if (player->pause_on_cork)
{
@@ -2938,38 +3008,41 @@ vlc_player_CorkCallback(vlc_object_t *this, const char *var,
player->corked = player->global_state == VLC_PLAYER_STATE_PLAYING
|| player->global_state == VLC_PLAYER_STATE_STARTED;
if (player->corked)
- vlc_player_Pause(player);
+ vlc_player_Pause(player_);
}
else
{
if (player->corked)
{
- vlc_player_Resume(player);
+ vlc_player_Resume(player_);
player->corked = false;
}
}
}
else
- vlc_player_SendEvent(player, on_cork_changed, newval.i_int);
+ vlc_player_SendEvent(player_, on_cork_changed, newval.i_int);
- vlc_player_Unlock(player);
+ vlc_player_Unlock(player_);
return VLC_SUCCESS;
(void) this; (void) var;
}
audio_output_t *
-vlc_player_aout_Hold(vlc_player_t *player)
+vlc_player_aout_Hold(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
return input_resource_HoldAout(player->resource);
}
vlc_player_aout_listener_id *
-vlc_player_aout_AddListener(vlc_player_t *player,
+vlc_player_aout_AddListener(vlc_player_t *player_,
const struct vlc_player_aout_cbs *cbs,
void *cbs_data)
{
assert(cbs);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
vlc_player_aout_listener_id *listener = malloc(sizeof(*listener));
if (!listener)
@@ -2986,10 +3059,11 @@ vlc_player_aout_AddListener(vlc_player_t *player,
}
void
-vlc_player_aout_RemoveListener(vlc_player_t *player,
+vlc_player_aout_RemoveListener(vlc_player_t *player_,
vlc_player_aout_listener_id *id)
{
assert(id);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
vlc_mutex_lock(&player->aout_listeners_lock);
vlc_list_remove(&id->node);
@@ -2998,45 +3072,45 @@ vlc_player_aout_RemoveListener(vlc_player_t *player,
}
static void
-vlc_player_vout_OSDVolume(vlc_player_t *player, bool mute_action)
+vlc_player_vout_OSDVolume(vlc_player_t *player_, bool mute_action)
{
size_t count;
- vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player, &count);
+ vout_thread_t **vouts = vlc_player_vout_OSDHoldAll(player_, &count);
- bool mute = vlc_player_aout_IsMuted(player);
- int volume = lroundf(vlc_player_aout_GetVolume(player) * 100.f);
+ bool mute = vlc_player_aout_IsMuted(player_);
+ int volume = lroundf(vlc_player_aout_GetVolume(player_) * 100.f);
if (mute_action && mute)
vouts_osd_Icon(vouts, count, OSD_MUTE_ICON);
else
{
- if (vlc_player_vout_IsFullscreen(player))
+ if (vlc_player_vout_IsFullscreen(player_))
vouts_osd_Slider(vouts, count, volume, OSD_VERT_SLIDER);
vouts_osd_Message(vouts, count, _("Volume: %ld%%"), volume);
}
- vlc_player_vout_OSDReleaseAll(player, vouts, count);
+ vlc_player_vout_OSDReleaseAll(player_, vouts, count);
}
static int
vlc_player_AoutCallback(vlc_object_t *this, const char *var,
vlc_value_t oldval, vlc_value_t newval, void *data)
{
- vlc_player_t *player = data;
+ vlc_player_t *player_ = data;
if (strcmp(var, "volume") == 0)
{
if (oldval.f_float != newval.f_float)
{
- vlc_player_aout_SendEvent(player, on_volume_changed, newval.f_float);
- vlc_player_vout_OSDVolume(player, false);
+ vlc_player_aout_SendEvent(player_, on_volume_changed, newval.f_float);
+ vlc_player_vout_OSDVolume(player_, false);
}
}
else if (strcmp(var, "mute") == 0)
{
if (oldval.b_bool != newval.b_bool)
{
- vlc_player_aout_SendEvent(player, on_mute_changed, newval.b_bool);
- vlc_player_vout_OSDVolume(player, true);
+ vlc_player_aout_SendEvent(player_, on_mute_changed, newval.b_bool);
+ vlc_player_vout_OSDVolume(player_, true);
}
}
else
@@ -3047,9 +3121,9 @@ vlc_player_AoutCallback(vlc_object_t *this, const char *var,
}
float
-vlc_player_aout_GetVolume(vlc_player_t *player)
+vlc_player_aout_GetVolume(vlc_player_t *player_)
{
- audio_output_t *aout = vlc_player_aout_Hold(player);
+ audio_output_t *aout = vlc_player_aout_Hold(player_);
if (!aout)
return -1.f;
float vol = aout_VolumeGet(aout);
@@ -3059,9 +3133,9 @@ vlc_player_aout_GetVolume(vlc_player_t *player)
}
int
-vlc_player_aout_SetVolume(vlc_player_t *player, float volume)
+vlc_player_aout_SetVolume(vlc_player_t *player_, float volume)
{
- audio_output_t *aout = vlc_player_aout_Hold(player);
+ audio_output_t *aout = vlc_player_aout_Hold(player_);
if (!aout)
return -1;
int ret = aout_VolumeSet(aout, volume);
@@ -3071,9 +3145,9 @@ vlc_player_aout_SetVolume(vlc_player_t *player, float volume)
}
int
-vlc_player_aout_IncrementVolume(vlc_player_t *player, int steps, float *result)
+vlc_player_aout_IncrementVolume(vlc_player_t *player_, int steps, float *result)
{
- audio_output_t *aout = vlc_player_aout_Hold(player);
+ audio_output_t *aout = vlc_player_aout_Hold(player_);
if (!aout)
return -1;
int ret = aout_VolumeUpdate(aout, steps, result);
@@ -3083,9 +3157,9 @@ vlc_player_aout_IncrementVolume(vlc_player_t *player, int steps, float *result)
}
int
-vlc_player_aout_IsMuted(vlc_player_t *player)
+vlc_player_aout_IsMuted(vlc_player_t *player_)
{
- audio_output_t *aout = vlc_player_aout_Hold(player);
+ audio_output_t *aout = vlc_player_aout_Hold(player_);
if (!aout)
return -1;
int ret = aout_MuteGet(aout);
@@ -3095,9 +3169,9 @@ vlc_player_aout_IsMuted(vlc_player_t *player)
}
int
-vlc_player_aout_Mute(vlc_player_t *player, bool mute)
+vlc_player_aout_Mute(vlc_player_t *player_, bool mute)
{
- audio_output_t *aout = vlc_player_aout_Hold(player);
+ audio_output_t *aout = vlc_player_aout_Hold(player_);
if (!aout)
return -1;
int ret = aout_MuteSet (aout, mute);
@@ -3108,9 +3182,9 @@ vlc_player_aout_Mute(vlc_player_t *player, bool mute)
int
-vlc_player_aout_EnableFilter(vlc_player_t *player, const char *name, bool add)
+vlc_player_aout_EnableFilter(vlc_player_t *player_, const char *name, bool add)
{
- audio_output_t *aout = vlc_player_aout_Hold(player);
+ audio_output_t *aout = vlc_player_aout_Hold(player_);
if (!aout)
return -1;
aout_EnableFilter(aout, name, add);
@@ -3120,25 +3194,30 @@ vlc_player_aout_EnableFilter(vlc_player_t *player, const char *name, bool add)
}
vout_thread_t *
-vlc_player_vout_Hold(vlc_player_t *player)
+vlc_player_vout_Hold(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
return input_resource_HoldVout(player->resource);
}
vout_thread_t **
-vlc_player_vout_HoldAll(vlc_player_t *player, size_t *count)
+vlc_player_vout_HoldAll(vlc_player_t *player_, size_t *count)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
vout_thread_t **vouts;
+
input_resource_HoldVouts(player->resource, &vouts, count);
return vouts;
}
vlc_player_vout_listener_id *
-vlc_player_vout_AddListener(vlc_player_t *player,
+vlc_player_vout_AddListener(vlc_player_t *player_,
const struct vlc_player_vout_cbs *cbs,
void *cbs_data)
{
assert(cbs);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
vlc_player_vout_listener_id *listener = malloc(sizeof(*listener));
if (!listener)
@@ -3155,10 +3234,11 @@ vlc_player_vout_AddListener(vlc_player_t *player,
}
void
-vlc_player_vout_RemoveListener(vlc_player_t *player,
+vlc_player_vout_RemoveListener(vlc_player_t *player_,
vlc_player_vout_listener_id *id)
{
assert(id);
+ struct vlc_player_priv *player = vlc_player_priv(player_);
vlc_mutex_lock(&player->vout_listeners_lock);
vlc_list_remove(&id->node);
@@ -3167,27 +3247,27 @@ vlc_player_vout_RemoveListener(vlc_player_t *player,
}
bool
-vlc_player_vout_IsFullscreen(vlc_player_t *player)
+vlc_player_vout_IsFullscreen(vlc_player_t *player_)
{
- return var_GetBool(player, "fullscreen");
+ return var_GetBool(player_, "fullscreen");
}
static int
vlc_player_VoutCallback(vlc_object_t *this, const char *var,
vlc_value_t oldval, vlc_value_t newval, void *data)
{
- vlc_player_t *player = data;
+ vlc_player_t *player_ = data;
if (strcmp(var, "fullscreen") == 0)
{
if (oldval.b_bool != newval.b_bool )
- vlc_player_vout_SendEvent(player, on_fullscreen_changed,
+ vlc_player_vout_SendEvent(player_, on_fullscreen_changed,
(vout_thread_t *)this, newval.b_bool);
}
else if (strcmp(var, "video-wallpaper") == 0)
{
if (oldval.b_bool != newval.b_bool )
- vlc_player_vout_SendEvent(player, on_wallpaper_mode_changed,
+ vlc_player_vout_SendEvent(player_, on_wallpaper_mode_changed,
(vout_thread_t *)this, newval.b_bool);
}
else
@@ -3295,13 +3375,13 @@ vlc_player_VoutOSDCallback(vlc_object_t *this, const char *var,
}
static void
-vlc_player_vout_SetVar(vlc_player_t *player, const char *name, int type,
+vlc_player_vout_SetVar(vlc_player_t *player_, const char *name, int type,
vlc_value_t val)
{
- var_SetChecked(player, name, type, val);
+ var_SetChecked(player_, name, type, val);
size_t count;
- vout_thread_t **vouts = vlc_player_vout_HoldAll(player, &count);
+ vout_thread_t **vouts = vlc_player_vout_HoldAll(player_, &count);
for (size_t i = 0; i < count; i++)
{
var_SetChecked(vouts[i], name, type, val);
@@ -3312,10 +3392,10 @@ vlc_player_vout_SetVar(vlc_player_t *player, const char *name, int type,
static void
-vlc_player_vout_TriggerOption(vlc_player_t *player, const char *option)
+vlc_player_vout_TriggerOption(vlc_player_t *player_, const char *option)
{
size_t count;
- vout_thread_t **vouts = vlc_player_vout_HoldAll(player, &count);
+ vout_thread_t **vouts = vlc_player_vout_HoldAll(player_, &count);
for (size_t i = 0; i < count; ++i)
{
var_TriggerCallback(vouts[i], option);
@@ -3325,23 +3405,23 @@ vlc_player_vout_TriggerOption(vlc_player_t *player, const char *option)
}
vlc_object_t *
-vlc_player_GetV4l2Object(vlc_player_t *player)
+vlc_player_GetV4l2Object(vlc_player_t *player_)
{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
return input && var_Type(input->thread, "controls") != 0 ?
(vlc_object_t*) input->thread : NULL;
}
void
-vlc_player_SetVideoSplitter(vlc_player_t *player, const char *splitter)
+vlc_player_SetVideoSplitter(vlc_player_t *player_, const char *splitter)
{
if (config_GetType("video-splitter") == 0)
return;
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
+ struct vlc_player_input *input = vlc_player_get_input_locked(player_);
if (!input)
return;
- vout_thread_t *vout = vlc_player_vout_Hold(player);
+ vout_thread_t *vout = vlc_player_vout_Hold(player_);
var_SetString(vout, "video-splitter", splitter);
vout_Release(vout);
@@ -3351,31 +3431,31 @@ vlc_player_SetVideoSplitter(vlc_player_t *player, const char *splitter)
vlc_vector_foreach(track, &input->video_track_vector)
if (track->selected)
{
- vlc_player_RestartTrack(player, track->es_id);
+ vlc_player_RestartTrack(player_, track->es_id);
break;
}
}
void
-vlc_player_vout_SetFullscreen(vlc_player_t *player, bool enabled)
+vlc_player_vout_SetFullscreen(vlc_player_t *player_, bool enabled)
{
- vlc_player_vout_SetVar(player, "fullscreen", VLC_VAR_BOOL,
+ vlc_player_vout_SetVar(player_, "fullscreen", VLC_VAR_BOOL,
(vlc_value_t) { .b_bool = enabled });
- vlc_player_vout_SendEvent(player, on_fullscreen_changed, NULL, enabled);
+ vlc_player_vout_SendEvent(player_, on_fullscreen_changed, NULL, enabled);
}
bool
-vlc_player_vout_IsWallpaperModeEnabled(vlc_player_t *player)
+vlc_player_vout_IsWallpaperModeEnabled(vlc_player_t *player_)
{
- return var_GetBool(player, "video-wallpaper");
+ return var_GetBool(player_, "video-wallpaper");
}
void
-vlc_player_vout_SetWallpaperModeEnabled(vlc_player_t *player, bool enabled)
+vlc_player_vout_SetWallpaperModeEnabled(vlc_player_t *player_, bool enabled)
{
- vlc_player_vout_SetVar(player, "video-wallpaper", VLC_VAR_BOOL,
+ vlc_player_vout_SetVar(player_, "video-wallpaper", VLC_VAR_BOOL,
(vlc_value_t) { .b_bool = enabled });
- vlc_player_vout_SendEvent(player, on_wallpaper_mode_changed, NULL, enabled);
+ vlc_player_vout_SendEvent(player_, on_wallpaper_mode_changed, NULL, enabled);
}
static const char *
@@ -3395,31 +3475,33 @@ vlc_vout_filter_type_to_varname(enum vlc_vout_filter_type type)
}
void
-vlc_player_vout_SetFilter(vlc_player_t *player, enum vlc_vout_filter_type type,
+vlc_player_vout_SetFilter(vlc_player_t *player_, enum vlc_vout_filter_type type,
const char *value)
{
const char *varname = vlc_vout_filter_type_to_varname(type);
if (varname)
- vlc_player_vout_SetVar(player, varname, VLC_VAR_STRING,
+ vlc_player_vout_SetVar(player_, varname, VLC_VAR_STRING,
(vlc_value_t) { .psz_string = (char *) value });
}
char *
-vlc_player_vout_GetFilter(vlc_player_t *player, enum vlc_vout_filter_type type)
+vlc_player_vout_GetFilter(vlc_player_t *player_, enum vlc_vout_filter_type type)
{
const char *varname = vlc_vout_filter_type_to_varname(type);
- return varname ? var_GetString(player, varname) : NULL;
+ return varname ? var_GetString(player_, varname) : NULL;
}
void
-vlc_player_vout_Snapshot(vlc_player_t *player)
+vlc_player_vout_Snapshot(vlc_player_t *player_)
{
- vlc_player_vout_TriggerOption(player, "video-snapshot");
+ vlc_player_vout_TriggerOption(player_, "video-snapshot");
}
static void
-vlc_player_InitLocks(vlc_player_t *player)
+vlc_player_InitLocks(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
vlc_mutex_init(&player->lock);
vlc_mutex_init(&player->vout_listeners_lock);
vlc_mutex_init(&player->aout_listeners_lock);
@@ -3428,8 +3510,10 @@ vlc_player_InitLocks(vlc_player_t *player)
}
static void
-vlc_player_DestroyLocks(vlc_player_t *player)
+vlc_player_DestroyLocks(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
vlc_mutex_destroy(&player->lock);
vlc_mutex_destroy(&player->vout_listeners_lock);
vlc_mutex_destroy(&player->aout_listeners_lock);
@@ -3438,12 +3522,14 @@ vlc_player_DestroyLocks(vlc_player_t *player)
}
void
-vlc_player_Delete(vlc_player_t *player)
+vlc_player_Delete(vlc_player_t *player_)
{
+ struct vlc_player_priv *player = vlc_player_priv(player_);
+
vlc_mutex_lock(&player->lock);
if (player->input)
- vlc_player_destructor_AddInput(player, player->input);
+ vlc_player_destructor_AddInput(player_, player->input);
player->deleting = true;
vlc_cond_signal(&player->destructor.wait);
@@ -3459,21 +3545,21 @@ vlc_player_Delete(vlc_player_t *player)
if (player->next_media)
input_item_Release(player->next_media);
- vlc_player_DestroyLocks(player);
+ vlc_player_DestroyLocks(player_);
- audio_output_t *aout = vlc_player_aout_Hold(player);
+ audio_output_t *aout = vlc_player_aout_Hold(player_);
if (aout)
{
- var_DelCallback(aout, "volume", vlc_player_AoutCallback, player);
- var_DelCallback(aout, "mute", vlc_player_AoutCallback, player);
- var_DelCallback(player, "corks", vlc_player_CorkCallback, NULL);
+ var_DelCallback(aout, "volume", vlc_player_AoutCallback, player_);
+ var_DelCallback(aout, "mute", vlc_player_AoutCallback, player_);
+ var_DelCallback(player_, "corks", vlc_player_CorkCallback, NULL);
aout_Release(aout);
}
input_resource_Release(player->resource);
if (player->renderer)
vlc_renderer_item_release(player->renderer);
- vlc_object_delete(player);
+ vlc_object_delete(player_);
}
vlc_player_t *
@@ -3482,9 +3568,11 @@ vlc_player_New(vlc_object_t *parent,
void *media_provider_data)
{
audio_output_t *aout = NULL;
- vlc_player_t *player = vlc_custom_create(parent, sizeof(*player), "player");
- if (!player)
+ vlc_player_t *player_ =
+ vlc_custom_create(parent, sizeof(struct vlc_player_priv), "player");
+ if (!player_)
return NULL;
+ struct vlc_player_priv *player = vlc_player_priv(player_);
assert(!media_provider || media_provider->get_next);
@@ -3513,7 +3601,7 @@ vlc_player_New(vlc_object_t *parent,
player->next_media = NULL;
#define VAR_CREATE(var, flag) do { \
- if (var_Create(player, var, flag) != VLC_SUCCESS) \
+ if (var_Create(player_, var, flag) != VLC_SUCCESS) \
goto error; \
} while(0)
@@ -3554,7 +3642,7 @@ vlc_player_New(vlc_object_t *parent,
#undef VAR_CREATE
- player->resource = input_resource_New(VLC_OBJECT(player));
+ player->resource = input_resource_New(VLC_OBJECT(player_));
if (!player->resource)
goto error;
@@ -3563,34 +3651,34 @@ vlc_player_New(vlc_object_t *parent,
aout = input_resource_GetAout(player->resource);
if (aout != NULL)
{
- var_AddCallback(aout, "volume", vlc_player_AoutCallback, player);
- var_AddCallback(aout, "mute", vlc_player_AoutCallback, player);
- var_AddCallback(player, "corks", vlc_player_CorkCallback, NULL);
+ var_AddCallback(aout, "volume", vlc_player_AoutCallback, player_);
+ var_AddCallback(aout, "mute", vlc_player_AoutCallback, player_);
+ var_AddCallback(player_, "corks", vlc_player_CorkCallback, NULL);
input_resource_PutAout(player->resource, aout);
}
player->deleting = false;
- vlc_player_InitLocks(player);
+ vlc_player_InitLocks(player_);
if (vlc_clone(&player->destructor.thread, vlc_player_destructor_Thread,
- player, VLC_THREAD_PRIORITY_LOW) != 0)
+ player_, VLC_THREAD_PRIORITY_LOW) != 0)
{
- vlc_player_DestroyLocks(player);
+ vlc_player_DestroyLocks(player_);
goto error;
}
- return player;
+ return player_;
error:
if (aout)
{
- var_DelCallback(aout, "volume", vlc_player_AoutCallback, player);
- var_DelCallback(aout, "mute", vlc_player_AoutCallback, player);
- var_DelCallback(player, "corks", vlc_player_AoutCallback, NULL);
+ var_DelCallback(aout, "volume", vlc_player_AoutCallback, player_);
+ var_DelCallback(aout, "mute", vlc_player_AoutCallback, player_);
+ var_DelCallback(player_, "corks", vlc_player_AoutCallback, NULL);
}
if (player->resource)
input_resource_Release(player->resource);
- vlc_object_delete(player);
+ vlc_object_delete(player_);
return NULL;
}
--
2.20.1
More information about the vlc-devel
mailing list