/* "record" has changed */
INPUT_EVENT_RECORD,
- /* A vout has been created/deleted by *the input* */
- INPUT_EVENT_VOUT,
-
/* input_item_t media has changed */
INPUT_EVENT_ITEM_META,
/* input_item_t info has changed */
/* cache" has changed */
INPUT_EVENT_CACHE,
+ /* A aout_instance_t object has been created/deleted by *the input* */
+ INPUT_EVENT_AOUT,
+ /* A vout_thread_t object has been created/deleted by *the input* */
+ INPUT_EVENT_VOUT,
+
} input_event_type_e;
/** @}*/
#define input_CreateThread(a,b) __input_CreateThread(VLC_OBJECT(a),b)
VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, input_item_t * ) );
+VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) );
+
#define input_Preparse(a,b) __input_Preparse(VLC_OBJECT(a),b)
VLC_EXPORT( int, __input_Preparse, ( vlc_object_t *, input_item_t * ) );
#define input_Read(a,b,c) __input_Read(VLC_OBJECT(a),b, c)
VLC_EXPORT( int, __input_Read, ( vlc_object_t *, input_item_t *, bool ) );
-VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) );
enum input_query_e
{
/* ES */
INPUT_RESTART_ES, /* arg1=int (-AUDIO/VIDEO/SPU_ES for the whole category) */
+
+ /* Input ressources
+ * XXX You must call vlc_object_release as soon as possible */
+ INPUT_GET_AOUT, /* arg1=aout_instance_t ** res=can fail */
+ INPUT_GET_VOUTS, /* arg1=vout_thread_t ***, int * res=can fail */
};
VLC_EXPORT( int, input_vaControl,( input_thread_t *, int i_query, va_list ) );
#include "input_internal.h"
#include "event.h"
+#include "ressource.h"
static void UpdateBookmarksOption( input_thread_t * );
input_ControlPush( p_input, INPUT_CONTROL_RESTART_ES, &val );
return VLC_SUCCESS;
+ case INPUT_GET_AOUT:
+ {
+ aout_instance_t *p_aout = input_ressource_HoldAout( p_input->p->p_ressource );
+ if( !p_aout )
+ return VLC_EGENERIC;
+
+ aout_instance_t **pp_aout = (aout_instance_t**)va_arg( args, aout_instance_t** );
+ *pp_aout = p_aout;
+ return VLC_SUCCESS;
+ }
+
+ case INPUT_GET_VOUTS:
+ {
+ vout_thread_t ***ppp_vout = (vout_thread_t***)va_arg( args, vout_thread_t*** );
+ int *pi_vout = (int*)va_arg( args, int* );
+
+ input_ressource_HoldVouts( p_input->p->p_ressource, ppp_vout, pi_vout );
+ if( *pi_vout <= 0 )
+ return VLC_EGENERIC;
+ return VLC_SUCCESS;
+ }
+
default:
msg_Err( p_input, "unknown query in input_vaControl" );
return VLC_EGENERIC;
{
input_ressource_RequestAout( p_owner->p_input->p->p_ressource,
p_owner->p_aout );
+ input_SendEventAout( p_owner->p_input );
p_owner->p_aout = NULL;
}
if( p_owner->p_vout )
/* Hack to make sure all the the pictures are freed by the decoder */
vout_FixLeaks( p_owner->p_vout, true );
- /* We are about to die. Reattach video output to p_vlc. */
+ /* */
input_ressource_RequestVout( p_owner->p_input->p->p_ressource, p_owner->p_vout, NULL );
input_SendEventVout( p_owner->p_input );
}
vlc_mutex_unlock( &p_owner->lock );
+ input_SendEventAout( p_owner->p_input );
+
if( p_owner->p_aout_input == NULL )
{
msg_Err( p_dec, "failed to create audio output" );
Trigger( p_input, INPUT_EVENT_VOUT );
}
+void input_SendEventAout( input_thread_t *p_input )
+{
+ Trigger( p_input, INPUT_EVENT_AOUT );
+}
+
/*****************************************************************************
* Event for control.c/input.c
*****************************************************************************/
* Event for decoder.c
*****************************************************************************/
void input_SendEventVout( input_thread_t *p_input );
+void input_SendEventAout( input_thread_t *p_input );
/*****************************************************************************
* Event for control.c/input.c
return p_vout;
}
+static void HoldVouts( input_ressource_t *p_ressource, vout_thread_t ***ppp_vout, int *pi_vout )
+{
+ vout_thread_t **pp_vout;
+
+ *pi_vout = 0;
+ *ppp_vout = NULL;
+ if( p_ressource->i_vout <= 0 )
+ return;
+
+ pp_vout = calloc( p_ressource->i_vout, sizeof(*pp_vout) );
+ if( !pp_vout )
+ return;
+
+ *ppp_vout = pp_vout;
+ *pi_vout = p_ressource->i_vout;
+
+ for( int i = 0; i < p_ressource->i_vout; i++ )
+ {
+ pp_vout[i] = p_ressource->pp_vout[i];
+ vlc_object_hold( pp_vout[i] );
+ }
+}
/* */
static void DestroyAout( input_ressource_t *p_ressource )
return p_ressource->p_aout;
}
}
+static aout_instance_t *HoldAout( input_ressource_t *p_ressource )
+{
+ if( !p_ressource->p_aout )
+ return NULL;
+
+ /* TODO FIXME: p_ressource->pp_vout order is NOT stable */
+ aout_instance_t *p_aout = p_ressource->p_aout;
+
+ vlc_object_hold( p_aout );
+ return p_aout;
+}
/* */
input_ressource_t *input_ressource_New( void )
{
return p_ret;
}
+void input_ressource_HoldVouts( input_ressource_t *p_ressource, vout_thread_t ***ppp_vout, int *pi_vout )
+{
+ vlc_mutex_lock( &p_ressource->lock );
+ HoldVouts( p_ressource, ppp_vout, pi_vout );
+ vlc_mutex_unlock( &p_ressource->lock );
+}
void input_ressource_TerminateVout( input_ressource_t *p_ressource )
{
input_ressource_RequestVout( p_ressource, NULL, NULL );
return p_ret;
}
+aout_instance_t *input_ressource_HoldAout( input_ressource_t *p_ressource )
+{
+ vlc_mutex_lock( &p_ressource->lock );
+ aout_instance_t *p_ret = HoldAout( p_ressource );
+ vlc_mutex_unlock( &p_ressource->lock );
+ return p_ret;
+}
/* */
sout_instance_t *input_ressource_RequestSout( input_ressource_t *p_ressource, sout_instance_t *p_sout, const char *psz_sout )
{
*/
aout_instance_t *input_ressource_RequestAout( input_ressource_t *, aout_instance_t * );
+/**
+ * This function return the current aout if any.
+ *
+ * You must call vlc_object_release on the value returned (if non NULL).
+ */
+aout_instance_t *input_ressource_HoldAout( input_ressource_t *p_ressource );
+
/**
* This function handles vout request.
*/
vout_thread_t *input_ressource_RequestVout( input_ressource_t *, vout_thread_t *, video_format_t * );
/**
- * This function return the current vout if any.
+ * This function return one of the current vout if any.
*
* You must call vlc_object_release on the value returned (if non NULL).
*/
vout_thread_t *input_ressource_HoldVout( input_ressource_t * );
+/**
+ * This function return all current vouts if any.
+ *
+ * You must call vlc_object_release on all values returned (if non NULL).
+ */
+void input_ressource_HoldVouts( input_ressource_t *, vout_thread_t ***, int * );
+
#endif