* modules/demux/util/sub.h: thou shall do a vlc_object_attach().
* src/misc/variables.c: added VLC_VAR_FILE and VLC_VAR_DIRECTORY inheritance support.
* sub.c
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: sub.c,v 1.18 2003/07/23 21:45:13 hartman Exp $
+ * $Id: sub.c,v 1.19 2003/07/23 23:05:25 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
p_sub->pf_close = sub_close;
/* Initialize the variables */
- if( !var_Type( p_this, "sub-file" ) )
- {
- var_Create( p_this, "sub-file", VLC_VAR_STRING );
- var_Change( p_this, "sub-file", VLC_VAR_INHERITVALUE, NULL, NULL );
- }
- if( !var_Type( p_this, "sub-fps" ) )
- {
- var_Create( p_this, "sub-fps", VLC_VAR_FLOAT );
- var_Change( p_this, "sub-fps", VLC_VAR_INHERITVALUE, NULL, NULL );
- }
- if( !var_Type( p_this, "sub-delay" ) )
- {
- var_Create( p_this, "sub-delay", VLC_VAR_INTEGER );
- var_Change( p_this, "sub-delay", VLC_VAR_INHERITVALUE, NULL, NULL );
- }
- if( !var_Type( p_this, "sub-type" ) )
- {
- var_Create( p_this, "sub-type", VLC_VAR_STRING );
- var_Change( p_this, "sub-type", VLC_VAR_INHERITVALUE, NULL, NULL );
- }
+ var_Create( p_this, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
+ var_Create( p_this, "sub-fps", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
+ var_Create( p_this, "sub-delay", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+ var_Create( p_this, "sub-type", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
return VLC_SUCCESS;
}
var_Get( p_sub, "sub-file", &val );
if( !val.psz_string || !*val.psz_string )
{
- if( val.psz_string) free( val.psz_string);
+ if( val.psz_string ) free( val.psz_string );
+ msg_Err( p_sub, "cannot open `%s' subtitle fileeee", val.psz_string );
return VLC_EGENERIC;
}
- psz_name = strdup( val.psz_string );
- free( val.psz_string );
+ psz_name = val.psz_string;
}
else
{
{
if( sub_read_subtitle_function[i].i_type == SUB_TYPE_UNKNOWN )
{
- msg_Dbg( p_input, "unknown subtitile file" );
+ msg_Dbg( p_input, "unknown subtitle file" );
text_unload( &txt );
return VLC_EGENERIC;
}
if( sub_read_subtitle_function[i].i_type == i_sub_type )
{
- msg_Dbg( p_input,
- "detected %s format",
+ msg_Dbg( p_input, "detected %s format",
sub_read_subtitle_function[i].psz_name );
pf_read_subtitle = sub_read_subtitle_function[i].pf_read_subtitle;
break;
* sub.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: sub.h,v 1.4 2003/03/15 18:44:31 fenrir Exp $
+ * $Id: sub.h,v 1.5 2003/07/23 23:05:25 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
p_sub = vlc_object_create( p_input, sizeof( subtitle_demux_t ) );
p_sub->psz_object_name = "subtitle demux";
+ vlc_object_attach( p_sub, p_input );
p_sub->p_module = module_Need( p_sub, "subtitle demux", "" );
if( p_sub->p_module &&
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
- * $Id: freetype.c,v 1.10 2003/07/23 21:45:13 hartman Exp $
+ * $Id: freetype.c,v 1.11 2003/07/23 23:05:25 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
(uint8_t)( pow( (double)i / 255.0f, gamma_inv) * 255.0f );
}
- if( !var_Type( p_vout, "freetype-font" ) )
- {
- var_Create( p_vout, "freetype-font", VLC_VAR_STRING );
- var_Change( p_vout, "freetype-font", VLC_VAR_INHERITVALUE, NULL, NULL );
- }
- if( !var_Type( p_vout, "freetype-fontsize" ) )
- {
- var_Create( p_vout, "freetype-fontsize", VLC_VAR_INTEGER );
- var_Change( p_vout, "freetype-fontsize", VLC_VAR_INHERITVALUE, NULL, NULL );
- }
+ var_Create( p_vout, "freetype-font", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+ var_Create( p_vout, "freetype-fontsize",
+ VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
/* Look what method was requested */
var_Get( p_vout, "freetype-font", &val );
- psz_fontfile = (char *)malloc( PATH_MAX + 1 );
- strcat( psz_fontfile, val.psz_string );
- free( val.psz_string);
-
+ psz_fontfile = val.psz_string;
+
if( !psz_fontfile || !*psz_fontfile )
{
if( psz_fontfile ) free( psz_fontfile );
GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 );
strcat( psz_fontfile, "\\fonts\\arial.ttf" );
#elif SYS_DARWIN
- strcat( psz_fontfile, DEFAULT_FONT );
+ strcpy( psz_fontfile, DEFAULT_FONT );
#endif
}
* variables.c: routines for object variables handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: variables.c,v 1.28 2003/07/23 22:01:25 gbazin Exp $
+ * $Id: variables.c,v 1.29 2003/07/23 23:05:25 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
{
switch( i_type & VLC_VAR_TYPE )
{
+ case VLC_VAR_FILE:
+ case VLC_VAR_DIRECTORY:
case VLC_VAR_STRING:
p_val->psz_string = config_GetPsz( p_this, psz_name );
if( !p_val->psz_string ) p_val->psz_string = strdup("");