Commit 4c8b741e authored by Romain Vimont's avatar Romain Vimont Committed by Jean-Baptiste Kempf

core: replace filter_sys_t* by void*

See #17078
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7442c8c7
......@@ -68,7 +68,7 @@ struct filter_t
/* Module properties */
module_t * p_module;
filter_sys_t * p_sys;
void *p_sys;
/* Input format */
es_format_t fmt_in;
......
......@@ -494,10 +494,11 @@ static int OpenFilter( vlc_object_t *p_this )
static void CloseFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
free( p_filter->p_sys->p_overflow_buffer );
free( p_filter->p_sys->p_atomic_operations );
free( p_filter->p_sys );
free( p_sys->p_overflow_buffer );
free( p_sys->p_atomic_operations );
free( p_sys );
}
static block_t *Convert( filter_t *p_filter, block_t *p_block )
......
......@@ -432,7 +432,8 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
return NULL;
}
i_out_size = p_block->i_nb_samples * p_filter->p_sys->i_bitspersample/8 *
filter_sys_t *p_sys = p_filter->p_sys;
i_out_size = p_block->i_nb_samples * p_sys->i_bitspersample/8 *
aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
p_out = block_Alloc( i_out_size );
......@@ -443,11 +444,11 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_nb_samples =
(p_block->i_nb_samples / p_filter->p_sys->i_nb_channels) *
(p_block->i_nb_samples / p_sys->i_nb_channels) *
aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
#if 0
unsigned int i_in_size = in_buf.i_nb_samples * (p_filter->p_sys->i_bitspersample/8) *
unsigned int i_in_size = in_buf.i_nb_samples * (p_sys->i_bitspersample/8) *
aout_FormatNbChannels( &(p_filter->fmt_in.audio) );
if( (in_buf.i_buffer != i_in_size) && ((i_in_size % 32) != 0) ) /* is it word aligned?? */
{
......@@ -457,7 +458,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
#endif
memset( p_out->p_buffer, 0, i_out_size );
if( p_filter->p_sys->b_downmix )
if( p_sys->b_downmix )
{
stereo2mono_downmix( p_filter, p_block, p_out );
mono( p_filter, p_out, p_block );
......
......@@ -74,9 +74,11 @@ static block_t *Upmix( filter_t *p_filter, block_t *p_in_buf )
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->i_length = p_in_buf->i_length;
filter_sys_t *p_sys = p_filter->p_sys;
float *p_dest = (float *)p_out_buf->p_buffer;
const float *p_src = (float *)p_in_buf->p_buffer;
const int *channel_map = p_filter->p_sys->channel_map;
const int *channel_map = p_sys->channel_map;
for( size_t i = 0; i < p_in_buf->i_nb_samples; i++ )
{
......@@ -101,9 +103,11 @@ static block_t *Downmix( filter_t *p_filter, block_t *p_buf )
assert( i_input_nb >= i_output_nb );
filter_sys_t *p_sys = p_filter->p_sys;
float *p_dest = (float *)p_buf->p_buffer;
const float *p_src = p_dest;
const int *channel_map = p_filter->p_sys->channel_map;
const int *channel_map = p_sys->channel_map;
/* Use an extra buffer to avoid overlapping */
float buffer[i_output_nb];
......@@ -293,10 +297,11 @@ static int Create( vlc_object_t *p_this )
}
}
p_filter->p_sys = malloc( sizeof(*p_filter->p_sys) );
if(! p_filter->p_sys )
filter_sys_t *p_sys = malloc( sizeof(*p_sys) );
if( !p_sys )
return VLC_ENOMEM;
memcpy( p_filter->p_sys->channel_map, channel_map, sizeof(channel_map) );
p_filter->p_sys = p_sys;
memcpy( p_sys->channel_map, channel_map, sizeof(channel_map) );
if( aout_FormatNbChannels( outfmt ) > aout_FormatNbChannels( infmt ) )
p_filter->pf_audio_filter = Upmix;
......
......@@ -165,9 +165,10 @@ static void write_data( filter_t *p_filter, const void *p_buf, size_t i_size,
static void write_buffer( filter_t *p_filter, block_t *p_in_buf )
{
filter_sys_t *p_sys = p_filter->p_sys;
write_data( p_filter, p_in_buf->p_buffer, p_in_buf->i_buffer,
is_big_endian( p_filter, p_in_buf ) );
p_filter->p_sys->p_out_buf->i_length += p_in_buf->i_length;
p_sys->p_out_buf->i_length += p_in_buf->i_length;
}
static int write_init( filter_t *p_filter, block_t *p_in_buf,
......@@ -389,6 +390,7 @@ static int write_buffer_truehd( filter_t *p_filter, block_t *p_in_buf )
static int write_buffer_dts( filter_t *p_filter, block_t *p_in_buf )
{
uint16_t i_data_type;
filter_sys_t *p_sys = p_filter->p_sys;
/* Only send the DTS core part */
vlc_dts_header_t core;
......@@ -429,7 +431,7 @@ static int write_buffer_dts( filter_t *p_filter, block_t *p_in_buf )
return SPDIF_ERROR;
if( i_data_type == 0 )
p_filter->p_sys->i_out_offset = 0;
p_sys->i_out_offset = 0;
write_buffer( p_filter, p_in_buf );
write_finalize( p_filter, i_data_type, 8 /* in bits */ );
......@@ -481,7 +483,7 @@ static int write_buffer_dtshd( filter_t *p_filter, block_t *p_in_buf )
size_t i_out_size = i_period * 4;
uint16_t i_data_type = IEC61937_DTSHD | i_subtype << 8;
if( p_filter->p_sys->dtshd.b_skip
if( p_sys->dtshd.b_skip
|| i_in_size + SPDIF_HEADER_SIZE > i_out_size )
{
/* The bitrate is too high, pass only the core part */
......@@ -492,7 +494,7 @@ static int write_buffer_dtshd( filter_t *p_filter, block_t *p_in_buf )
/* Don't try to send substreams anymore. That way, we avoid to switch
* back and forth between DTD and DTS-HD */
p_filter->p_sys->dtshd.b_skip = true;
p_sys->dtshd.b_skip = true;
}
if( write_init( p_filter, p_in_buf, i_out_size,
......
......@@ -110,7 +110,7 @@ static int Open( vlc_object_t *p_this )
if( p_sys->f_max <= 0 ) p_sys->f_max = 0.01;
/* We need to store (nb_buffers+1)*nb_channels floats */
p_sys->p_last = calloc( i_channels * (p_filter->p_sys->i_nb + 2), sizeof(float) );
p_sys->p_last = calloc( i_channels * (p_sys->i_nb + 2), sizeof(float) );
if( !p_sys->p_last )
{
free( p_sys );
......
......@@ -155,8 +155,9 @@ static int Open( vlc_object_t *p_this )
static void Close( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
free( p_filter->p_sys->p_state );
free( p_filter->p_sys );
filter_sys_t *p_sys = p_filter->p_sys;
free( p_sys->p_state );
free( p_sys );
}
/*****************************************************************************
......@@ -166,10 +167,11 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
{
filter_sys_t *p_sys = p_filter->p_sys;
ProcessEQ( (float*)p_in_buf->p_buffer, (float*)p_in_buf->p_buffer,
p_filter->p_sys->p_state,
p_sys->p_state,
p_filter->fmt_in.audio.i_channels, p_in_buf->i_nb_samples,
p_filter->p_sys->coeffs, 5 );
p_sys->coeffs, 5 );
return p_in_buf;
}
......
......@@ -484,12 +484,13 @@ static filter_t *ResamplerCreate(filter_t *p_filter)
if( unlikely( p_resampler == NULL ) )
return NULL;
filter_sys_t *p_sys = p_filter->p_sys;
p_resampler->owner.sys = NULL;
p_resampler->p_cfg = NULL;
p_resampler->fmt_in = p_filter->fmt_in;
p_resampler->fmt_out = p_filter->fmt_in;
p_resampler->fmt_out.audio.i_rate =
vlc_atomic_load_float( &p_filter->p_sys->rate_shift );
vlc_atomic_load_float( &p_sys->rate_shift );
aout_FormatPrepare( &p_resampler->fmt_out.audio );
p_resampler->p_module = module_need( p_resampler, "audio resampler", NULL,
false );
......
......@@ -135,7 +135,7 @@ static int Open( vlc_object_t *p_this )
vlc_object_t *p_aout = p_filter->obj.parent;
/* Allocate structure */
p_sys = p_filter->p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) );
p_filter->p_sys = p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) );
if( !p_sys )
return VLC_ENOMEM;
......@@ -172,7 +172,7 @@ static int Open( vlc_object_t *p_this )
static void Close( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
vlc_object_t *p_aout = p_filter->obj.parent;
/* Delete the callbacks */
......@@ -196,7 +196,7 @@ static void Close( vlc_object_t *p_this )
static void SpatFilter( filter_t *p_filter, float *out, float *in,
unsigned i_samples, unsigned i_channels )
{
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
vlc_mutex_locker locker( &p_sys->lock );
for( unsigned i = 0; i < i_samples; i++ )
......
......@@ -119,7 +119,8 @@ static int assert_ProcessorInput(filter_t *p_filter, picture_sys_t *p_sys_src)
static void Flush(filter_t *filter)
{
FlushDeinterlacing(&filter->p_sys->context);
filter_sys_t *p_sys = filter->p_sys;
FlushDeinterlacing(&p_sys->context);
}
static int RenderPic( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
......@@ -274,7 +275,8 @@ static struct picture_context_t *d3d11_pic_context_copy(struct picture_context_t
static picture_t *NewOutputPicture( filter_t *p_filter )
{
picture_t *pic = p_filter->p_sys->buffer_new( p_filter );
filter_sys_t *p_sys = p_filter->p_sys;
picture_t *pic = p_sys->buffer_new( p_filter );
picture_sys_t *pic_sys = pic->p_sys;
if ( !pic->context )
{
......@@ -288,7 +290,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
pic->p_sys = pic_sys;
D3D11_TEXTURE2D_DESC dstDesc;
ID3D11Texture2D_GetDesc(p_filter->p_sys->outTexture, &dstDesc);
ID3D11Texture2D_GetDesc(p_sys->outTexture, &dstDesc);
const d3d_format_t *cfg = NULL;
for (const d3d_format_t *output_format = GetRenderFormatList();
......@@ -311,7 +313,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
video_format_t fmt = p_filter->fmt_out.video;
fmt.i_width = dstDesc.Width;
fmt.i_height = dstDesc.Height;
if (AllocateTextures(VLC_OBJECT(p_filter), &p_filter->p_sys->d3d_dev, cfg,
if (AllocateTextures(VLC_OBJECT(p_filter), &p_sys->d3d_dev, cfg,
&fmt, 1, pic_sys->texture) != VLC_SUCCESS)
{
free(pic_sys);
......@@ -319,7 +321,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
}
b_local_texture = true;
pic_sys->context = p_filter->p_sys->d3d_dev.d3dcontext;
pic_sys->context = p_sys->d3d_dev.d3dcontext;
pic_sys->formatTexture = dstDesc.Format;
}
......
......@@ -583,7 +583,8 @@ static void DeleteFilter( filter_t * p_filter )
static picture_t *NewBuffer(filter_t *p_filter)
{
filter_t *p_parent = p_filter->owner.sys;
return p_parent->p_sys->staging_pic;
filter_sys_t *p_sys = p_parent->p_sys;
return p_sys->staging_pic;
}
static filter_t *CreateFilter( vlc_object_t *p_this, const es_format_t *p_fmt_in,
......
......@@ -191,7 +191,8 @@ static void DeleteFilter( filter_t * p_filter )
static picture_t *NewBuffer(filter_t *p_filter)
{
filter_t *p_parent = p_filter->owner.sys;
return p_parent->p_sys->staging;
filter_sys_t *p_sys = p_parent->p_sys;
return p_sys->staging;
}
static filter_t *CreateFilter( vlc_object_t *p_this, const es_format_t *p_fmt_in,
......
......@@ -81,7 +81,8 @@ static struct filter_mode_t filter_mode [] = {
static void Flush(filter_t *filter)
{
FlushDeinterlacing(&filter->p_sys->context);
filter_sys_t *p_sys = filter->p_sys;
FlushDeinterlacing(&p_sys->context);
}
static void FillSample( DXVA2_VideoSample *p_sample,
......@@ -211,7 +212,8 @@ static int RenderSinglePic( filter_t *p_filter, picture_t *p_outpic, picture_t *
static picture_t *Deinterlace(filter_t *p_filter, picture_t *p_pic)
{
return DoDeinterlacing( p_filter, &p_filter->p_sys->context, p_pic );
filter_sys_t *p_sys = p_filter->p_sys;
return DoDeinterlacing( p_filter, &p_sys->context, p_pic );
}
static const struct filter_mode_t *GetFilterMode(const char *mode)
......
......@@ -170,7 +170,7 @@ DownloadSurface(filter_t *filter, picture_t *src_pic)
if (vlc_vaapi_MapBuffer(VLC_OBJECT(filter), va_dpy, src_img.buf, &src_buf))
goto error;
FillPictureFromVAImage(dest, &src_img, src_buf, &filter->p_sys->cache);
FillPictureFromVAImage(dest, &src_img, src_buf, &filter_sys->cache);
vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter), va_dpy, src_img.buf);
vlc_vaapi_DestroyImage(VLC_OBJECT(filter), va_dpy, src_img.image_id);
......@@ -239,10 +239,11 @@ FillVAImageFromPicture(VAImage *dest_img, uint8_t *dest_buf,
static picture_t *
UploadSurface(filter_t *filter, picture_t *src)
{
VADisplay const va_dpy = filter->p_sys->dpy;
filter_sys_t *p_sys = filter->p_sys;
VADisplay const va_dpy = p_sys->dpy;
VAImage dest_img;
void * dest_buf;
picture_t * dest_pic = picture_pool_Wait(filter->p_sys->dest_pics);
picture_t * dest_pic = picture_pool_Wait(p_sys->dest_pics);
if (!dest_pic)
{
......@@ -259,7 +260,7 @@ UploadSurface(filter_t *filter, picture_t *src)
goto error;
FillVAImageFromPicture(&dest_img, dest_buf, dest_pic,
src, &filter->p_sys->cache);
src, &p_sys->cache);
if (vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter), va_dpy, dest_img.buf)
|| vlc_vaapi_DestroyImage(VLC_OBJECT(filter),
......
......@@ -961,7 +961,8 @@ error:
static void
Deinterlace_Flush(filter_t *filter)
{
struct deint_data *const p_deint_data = filter->p_sys->p_data;
filter_sys_t *p_sys = filter->p_sys;
struct deint_data *const p_deint_data = p_sys->p_data;
while (p_deint_data->history.num_pics)
{
......
......@@ -413,7 +413,8 @@ static subpicture_t * SubsdelayFilter( filter_t *p_filter, subpicture_t* p_subpi
return NULL;
}
p_heap = &p_filter->p_sys->heap;
filter_sys_t *p_sys = p_filter->p_sys;
p_heap = &p_sys->heap;
/* add subpicture to the heap */
......@@ -778,13 +779,15 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
int64_t i_min_stop_start_interval;
int64_t i_min_start_stop_interval;
p_list = p_filter->p_sys->heap.p_list;
i_count = p_filter->p_sys->heap.i_count;
filter_sys_t *p_sys = p_filter->p_sys;
p_list = p_sys->heap.p_list;
i_count = p_sys->heap.i_count;
i_overlap = p_filter->p_sys->i_overlap;
i_min_stops_interval = p_filter->p_sys->i_min_stops_interval;
i_min_stop_start_interval = p_filter->p_sys->i_min_stop_start_interval;
i_min_start_stop_interval = p_filter->p_sys->i_min_start_stop_interval;
i_overlap = p_sys->i_overlap;
i_min_stops_interval = p_sys->i_min_stops_interval;
i_min_stop_start_interval = p_sys->i_min_stop_start_interval;
i_min_start_stop_interval = p_sys->i_min_start_stop_interval;
/* step 1 - enforce min stops interval rule (extend delays) */
......@@ -907,7 +910,8 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
*****************************************************************************/
static void SubsdelayRecalculateDelays( filter_t *p_filter )
{
for( subsdelay_heap_entry_t *p_curr = p_filter->p_sys->heap.p_head;
filter_sys_t *p_sys = p_filter->p_sys;
for( subsdelay_heap_entry_t *p_curr = p_sys->heap.p_head;
p_curr != NULL; p_curr = p_curr->p_next )
{
if( !p_curr->b_update_ephemer )
......@@ -1018,7 +1022,8 @@ static void SubpicDestroyWrapper( subpicture_t *p_subpic )
if( p_entry->p_filter )
{
p_heap = &p_entry->p_filter->p_sys->heap;
filter_sys_t *p_sys = p_entry->p_filter->p_sys;
p_heap = &p_sys->heap;
SubsdelayHeapLock( p_heap );
SubsdelayHeapRemove( p_heap, p_entry );
......@@ -1046,7 +1051,8 @@ static void SubpicLocalUpdate( subpicture_t* p_subpic, mtime_t i_ts )
}
p_filter = p_entry->p_filter;
p_heap = &p_filter->p_sys->heap;
filter_sys_t *p_sys = p_filter->p_sys;
p_heap = &p_sys->heap;
SubsdelayHeapLock( p_heap );
......@@ -1169,8 +1175,10 @@ static int64_t SubsdelayEstimateDelay( filter_t *p_filter, subsdelay_heap_entry_
int i_factor;
int i_rank;
i_mode = p_filter->p_sys->i_mode;
i_factor = p_filter->p_sys->i_factor;
filter_sys_t *p_sys = p_filter->p_sys;
i_mode = p_sys->i_mode;
i_factor = p_sys->i_factor;
if( i_mode == SUBSDELAY_MODE_ABSOLUTE )
{
......@@ -1208,14 +1216,16 @@ static int SubsdelayCalculateAlpha( filter_t *p_filter, int i_overlapping, int i
int i_new_alpha;
int i_min_alpha;
i_min_alpha = p_filter->p_sys->i_min_alpha;
filter_sys_t *p_sys = p_filter->p_sys;
i_min_alpha = p_sys->i_min_alpha;
if( i_overlapping > p_filter->p_sys->i_overlap - 1)
if( i_overlapping > p_sys->i_overlap - 1)
{
i_overlapping = p_filter->p_sys->i_overlap - 1;
i_overlapping = p_sys->i_overlap - 1;
}
switch ( p_filter->p_sys->i_overlap )
switch ( p_sys->i_overlap )
{
case 1:
i_new_alpha = 255;
......
......@@ -132,14 +132,15 @@ extern "C" int InitDWrite( filter_t *p_filter )
return VLC_EGENERIC;
}
p_filter->p_sys->p_dw_sys = p_dw_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
p_sys->p_dw_sys = p_dw_sys;
msg_Dbg( p_filter, "Using DWrite backend" );
return VLC_SUCCESS;
}
extern "C" int ReleaseDWrite( filter_t *p_filter )
{
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_sys->p_dw_sys;
#if VLC_WINSTORE_APP
......@@ -158,7 +159,8 @@ extern "C" int ReleaseDWrite( filter_t *p_filter )
extern "C" int DWrite_GetFontStream( filter_t *p_filter, int i_index, FT_Stream *pp_stream )
{
dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_filter->p_sys->p_dw_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_sys->p_dw_sys;
if( i_index < 0 || i_index >= ( int ) p_dw_sys->streams.size() )
return VLC_ENOITEM;
......@@ -394,7 +396,7 @@ static void DWrite_ParseFamily( IDWriteFontFamily *p_dw_family, vlc_family_t *p_
extern "C" const vlc_family_t *DWrite_GetFamily( filter_t *p_filter, const char *psz_family )
{
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_sys->p_dw_sys;
ComPtr< IDWriteFontFamily > p_dw_family;
......@@ -454,7 +456,7 @@ done:
static char *DWrite_Fallback( filter_t *p_filter, const char *psz_family,
uni_char_t codepoint )
{
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_sys->p_dw_sys;
wchar_t *pwsz_buffer = NULL;
char *psz_result = NULL;
......@@ -527,7 +529,7 @@ done:
extern "C" vlc_family_t *DWrite_GetFallbacks( filter_t *p_filter, const char *psz_family,
uni_char_t codepoint )
{
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
vlc_family_t *p_family = NULL;
vlc_family_t *p_fallbacks = NULL;
char *psz_fallback = NULL;
......
......@@ -896,6 +896,8 @@ static inline int RenderAXYZ( filter_t *p_filter,
void (*FillPicture)( picture_t *p_picture, int, int, int, int ),
void (*BlendPixel)(picture_t *, int, int, int, int, int, int, int) )
{
filter_sys_t *p_sys = p_filter->p_sys;
/* Create a new subpicture region */
video_format_t fmt;
video_format_Init( &fmt, i_chroma );
......@@ -920,7 +922,7 @@ static inline int RenderAXYZ( filter_t *p_filter,
p_region->fmt.i_sar_den = regionden;
/* Initialize the picture background */
const text_style_t *p_style = p_filter->p_sys->p_default_style;
const text_style_t *p_style = p_sys->p_default_style;
uint8_t i_x, i_y, i_z;
if (p_region->b_noregionbg) {
......@@ -959,7 +961,8 @@ static inline int RenderAXYZ( filter_t *p_filter,
static void UpdateDefaultLiveStyles( filter_t *p_filter )
{
text_style_t *p_style = p_filter->p_sys->p_default_style;
filter_sys_t *p_sys = p_filter->p_sys;
text_style_t *p_style = p_sys->p_default_style;
p_style->i_font_color = var_InheritInteger( p_filter, "freetype-color" );
......
......@@ -1134,11 +1134,11 @@ static int LoadGlyphs( filter_t *p_filter, paragraph_t *p_paragraph,
#undef SKIP_GLYPH
if( p_filter->p_sys->p_stroker && (p_style->i_style_flags & STYLE_OUTLINE) )
if( p_sys->p_stroker && (p_style->i_style_flags & STYLE_OUTLINE) )
{
p_bitmaps->p_outline = p_bitmaps->p_glyph;
if( FT_Glyph_StrokeBorder( &p_bitmaps->p_outline,
p_filter->p_sys->p_stroker, 0, 0 ) )
p_sys->p_stroker, 0, 0 ) )
p_bitmaps->p_outline = 0;
}
......
......@@ -170,7 +170,7 @@ error:
static void Destroy(vlc_object_t *p_this)
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
if (p_sys->cpVoice)
p_sys->cpVoice->Release();
......@@ -184,7 +184,7 @@ static int RenderText(filter_t *p_filter,
subpicture_region_t *p_region_in,
const vlc_fourcc_t *)
{
filter_sys_t *p_sys = p_filter->p_sys;
filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
text_segment_t *p_segment = p_region_in->p_text;
if (!p_segment)
......
......@@ -180,9 +180,10 @@ static int Create( vlc_object_t *p_this )
{
filter_t *p_filter = ( filter_t * )p_this;
p_filter->p_sys = calloc( 1, sizeof(*p_filter->p_sys) );
if( !p_filter->p_sys )
filter_sys_t *p_sys = calloc( 1, sizeof(*p_sys) );
if( !p_sys )
return VLC_ENOMEM;
p_filter->p_sys = p_sys;
p_filter->pf_render = RenderText;
svg_LoadTemplate( p_filter );
......@@ -202,11 +203,12 @@ static int Create( vlc_object_t *p_this )
static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = ( filter_t * )p_this;
filter_sys_t *p_sys = p_filter->p_sys;
#if (GLIB_MAJOR_VERSION < 2 || GLIB_MINOR_VERSION < 36)
rsvg_term();
#endif
free( p_filter->p_sys->psz_file_template );
free( p_filter->p_sys );
free( p_sys->psz_file_template );
free( p_sys );
}
static void svg_RescaletoFit( filter_t *p_filter, int *width, int *height, float *scale )
......
......@@ -198,7 +198,7 @@ static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) )
{
es_format_Clean( &p_filter->fmt_out );
es_format_Copy( &p_filter->fmt_out,
filter_chain_GetFmtOut( p_filter->p_sys->p_chain ) );
filter_chain_GetFmtOut( p_sys->p_chain ) );
}
/* */
p_filter->pf_video_filter = Chain;
......@@ -244,12 +244,13 @@ static int ActivateFilter( vlc_object_t *p_this )
static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
if (p_filter->p_sys->p_video_filter)
filter_DelProxyCallbacks( p_filter, p_filter->p_sys->p_video_filter,
if (p_sys->p_video_filter)
filter_DelProxyCallbacks( p_filter, p_sys->p_video_filter,
RestartFilterCallback );
filter_chain_Delete( p_filter->p_sys->p_chain );
free( p_filter->p_sys );
filter_chain_Delete( p_sys->p_chain );
free( p_sys );
}
/*****************************************************************************
......@@ -257,7 +258,8 @@ static void Destroy( vlc_object_t *p_this )
*****************************************************************************/
static picture_t *Chain( filter_t *p_filter, picture_t *p_pic )
{
return filter_chain_VideoFilter( p_filter->p_sys->p_chain, p_pic );
filter_sys_t *p_sys = p_filter->p_sys;
return filter_chain_VideoFilter( p_sys->p_chain, p_pic );
}
/*****************************************************************************
......@@ -354,7 +356,8 @@ static int ChainMouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
{
(void) p_old;
return filter_chain_MouseFilter( p_filter->p_sys->p_chain, p_mouse, p_new );
filter_sys_t *p_sys = p_filter->p_sys;
return filter_chain_MouseFilter( p_sys->p_chain, p_mouse, p_new );
}
static int BuildFilterChain( filter_t *p_filter )
......@@ -362,11 +365,13 @@ static int BuildFilterChain( filter_t *p_filter )
es_format_t fmt_mid;
int i_ret = VLC_EGENERIC;
filter_sys_t *p_sys = p_filter->p_sys;
/* Now try chroma format list */
const vlc_fourcc_t *pi_allowed_chromas = get_allowed_chromas( p_filter );
for( int i = 0; pi_allowed_chromas[i]; i++ )
{
filter_chain_Reset( p_filter->p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
filter_chain_Reset( p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
const vlc_fourcc_t i_chroma = pi_allowed_chromas[i];
if( i_chroma == p_filter->fmt_in.i_codec ||
......@@ -384,19 +389,19 @@ static int BuildFilterChain( filter_t *p_filter )
fmt_mid.video.i_bmask = 0;
video_format_FixRgb(&fmt_mid.video);
if( filter_chain_AppendConverter( p_filter->p_sys->p_chain,
if( filter_chain_AppendConverter( p_sys->p_chain,
NULL, &fmt_mid ) == VLC_SUCCESS )
{
p_filter->p_sys->p_video_filter =
filter_chain_AppendFilter( p_filter->p_sys->p_chain,
p_sys->p_video_filter =
filter_chain_AppendFilter( p_sys->p_chain,
p_filter->psz_name, p_filter->p_cfg,
&fmt_mid, &fmt_mid );
if( p_filter->p_sys->p_video_filter )
if( p_sys->p_video_filter )
{
filter_AddProxyCallbacks( p_filter,
p_filter->p_sys->p_video_filter,
p_sys->p_video_filter,
RestartFilterCallback );
if (p_filter->p_sys->p_video_filter->pf_video_mouse != NULL)
if (p_sys->p_video_filter->pf_video_mouse != NULL)
p_filter->pf_video_mouse = ChainMouse;
es_format_Clean( &fmt_mid );
i_ret = VLC_SUCCESS;
......@@ -406,7 +411,7 @@ static int BuildFilterChain( filter_t *p_filter )