[vlc-devel] [PATCH 08/13] Replace decoder_sys_t* by void*
Romain Vimont
rom1v at videolabs.io
Tue Apr 24 11:18:26 CEST 2018
See #17078
---
include/vlc_codec.h | 2 +-
modules/codec/avcodec/subtitle.c | 4 +++-
modules/codec/avcodec/video.c | 19 +++++++++++--------
modules/codec/cc.c | 3 ++-
modules/codec/crystalhd.c | 11 ++++++-----
modules/codec/cvdsub.c | 4 +++-
modules/codec/flac.c | 13 +++++++------
modules/codec/kate.c | 9 ++++++---
modules/codec/oggspots.c | 3 ++-
modules/codec/opus.c | 2 +-
modules/codec/png.c | 5 +++--
modules/codec/rawvideo.c | 2 +-
modules/codec/scte18.c | 4 +++-
modules/codec/speex.c | 11 ++++++-----
modules/codec/spudec/spudec.c | 5 ++++-
modules/codec/stl.c | 10 ++++++----
modules/codec/textst.c | 15 +++++++++------
modules/codec/theora.c | 14 +++++++++-----
modules/codec/ttml/substtml.c | 5 +++--
modules/codec/vorbis.c | 9 ++++++---
modules/codec/webvtt/subsvtt.c | 24 +++++++++++++++---------
modules/packetizer/avparser.c | 9 +++++----
modules/packetizer/copy.c | 19 +++++++++++--------
modules/packetizer/h264.c | 5 +++--
modules/packetizer/hevc.c | 5 +++--
modules/packetizer/mpeg4audio.c | 5 +++--
modules/packetizer/mpeg4video.c | 12 ++++++------
modules/packetizer/mpegaudio.c | 2 +-
28 files changed, 139 insertions(+), 92 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index a4842a5f3e..0ba09d736d 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -56,7 +56,7 @@ struct decoder_t
/* Module properties */
module_t * p_module;
- decoder_sys_t * p_sys;
+ void *p_sys;
/* Input format ie from demuxer (XXX: a lot of field could be invalid) */
es_format_t fmt_in;
diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index b03dd648d0..2623a2c9b2 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -317,12 +317,14 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, mtime_t
if (!spu)
return NULL;
+ decoder_sys_t *p_sys = dec->p_sys;
+
//msg_Err(dec, "%lld %d %d",
// pts, ffsub->start_display_time, ffsub->end_display_time);
spu->i_start = pts + ffsub->start_display_time * INT64_C(1000);
spu->i_stop = pts + ffsub->end_display_time * INT64_C(1000);
spu->b_absolute = true; /* We have offset and size for subtitle */
- spu->b_ephemer = dec->p_sys->b_need_ephemer;
+ spu->b_ephemer = p_sys->b_need_ephemer;
/* We only show subtitle for i_stop time only */
if (avctx->coded_width != 0 && avctx->coded_height != 0) {
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 13223e0e59..24c3d11261 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -337,15 +337,17 @@ static int lavc_UpdateVideoFormat(decoder_t *dec, AVCodecContext *ctx,
if (val)
return val;
+ decoder_sys_t *p_sys = dec->p_sys;
+
/* always have date in fields/ticks units */
- if(dec->p_sys->pts.i_divider_num)
- date_Change(&dec->p_sys->pts, fmt_out.i_frame_rate *
- __MAX(ctx->ticks_per_frame, 1),
- fmt_out.i_frame_rate_base);
+ if(p_sys->pts.i_divider_num)
+ date_Change(&p_sys->pts, fmt_out.i_frame_rate *
+ __MAX(ctx->ticks_per_frame, 1),
+ fmt_out.i_frame_rate_base);
else
- date_Init(&dec->p_sys->pts, fmt_out.i_frame_rate *
- __MAX(ctx->ticks_per_frame, 1),
- fmt_out.i_frame_rate_base);
+ date_Init(&p_sys->pts, fmt_out.i_frame_rate *
+ __MAX(ctx->ticks_per_frame, 1),
+ fmt_out.i_frame_rate_base);
fmt_out.p_palette = dec->fmt_out.video.p_palette;
dec->fmt_out.video.p_palette = NULL;
@@ -1363,7 +1365,8 @@ static int lavc_va_GetFrame(struct AVCodecContext *ctx, AVFrame *frame,
picture_t *pic)
{
decoder_t *dec = ctx->opaque;
- vlc_va_t *va = dec->p_sys->p_va;
+ decoder_sys_t *p_sys = dec->p_sys;
+ vlc_va_t *va = p_sys->p_va;
if (vlc_va_Get(va, pic, &frame->data[0]))
{
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index cc52ba8e05..d51a6d0569 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -502,6 +502,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, eia608_t *h, mtime_t i_pts )
p_spu->b_absolute = false;
subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
+ decoder_sys_t *p_dec_sys = p_dec->p_sys;
/* Set first region defaults */
/* The "leavetext" alignment is a special mode where the subpicture
@@ -512,7 +513,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, eia608_t *h, mtime_t i_pts )
/* Set style defaults (will be added to segments if none set) */
p_spu_sys->p_default_style->i_style_flags |= STYLE_MONOSPACED;
- if( p_dec->p_sys->b_opaque )
+ if( p_dec_sys->b_opaque )
{
p_spu_sys->p_default_style->i_background_alpha = STYLE_ALPHA_OPAQUE >> 1;
p_spu_sys->p_default_style->i_features |= STYLE_HAS_BACKGROUND_ALPHA;
diff --git a/modules/codec/crystalhd.c b/modules/codec/crystalhd.c
index edb597f9e6..4ca058e66e 100644
--- a/modules/codec/crystalhd.c
+++ b/modules/codec/crystalhd.c
@@ -183,8 +183,8 @@ static int OpenDecoder( vlc_object_t *p_this )
p_sys->i_nal_size = 4; // assume 4 byte start codes
p_sys->i_sps_pps_size = 0;
p_sys->p_sps_pps_buf = NULL;
- p_dec->p_sys->p_pic = NULL;
- p_dec->p_sys->proc_out = NULL;
+ p_sys->p_pic = NULL;
+ p_sys->proc_out = NULL;
/* Win32 code *
* We cannot link and ship BCM dll, even with LGPL license (too big)
@@ -392,7 +392,8 @@ static BC_STATUS ourCallback(void *shnd, uint32_t width, uint32_t height, uint32
VLC_UNUSED(width); VLC_UNUSED(height); VLC_UNUSED(stride);
decoder_t *p_dec = (decoder_t *)shnd;
- BC_DTS_PROC_OUT *proc_out = p_dec->p_sys->proc_out;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ BC_DTS_PROC_OUT *proc_out = p_sys->proc_out;
BC_DTS_PROC_OUT *proc_in = (BC_DTS_PROC_OUT*)pOut;
/* Direct Rendering */
@@ -401,11 +402,11 @@ static BC_STATUS ourCallback(void *shnd, uint32_t width, uint32_t height, uint32
!(proc_in->PicInfo.flags & VDEC_FLAG_FIELDPAIR) )
{
if( !decoder_UpdateVideoFormat( p_dec ) )
- p_dec->p_sys->p_pic = decoder_NewPicture( p_dec );
+ p_sys->p_pic = decoder_NewPicture( p_dec );
}
/* */
- picture_t *p_pic = p_dec->p_sys->p_pic;
+ picture_t *p_pic = p_sys->p_pic;
if( !p_pic )
return BC_STS_ERROR;
diff --git a/modules/codec/cvdsub.c b/modules/codec/cvdsub.c
index 3905bec032..c6fd0b0ddd 100644
--- a/modules/codec/cvdsub.c
+++ b/modules/codec/cvdsub.c
@@ -139,8 +139,10 @@ static int PacketizerOpen( vlc_object_t *p_this )
if( DecoderOpen( p_this ) != VLC_SUCCESS ) return VLC_EGENERIC;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
p_dec->fmt_out.i_codec = VLC_CODEC_CVD;
- p_dec->p_sys->b_packetizer = true;
+ p_sys->b_packetizer = true;
return VLC_SUCCESS;
}
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 31c9cca04b..13580f9a90 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -394,6 +394,7 @@ static void DecoderErrorCallback( const FLAC__StreamDecoder *decoder,
{
VLC_UNUSED(decoder);
decoder_t *p_dec = (decoder_t *)client_data;
+ decoder_sys_t *p_sys = p_dec->p_sys;
switch( status )
{
@@ -416,7 +417,7 @@ static void DecoderErrorCallback( const FLAC__StreamDecoder *decoder,
msg_Err( p_dec, "got decoder error: %d", status );
}
- FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+ FLAC__stream_decoder_flush( p_sys->p_flac );
return;
}
/*****************************************************************************
@@ -626,7 +627,7 @@ static void Flush( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys;
if( p_sys->b_stream_info )
- FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+ FLAC__stream_decoder_flush( p_sys->p_flac );
date_Set( &p_sys->end_date, 0 );
}
@@ -671,18 +672,18 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
decoder_state_error( p_dec,
FLAC__stream_decoder_get_state( p_sys->p_flac ) );
- FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+ FLAC__stream_decoder_flush( p_sys->p_flac );
}
/* If the decoder is in the "aborted" state,
* FLAC__stream_decoder_process_single() won't return an error. */
- switch ( FLAC__stream_decoder_get_state(p_dec->p_sys->p_flac) )
+ switch ( FLAC__stream_decoder_get_state(p_sys->p_flac) )
{
case FLAC__STREAM_DECODER_ABORTED:
- FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+ FLAC__stream_decoder_flush( p_sys->p_flac );
break;
case FLAC__STREAM_DECODER_END_OF_STREAM:
- FLAC__stream_decoder_reset( p_dec->p_sys->p_flac );
+ FLAC__stream_decoder_reset( p_sys->p_flac );
break;
default:
break;
diff --git a/modules/codec/kate.c b/modules/codec/kate.c
index b50d94c7d0..663635ed70 100644
--- a/modules/codec/kate.c
+++ b/modules/codec/kate.c
@@ -436,12 +436,13 @@ static int OpenDecoder( vlc_object_t *p_this )
static int OpenPacketizer( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
+ decoder_sys_t *p_sys = p_dec->p_sys;
int i_ret = OpenDecoder( p_this );
if( i_ret == VLC_SUCCESS )
{
- p_dec->p_sys->b_packetizer = true;
+ p_sys->b_packetizer = true;
p_dec->fmt_out.i_codec = VLC_CODEC_KATE;
}
@@ -1247,9 +1248,11 @@ static void ParseKateComments( decoder_t *p_dec )
char *psz_name, *psz_value, *psz_comment;
int i = 0;
- while ( i < p_dec->p_sys->kc.comments )
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
+ while ( i < p_sys->kc.comments )
{
- psz_comment = strdup( p_dec->p_sys->kc.user_comments[i] );
+ psz_comment = strdup( p_sys->kc.user_comments[i] );
if( !psz_comment )
break;
psz_name = psz_comment;
diff --git a/modules/codec/oggspots.c b/modules/codec/oggspots.c
index 4683b4c9b9..dc3e21cd93 100644
--- a/modules/codec/oggspots.c
+++ b/modules/codec/oggspots.c
@@ -138,11 +138,12 @@ static int OpenDecoder(vlc_object_t* p_this)
static int OpenPacketizer(vlc_object_t* p_this)
{
decoder_t* p_dec = (decoder_t*)p_this;
+ decoder_sys_t *p_sys = p_dec->p_sys;
int i_ret = OpenDecoder(p_this);
if (i_ret == VLC_SUCCESS) {
- p_dec->p_sys->b_packetizer = true;
+ p_sys->b_packetizer = true;
p_dec->fmt_out.i_codec = VLC_CODEC_OGGSPOTS;
}
diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index 4bc70dc402..01295d5991 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -177,7 +177,7 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t)) ) == NULL )
return VLC_ENOMEM;
- p_dec->p_sys->b_has_headers = false;
+ p_sys->b_has_headers = false;
date_Set( &p_sys->end_date, 0 );
diff --git a/modules/codec/png.c b/modules/codec/png.c
index e9bc71c6a7..d8af7c58c8 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -116,11 +116,12 @@ static int OpenDecoder( vlc_object_t *p_this )
}
/* Allocate the memory needed to store the decoder's structure */
- p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
+ decoder_sys_t *p_sys = malloc( sizeof(decoder_sys_t) );
if( p_dec->p_sys == NULL )
return VLC_ENOMEM;
+ p_dec->p_sys = p_sys;
- p_dec->p_sys->p_obj = p_this;
+ p_sys->p_obj = p_this;
/* Set output properties */
p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index e98061dc60..8fdd57ec21 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -244,7 +244,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
FillPicture( p_dec, p_block, p_pic );
/* Date management: 1 frame per packet */
- p_pic->date = date_Get( &p_dec->p_sys->pts );
+ p_pic->date = date_Get( &p_sys->pts );
date_Increment( &p_sys->pts, 1 );
if( p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK )
diff --git a/modules/codec/scte18.c b/modules/codec/scte18.c
index 2a2181fd3b..ebcb9315cd 100644
--- a/modules/codec/scte18.c
+++ b/modules/codec/scte18.c
@@ -178,7 +178,9 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
if (p_block->i_flags & (BLOCK_FLAG_CORRUPTED))
goto exit;
- scte18_cea_t *p_cea = scte18_cea_Decode( p_dec->p_sys->p_handle, p_block );
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
+ scte18_cea_t *p_cea = scte18_cea_Decode( p_sys->p_handle, p_block );
if( p_cea )
{
p_spu = decoder_NewSubpictureText( p_dec );
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 9f6884a40c..bfaf85a3db 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -216,10 +216,10 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t)) ) == NULL )
return VLC_ENOMEM;
- p_dec->p_sys->bits.buf_size = 0;
- p_dec->p_sys->b_packetizer = false;
- p_dec->p_sys->rtp_rate = p_dec->fmt_in.audio.i_rate;
- p_dec->p_sys->b_has_headers = false;
+ p_sys->bits.buf_size = 0;
+ p_sys->b_packetizer = false;
+ p_sys->rtp_rate = p_dec->fmt_in.audio.i_rate;
+ p_sys->b_has_headers = false;
date_Set( &p_sys->end_date, 0 );
@@ -255,12 +255,13 @@ static int OpenDecoder( vlc_object_t *p_this )
static int OpenPacketizer( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
+ decoder_sys_t *p_sys = p_dec->p_sys;
int i_ret = OpenDecoder( p_this );
if( i_ret == VLC_SUCCESS )
{
- p_dec->p_sys->b_packetizer = true;
+ p_sys->b_packetizer = true;
p_dec->fmt_out.i_codec = VLC_CODEC_SPEEX;
}
diff --git a/modules/codec/spudec/spudec.c b/modules/codec/spudec/spudec.c
index 09aeb376e8..67f3418252 100644
--- a/modules/codec/spudec/spudec.c
+++ b/modules/codec/spudec/spudec.c
@@ -113,8 +113,11 @@ static int PacketizerOpen( vlc_object_t *p_this )
{
return VLC_EGENERIC;
}
+
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
p_dec->pf_packetize = Packetize;
- p_dec->p_sys->b_packetizer = true;
+ p_sys->b_packetizer = true;
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
p_dec->fmt_out.i_codec = VLC_CODEC_SPU;
diff --git a/modules/codec/stl.c b/modules/codec/stl.c
index d97667c169..7211ad368a 100644
--- a/modules/codec/stl.c
+++ b/modules/codec/stl.c
@@ -381,6 +381,8 @@ static int Decode(decoder_t *p_dec, block_t *p_block)
if (p_block == NULL) /* No Drain */
return VLCDEC_SUCCESS;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
if(p_block->i_buffer < STL_TTI_SIZE)
p_block->i_flags |= BLOCK_FLAG_CORRUPTED;
@@ -395,11 +397,11 @@ static int Decode(decoder_t *p_dec, block_t *p_block)
}
}
- const char *psz_charset = cct_nums[p_dec->p_sys->cct - CCT_BEGIN].str;
+ const char *psz_charset = cct_nums[p_sys->cct - CCT_BEGIN].str;
for (size_t i = 0; i < p_block->i_buffer / STL_TTI_SIZE; i++)
{
- stl_sg_t *p_group = &p_dec->p_sys->groups[p_block->p_buffer[0]];
- if(ParseTTI(p_group, &p_block->p_buffer[i * STL_TTI_SIZE], psz_charset, p_dec->p_sys->i_fps) &&
+ stl_sg_t *p_group = &p_sys->groups[p_block->p_buffer[0]];
+ if(ParseTTI(p_group, &p_block->p_buffer[i * STL_TTI_SIZE], psz_charset, p_sys->i_fps) &&
p_group->p_segment != NULL )
{
/* output */
@@ -426,7 +428,7 @@ static int Decode(decoder_t *p_dec, block_t *p_block)
}
}
- ResetGroups(p_dec->p_sys);
+ ResetGroups(p_sys);
block_Release(p_block);
return VLCDEC_SUCCESS;
diff --git a/modules/codec/textst.c b/modules/codec/textst.c
index c5c414f1cb..72d615f209 100644
--- a/modules/codec/textst.c
+++ b/modules/codec/textst.c
@@ -64,7 +64,7 @@ vlc_module_end()
static size_t textst_FillRegion(decoder_t *p_dec, const uint8_t *p_data, size_t i_data,
subpicture_updater_sys_region_t *p_region)
{
- VLC_UNUSED(p_dec);
+ decoder_sys_t *p_sys = p_dec->p_sys;
text_segment_t **pp_last = &p_region->p_segments;
text_style_t *p_style = NULL;
@@ -122,8 +122,8 @@ static size_t textst_FillRegion(decoder_t *p_dec, const uint8_t *p_data, size_t
p_style->i_style_flags |= STYLE_ITALIC;
if(p_data[0] & 0x04)
p_style->i_style_flags |= STYLE_OUTLINE;
- p_style->i_outline_color = p_dec->p_sys->palette[p_data[1]] & 0x00FFFFFF;
- p_style->i_outline_alpha = p_dec->p_sys->palette[p_data[1]] >> 24;
+ p_style->i_outline_color = p_sys->palette[p_data[1]] & 0x00FFFFFF;
+ p_style->i_outline_alpha = p_sys->palette[p_data[1]] >> 24;
p_style->i_features |= STYLE_HAS_FLAGS | STYLE_HAS_OUTLINE_ALPHA | STYLE_HAS_OUTLINE_COLOR;
//p_data[2] outline__thickness
}
@@ -136,8 +136,8 @@ static size_t textst_FillRegion(decoder_t *p_dec, const uint8_t *p_data, size_t
case BD_TEXTST_DATA_FONT_COLOR:
if(i_data > 1 && (p_style || (p_style = text_style_Create( STYLE_NO_DEFAULTS ))))
{
- p_style->i_font_color = p_dec->p_sys->palette[p_data[1]] & 0x00FFFFFF;
- p_style->i_font_alpha = p_dec->p_sys->palette[p_data[1]] >> 24;
+ p_style->i_font_color = p_sys->palette[p_data[1]] & 0x00FFFFFF;
+ p_style->i_font_alpha = p_sys->palette[p_data[1]] >> 24;
p_style->i_features |= STYLE_HAS_FONT_ALPHA | STYLE_HAS_FONT_COLOR;
}
break;
@@ -171,13 +171,16 @@ static size_t textst_Decode_palette(decoder_t *p_dec, const uint8_t *p_data, siz
{
if(i_data < 2)
return i_data;
+
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
uint16_t i_size = GetWBE(&p_data[0]);
p_data += 2; i_data -= 2;
i_size = i_data = __MIN(i_data, i_size);
while (i_data > 4)
{
- p_dec->p_sys->palette[p_data[0]] = /* YCrCbT to ARGB */
+ p_sys->palette[p_data[0]] = /* YCrCbT to ARGB */
( (uint32_t)((float)p_data[1] +1.402f * (p_data[2]-128)) << 16 ) |
( (uint32_t)((float)p_data[1] -0.34414 * (p_data[3]-128) -0.71414 * (p_data[2]-128)) << 8 ) |
( (uint32_t)((float)p_data[1] +1.722 * (p_data[3]-128)) ) |
diff --git a/modules/codec/theora.c b/modules/codec/theora.c
index d48edaab47..fce1dcade5 100644
--- a/modules/codec/theora.c
+++ b/modules/codec/theora.c
@@ -159,7 +159,7 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys = malloc(sizeof(*p_sys)) ) == NULL )
return VLC_ENOMEM;
- p_dec->p_sys->b_packetizer = false;
+ p_sys->b_packetizer = false;
p_sys->b_has_headers = false;
p_sys->i_pts = VLC_TS_INVALID;
p_sys->b_decoded_first_keyframe = false;
@@ -183,12 +183,13 @@ static int OpenDecoder( vlc_object_t *p_this )
static int OpenPacketizer( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
+ decoder_sys_t *p_sys = p_dec->p_sys;
int i_ret = OpenDecoder( p_this );
if( i_ret == VLC_SUCCESS )
{
- p_dec->p_sys->b_packetizer = true;
+ p_sys->b_packetizer = true;
p_dec->fmt_out.i_codec = VLC_CODEC_THEORA;
}
@@ -550,6 +551,9 @@ static void ParseTheoraComments( decoder_t *p_dec )
{
char *psz_name, *psz_value, *psz_comment;
int i = 0;
+
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
/* Regarding the th_comment structure: */
/* The metadata is stored as a series of (tag, value) pairs, in
@@ -565,14 +569,14 @@ static void ParseTheoraComments( decoder_t *p_dec )
the bitstream format itself treats them as 8-bit clean vectors,
possibly containing null characters, and so the length array
should be treated as their authoritative length. */
- while ( i < p_dec->p_sys->tc.comments )
+ while ( i < p_sys->tc.comments )
{
- int clen = p_dec->p_sys->tc.comment_lengths[i];
+ int clen = p_sys->tc.comment_lengths[i];
if ( clen <= 0 || clen >= INT_MAX ) { i++; continue; }
psz_comment = (char *)malloc( clen + 1 );
if( !psz_comment )
break;
- memcpy( (void*)psz_comment, (void*)p_dec->p_sys->tc.user_comments[i], clen + 1 );
+ memcpy( (void*)psz_comment, (void*)p_sys->tc.user_comments[i], clen + 1 );
psz_name = psz_comment;
psz_value = strchr( psz_comment, '=' );
if( psz_value )
diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index edbc79a955..75b3711ae9 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -1107,6 +1107,7 @@ static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
subpicture_updater_sys_region_t *p_updtregion = NULL;
+ decoder_sys_t *p_dec_sys = p_dec->p_sys;
/* Create region update info from each ttml region */
for( ttml_region_t *p_region = p_regions;
@@ -1125,8 +1126,8 @@ static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
}
/* broken legacy align var (can't handle center...). Will change only regions content. */
- if( p_dec->p_sys->i_align & SUBPICTURE_ALIGN_MASK )
- p_spu_sys->region.inner_align = p_dec->p_sys->i_align;
+ if( p_dec_sys->i_align & SUBPICTURE_ALIGN_MASK )
+ p_spu_sys->region.inner_align = p_dec_sys->i_align;
p_spu_sys->margin_ratio = 0.0;
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index b4a8bda30f..4a724a5b63 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -271,12 +271,13 @@ static int OpenDecoder( vlc_object_t *p_this )
static int OpenPacketizer( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
+ decoder_sys_t *p_sys = p_dec->p_sys;
int i_ret = OpenDecoder( p_this );
if( i_ret == VLC_SUCCESS )
{
- p_dec->p_sys->b_packetizer = true;
+ p_sys->b_packetizer = true;
p_dec->fmt_out.i_codec = VLC_CODEC_VORBIS;
}
@@ -608,9 +609,11 @@ static void ParseVorbisComments( decoder_t *p_dec )
char *psz_name, *psz_value, *psz_comment;
int i = 0;
- while( i < p_dec->p_sys->vc.comments )
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
+ while( i < p_sys->vc.comments )
{
- psz_comment = strdup( p_dec->p_sys->vc.user_comments[i] );
+ psz_comment = strdup( p_sys->vc.user_comments[i] );
if( !psz_comment )
break;
psz_name = psz_comment;
diff --git a/modules/codec/webvtt/subsvtt.c b/modules/codec/webvtt/subsvtt.c
index 667482c133..5b92dbded7 100644
--- a/modules/codec/webvtt/subsvtt.c
+++ b/modules/codec/webvtt/subsvtt.c
@@ -862,7 +862,8 @@ static void webvtt_domnode_SelectNodesInTree( decoder_t *p_dec, const vlc_css_se
static void webvtt_domnode_SelectRuleNodes( decoder_t *p_dec, const vlc_css_rule_t *p_rule,
mtime_t i_playbacktime, vlc_array_t *p_results )
{
- const webvtt_dom_node_t *p_cues = p_dec->p_sys->p_root->p_child;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ const webvtt_dom_node_t *p_cues = p_sys->p_root->p_child;
for( const vlc_css_selector_t *p_sel = p_rule->p_selectors; p_sel; p_sel = p_sel->p_next )
{
vlc_array_t tempresults;
@@ -1309,6 +1310,7 @@ static text_style_t * ComputeStyle( decoder_t *p_dec, const webvtt_dom_node_t *p
text_style_t *p_style = NULL;
text_style_t *p_dfltstyle = NULL;
mtime_t i_tagtime = -1;
+ decoder_sys_t *p_sys = p_dec->p_sys;
for( const webvtt_dom_node_t *p_node = p_leaf ; p_node; p_node = p_node->p_parent )
{
@@ -1364,7 +1366,7 @@ static text_style_t * ComputeStyle( decoder_t *p_dec, const webvtt_dom_node_t *p
else if ( !strcmp( p_tagnode->psz_tag, "v" ) && p_tagnode->psz_attrs )
{
#ifdef HAVE_CSS
- if( p_dec->p_sys->p_css_rules == NULL ) /* Only auto style when no CSS sheet */
+ if( p_sys->p_css_rules == NULL ) /* Only auto style when no CSS sheet */
#endif
{
if( p_style || (p_style = text_style_Create( STYLE_NO_DEFAULTS )) )
@@ -1714,13 +1716,14 @@ static void RenderRegions( decoder_t *p_dec, mtime_t i_start, mtime_t i_stop )
{
subpicture_t *p_spu = NULL;
subpicture_updater_sys_region_t *p_updtregion = NULL;
+ decoder_sys_t *p_sys = p_dec->p_sys;
#ifdef HAVE_CSS
- ApplyCSSRules( p_dec, p_dec->p_sys->p_css_rules, i_start );
+ ApplyCSSRules( p_dec, p_sys->p_css_rules, i_start );
#endif
const webvtt_dom_cue_t *p_rlcue = NULL;
- for( const webvtt_dom_node_t *p_node = p_dec->p_sys->p_root->p_child;
+ for( const webvtt_dom_node_t *p_node = p_sys->p_root->p_child;
p_node; p_node = p_node->p_next )
{
if( p_node->type == NODE_REGION )
@@ -1879,6 +1882,7 @@ static int ProcessISOBMFF( decoder_t *p_dec,
const uint8_t *p_buffer, size_t i_buffer,
mtime_t i_start, mtime_t i_stop )
{
+ decoder_sys_t *p_sys = p_dec->p_sys;
mp4_box_iterator_t it;
mp4_box_iterator_Init( &it, p_buffer, i_buffer );
while( mp4_box_iterator_Next( &it ) )
@@ -1916,7 +1920,7 @@ static int ProcessISOBMFF( decoder_t *p_dec,
free( psz );
}
- webvtt_region_t *p_region = webvtt_region_GetByID( p_dec->p_sys,
+ webvtt_region_t *p_region = webvtt_region_GetByID( p_sys,
p_cue->settings.psz_region );
if( p_region )
{
@@ -1925,8 +1929,8 @@ static int ProcessISOBMFF( decoder_t *p_dec,
}
else
{
- webvtt_domnode_AppendLast( &p_dec->p_sys->p_root->p_child, p_cue );
- p_cue->p_parent = (webvtt_dom_node_t *) p_dec->p_sys->p_root;
+ webvtt_domnode_AppendLast( &p_sys->p_root->p_child, p_cue );
+ p_cue->p_parent = (webvtt_dom_node_t *) p_sys->p_root;
}
}
}
@@ -2052,13 +2056,15 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( p_block == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
mtime_t i_start = p_block->i_pts - VLC_TS_0;
mtime_t i_stop = i_start + p_block->i_length;
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
- ClearCuesByTime( &p_dec->p_sys->p_root->p_child, INT64_MAX );
+ ClearCuesByTime( &p_sys->p_root->p_child, INT64_MAX );
else
- ClearCuesByTime( &p_dec->p_sys->p_root->p_child, i_start );
+ ClearCuesByTime( &p_sys->p_root->p_child, i_start );
ProcessISOBMFF( p_dec, p_block->p_buffer, p_block->i_buffer,
i_start, i_stop );
diff --git a/modules/packetizer/avparser.c b/modules/packetizer/avparser.c
index 364141ac1f..aae267734a 100644
--- a/modules/packetizer/avparser.c
+++ b/modules/packetizer/avparser.c
@@ -142,11 +142,12 @@ int OpenPacketizer( vlc_object_t *p_this )
void ClosePacketizer( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
- if (likely( p_dec->p_sys != NULL ))
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ if (likely( p_sys != NULL ))
{
- avcodec_free_context( &p_dec->p_sys->p_codec_ctx );
- av_parser_close( p_dec->p_sys->p_parser_ctx );
- free( p_dec->p_sys );
+ avcodec_free_context( &p_sys->p_codec_ctx );
+ av_parser_close( p_sys->p_parser_ctx );
+ free( p_sys );
}
}
diff --git a/modules/packetizer/copy.c b/modules/packetizer/copy.c
index 073a663ed8..f37e68dd18 100644
--- a/modules/packetizer/copy.c
+++ b/modules/packetizer/copy.c
@@ -132,10 +132,11 @@ static int Open( vlc_object_t *p_this )
static void Close( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
+ decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_dec->p_sys->p_block )
+ if( p_sys->p_block )
{
- block_ChainRelease( p_dec->p_sys->p_block );
+ block_ChainRelease( p_sys->p_block );
}
free( p_dec->p_sys );
@@ -143,11 +144,12 @@ static void Close( vlc_object_t *p_this )
static void Flush( decoder_t *p_dec )
{
- block_t *p_ret = p_dec->p_sys->p_block;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ block_t *p_ret = p_sys->p_block;
if ( p_ret )
{
block_Release( p_ret );
- p_dec->p_sys->p_block = NULL;
+ p_sys->p_block = NULL;
}
}
@@ -157,7 +159,8 @@ static void Flush( decoder_t *p_dec )
static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
{
block_t *p_block;
- block_t *p_ret = p_dec->p_sys->p_block;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ block_t *p_ret = p_sys->p_block;
if( pp_block == NULL || *pp_block == NULL )
return NULL;
@@ -187,10 +190,10 @@ static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
if (p_dec->fmt_in.i_codec != VLC_CODEC_OPUS)
p_ret->i_length = p_block->i_pts - p_ret->i_pts;
}
- p_dec->p_sys->p_block = p_block;
+ p_sys->p_block = p_block;
- if( p_ret && p_dec->p_sys->pf_parse )
- p_dec->p_sys->pf_parse( p_dec, p_ret );
+ if( p_ret && p_sys->pf_parse )
+ p_sys->pf_parse( p_dec, p_ret );
return p_ret;
}
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 76b6ed5286..f7c068a4f9 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -327,7 +327,7 @@ static int Open( vlc_object_t *p_this )
p_sys->p_ccs = cc_storage_new();
if( unlikely(!p_sys->p_ccs) )
{
- free( p_dec->p_sys );
+ free( p_sys );
return VLC_ENOMEM;
}
@@ -519,7 +519,8 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
*****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
{
- return cc_storage_get_current( p_dec->p_sys->p_ccs, p_desc );
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ return cc_storage_get_current( p_sys->p_ccs, p_desc );
}
/****************************************************************************
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index ec8873af7c..151fbf81bc 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -187,7 +187,7 @@ static int Open(vlc_object_t *p_this)
INITQ(frame);
INITQ(post);
- packetizer_Init(&p_dec->p_sys->packetizer,
+ packetizer_Init(&p_sys->packetizer,
p_hevc_startcode, sizeof(p_hevc_startcode), startcode_FindAnnexB,
p_hevc_startcode, 1, 5,
PacketizeReset, PacketizeParse, PacketizeValidate, p_dec);
@@ -318,7 +318,8 @@ static void PacketizeFlush( decoder_t *p_dec )
*****************************************************************************/
static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
{
- return cc_storage_get_current( p_dec->p_sys->p_ccs, p_desc );
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ return cc_storage_get_current( p_sys->p_ccs, p_desc );
}
/****************************************************************************
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index eb39e70eb3..5c4a3208f5 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -150,9 +150,10 @@ enum
};
#define WARN_ONCE(warn, msg) do{\
- if( (p_dec->p_sys->i_warnings & warn) == 0 )\
+ decoder_sys_t *p_sys = p_dec->p_sys;\
+ if( (p_sys->i_warnings & warn) == 0 )\
{\
- p_dec->p_sys->i_warnings |= warn;\
+ p_sys->i_warnings |= warn;\
msg_Warn( p_dec, msg );\
}\
} while(0)
diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c
index 8b26ed557d..7ad0e67a54 100644
--- a/modules/packetizer/mpeg4video.c
+++ b/modules/packetizer/mpeg4video.c
@@ -510,7 +510,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
if( !bs_read1( &s ) ) return VLC_EGENERIC; /* Marker */
/* VOP time increment */
- i_time_increment_bits = vlc_log2(p_dec->p_sys->i_fps_num - 1) + 1;
+ i_time_increment_bits = vlc_log2(p_sys->i_fps_num - 1) + 1;
if( i_time_increment_bits < 1 ) i_time_increment_bits = 1;
i_time_increment = bs_read( &s, i_time_increment_bits );
@@ -519,13 +519,13 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
{
p_sys->i_last_time_ref = p_sys->i_time_ref;
p_sys->i_time_ref +=
- (i_modulo_time_base * p_dec->p_sys->i_fps_num);
+ (i_modulo_time_base * p_sys->i_fps_num);
i_time_ref = p_sys->i_time_ref;
}
else
{
i_time_ref = p_sys->i_last_time_ref +
- (i_modulo_time_base * p_dec->p_sys->i_fps_num);
+ (i_modulo_time_base * p_sys->i_fps_num);
}
#if 0
@@ -534,7 +534,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
p_vop->i_pts, p_vop->i_dts );
#endif
- if( p_dec->p_sys->i_fps_num < 5 && /* Work-around buggy streams */
+ if( p_sys->i_fps_num < 5 && /* Work-around buggy streams */
p_dec->fmt_in.video.i_frame_rate > 0 &&
p_dec->fmt_in.video.i_frame_rate_base > 0 )
{
@@ -542,11 +542,11 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
p_dec->fmt_in.video.i_frame_rate_base /
p_dec->fmt_in.video.i_frame_rate;
}
- else if( p_dec->p_sys->i_fps_num )
+ else if( p_sys->i_fps_num )
p_sys->i_interpolated_pts +=
( CLOCK_FREQ * (i_time_ref + i_time_increment -
p_sys->i_last_time - p_sys->i_last_timeincr) /
- p_dec->p_sys->i_fps_num );
+ p_sys->i_fps_num );
p_sys->i_last_time = i_time_ref;
p_sys->i_last_timeincr = i_time_increment;
diff --git a/modules/packetizer/mpegaudio.c b/modules/packetizer/mpegaudio.c
index 9e6d357b3c..1529d25215 100644
--- a/modules/packetizer/mpegaudio.c
+++ b/modules/packetizer/mpegaudio.c
@@ -399,7 +399,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->i_bit_rate == 0 )
{
/* Free bitrate, but 99% emulated startcode :( */
- if( p_dec->p_sys->i_free_frame_size == MPGA_HEADER_SIZE )
+ if( p_sys->i_free_frame_size == MPGA_HEADER_SIZE )
{
msg_Dbg( p_dec, "free bitrate mode");
}
--
2.17.0
More information about the vlc-devel
mailing list