* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* character table identified in the subtitle descriptor.
*
* The spec is quite vague in this area, but what is meant is perhaps that it
- * refers to the character index in the codepage belonging to the language specified
- * in the subtitle descriptor. Potentially it's designed for widechar
+ * refers to the character index in the codepage belonging to the language
+ * specified in the subtitle descriptor. Potentially it's designed for widechar
* (but not for UTF-*) codepages.
*****************************************************************************
*
*****************************************************************************
* Notes on DDS (Display Definition Segment)
- * DDS (Display Definition Segment) tells the decoder how the subtitle image relates to
- * the video image.
- * For SD, the subtitle image is always considered to be for display at 720x576
- * (although it's assumed that for NTSC, this is 720x480, this is not documented well)
- * Also, for SD, the subtitle image is drawn 'on the glass' (i.e. after video scaling,
- + * letterbox, etc.)
- * For 'HD' (subs marked type 0x14/0x24 in PSI), a DDS must be present, and the subs area
- * is drawn onto the video area (scales if necessary). The DDS tells the decoder what
- * resolution the subtitle images were intended for, and hence how to scale the subtitle
- * images for a particular video size
- * i.e. if HD video is presented as letterbox, the subs will
- * be in the same place on the video as if the video was presented on an HD set
- * indeed, if the HD video was pillarboxed by the decoder, the subs may be cut off as
- * well as the video. The intent here is that the subs can be placed accurately on the video
- * - somthing which was missed in the original spec.
+ * -----------------------------------------
+ * DDS (Display Definition Segment) tells the decoder how the subtitle image
+ * relates to the video image.
+ * For SD, the subtitle image is always considered to be for display at
+ * 720x576 (although it's assumed that for NTSC, this is 720x480, this
+ * is not documented well) Also, for SD, the subtitle image is drawn 'on
+ * the glass' (i.e. after video scaling, letterbox, etc.)
+ * For 'HD' (subs marked type 0x14/0x24 in PSI), a DDS must be present,
+ * and the subs area is drawn onto the video area (scales if necessary).
+ * The DDS tells the decoder what resolution the subtitle images were
+ * intended for, and hence how to scale the subtitle images for a
+ * particular video size
+ * i.e. if HD video is presented as letterbox, the subs will be in the
+ * same place on the video as if the video was presented on an HD set
+ * indeed, if the HD video was pillarboxed by the decoder, the subs may
+ * be cut off as well as the video. The intent here is that the subs can
+ * be placed accurately on the video - something which was missed in the
+ * original spec.
*
* A DDS may also specify a window - this is where the subs images are moved so that the (0,0)
* origin of decode is offset.
{
decoder_t *p_dec = (decoder_t *) p_this;
decoder_sys_t *p_sys;
- vlc_value_t val;
int i_posx, i_posy;
if( p_dec->fmt_in.i_codec != VLC_CODEC_DVBS )
}
p_dec->pf_decode_sub = Decode;
- p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
+ p_sys = p_dec->p_sys = calloc( 1, sizeof(decoder_sys_t) );
if( !p_sys )
return VLC_ENOMEM;
- memset( p_sys, 0, sizeof(decoder_sys_t) );
- p_sys->i_pts = (mtime_t) 0;
+ p_sys->i_pts = VLC_TS_INVALID;
p_sys->i_id = p_dec->fmt_in.subs.dvb.i_id & 0xFFFF;
p_sys->i_ancillary_id = p_dec->fmt_in.subs.dvb.i_id >> 16;
/* configure for SD res in case DDS is not present */
default_dds_init( p_dec );
- var_Create( p_this, DVBSUB_CFG_PREFIX "position",
- VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- var_Get( p_this, DVBSUB_CFG_PREFIX "position", &val );
- p_sys->i_spu_position = val.i_int;
- var_Create( p_this, DVBSUB_CFG_PREFIX "x",
- VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- var_Get( p_this, DVBSUB_CFG_PREFIX "x", &val );
- i_posx = val.i_int;
- var_Create( p_this, DVBSUB_CFG_PREFIX "y",
- VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- var_Get( p_this, DVBSUB_CFG_PREFIX "y", &val );
- i_posy = val.i_int;
+ p_sys->i_spu_position = var_CreateGetInteger( p_this,
+ DVBSUB_CFG_PREFIX "position" );
+ i_posx = var_CreateGetInteger( p_this, DVBSUB_CFG_PREFIX "x" );
+ i_posy = var_CreateGetInteger( p_this, DVBSUB_CFG_PREFIX "y" );
/* Check if subpicture position was overridden */
p_sys->b_absolute = true;
default_dds_init( p_dec );
p_sys->i_pts = p_block->i_pts;
- if( p_sys->i_pts <= 0 )
+ if( p_sys->i_pts <= VLC_TS_INVALID )
{
#ifdef DEBUG_DVBSUB
/* Some DVB channels send stuffing segments in non-dated packets so
#ifdef DEBUG_DVBSUB
msg_Dbg( p_dec, "new region: %i", i_id );
#endif
- p_region = *pp_region = malloc( sizeof(dvbsub_region_t) );
+ p_region = *pp_region = calloc( 1, sizeof(dvbsub_region_t) );
if( !p_region )
return;
- memset( p_region, 0, sizeof(dvbsub_region_t) );
p_region->p_object_defs = NULL;
p_region->p_pixbuf = NULL;
p_region->p_next = NULL;
free( p_region->p_pixbuf );
}
- p_region->p_pixbuf = malloc( i_height * i_width );
+ p_region->p_pixbuf = xmalloc( i_height * i_width );
p_region->i_depth = 0;
b_fill = true;
}
/* We create a new object */
p_region->i_object_defs++;
- p_region->p_object_defs =
- realloc( p_region->p_object_defs,
+ p_region->p_object_defs = xrealloc( p_region->p_object_defs,
sizeof(dvbsub_objectdef_t) * p_region->i_object_defs );
/* We parse object properties */
if( p_region->p_object_defs[i].i_id != i_id ) continue;
p_region->p_object_defs[i].psz_text =
- realloc( p_region->p_object_defs[i].psz_text,
+ xrealloc( p_region->p_object_defs[i].psz_text,
i_number_of_codes + 1 );
/* FIXME 16bits -> char ??? See Preamble */
p_spu->b_absolute = p_sys->b_absolute;
/* Set the pf_render callback */
- p_spu->i_start = (mtime_t) p_sys->i_pts;
+ p_spu->i_start = p_sys->i_pts;
//p_spu->i_stop = (mtime_t) 0;
p_spu->b_ephemer = true;
//p_spu->b_fade = true;
{
encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys;
- vlc_value_t val;
if( ( p_enc->fmt_out.i_codec != VLC_CODEC_DVBS ) &&
!p_enc->b_force )
p_sys->i_regions = 0;
p_sys->p_regions = 0;
- var_Create( p_this, ENC_CFG_PREFIX "x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- var_Get( p_this, ENC_CFG_PREFIX "x", &val );
- p_sys->i_offset_x = val.i_int;
- var_Create( p_this, ENC_CFG_PREFIX "y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- var_Get( p_this, ENC_CFG_PREFIX "y", &val );
- p_sys->i_offset_y = val.i_int;
+ p_sys->i_offset_x = var_CreateGetInteger( p_this, ENC_CFG_PREFIX "x" );
+ p_sys->i_offset_y = var_CreateGetInteger( p_this, ENC_CFG_PREFIX "y" );
return VLC_SUCCESS;
}
#endif
#ifndef RANDOM_DITHERING
- pi_delta = malloc( ( p_region->p_picture->p[0].i_pitch + 1 )
+ pi_delta = xmalloc( ( p_region->p_picture->p[0].i_pitch + 1 )
* sizeof(int) * 4 );
for( i = 0; i < (p_region->p_picture->p[0].i_pitch + 1) * 4 ; i++ )
{
{
encoder_region_t region;
region.i_width = region.i_height = 0;
- p_sys->p_regions =
- realloc( p_sys->p_regions, sizeof(encoder_region_t) *
- (p_sys->i_regions + 1) );
+ p_sys->p_regions = xrealloc( p_sys->p_regions,
+ sizeof(encoder_region_t) * (p_sys->i_regions + 1) );
p_sys->p_regions[p_sys->i_regions++] = region;
}