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

core: replace decoder_sys_t* by void*

See #17078
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 238459bf
......@@ -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;
......
......@@ -149,7 +149,8 @@ static vlc_fourcc_t FindVlcChroma( struct aom_image *img )
****************************************************************************/
static int Decode(decoder_t *dec, block_t *block)
{
aom_codec_ctx_t *ctx = &dec->p_sys->ctx;
decoder_sys_t *p_sys = dec->p_sys;
aom_codec_ctx_t *ctx = &p_sys->ctx;
if (!block) /* No Drain */
return VLCDEC_SUCCESS;
......
......@@ -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) {
......
......@@ -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;
......@@ -1373,7 +1375,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]))
{
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 )
......
......@@ -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 );
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)) ) |
......
......@@ -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 )
......
......@@ -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;
......
......@@ -1615,13 +1615,15 @@ static CFMutableDictionaryRef ESDSExtradataInfoCreate(decoder_t *p_dec,
static int ConfigureVout(decoder_t *p_dec)
{
decoder_sys_t *p_sys = p_dec->p_sys;
/* return our proper VLC internal state */
p_dec->fmt_out.video = p_dec->fmt_in.video;
p_dec->fmt_out.video.p_palette = NULL;
p_dec->fmt_out.i_codec = 0;
if(p_dec->p_sys->pf_configure_vout &&
!p_dec->p_sys->pf_configure_vout(p_dec))
if(p_sys->pf_configure_vout &&
!p_sys->pf_configure_vout(p_dec))
return VLC_EGENERIC;
if (!p_dec->fmt_out.video.i_sar_num || !p_dec->fmt_out.video.i_sar_den)
......@@ -1667,11 +1669,12 @@ static CMSampleBufferRef VTSampleBufferCreate(decoder_t *p_dec,
CMFormatDescriptionRef fmt_desc,
block_t *p_block)
{
decoder_sys_t *p_sys = p_dec->p_sys;
OSStatus status;
CMBlockBufferRef block_buf = NULL;
CMSampleBufferRef sample_buf = NULL;
CMTime pts;
if(!p_dec->p_sys->b_poc_based_reorder && p_block->i_pts == VLC_TS_INVALID)
if(!p_sys->b_poc_based_reorder && p_block->i_pts == VLC_TS_INVALID)
pts = CMTimeMake(p_block->i_dts, CLOCK_FREQ);
else
pts = CMTimeMake(p_block->i_pts, CLOCK_FREQ);
......@@ -2029,6 +2032,7 @@ skip:
static int UpdateVideoFormat(decoder_t *p_dec, CVPixelBufferRef imageBuffer)
{
decoder_sys_t *p_sys = p_dec->p_sys;
NSDictionary *attachmentDict =
(__bridge NSDictionary *)CVBufferGetAttachments(imageBuffer, kCVAttachmentMode_ShouldPropagate);
......@@ -2088,13 +2092,13 @@ static int UpdateVideoFormat(decoder_t *p_dec, CVPixelBufferRef imageBuffer)
assert(CVPixelBufferIsPlanar(imageBuffer) == false);
break;
default:
p_dec->p_sys->vtsession_status = VTSESSION_STATUS_ABORT;
p_sys->vtsession_status = VTSESSION_STATUS_ABORT;
return -1;
}
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
if (decoder_UpdateVideoFormat(p_dec) != 0)
{
p_dec->p_sys->vtsession_status = VTSESSION_STATUS_ABORT;
p_sys->vtsession_status = VTSESSION_STATUS_ABORT;
return -1;
}
return 0;
......
......@@ -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;
......
......@@ -161,7 +161,8 @@ static vlc_fourcc_t FindVlcChroma( struct vpx_image *img )
****************************************************************************/
static int Decode(decoder_t *dec, block_t *block)
{
struct vpx_codec_ctx *ctx = &dec->p_sys->ctx;
decoder_sys_t *p_sys = dec->p_sys;
struct vpx_codec_ctx *ctx = &p_sys->ctx;
if (block == NULL) /* No Drain */
return VLCDEC_SUCCESS;
......
......@@ -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 );
......
......@@ -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 );
}
}
......
......@@ -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;