Commit 337c8691 authored by Laurent Aimar's avatar Laurent Aimar

Allow aout to grab vout_Request calls.

 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.
parent fc22aeac
......@@ -223,6 +223,8 @@ struct aout_fifo_t
};
/** 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
......@@ -232,13 +234,24 @@ struct aout_filter_t
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
......@@ -422,6 +435,9 @@ VLC_EXPORT( void, aout_EnableFilter, (vlc_object_t *, const char *, bool ));
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
......
......@@ -92,7 +92,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
typedef struct aout_filter_sys_t
struct aout_filter_sys_t
{
/* Filter static config */
int i_band;
......@@ -117,7 +117,7 @@ typedef struct aout_filter_sys_t
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 * );
......
......@@ -57,12 +57,12 @@ static void Close ( vlc_object_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
......
......@@ -82,7 +82,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
typedef struct aout_filter_sys_t
struct aout_filter_sys_t
{
/* Filter static config */
float f_lowf, f_lowgain;
......@@ -95,7 +95,7 @@ typedef struct aout_filter_sys_t
/* State */
float *p_state;
} aout_filter_sys_t;
};
......
......@@ -76,7 +76,7 @@ vlc_module_end ()
* 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;
......@@ -114,7 +114,7 @@ typedef struct aout_filter_sys_t
/* 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
......
......@@ -173,7 +173,7 @@ static int Open( vlc_object_t *p_this )
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" );
......@@ -402,7 +402,7 @@ static void Close( vlc_object_t *p_this )
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 );
......
......@@ -311,7 +311,7 @@ static int Open( vlc_object_t *p_this )
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" );
......@@ -387,7 +387,7 @@ static void Close( vlc_object_t *p_this )
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 */
......
......@@ -41,7 +41,7 @@ typedef struct visual_effect_t
* 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;
......@@ -50,7 +50,7 @@ typedef struct aout_filter_sys_t
int i_effect;
visual_effect_t **effect;
} aout_filter_sys_t;
};
/* Prototypes */
int scope_Run
......
......@@ -81,6 +81,12 @@
/* else printf("%s:%d\n", __FILE__, __LINE__); */ \
}
struct aout_filter_owner_sys_t
{
aout_instance_t *p_aout;
aout_input_t *p_input;
};
/****************************************************************************
* Prototypes
*****************************************************************************/
......
......@@ -275,9 +275,12 @@ void aout_FiltersDestroyPipeline( aout_instance_t * p_aout,
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 );
}
}
......@@ -372,3 +375,14 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
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 );
}
......@@ -37,6 +37,7 @@
#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>
......@@ -60,6 +61,9 @@ static int EqualizerCallback( vlc_object_t *, char const *,
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
*****************************************************************************/
......@@ -269,6 +273,11 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
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 */
{
......@@ -326,6 +335,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
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 );
......@@ -345,6 +355,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
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 );
......@@ -782,6 +793,13 @@ static void inputResamplingStop( aout_input_t *p_input )
}
}
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 )
{
......
......@@ -17,6 +17,7 @@ aout_DateSet
aout_EnableFilter
aout_FifoFirstDate
aout_FifoPop
aout_filter_RequestVout
aout_FindAndRestart
aout_FormatNbChannels
aout_FormatPrepare
......
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