Commit bf12bbf6 authored by Gildas Bazin's avatar Gildas Bazin

* src/input/es_out.c, include/vlc_es_out.h: added an ES_OUT_GET_TS method to...

* src/input/es_out.c, include/vlc_es_out.h: added an ES_OUT_GET_TS method to get a converted timestamp.
* modules/control/netsync.c: fixed the netsync module.
parent acd4ad06
......@@ -64,6 +64,10 @@ enum es_out_query_e
ES_OUT_SET_GROUP_PCR, /* arg1= int i_group, arg2=int64_t i_pcr(microsecond!)*/
ES_OUT_RESET_PCR, /* no arg */
/* Timestamp handling, convert an input timestamp to a global clock one.
* (shouldn't have to be used by input plugins directly) */
ES_OUT_GET_TS, /* arg1=int64_t i_ts(microsecond!) (using default group 0), arg2=int64_t* converted i_ts */
/* Try not to use this one as it is a bit hacky */
ES_OUT_SET_FMT /* arg1= es_out_id_t* arg2=es_format_t* */
};
......
......@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/input.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
......@@ -147,7 +148,7 @@ static void Run( intf_thread_t *p_intf )
#define MAX_MSG_LENGTH (2 * sizeof(int64_t))
vlc_bool_t b_master = config_GetInt( p_intf, "netsync-master" );
char *psz_master;
char *psz_master = NULL;
char p_data[MAX_MSG_LENGTH];
int i_socket;
......@@ -166,8 +167,7 @@ static void Run( intf_thread_t *p_intf )
b_master ? NULL : psz_master,
b_master ? 0 : NETSYNC_PORT_MASTER );
if( !b_master )
free( psz_master );
if( psz_master ) free( psz_master );
if( i_socket < 0 )
{
......@@ -325,16 +325,15 @@ static void Run( intf_thread_t *p_intf )
static mtime_t GetClockRef( intf_thread_t *p_intf, mtime_t i_pts )
{
input_thread_t *p_input = p_intf->p_sys->p_input;
pgrm_descriptor_t *p_pgrm;
mtime_t i_ts;
if( !p_input ) return 0;
if( !p_input || !p_input->p_es_out ) return 0;
#if 0
p_pgrm = p_input->stream.p_selected_program;
if( p_pgrm ) return input_ClockGetTS( p_input, p_pgrm, i_pts );
#else
#warning "This code is currently broken. FIXME!!!"
#endif
if( es_out_Control( p_input->p_es_out, ES_OUT_GET_TS, i_pts, &i_ts ) ==
VLC_SUCCESS )
{
return i_ts;
}
return 0;
}
......@@ -742,7 +742,8 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
p_block->i_rate = p_input->i_rate;
/* TODO handle mute */
if( es->p_dec && ( es->fmt.i_cat != AUDIO_ES || p_input->i_rate == INPUT_RATE_DEFAULT ) )
if( es->p_dec && ( es->fmt.i_cat != AUDIO_ES ||
p_input->i_rate == INPUT_RATE_DEFAULT ) )
{
input_DecoderDecode( es->p_dec, p_block );
}
......@@ -984,6 +985,18 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
}
return VLC_SUCCESS;
case ES_OUT_GET_TS:
if( p_sys->p_pgrm )
{
int64_t i_ts = (int64_t)va_arg( args, int64_t );
int64_t *pi_ts = (int64_t *)va_arg( args, int64_t * );
*pi_ts = input_ClockGetTS( p_sys->p_input,
&p_sys->p_pgrm->clock,
( i_ts + 11 ) * 9 / 100 );
return VLC_SUCCESS;
}
return VLC_EGENERIC;
case ES_OUT_GET_GROUP:
pi = (int*) va_arg( args, int* );
if( p_sys->p_pgrm )
......
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