Commit 6e3dbc37 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Use the microdvd framerate when available

* avoid the error on sub-original-fps
parent d9c2c093
...@@ -171,13 +171,14 @@ static int Control( demux_t *, int, va_list ); ...@@ -171,13 +171,14 @@ static int Control( demux_t *, int, va_list );
*****************************************************************************/ *****************************************************************************/
static int Open ( vlc_object_t *p_this ) static int Open ( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t*)p_this; demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys; demux_sys_t *p_sys;
es_format_t fmt; es_format_t fmt;
float f_fps; input_thread_t *p_input;
char *psz_type; float f_fps;
char *psz_type;
int (*pf_read)( demux_t *, subtitle_t* ); int (*pf_read)( demux_t *, subtitle_t* );
int i, i_max; int i, i_max;
if( strcmp( p_demux->psz_demux, "subtitle" ) ) if( strcmp( p_demux->psz_demux, "subtitle" ) )
{ {
...@@ -188,11 +189,12 @@ static int Open ( vlc_object_t *p_this ) ...@@ -188,11 +189,12 @@ static int Open ( vlc_object_t *p_this )
p_demux->pf_demux = Demux; p_demux->pf_demux = Demux;
p_demux->pf_control = Control; p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->psz_header = NULL; p_sys->psz_header = NULL;
p_sys->i_subtitle = 0; p_sys->i_subtitle = 0;
p_sys->i_subtitles= 0; p_sys->i_subtitles = 0;
p_sys->subtitle = NULL; p_sys->subtitle = NULL;
p_sys->i_microsecperframe = 0;
p_sys->i_original_mspf = 0;
/* Get the FPS */ /* Get the FPS */
f_fps = var_CreateGetFloat( p_demux, "sub-fps" ); f_fps = var_CreateGetFloat( p_demux, "sub-fps" );
...@@ -200,19 +202,15 @@ static int Open ( vlc_object_t *p_this ) ...@@ -200,19 +202,15 @@ static int Open ( vlc_object_t *p_this )
{ {
p_sys->i_microsecperframe = (int64_t)( (float)1000000 / f_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" ); p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT );
if( f_fps >= 1.0 ) if( p_input )
{ {
p_sys->i_original_mspf = (int64_t)( (float)1000000 / f_fps ); f_fps = var_GetFloat( p_input, "sub-original-fps" );
} if( f_fps >= 1.0 )
else p_sys->i_original_mspf = (int64_t)( (float)1000000 / f_fps );
{
p_sys->i_original_mspf = 0; vlc_object_release( p_input );
} }
/* Get or probe the type */ /* Get or probe the type */
...@@ -727,6 +725,14 @@ static int ParseMicroDvd( demux_t *p_demux, subtitle_t *p_subtitle ) ...@@ -727,6 +725,14 @@ static int ParseMicroDvd( demux_t *p_demux, subtitle_t *p_subtitle )
break; 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 */ /* replace | by \n */
for( i = 0; i < strlen( buffer_text ); i++ ) for( i = 0; i < strlen( buffer_text ); i++ )
{ {
......
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