Commit aa2a22d8 authored by Laurent Aimar's avatar Laurent Aimar

* es_out: implement ES_OUT_SET_PCR and reset but don't use them !

 * demux: added demux2_New/Delete.
parent d4215f4f
......@@ -2,7 +2,7 @@
* demux.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: demux.c,v 1.4 2003/10/08 21:01:07 gbazin Exp $
* $Id: demux.c,v 1.5 2003/11/30 17:29:56 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -160,3 +160,96 @@ static void SeekOffset( input_thread_t *p_input, int64_t i_pos )
p_input->pf_seek( p_input, i_pos );
vlc_mutex_lock( &p_input->stream.stream_lock );
}
/*****************************************************************************
* demux2_New:
*****************************************************************************/
demux_t *__demux2_New( vlc_object_t *p_obj,
char *psz_mrl, stream_t *s, es_out_t *out )
{
demux_t *p_demux = vlc_object_create( p_obj, sizeof( demux_t ) );
char *psz_dup = strdup( psz_mrl ? psz_mrl : "" );
char *psz = strchr( psz_dup, ':' );
if( p_demux == NULL )
{
free( psz_dup );
return NULL;
}
/* Parse URL */
p_demux->psz_access = NULL;
p_demux->psz_demux = NULL;
p_demux->psz_path = NULL;
if( psz )
{
*psz++ = '\0';
if( psz[0] == '/' && psz[1] == '/' )
{
psz += 2;
}
p_demux->psz_path = strdup( psz );
psz = strchr( psz_dup, '/' );
if( psz )
{
*psz++ = '\0';
p_demux->psz_access = strdup( psz_dup );
p_demux->psz_demux = strdup( psz );
}
}
free( psz_dup );
if( p_demux->psz_access == NULL )
{
p_demux->psz_access = strdup( "" );
}
if( p_demux->psz_demux == NULL )
{
p_demux->psz_demux = strdup( "" );
}
if( p_demux->psz_path == NULL )
{
p_demux->psz_path = strdup( "" );
}
p_demux->s = s;
p_demux->out = out;
p_demux->pf_demux = NULL;
p_demux->pf_control = NULL;
p_demux->p_sys = NULL;
vlc_object_attach( p_demux, p_obj ); /* before module_Need (for var_Create...)*/
p_demux->p_module = module_Need( p_demux, "demux2", p_demux->psz_demux );
if( p_demux->p_module == NULL )
{
vlc_object_detach( p_demux );
vlc_object_destroy( p_demux );
return NULL;
}
return p_demux;
}
/*****************************************************************************
* demux2_Delete:
*****************************************************************************/
void demux2_Delete( demux_t *p_demux )
{
module_Unneed( p_demux, p_demux->p_module );
vlc_object_detach( p_demux );
free( p_demux->psz_path );
free( p_demux->psz_demux );
free( p_demux->psz_access );
vlc_object_destroy( p_demux );
}
......@@ -2,7 +2,7 @@
* es_out.c: Es Out handler for input.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: es_out.c,v 1.4 2003/11/27 12:22:15 fenrir Exp $
* $Id: es_out.c,v 1.5 2003/11/30 17:29:56 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -44,6 +44,7 @@ struct es_out_id_t
struct es_out_sys_t
{
input_thread_t *p_input;
vlc_bool_t b_pcr_set;
/* all es */
int i_id;
......@@ -92,6 +93,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input )
out->p_sys = p_sys;
p_sys->p_input = p_input;
p_sys->b_pcr_set = VLC_FALSE;
p_sys->b_active = VLC_FALSE;
p_sys->i_mode = ES_OUT_MODE_AUTO;
......@@ -422,6 +424,25 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
*****************************************************************************/
static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
{
es_out_sys_t *p_sys = out->p_sys;
if( p_sys->b_pcr_set && p_sys->p_input->stream.p_selected_program )
{
input_thread_t *p_input = p_sys->p_input;
if( p_block->i_dts > 0 )
{
p_block->i_dts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program,
p_block->i_dts * 9 / 100 );
}
if( p_block->i_pts > 0 )
{
p_block->i_pts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program,
p_block->i_pts * 9 / 100 );
}
}
vlc_mutex_lock( &out->p_sys->p_input->stream.stream_lock );
if( es->p_es->p_dec )
{
......@@ -489,6 +510,8 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
es_out_sys_t *p_sys = out->p_sys;
vlc_bool_t b, *pb;
int i, *pi;
int i_group;
int64_t i_pcr;
es_out_id_t *es;
......@@ -596,6 +619,31 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
}
return VLC_SUCCESS;
case ES_OUT_SET_PCR:
{
pgrm_descriptor_t *p_prgm = NULL;
i_group = (int)va_arg( args, int );
i_pcr = (int64_t)va_arg( args, int64_t );
/* search program */
if( ( p_prgm = input_FindProgram( p_sys->p_input, i_group ) ) )
{
input_ClockManageRef( p_sys->p_input, p_prgm, i_pcr );
}
p_sys->b_pcr_set = VLC_TRUE;
return VLC_SUCCESS;
}
case ES_OUT_RESET_PCR:
/* FIXME do it for all program */
if( p_sys->p_input->stream.p_selected_program )
{
p_sys->p_input->stream.p_selected_program->i_synchro_state = SYNCHRO_REINIT;
}
p_sys->b_pcr_set = VLC_TRUE;
return VLC_SUCCESS;
default:
msg_Err( p_sys->p_input, "unknown query in es_out_Control" );
return VLC_EGENERIC;
......
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