*****************************************************************************/
static int Open ( vlc_object_t *p_this )
{
- demux_t *p_demux = (demux_t*)p_this;
- demux_sys_t *p_sys;
- es_format_t fmt;
- float f_fps;
- char *psz_type;
+ demux_t *p_demux = (demux_t*)p_this;
+ demux_sys_t *p_sys;
+ es_format_t fmt;
+ input_thread_t *p_input;
+ float f_fps;
+ char *psz_type;
int (*pf_read)( demux_t *, subtitle_t* );
- int i, i_max;
+ int i, i_max;
if( strcmp( p_demux->psz_demux, "subtitle" ) )
{
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
- p_sys->psz_header = NULL;
- p_sys->i_subtitle = 0;
- p_sys->i_subtitles= 0;
- p_sys->subtitle = NULL;
-
+ p_sys->psz_header = NULL;
+ p_sys->i_subtitle = 0;
+ p_sys->i_subtitles = 0;
+ p_sys->subtitle = NULL;
+ p_sys->i_microsecperframe = 0;
+ p_sys->i_original_mspf = 0;
/* Get the FPS */
f_fps = var_CreateGetFloat( p_demux, "sub-fps" );
{
p_sys->i_microsecperframe = (int64_t)( (float)1000000 / f_fps );
}
- else
- {
- p_sys->i_microsecperframe = 0;
- }
- f_fps = var_CreateGetFloat( p_demux, "sub-original-fps" );
- if( f_fps >= 1.0 )
+ p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT );
+ if( p_input )
{
- p_sys->i_original_mspf = (int64_t)( (float)1000000 / f_fps );
- }
- else
- {
- p_sys->i_original_mspf = 0;
+ f_fps = var_GetFloat( p_input, "sub-original-fps" );
+ if( f_fps >= 1.0 )
+ p_sys->i_original_mspf = (int64_t)( (float)1000000 / f_fps );
+
+ vlc_object_release( p_input );
}
/* Get or probe the type */
break;
}
}
+ if( i_start == 1 && i_stop == 1 )
+ {
+ /* We found a possible setting of the framerate "{1}{1}23.976" */
+ float tmp = us_strtod( buffer_text, NULL );
+ if( tmp > 0.0 && !var_GetFloat( p_demux, "sub-fps" ) > 0.0 )
+ p_sys->i_microsecperframe = tmp;
+ }
+
/* replace | by \n */
for( i = 0; i < strlen( buffer_text ); i++ )
{