[vlc-devel] commit: Improved a bit es_out_t generalisation. (Laurent Aimar )
git version control
git at videolan.org
Tue Nov 4 23:56:11 CET 2008
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Nov 2 13:53:01 2008 +0100| [d551561daaeb546f7fb328dbf07c07562de3a335] | committer: Laurent Aimar
Improved a bit es_out_t generalisation.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d551561daaeb546f7fb328dbf07c07562de3a335
---
include/vlc_es_out.h | 16 ++++++-
src/input/es_out.c | 114 +++++++++++++++++++++++++-------------------------
src/input/es_out.h | 1 -
src/input/input.c | 4 +-
4 files changed, 72 insertions(+), 63 deletions(-)
diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 08e75eb..9afef8e 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -71,7 +71,7 @@ enum es_out_query_e
/* 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
* 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.
*/
ES_OUT_SET_PCR, /* arg1=int64_t i_pcr(microsecond!) (using default group 0)*/
@@ -92,7 +92,10 @@ enum es_out_query_e
/* Set epg for group (dynamic) */
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
@@ -101,7 +104,9 @@ struct es_out_t
int (*pf_send) ( es_out_t *, es_out_id_t *, block_t * );
void (*pf_del) ( es_out_t *, es_out_id_t * );
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;
};
@@ -139,6 +144,11 @@ static inline int es_out_Control( es_out_t *out, int i_query, ... )
return i_result;
}
+static inline void es_out_Delete( es_out_t *p_out )
+{
+ p_out->pf_destroy( p_out );
+}
+
/**
* @}
*/
diff --git a/src/input/es_out.c b/src/input/es_out.c
index c4e46e3..6240f77 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -160,9 +160,10 @@ struct es_out_sys_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 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 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 bool EsIsSelected( es_out_id_t *es );
@@ -221,6 +222,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
out->pf_send = EsOutSend;
out->pf_del = EsOutDel;
out->pf_control = EsOutControl;
+ out->pf_destroy = EsOutDelete;
out->p_sys = p_sys;
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 )
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 )
{
int i;
@@ -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 )
{
es_out_sys_t *p_sys = out->p_sys;
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 2766371..a433697 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -32,7 +32,6 @@
#include <vlc_common.h>
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 );
mtime_t input_EsOutGetWakeup( es_out_t * );
void input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
diff --git a/src/input/input.c b/src/input/input.c
index 4f37c84..e47ae88 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1275,7 +1275,7 @@ error:
input_ChangeState( p_input, ERROR_S );
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
if( p_input->p->p_sout )
{
@@ -1363,7 +1363,7 @@ static void End( input_thread_t * p_input )
/* Unload all modules */
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 )
{
More information about the vlc-devel
mailing list