Commit 8974b4a5 authored by Thomas Guillem's avatar Thomas Guillem

clock: add 'clock-master' option to choose the master clock

parent 242669ab
......@@ -20,6 +20,13 @@
#ifndef VLC_CLOCK_H
#define VLC_CLOCK_H
enum vlc_clock_master_source
{
VLC_CLOCK_MASTER_AUDIO = 0,
VLC_CLOCK_MASTER_MONOTONIC,
VLC_CLOCK_MASTER_DEFAULT = VLC_CLOCK_MASTER_AUDIO,
};
typedef struct vlc_clock_main_t vlc_clock_main_t;
typedef struct vlc_clock_t vlc_clock_t;
......
......@@ -163,6 +163,8 @@ typedef struct
struct vlc_list programs;
es_out_pgrm_t *p_pgrm; /* Master program */
enum es_format_category_e i_master_source_cat;
/* all es */
int i_id;
struct vlc_list es;
......@@ -346,6 +348,19 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, float rate )
p_sys->i_group_id = var_GetInteger( p_input, "program" );
enum vlc_clock_master_source master_source =
var_InheritInteger( p_input, "clock-master" );
switch( master_source )
{
case VLC_CLOCK_MASTER_AUDIO:
p_sys->i_master_source_cat = AUDIO_ES;
break;
case VLC_CLOCK_MASTER_MONOTONIC:
default:
p_sys->i_master_source_cat = UNKNOWN_ES;
break;
}
p_sys->i_pause_date = -1;
p_sys->rate = rate;
......@@ -1796,7 +1811,9 @@ static void EsOutCreateDecoder( es_out_t *out, es_out_id_t *p_es )
input_thread_t *p_input = p_sys->p_input;
decoder_t *dec;
if( p_es->fmt.i_cat == AUDIO_ES && p_es->p_pgrm->p_master_clock == NULL )
if( p_es->fmt.i_cat != UNKNOWN_ES
&& p_es->fmt.i_cat == p_sys->i_master_source_cat
&& p_es->p_pgrm->p_master_clock == NULL )
p_es->p_pgrm->p_master_clock = p_es->p_clock =
vlc_clock_main_CreateMaster( p_es->p_pgrm->p_main_clock );
else
......
......@@ -45,6 +45,8 @@
#include <vlc_aout.h>
#include <vlc_vout.h>
#include "clock/clock.h"
static const char *const ppsz_snap_formats[] =
{ "png", "jpg", "tiff" };
......@@ -527,6 +529,17 @@ static const char *const ppsz_pos_descriptions[] =
"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")
static const int pi_clock_master_values[] = {
VLC_CLOCK_MASTER_AUDIO,
VLC_CLOCK_MASTER_MONOTONIC,
};
static const char *const ppsz_clock_master_descriptions[] = {
N_("Audio"),
N_("Monotonic")
};
#define NETSYNC_TEXT N_("Network synchronisation" )
#define NETSYNC_LONGTEXT N_( "This allows you to remotely " \
"synchronise clocks for server and client. The detailed settings " \
......@@ -1940,6 +1953,9 @@ 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 )
change_integer_list( pi_clock_master_values, ppsz_clock_master_descriptions )
add_bool( "network-synchronisation", false, NETSYNC_TEXT,
NETSYNC_LONGTEXT, true )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment