Commit d551561d authored by Laurent Aimar's avatar Laurent Aimar

Improved a bit es_out_t generalisation.

parent a7e6be66
...@@ -71,7 +71,7 @@ enum es_out_query_e ...@@ -71,7 +71,7 @@ enum es_out_query_e
/* PCR handling, DTS/PTS will be automatically computed using thoses PCR /* PCR handling, DTS/PTS will be automatically computed using thoses PCR
* XXX: SET_PCR(_GROUP) are in charge of the pace control. They will wait * XXX: SET_PCR(_GROUP) are in charge of the pace control. They will wait
* to slow down the demuxer so that it reads at the right speed. * to slow down the demuxer so that it reads at the right speed.
* XXX: if you want PREROLL just call ES_OUT_SET_NEXT_DISPLAY_TIME and send$ * XXX: if you want PREROLL just call ES_OUT_SET_NEXT_DISPLAY_TIME and send
* as you would normally do. * as you would normally do.
*/ */
ES_OUT_SET_PCR, /* arg1=int64_t i_pcr(microsecond!) (using default group 0)*/ ES_OUT_SET_PCR, /* arg1=int64_t i_pcr(microsecond!) (using default group 0)*/
...@@ -92,7 +92,10 @@ enum es_out_query_e ...@@ -92,7 +92,10 @@ enum es_out_query_e
/* Set epg for group (dynamic) */ /* Set epg for group (dynamic) */
ES_OUT_SET_GROUP_EPG, /* arg1=int i_group arg2=vlc_epg_t */ ES_OUT_SET_GROUP_EPG, /* arg1=int i_group arg2=vlc_epg_t */
/* */ /* */
ES_OUT_DEL_GROUP /* arg1=int i_group */ ES_OUT_DEL_GROUP, /* arg1=int i_group */
/* First value usable for private control */
ES_OUT_PRIVATE_START = 0x10000,
}; };
struct es_out_t struct es_out_t
...@@ -101,7 +104,9 @@ struct es_out_t ...@@ -101,7 +104,9 @@ struct es_out_t
int (*pf_send) ( es_out_t *, es_out_id_t *, block_t * ); int (*pf_send) ( es_out_t *, es_out_id_t *, block_t * );
void (*pf_del) ( es_out_t *, es_out_id_t * ); void (*pf_del) ( es_out_t *, es_out_id_t * );
int (*pf_control)( es_out_t *, int i_query, va_list ); int (*pf_control)( es_out_t *, int i_query, va_list );
bool b_sout; void (*pf_destroy)( es_out_t * );
bool b_sout;
es_out_sys_t *p_sys; es_out_sys_t *p_sys;
}; };
...@@ -139,6 +144,11 @@ static inline int es_out_Control( es_out_t *out, int i_query, ... ) ...@@ -139,6 +144,11 @@ static inline int es_out_Control( es_out_t *out, int i_query, ... )
return i_result; return i_result;
} }
static inline void es_out_Delete( es_out_t *p_out )
{
p_out->pf_destroy( p_out );
}
/** /**
* @} * @}
*/ */
......
...@@ -160,9 +160,10 @@ struct es_out_sys_t ...@@ -160,9 +160,10 @@ struct es_out_sys_t
static es_out_id_t *EsOutAdd ( es_out_t *, es_format_t * ); static es_out_id_t *EsOutAdd ( es_out_t *, es_format_t * );
static int EsOutSend ( es_out_t *, es_out_id_t *, block_t * ); static int EsOutSend ( es_out_t *, es_out_id_t *, block_t * );
static void EsOutDel ( es_out_t *, es_out_id_t * ); static void EsOutDel ( es_out_t *, es_out_id_t * );
static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force );
static int EsOutControl( es_out_t *, int i_query, va_list ); static int EsOutControl( es_out_t *, int i_query, va_list );
static void EsOutDelete ( es_out_t *out );
static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force );
static void EsOutAddInfo( es_out_t *, es_out_id_t *es ); static void EsOutAddInfo( es_out_t *, es_out_id_t *es );
static bool EsIsSelected( es_out_id_t *es ); static bool EsIsSelected( es_out_id_t *es );
...@@ -221,6 +222,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate ) ...@@ -221,6 +222,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
out->pf_send = EsOutSend; out->pf_send = EsOutSend;
out->pf_del = EsOutDel; out->pf_del = EsOutDel;
out->pf_control = EsOutControl; out->pf_control = EsOutControl;
out->pf_destroy = EsOutDelete;
out->p_sys = p_sys; out->p_sys = p_sys;
out->b_sout = p_input->p->p_sout != NULL; out->b_sout = p_input->p->p_sout != NULL;
...@@ -308,62 +310,6 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate ) ...@@ -308,62 +310,6 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
return out; return out;
} }
/*****************************************************************************
* input_EsOutDelete:
*****************************************************************************/
void input_EsOutDelete( es_out_t *out )
{
es_out_sys_t *p_sys = out->p_sys;
int i;
if( p_sys->p_sout_record )
input_EsOutSetRecord( out, false );
for( i = 0; i < p_sys->i_es; i++ )
{
if( p_sys->es[i]->p_dec )
input_DecoderDelete( p_sys->es[i]->p_dec );
free( p_sys->es[i]->psz_language );
free( p_sys->es[i]->psz_language_code );
es_format_Clean( &p_sys->es[i]->fmt );
free( p_sys->es[i] );
}
if( p_sys->ppsz_audio_language )
{
for( i = 0; p_sys->ppsz_audio_language[i]; i++ )
free( p_sys->ppsz_audio_language[i] );
free( p_sys->ppsz_audio_language );
}
if( p_sys->ppsz_sub_language )
{
for( i = 0; p_sys->ppsz_sub_language[i]; i++ )
free( p_sys->ppsz_sub_language[i] );
free( p_sys->ppsz_sub_language );
}
free( p_sys->es );
/* FIXME duplicate work EsOutProgramDel (but we cannot use it) add a EsOutProgramClean ? */
for( i = 0; i < p_sys->i_pgrm; i++ )
{
es_out_pgrm_t *p_pgrm = p_sys->pgrm[i];
input_clock_Delete( p_pgrm->p_clock );
free( p_pgrm->psz_now_playing );
free( p_pgrm->psz_publisher );
free( p_pgrm->psz_name );
if( p_pgrm->p_epg )
vlc_epg_Delete( p_pgrm->p_epg );
free( p_pgrm );
}
TAB_CLEAN( p_sys->i_pgrm, p_sys->pgrm );
vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
free( out );
}
es_out_id_t *input_EsOutGetFromID( es_out_t *out, int i_id ) es_out_id_t *input_EsOutGetFromID( es_out_t *out, int i_id )
{ {
int i; int i;
...@@ -671,6 +617,60 @@ void input_EsOutUnlock( es_out_t *out ) ...@@ -671,6 +617,60 @@ void input_EsOutUnlock( es_out_t *out )
/***************************************************************************** /*****************************************************************************
* *
*****************************************************************************/ *****************************************************************************/
static void EsOutDelete( es_out_t *out )
{
es_out_sys_t *p_sys = out->p_sys;
int i;
if( p_sys->p_sout_record )
input_EsOutSetRecord( out, false );
for( i = 0; i < p_sys->i_es; i++ )
{
if( p_sys->es[i]->p_dec )
input_DecoderDelete( p_sys->es[i]->p_dec );
free( p_sys->es[i]->psz_language );
free( p_sys->es[i]->psz_language_code );
es_format_Clean( &p_sys->es[i]->fmt );
free( p_sys->es[i] );
}
if( p_sys->ppsz_audio_language )
{
for( i = 0; p_sys->ppsz_audio_language[i]; i++ )
free( p_sys->ppsz_audio_language[i] );
free( p_sys->ppsz_audio_language );
}
if( p_sys->ppsz_sub_language )
{
for( i = 0; p_sys->ppsz_sub_language[i]; i++ )
free( p_sys->ppsz_sub_language[i] );
free( p_sys->ppsz_sub_language );
}
free( p_sys->es );
/* FIXME duplicate work EsOutProgramDel (but we cannot use it) add a EsOutProgramClean ? */
for( i = 0; i < p_sys->i_pgrm; i++ )
{
es_out_pgrm_t *p_pgrm = p_sys->pgrm[i];
input_clock_Delete( p_pgrm->p_clock );
free( p_pgrm->psz_now_playing );
free( p_pgrm->psz_publisher );
free( p_pgrm->psz_name );
if( p_pgrm->p_epg )
vlc_epg_Delete( p_pgrm->p_epg );
free( p_pgrm );
}
TAB_CLEAN( p_sys->i_pgrm, p_sys->pgrm );
vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
free( out );
}
static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced ) static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
{ {
es_out_sys_t *p_sys = out->p_sys; es_out_sys_t *p_sys = out->p_sys;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <vlc_common.h> #include <vlc_common.h>
es_out_t *input_EsOutNew( input_thread_t *, int i_rate ); es_out_t *input_EsOutNew( input_thread_t *, int i_rate );
void input_EsOutDelete( es_out_t * );
es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id ); es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id );
mtime_t input_EsOutGetWakeup( es_out_t * ); mtime_t input_EsOutGetWakeup( es_out_t * );
void input_EsOutSetDelay( es_out_t *, int i_cat, int64_t ); void input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
......
...@@ -1275,7 +1275,7 @@ error: ...@@ -1275,7 +1275,7 @@ error:
input_ChangeState( p_input, ERROR_S ); input_ChangeState( p_input, ERROR_S );
if( p_input->p->p_es_out ) if( p_input->p->p_es_out )
input_EsOutDelete( p_input->p->p_es_out ); es_out_Delete( p_input->p->p_es_out );
#ifdef ENABLE_SOUT #ifdef ENABLE_SOUT
if( p_input->p->p_sout ) if( p_input->p->p_sout )
{ {
...@@ -1363,7 +1363,7 @@ static void End( input_thread_t * p_input ) ...@@ -1363,7 +1363,7 @@ static void End( input_thread_t * p_input )
/* Unload all modules */ /* Unload all modules */
if( p_input->p->p_es_out ) if( p_input->p->p_es_out )
input_EsOutDelete( p_input->p->p_es_out ); es_out_Delete( p_input->p->p_es_out );
if( !p_input->b_preparsing ) if( !p_input->b_preparsing )
{ {
......
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