Commit 6135b00b authored by Gildas Bazin's avatar Gildas Bazin

* modules/misc/freetype.c, modules/demux/util/sub.c: cleanup.
* 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.
parent f8551ccd
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* sub.c * sub.c
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -94,26 +94,10 @@ static int Open ( vlc_object_t *p_this ) ...@@ -94,26 +94,10 @@ static int Open ( vlc_object_t *p_this )
p_sub->pf_close = sub_close; p_sub->pf_close = sub_close;
/* Initialize the variables */ /* Initialize the variables */
if( !var_Type( p_this, "sub-file" ) ) 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-file", VLC_VAR_STRING ); var_Create( p_this, "sub-delay", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Change( p_this, "sub-file", VLC_VAR_INHERITVALUE, NULL, NULL ); var_Create( p_this, "sub-type", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
}
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 );
}
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -269,11 +253,11 @@ static int sub_open ( subtitle_demux_t *p_sub, ...@@ -269,11 +253,11 @@ static int sub_open ( subtitle_demux_t *p_sub,
var_Get( p_sub, "sub-file", &val ); var_Get( p_sub, "sub-file", &val );
if( !val.psz_string || !*val.psz_string ) 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; return VLC_EGENERIC;
} }
psz_name = strdup( val.psz_string ); psz_name = val.psz_string;
free( val.psz_string );
} }
else else
{ {
...@@ -401,15 +385,14 @@ static int sub_open ( subtitle_demux_t *p_sub, ...@@ -401,15 +385,14 @@ static int sub_open ( subtitle_demux_t *p_sub,
{ {
if( sub_read_subtitle_function[i].i_type == SUB_TYPE_UNKNOWN ) 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 ); text_unload( &txt );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if( sub_read_subtitle_function[i].i_type == i_sub_type ) if( sub_read_subtitle_function[i].i_type == i_sub_type )
{ {
msg_Dbg( p_input, msg_Dbg( p_input, "detected %s format",
"detected %s format",
sub_read_subtitle_function[i].psz_name ); sub_read_subtitle_function[i].psz_name );
pf_read_subtitle = sub_read_subtitle_function[i].pf_read_subtitle; pf_read_subtitle = sub_read_subtitle_function[i].pf_read_subtitle;
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* sub.h * sub.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -133,6 +133,7 @@ static inline ...@@ -133,6 +133,7 @@ static inline
p_sub = vlc_object_create( p_input, sizeof( subtitle_demux_t ) ); p_sub = vlc_object_create( p_input, sizeof( subtitle_demux_t ) );
p_sub->psz_object_name = "subtitle demux"; p_sub->psz_object_name = "subtitle demux";
vlc_object_attach( p_sub, p_input );
p_sub->p_module = module_Need( p_sub, "subtitle demux", "" ); p_sub->p_module = module_Need( p_sub, "subtitle demux", "" );
if( p_sub->p_module && if( p_sub->p_module &&
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* freetype.c : Put text on the video, using freetype2 * freetype.c : Put text on the video, using freetype2
***************************************************************************** *****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN * 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> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -137,22 +137,13 @@ static int Create( vlc_object_t *p_this ) ...@@ -137,22 +137,13 @@ static int Create( vlc_object_t *p_this )
(uint8_t)( pow( (double)i / 255.0f, gamma_inv) * 255.0f ); (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 | VLC_VAR_DOINHERIT );
{ var_Create( p_vout, "freetype-fontsize",
var_Create( p_vout, "freetype-font", VLC_VAR_STRING ); VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
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 );
}
/* Look what method was requested */ /* Look what method was requested */
var_Get( p_vout, "freetype-font", &val ); var_Get( p_vout, "freetype-font", &val );
psz_fontfile = (char *)malloc( PATH_MAX + 1 ); psz_fontfile = val.psz_string;
strcat( psz_fontfile, val.psz_string );
free( val.psz_string);
if( !psz_fontfile || !*psz_fontfile ) if( !psz_fontfile || !*psz_fontfile )
{ {
...@@ -162,7 +153,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -162,7 +153,7 @@ static int Create( vlc_object_t *p_this )
GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 ); GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 );
strcat( psz_fontfile, "\\fonts\\arial.ttf" ); strcat( psz_fontfile, "\\fonts\\arial.ttf" );
#elif SYS_DARWIN #elif SYS_DARWIN
strcat( psz_fontfile, DEFAULT_FONT ); strcpy( psz_fontfile, DEFAULT_FONT );
#endif #endif
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.c: routines for object variables handling * variables.c: routines for object variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -1118,6 +1118,8 @@ static int InheritValue( vlc_object_t *p_this, const char *psz_name, ...@@ -1118,6 +1118,8 @@ static int InheritValue( vlc_object_t *p_this, const char *psz_name,
{ {
switch( i_type & VLC_VAR_TYPE ) switch( i_type & VLC_VAR_TYPE )
{ {
case VLC_VAR_FILE:
case VLC_VAR_DIRECTORY:
case VLC_VAR_STRING: case VLC_VAR_STRING:
p_val->psz_string = config_GetPsz( p_this, psz_name ); p_val->psz_string = config_GetPsz( p_this, psz_name );
if( !p_val->psz_string ) p_val->psz_string = strdup(""); if( !p_val->psz_string ) p_val->psz_string = strdup("");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment