Do not use vout_Request in aout_filter_t anymore but aout_filter_RequestVout.
They have the same semantic but it will allows to control every vout creation
from aout.
};
/** audio output filter */
+typedef struct aout_filter_owner_sys_t aout_filter_owner_sys_t;
+typedef struct aout_filter_sys_t aout_filter_sys_t;
struct aout_filter_t
{
VLC_COMMON_MEMBERS
aout_alloc_t output_alloc;
module_t * p_module;
- struct aout_filter_sys_t * p_sys;
- void (* pf_do_work)( struct aout_instance_t *,
- struct aout_filter_t *,
- struct aout_buffer_t *,
- struct aout_buffer_t * );
- bool b_in_place;
- bool b_continuity;
+ aout_filter_sys_t *p_sys;
+
+ bool b_in_place;
+ bool b_continuity;
+
+ void (*pf_do_work)( aout_instance_t *, aout_filter_t *,
+ aout_buffer_t *, aout_buffer_t * );
+
+ /* Owner fieldS
+ * XXX You MUST not use them directly */
+
+ /* Vout callback
+ * XXX use aout_filter_RequestVout */
+ vout_thread_t *(*pf_request_vout)( aout_filter_t *,
+ vout_thread_t *, video_format_t * );
+
+ /* Private structure for the owner of the filter */
+ aout_filter_owner_sys_t *p_owner;
};
#define AOUT_RESAMPLING_NONE 0
VLC_EXPORT( char *, aout_VisualChange, (vlc_object_t *, int ) );
+/* */
+VLC_EXPORT( vout_thread_t *, aout_filter_RequestVout, ( aout_filter_t *, vout_thread_t *p_vout, video_format_t *p_fmt ) );
+
# ifdef __cplusplus
}
# endif
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-typedef struct aout_filter_sys_t
+struct aout_filter_sys_t
{
/* Filter static config */
int i_band;
float x2[32][2];
float y2[32][128][2];
-} aout_filter_sys_t;
+};
static void DoWork( aout_instance_t *, aout_filter_t *,
aout_buffer_t *, aout_buffer_t * );
static void DoWork ( aout_instance_t * , aout_filter_t *,
aout_buffer_t * , aout_buffer_t *);
-typedef struct aout_filter_sys_t
+struct aout_filter_sys_t
{
int i_nb;
float *p_last;
float f_max;
-} aout_filter_sys_t;
+};
/*****************************************************************************
* Module descriptor
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-typedef struct aout_filter_sys_t
+struct aout_filter_sys_t
{
/* Filter static config */
float f_lowf, f_lowgain;
/* State */
float *p_state;
-} aout_filter_sys_t;
+};
* frame: a single set of samples, one for each channel
* VLC uses these terms differently
*/
-typedef struct aout_filter_sys_t
+struct aout_filter_sys_t
{
/* Filter static config */
double scale;
/* for "audio filter" only, manage own buffers */
int i_buf;
uint8_t *p_buffers[2];
-} aout_filter_sys_t;
+};
/*****************************************************************************
* best_overlap_offset: calculate best offset for overlap
fmt.i_aspect = VOUT_ASPECT_FACTOR * width.i_int/height.i_int;
fmt.i_sar_num = fmt.i_sar_den = 1;
- p_thread->p_vout = vout_Request( p_filter, NULL, &fmt );
+ p_thread->p_vout = aout_filter_RequestVout( p_filter, NULL, &fmt );
if( p_thread->p_vout == NULL )
{
msg_Err( p_filter, "no suitable vout module" );
vlc_thread_join( p_sys->p_thread );
/* Free data */
- vout_Request( p_filter, p_sys->p_thread->p_vout, 0 );
+ aout_filter_RequestVout( p_filter, p_sys->p_thread->p_vout, 0 );
vlc_mutex_destroy( &p_sys->p_thread->lock );
vlc_cond_destroy( &p_sys->p_thread->wait );
vlc_object_detach( p_sys->p_thread );
fmt.i_aspect = VOUT_ASPECT_FACTOR * p_sys->i_width/p_sys->i_height;
fmt.i_sar_num = fmt.i_sar_den = 1;
- p_sys->p_vout = vout_Request( p_filter, NULL, &fmt );
+ p_sys->p_vout = aout_filter_RequestVout( p_filter, NULL, &fmt );
if( p_sys->p_vout == NULL )
{
msg_Err( p_filter, "no suitable vout module" );
if( p_filter->p_sys->p_vout )
{
- vout_Request( p_filter, p_filter->p_sys->p_vout, 0 );
+ aout_filter_RequestVout( p_filter, p_filter->p_sys->p_vout, 0 );
}
/* Free the list */
* This structure is part of the audio filter descriptor.
* It describes some visualizer specific variables.
*****************************************************************************/
-typedef struct aout_filter_sys_t
+struct aout_filter_sys_t
{
vout_thread_t *p_vout;
int i_effect;
visual_effect_t **effect;
-} aout_filter_sys_t;
+};
/* Prototypes */
int scope_Run
/* else printf("%s:%d\n", __FILE__, __LINE__); */ \
}
+struct aout_filter_owner_sys_t
+{
+ aout_instance_t *p_aout;
+ aout_input_t *p_input;
+};
+
/****************************************************************************
* Prototypes
*****************************************************************************/
for ( i = 0; i < i_nb_filters; i++ )
{
- module_unneed( pp_filters[i], pp_filters[i]->p_module );
- vlc_object_detach( pp_filters[i] );
- vlc_object_release( pp_filters[i] );
+ aout_filter_t *p_filter = pp_filters[i];
+
+ module_unneed( p_filter, p_filter->p_module );
+ free( p_filter->p_owner );
+ vlc_object_detach( p_filter );
+ vlc_object_release( p_filter );
}
}
assert( (*pp_input_buffer) == NULL || (*pp_input_buffer)->i_alloc_type != AOUT_ALLOC_STACK );
}
+/*****************************************************************************
+ * aout_filter_RequestVout
+ *****************************************************************************/
+vout_thread_t *aout_filter_RequestVout( aout_filter_t *p_filter,
+ vout_thread_t *p_vout, video_format_t *p_fmt )
+{
+ if( !p_filter->pf_request_vout )
+ return NULL;
+ return p_filter->pf_request_vout( p_filter, p_vout, p_fmt );
+}
+
#include <assert.h>
#include <vlc_input.h> /* for input_thread_t and i_pts_delay */
+#include <vlc_vout.h> /* for vout_Request */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
static int ReplayGainCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static void ReplayGainSelect( aout_instance_t *, aout_input_t * );
+
+static vout_thread_t *RequestVout( aout_filter_t *,
+ vout_thread_t *, video_format_t * );
/*****************************************************************************
* aout_InputNew : allocate a new input and rework the filter pipeline
*****************************************************************************/
vlc_object_attach( p_filter , p_aout );
+ p_filter->pf_request_vout = RequestVout;
+ p_filter->p_owner = malloc( sizeof(*p_filter->p_owner) );
+ p_filter->p_owner->p_aout = p_aout;
+ p_filter->p_owner->p_input = p_input;
+
/* try to find the requested filter */
if( i_visual == 2 ) /* this can only be a visualization module */
{
msg_Err( p_aout, "cannot add user filter %s (skipped)",
psz_parser );
+ free( p_filter->p_owner );
vlc_object_detach( p_filter );
vlc_object_release( p_filter );
psz_parser );
module_unneed( p_filter, p_filter->p_module );
+ free( p_filter->p_owner );
vlc_object_detach( p_filter );
vlc_object_release( p_filter );
}
}
+static vout_thread_t *RequestVout( aout_filter_t *p_filter,
+ vout_thread_t *p_vout, video_format_t *p_fmt )
+{
+ /* TODO */
+ return vout_Request( p_filter, p_vout, p_fmt );
+}
+
static int ChangeFiltersString( aout_instance_t * p_aout, const char* psz_variable,
const char *psz_name, bool b_add )
{
aout_EnableFilter
aout_FifoFirstDate
aout_FifoPop
+aout_filter_RequestVout
aout_FindAndRestart
aout_FormatNbChannels
aout_FormatPrepare