[vlc-devel] commit: Added input internal es_out_GetEsObjects to retreives decoder associated objects . (Laurent Aimar )
git version control
git at videolan.org
Sun Jan 31 01:41:55 CET 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jan 30 20:19:38 2010 +0100| [64002dd12580e648c28f5602c70c19dc59cdf0d6] | committer: Laurent Aimar
Added input internal es_out_GetEsObjects to retreives decoder associated objects.
It will allow to removes vlc_object_find(_*) hacks.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64002dd12580e648c28f5602c70c19dc59cdf0d6
---
src/input/decoder.c | 13 +++++++++++++
src/input/decoder.h | 7 +++++++
src/input/es_out.c | 26 ++++++++++++++++++++++++++
src/input/es_out.h | 6 ++++++
src/input/es_out_timeshift.c | 1 +
5 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 8ed5a13..5a0ef02 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -624,6 +624,19 @@ size_t input_DecoderGetFifoSize( decoder_t *p_dec )
return block_FifoSize( p_owner->p_fifo );
}
+void input_DecoderGetObjects( decoder_t *p_dec,
+ vout_thread_t **pp_vout, aout_instance_t **pp_aout )
+{
+ decoder_owner_sys_t *p_owner = p_dec->p_owner;
+
+ vlc_mutex_lock( &p_owner->lock );
+ if( pp_vout )
+ *pp_vout = vlc_object_hold( p_owner->p_vout );
+ if( pp_aout )
+ *pp_aout = vlc_object_hold( p_owner->p_aout );
+ vlc_mutex_unlock( &p_owner->lock );
+}
+
/*****************************************************************************
* Internal functions
*****************************************************************************/
diff --git a/src/input/decoder.h b/src/input/decoder.h
index fe99b42..b113d22 100644
--- a/src/input/decoder.h
+++ b/src/input/decoder.h
@@ -104,4 +104,11 @@ bool input_DecoderHasFormatChanged( decoder_t *p_dec, es_format_t *p_fmt, vlc_me
*/
size_t input_DecoderGetFifoSize( decoder_t *p_dec );
+/**
+ * This function returns the objects associated to a decoder
+ *
+ * They must be released using vlc_object_release().
+ */
+void input_DecoderGetObjects( decoder_t *, vout_thread_t **, aout_instance_t ** );
+
#endif
diff --git a/src/input/es_out.c b/src/input/es_out.c
index f2546b5..e42f29a 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2459,6 +2459,32 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return i_ret;
}
+ case ES_OUT_GET_ES_OBJECTS_BY_ID:
+ {
+ const int i_id = va_arg( args, int );
+ es_out_id_t *p_es = EsOutGetFromID( out, i_id );
+ if( !p_es )
+ return VLC_EGENERIC;
+
+ vlc_object_t **pp_decoder = va_arg( args, vlc_object_t ** );
+ vout_thread_t **pp_vout = va_arg( args, vout_thread_t ** );
+ aout_instance_t **pp_aout = va_arg( args, aout_instance_t ** );
+ if( es->p_dec )
+ {
+ if( pp_decoder )
+ *pp_decoder = vlc_object_hold( es->p_dec );
+ input_DecoderGetObjects( es->p_dec, pp_vout, pp_aout );
+ }
+ else
+ {
+ if( pp_vout )
+ *pp_vout = NULL;
+ if( pp_aout )
+ *pp_aout = NULL;
+ }
+ return VLC_SUCCESS;
+ }
+
case ES_OUT_GET_BUFFERING:
pb = (bool *)va_arg( args, bool* );
*pb = p_sys->b_buffering;
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 9dd5d45..36cb807 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -55,6 +55,7 @@ enum es_out_query_private_e
ES_OUT_SET_ES_BY_ID,
ES_OUT_RESTART_ES_BY_ID,
ES_OUT_SET_ES_DEFAULT_BY_ID,
+ ES_OUT_GET_ES_OBJECTS_BY_ID, /* arg1=int id, vlc_object_t **dec, vout_thread_t **, aout_instance_t ** res=can fail*/
/* Get buffering state */
ES_OUT_GET_BUFFERING, /* arg1=bool* res=cannot fail */
@@ -142,6 +143,11 @@ static inline void es_out_SetJitter( es_out_t *p_out, mtime_t i_pts_delay, int i
int i_ret = es_out_Control( p_out, ES_OUT_SET_JITTER, i_pts_delay, i_cr_average );
assert( !i_ret );
}
+static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id,
+ vlc_object_t **pp_decoder, vout_thread_t **pp_vout, aout_instance_t **pp_aout )
+{
+ return es_out_Control( p_out, ES_OUT_GET_ES_OBJECTS_BY_ID, i_id, pp_decoder, pp_vout, pp_aout );
+}
es_out_t *input_EsOutNew( input_thread_t *, int i_rate );
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 5981be2..51f38cf 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -581,6 +581,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
case ES_OUT_SET_ES_BY_ID:
case ES_OUT_RESTART_ES_BY_ID:
case ES_OUT_SET_ES_DEFAULT_BY_ID:
+ case ES_OUT_GET_ES_OBJECTS_BY_ID:
case ES_OUT_SET_DELAY:
case ES_OUT_SET_RECORD_STATE:
assert(0);
More information about the vlc-devel
mailing list