Commit 997c6c34 authored by Clément Stenac's avatar Clément Stenac

* Re-added sub-delay option

* Re-implemented sub-fps for SubRIP.
* Use 50ms increments for hotkeys
parent c9275380
......@@ -293,7 +293,7 @@ static void Run( intf_thread_t *p_intf )
{
int64_t i_delay = var_GetTime( p_input, "spu-delay" );
i_delay -= 10000; /* 10 ms */
i_delay -= 50000; /* 50 ms */
var_SetTime( p_input, "spu-delay", i_delay );
ClearChannels( p_intf, p_vout );
......@@ -304,7 +304,7 @@ static void Run( intf_thread_t *p_intf )
{
int64_t i_delay = var_GetTime( p_input, "spu-delay" );
i_delay += 10000; /* 10 ms */
i_delay += 50000; /* 50 ms */
var_SetTime( p_input, "spu-delay", i_delay );
ClearChannels( p_intf, p_vout );
......
......@@ -66,6 +66,9 @@ vlc_module_begin();
add_float( "sub-fps", 0.0, NULL,
N_("Frames per second"),
SUB_FPS_LONGTEXT, VLC_TRUE );
add_integer( "sub-delay", 0, NULL,
N_("Subtitles delay"),
SUB_DELAY_LONGTEXT, VLC_TRUE );
add_string( "sub-type", "auto", NULL, "Subtitles fileformat",
SUB_TYPE_LONGTEXT, VLC_TRUE );
change_string_list( ppsz_sub_type, 0, 0 );
......@@ -116,12 +119,12 @@ struct demux_sys_t
int64_t i_next_demux_date;
int64_t i_microsecperframe;
mtime_t i_original_mspf;
char *psz_header;
int i_subtitle;
int i_subtitles;
subtitle_t *subtitle;
mtime_t i_original_mspf;
int64_t i_length;
};
......@@ -182,7 +185,6 @@ static int Open ( vlc_object_t *p_this )
p_sys->i_subtitle = 0;
p_sys->i_subtitles= 0;
p_sys->subtitle = NULL;
p_sys->i_original_mspf = 0;
/* Get the FPS */
......@@ -193,6 +195,16 @@ static int Open ( vlc_object_t *p_this )
p_sys->i_microsecperframe = (mtime_t)( (float)1000000 / f_fps );
}
f_fps = var_CreateGetFloat( p_demux, "sub-original-fps" );
if( f_fps >= 1.0 )
{
p_sys->i_original_mspf = (mtime_t)( (float)1000000 / f_fps );
}
else
{
p_sys->i_original_mspf = 0;
}
/* Get or probe the type */
p_sys->i_type = SUB_TYPE_UNKNOWN;
psz_type = var_CreateGetString( p_demux, "sub-type" );
......@@ -769,11 +781,11 @@ static int ParseSubRip( demux_t *p_demux, subtitle_t *p_subtitle )
p_sys->i_original_mspf != 0)
{
p_subtitle->i_start = (mtime_t)i_start *
p_sys->i_original_mspf /
p_sys->i_microsecperframe;
p_sys->i_microsecperframe/
p_sys->i_original_mspf;
p_subtitle->i_stop = (mtime_t)i_stop *
p_sys->i_original_mspf /
p_sys->i_microsecperframe;
p_sys->i_microsecperframe /
p_sys->i_original_mspf;
}
return 0;
}
......
......@@ -514,7 +514,7 @@ static int Init( input_thread_t * p_input )
vlc_value_t val;
double f_fps;
vlc_meta_t *p_meta, *p_meta_user;
int i;
int i, i_delay;
/* Initialize optional stream output. (before access/demuxer) */
psz = var_GetString( p_input, "sout" );
......@@ -628,14 +628,27 @@ static int Init( input_thread_t * p_input )
f_fps > 1.0 )
{
vlc_value_t fps;
float f_requested_fps;
var_Create( p_input, "sub-original-fps", VLC_VAR_FLOAT );
var_SetFloat( p_input, "sub-original-fps", f_fps );
if( var_Get( p_input, "sub-fps", &fps ) )
f_requested_fps = var_CreateGetFloat( p_input, "sub-fps" );
if( f_requested_fps != f_fps )
{
var_Create( p_input, "sub-fps", VLC_VAR_FLOAT| VLC_VAR_DOINHERIT );
var_SetFloat( p_input, "sub-fps", f_fps );
var_SetFloat( p_input, "sub-fps", f_requested_fps );
}
}
i_delay = var_CreateGetInteger( p_input, "sub-delay" );
if( i_delay != 0 )
{
var_SetTime( p_input, "spu-delay", (mtime_t)i_delay * 100000 );
}
/* Look for and add subtitle files */
psz_subtitle = var_GetString( p_input, "sub-file" );
if( *psz_subtitle )
......
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