[vlc-devel] [PATCH 1/4] clock: rename: s/master/driver, s/slave/client
Thomas Guillem
thomas at gllm.fr
Thu Mar 11 11:31:28 UTC 2021
In order to use more descriptive and inclusive terms.
No functional changes.
---
src/audio_output/filters.c | 2 +-
src/clock/clock.c | 92 +++++++++++++++++++-------------------
src/clock/clock.h | 32 ++++++-------
src/input/es_out.c | 24 +++++-----
src/libvlc-module.c | 10 ++---
5 files changed, 80 insertions(+), 80 deletions(-)
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 4578051a41d..a1591548f55 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -507,7 +507,7 @@ aout_filters_t *aout_FiltersNewWithClock(vlc_object_t *obj, const vlc_clock_t *c
filters->count = 0;
if (clock)
{
- filters->clock = vlc_clock_CreateSlave(clock, AUDIO_ES);
+ filters->clock = vlc_clock_CreateClient(clock, AUDIO_ES);
if (!filters->clock)
goto error;
}
diff --git a/src/clock/clock.c b/src/clock/clock.c
index cfbb5eb6f6d..3147920028a 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -33,7 +33,7 @@ struct vlc_clock_main_t
vlc_mutex_t lock;
vlc_cond_t cond;
- vlc_clock_t *master;
+ vlc_clock_t *driver;
unsigned rc;
@@ -51,7 +51,7 @@ struct vlc_clock_main_t
vlc_tick_t pause_date;
unsigned wait_sync_ref_priority;
- clock_point_t wait_sync_ref; /* When the master */
+ clock_point_t wait_sync_ref; /* When the driver */
clock_point_t first_pcr;
vlc_tick_t output_dejitter; /* Delay used to absorb the output clock jitter */
vlc_tick_t input_dejitter; /* Delay used to absorb the input jitter */
@@ -109,7 +109,7 @@ static inline void vlc_clock_on_update(vlc_clock_t *clock,
clock->cbs_data);
}
-static vlc_tick_t vlc_clock_master_update(vlc_clock_t *clock,
+static vlc_tick_t vlc_clock_driver_update(vlc_clock_t *clock,
vlc_tick_t system_now,
vlc_tick_t original_ts, double rate,
unsigned frame_rate,
@@ -164,7 +164,7 @@ static vlc_tick_t vlc_clock_master_update(vlc_clock_t *clock,
return VLC_TICK_INVALID;
}
-static void vlc_clock_master_reset(vlc_clock_t *clock)
+static void vlc_clock_driver_reset(vlc_clock_t *clock)
{
vlc_clock_main_t *main_clock = clock->owner;
@@ -173,7 +173,7 @@ static void vlc_clock_master_reset(vlc_clock_t *clock)
assert(main_clock->delay <= 0);
assert(clock->delay >= 0);
- /* Move the delay from the slaves to the master */
+ /* Move the delay from the clients to the driver */
if (clock->delay != 0 && main_clock->delay != 0)
{
vlc_tick_t delta = clock->delay + main_clock->delay;
@@ -194,7 +194,7 @@ static void vlc_clock_master_reset(vlc_clock_t *clock)
vlc_clock_on_update(clock, VLC_TICK_INVALID, VLC_TICK_INVALID, 1.f, 0, 0);
}
-static vlc_tick_t vlc_clock_master_set_delay(vlc_clock_t *clock, vlc_tick_t delay)
+static vlc_tick_t vlc_clock_driver_set_delay(vlc_clock_t *clock, vlc_tick_t delay)
{
vlc_clock_main_t *main_clock = clock->owner;
vlc_mutex_lock(&main_clock->lock);
@@ -203,13 +203,13 @@ static vlc_tick_t vlc_clock_master_set_delay(vlc_clock_t *clock, vlc_tick_t dela
if (delta > 0)
{
- /* The master clock is delayed */
+ /* The driver clock is delayed */
main_clock->delay = 0;
clock->delay = delay;
}
else
{
- /* Delay all slaves clock instead of advancing the master one */
+ /* Delay all clients clock instead of advancing the driver one */
main_clock->delay = delta;
}
@@ -250,7 +250,7 @@ vlc_clock_monotonic_to_system_locked(vlc_clock_t *clock, vlc_tick_t now,
+ main_clock->wait_sync_ref.system;
}
-static vlc_tick_t vlc_clock_slave_to_system_locked(vlc_clock_t *clock,
+static vlc_tick_t vlc_clock_client_to_system_locked(vlc_clock_t *clock,
vlc_tick_t now,
vlc_tick_t ts, double rate)
{
@@ -261,7 +261,7 @@ static vlc_tick_t vlc_clock_slave_to_system_locked(vlc_clock_t *clock,
vlc_tick_t system = main_stream_to_system(main_clock, ts);
if (system == VLC_TICK_INVALID)
{
- /* We don't have a master sync point, let's fallback to a monotonic ref
+ /* We don't have a driver sync point, let's fallback to a monotonic ref
* point */
system = vlc_clock_monotonic_to_system_locked(clock, now, ts, rate);
}
@@ -269,7 +269,7 @@ static vlc_tick_t vlc_clock_slave_to_system_locked(vlc_clock_t *clock,
return system + (clock->delay - main_clock->delay) * rate;
}
-static vlc_tick_t vlc_clock_master_to_system_locked(vlc_clock_t *clock,
+static vlc_tick_t vlc_clock_driver_to_system_locked(vlc_clock_t *clock,
vlc_tick_t now,
vlc_tick_t ts, double rate)
{
@@ -277,7 +277,7 @@ static vlc_tick_t vlc_clock_master_to_system_locked(vlc_clock_t *clock,
vlc_tick_t system = main_stream_to_system(main_clock, ts);
if (system == VLC_TICK_INVALID)
{
- /* We don't have a master sync point, let's fallback to a monotonic ref
+ /* We don't have a driver sync point, let's fallback to a monotonic ref
* point */
system = vlc_clock_monotonic_to_system_locked(clock, now, ts, rate);
}
@@ -285,11 +285,11 @@ static vlc_tick_t vlc_clock_master_to_system_locked(vlc_clock_t *clock,
return system + clock->delay * rate;
}
-static vlc_tick_t vlc_clock_slave_update(vlc_clock_t *clock,
- vlc_tick_t system_now,
- vlc_tick_t ts, double rate,
- unsigned frame_rate,
- unsigned frame_rate_base)
+static vlc_tick_t vlc_clock_client_update(vlc_clock_t *clock,
+ vlc_tick_t system_now,
+ vlc_tick_t ts, double rate,
+ unsigned frame_rate,
+ unsigned frame_rate_base)
{
vlc_clock_main_t *main_clock = clock->owner;
@@ -311,7 +311,7 @@ static vlc_tick_t vlc_clock_slave_update(vlc_clock_t *clock,
return computed - system_now;
}
-static void vlc_clock_slave_reset(vlc_clock_t *clock)
+static void vlc_clock_client_reset(vlc_clock_t *clock)
{
vlc_clock_main_t *main_clock = clock->owner;
vlc_mutex_lock(&main_clock->lock);
@@ -324,7 +324,7 @@ static void vlc_clock_slave_reset(vlc_clock_t *clock)
vlc_clock_on_update(clock, VLC_TICK_INVALID, VLC_TICK_INVALID, 1.0f, 0, 0);
}
-static vlc_tick_t vlc_clock_slave_set_delay(vlc_clock_t *clock, vlc_tick_t delay)
+static vlc_tick_t vlc_clock_client_set_delay(vlc_clock_t *clock, vlc_tick_t delay)
{
vlc_clock_main_t *main_clock = clock->owner;
vlc_mutex_lock(&main_clock->lock);
@@ -337,7 +337,7 @@ static vlc_tick_t vlc_clock_slave_set_delay(vlc_clock_t *clock, vlc_tick_t delay
}
void vlc_clock_Wait(vlc_clock_t *clock, vlc_tick_t system_now, vlc_tick_t ts,
- double rate, vlc_tick_t max_duration)
+ double rate, vlc_tick_t max_duration)
{
vlc_clock_main_t *main_clock = clock->owner;
vlc_mutex_lock(&main_clock->lock);
@@ -367,7 +367,7 @@ vlc_clock_main_t *vlc_clock_main_New(void)
vlc_mutex_init(&main_clock->lock);
vlc_cond_init(&main_clock->cond);
- main_clock->master = NULL;
+ main_clock->driver = NULL;
main_clock->rc = 1;
main_clock->coeff = 1.0f;
@@ -520,20 +520,20 @@ void vlc_clock_ConvertArrayToSystem(vlc_clock_t *clock, vlc_tick_t system_now,
vlc_mutex_unlock(&main_clock->lock);
}
-static void vlc_clock_set_master_callbacks(vlc_clock_t *clock)
+static void vlc_clock_set_driver_callbacks(vlc_clock_t *clock)
{
- clock->update = vlc_clock_master_update;
- clock->reset = vlc_clock_master_reset;
- clock->set_delay = vlc_clock_master_set_delay;
- clock->to_system_locked = vlc_clock_master_to_system_locked;
+ clock->update = vlc_clock_driver_update;
+ clock->reset = vlc_clock_driver_reset;
+ clock->set_delay = vlc_clock_driver_set_delay;
+ clock->to_system_locked = vlc_clock_driver_to_system_locked;
}
-static void vlc_clock_set_slave_callbacks(vlc_clock_t *clock)
+static void vlc_clock_set_client_callbacks(vlc_clock_t *clock)
{
- clock->update = vlc_clock_slave_update;
- clock->reset = vlc_clock_slave_reset;
- clock->set_delay = vlc_clock_slave_set_delay;
- clock->to_system_locked = vlc_clock_slave_to_system_locked;
+ clock->update = vlc_clock_client_update;
+ clock->reset = vlc_clock_client_reset;
+ clock->set_delay = vlc_clock_client_set_delay;
+ clock->to_system_locked = vlc_clock_client_to_system_locked;
}
static vlc_clock_t *vlc_clock_main_Create(vlc_clock_main_t *main_clock,
@@ -555,30 +555,30 @@ static vlc_clock_t *vlc_clock_main_Create(vlc_clock_main_t *main_clock,
return clock;
}
-vlc_clock_t *vlc_clock_main_CreateMaster(vlc_clock_main_t *main_clock,
+vlc_clock_t *vlc_clock_main_CreateDriver(vlc_clock_main_t *main_clock,
const struct vlc_clock_cbs *cbs,
void *cbs_data)
{
- /* The master has always the 0 priority */
+ /* The driver has always the 0 priority */
vlc_clock_t *clock = vlc_clock_main_Create(main_clock, 0, cbs, cbs_data);
if (!clock)
return NULL;
vlc_mutex_lock(&main_clock->lock);
- assert(main_clock->master == NULL);
+ assert(main_clock->driver == NULL);
- vlc_clock_set_master_callbacks(clock);
- main_clock->master = clock;
+ vlc_clock_set_driver_callbacks(clock);
+ main_clock->driver = clock;
main_clock->rc++;
vlc_mutex_unlock(&main_clock->lock);
return clock;
}
-vlc_clock_t *vlc_clock_main_CreateSlave(vlc_clock_main_t *main_clock,
- enum es_format_category_e cat,
- const struct vlc_clock_cbs *cbs,
- void *cbs_data)
+vlc_clock_t *vlc_clock_main_CreateClient(vlc_clock_main_t *main_clock,
+ enum es_format_category_e cat,
+ const struct vlc_clock_cbs *cbs,
+ void *cbs_data)
{
/* SPU outputs should have lower priority than VIDEO outputs since they
* necessarily depend on a VIDEO output. This mean that a SPU reference
@@ -603,27 +603,27 @@ vlc_clock_t *vlc_clock_main_CreateSlave(vlc_clock_main_t *main_clock,
return NULL;
vlc_mutex_lock(&main_clock->lock);
- vlc_clock_set_slave_callbacks(clock);
+ vlc_clock_set_client_callbacks(clock);
main_clock->rc++;
vlc_mutex_unlock(&main_clock->lock);
return clock;
}
-vlc_clock_t *vlc_clock_CreateSlave(const vlc_clock_t *clock,
- enum es_format_category_e cat)
+vlc_clock_t *vlc_clock_CreateClient(const vlc_clock_t *clock,
+ enum es_format_category_e cat)
{
- return vlc_clock_main_CreateSlave(clock->owner, cat, NULL, NULL);
+ return vlc_clock_main_CreateClient(clock->owner, cat, NULL, NULL);
}
void vlc_clock_Delete(vlc_clock_t *clock)
{
vlc_clock_main_t *main_clock = clock->owner;
vlc_mutex_lock(&main_clock->lock);
- if (clock == main_clock->master)
+ if (clock == main_clock->driver)
{
vlc_clock_main_reset(main_clock);
- main_clock->master = NULL;
+ main_clock->driver = NULL;
}
main_clock->rc--;
vlc_mutex_unlock(&main_clock->lock);
diff --git a/src/clock/clock.h b/src/clock/clock.h
index e7373391697..eef01d07d0e 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -20,11 +20,11 @@
#ifndef VLC_CLOCK_H
#define VLC_CLOCK_H
-enum vlc_clock_master_source
+enum vlc_clock_driver_source
{
- VLC_CLOCK_MASTER_AUDIO = 0,
- VLC_CLOCK_MASTER_MONOTONIC,
- VLC_CLOCK_MASTER_DEFAULT = VLC_CLOCK_MASTER_AUDIO,
+ VLC_CLOCK_DRIVER_AUDIO = 0,
+ VLC_CLOCK_DRIVER_MONOTONIC,
+ VLC_CLOCK_DRIVER_DEFAULT = VLC_CLOCK_DRIVER_AUDIO,
};
typedef struct vlc_clock_main_t vlc_clock_main_t;
@@ -94,33 +94,33 @@ void vlc_clock_main_ChangePause(vlc_clock_main_t *clock, vlc_tick_t system_now,
bool paused);
/**
- * This function creates a new master vlc_clock_t interface
+ * This function creates a new driver vlc_clock_t interface
*
- * @warning There can be only one master at a given time.
+ * @warning There can be only one driver at a given time.
*
* You must use vlc_clock_Delete to free it.
*/
-vlc_clock_t *vlc_clock_main_CreateMaster(vlc_clock_main_t *main_clock,
+vlc_clock_t *vlc_clock_main_CreateDriver(vlc_clock_main_t *main_clock,
const struct vlc_clock_cbs *cbs,
void *cbs_data);
/**
- * This function creates a new slave vlc_clock_t interface
+ * This function creates a new client vlc_clock_t interface
*
* You must use vlc_clock_Delete to free it.
*/
-vlc_clock_t *vlc_clock_main_CreateSlave(vlc_clock_main_t *main_clock,
- enum es_format_category_e cat,
- const struct vlc_clock_cbs *cbs,
- void *cbs_data);
+vlc_clock_t *vlc_clock_main_CreateClient(vlc_clock_main_t *main_clock,
+ enum es_format_category_e cat,
+ const struct vlc_clock_cbs *cbs,
+ void *cbs_data);
/**
- * This function creates a new slave vlc_clock_t interface
+ * This function creates a new client vlc_clock_t interface
*
* You must use vlc_clock_Delete to free it.
*/
-vlc_clock_t *vlc_clock_CreateSlave(const vlc_clock_t *clock,
- enum es_format_category_e cat);
+vlc_clock_t *vlc_clock_CreateClient(const vlc_clock_t *clock,
+ enum es_format_category_e cat);
/**
* This function free the resources allocated by vlc_clock*Create*()
@@ -132,7 +132,7 @@ void vlc_clock_Delete(vlc_clock_t *clock);
* @param system_now valid system time or INT64_MAX is the updated point is
* forced (when paused for example)
* @return a valid drift relative time, VLC_TICK_INVALID if there is no drift
- * (clock is master) or INT64_MAX if the clock is paused
+ * (the clock is the driver) or INT64_MAX if the clock is paused
*/
vlc_tick_t vlc_clock_Update(vlc_clock_t *clock, vlc_tick_t system_now,
vlc_tick_t ts, double rate);
diff --git a/src/input/es_out.c b/src/input/es_out.c
index b3b35621052..0ea8cb34ec9 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -182,7 +182,7 @@ typedef struct
struct vlc_list programs;
es_out_pgrm_t *p_pgrm; /* Master program */
- enum es_format_category_e i_master_source_cat;
+ enum es_format_category_e i_driver_source_cat;
/* all es */
int i_id;
@@ -516,16 +516,16 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, input_source_t *main_source,
p_sys->i_group_id = var_GetInteger( p_input, "program" );
- enum vlc_clock_master_source master_source =
+ enum vlc_clock_driver_source driver_source =
var_InheritInteger( p_input, "clock-master" );
- switch( master_source )
+ switch( driver_source )
{
- case VLC_CLOCK_MASTER_AUDIO:
- p_sys->i_master_source_cat = AUDIO_ES;
+ case VLC_CLOCK_DRIVER_AUDIO:
+ p_sys->i_driver_source_cat = AUDIO_ES;
break;
- case VLC_CLOCK_MASTER_MONOTONIC:
+ case VLC_CLOCK_DRIVER_MONOTONIC:
default:
- p_sys->i_master_source_cat = UNKNOWN_ES;
+ p_sys->i_driver_source_cat = UNKNOWN_ES;
break;
}
@@ -2165,20 +2165,20 @@ static void EsOutCreateDecoder( es_out_t *out, es_out_id_t *p_es )
assert( p_es->p_pgrm );
if( p_es->fmt.i_cat != UNKNOWN_ES
- && p_es->fmt.i_cat == p_sys->i_master_source_cat
+ && p_es->fmt.i_cat == p_sys->i_driver_source_cat
&& p_es->p_pgrm->p_master_clock == NULL )
{
p_es->master = true;
p_es->p_pgrm->p_master_clock = p_es->p_clock =
- vlc_clock_main_CreateMaster( p_es->p_pgrm->p_main_clock,
+ vlc_clock_main_CreateDriver( p_es->p_pgrm->p_main_clock,
&clock_cbs, p_es );
}
else
{
p_es->master = false;
- p_es->p_clock = vlc_clock_main_CreateSlave( p_es->p_pgrm->p_main_clock,
- p_es->fmt.i_cat,
- &clock_cbs, p_es );
+ p_es->p_clock = vlc_clock_main_CreateClient( p_es->p_pgrm->p_main_clock,
+ p_es->fmt.i_cat,
+ &clock_cbs, p_es );
}
if( !p_es->p_clock )
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 16d96d53b5c..acfff58fe91 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -536,11 +536,11 @@ static const char *const screensaver_texts[] = {
"This defines the maximum input delay jitter that the synchronization " \
"algorithms should try to compensate (in milliseconds)." )
-#define CLOCK_MASTER_TEXT N_("Clock master source")
+#define CLOCK_DRIVER_TEXT N_("Clock driver source")
static const int pi_clock_master_values[] = {
- VLC_CLOCK_MASTER_AUDIO,
- VLC_CLOCK_MASTER_MONOTONIC,
+ VLC_CLOCK_DRIVER_AUDIO,
+ VLC_CLOCK_DRIVER_MONOTONIC,
};
static const char *const ppsz_clock_master_descriptions[] = {
N_("Audio"),
@@ -1977,8 +1977,8 @@ vlc_module_begin ()
add_integer( "clock-jitter", 5000, CLOCK_JITTER_TEXT,
CLOCK_JITTER_LONGTEXT, true )
change_safe()
- add_integer( "clock-master", VLC_CLOCK_MASTER_DEFAULT,
- CLOCK_MASTER_TEXT, NULL, true )
+ add_integer( "clock-master", VLC_CLOCK_DRIVER_DEFAULT,
+ CLOCK_DRIVER_TEXT, NULL, true )
change_integer_list( pi_clock_master_values, ppsz_clock_master_descriptions )
add_directory("input-record-path", NULL,
--
2.30.0
More information about the vlc-devel
mailing list