X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fsubtitle_asa.c;h=63bf9f717004bb4ad37619f04e3ef5097e68643e;hb=e1ff44d2afe03c87242cd3e5e9b48146bdb1e1da;hp=4882206a3cbd53a7b2bd34a0416d339b745cfaf4;hpb=14f37b2101842fa6e427f962f689db74eff6faba;p=vlc diff --git a/modules/demux/subtitle_asa.c b/modules/demux/subtitle_asa.c index 4882206a3c..63bf9f7170 100644 --- a/modules/demux/subtitle_asa.c +++ b/modules/demux/subtitle_asa.c @@ -33,16 +33,9 @@ #include #include #include - - -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#include +#include #include -#include #include "asademux.h" @@ -124,7 +117,6 @@ 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; - input_thread_t *p_input; float f_fps; char *psz_type; int64_t i_ssize; @@ -149,16 +141,11 @@ static int Open ( vlc_object_t *p_this ) p_sys->i_microsecperframe = 40000; /* Get the FPS */ - p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); - if( p_input ) - { - f_fps = var_GetFloat( p_input, "sub-original-fps" ); - if( f_fps >= 1.0 ) - p_sys->i_microsecperframe = (int64_t)( (float)1000000 / f_fps ); + f_fps = var_CreateGetFloat( p_demux, "sub-original-fps" ); + if( f_fps >= 1.0 ) + p_sys->i_microsecperframe = (int64_t)( (float)1000000 / f_fps ); - msg_Dbg( p_demux, "Movie fps: %f", f_fps ); - vlc_object_release( p_input ); - } + msg_Dbg( p_demux, "Movie fps: %f", f_fps ); /* Check for override of the fps */ f_fps = var_CreateGetFloat( p_demux, "sub-fps" ); @@ -246,7 +233,7 @@ static int Open ( vlc_object_t *p_this ) p_sys->i_length = p_sys->subtitle[p_sys->i_subtitles-1].i_stop; /* +1 to avoid 0 */ if( p_sys->i_length <= 0 ) - p_sys->i_length = p_sys->subtitle[p_sys->i_subtitles-1].i_start+1; + p_sys->i_length = p_sys->subtitle[p_sys->i_subtitles-1].i_start + VLC_TS_0; } /* *** add subtitle ES *** */ @@ -280,8 +267,8 @@ static int ProcessLine( demux_t *p_demux, void *p_arg, if( p_sys->i_subtitles >= p_sys->i_subs_alloc ) { p_sys->i_subs_alloc += 500; - if( !( p_sys->subtitle = realloc( p_sys->subtitle, sizeof(subtitle_t) - * p_sys->i_subs_alloc ) ) ) + if( !( p_sys->subtitle = realloc_or_free( p_sys->subtitle, + sizeof(subtitle_t) * p_sys->i_subs_alloc ) ) ) { return VLC_ENOMEM; } @@ -446,9 +433,9 @@ static int Demux( demux_t *p_demux ) continue; } - p_block->i_pts = p_sys->subtitle[p_sys->i_subtitle].i_start; - p_block->i_dts = p_block->i_pts; - if( p_sys->subtitle[p_sys->i_subtitle].i_stop > 0 ) + p_block->i_pts = VLC_TS_0 + p_sys->subtitle[p_sys->i_subtitle].i_start; + p_block->i_dts = VLC_TS_0 + p_block->i_pts; + if( p_sys->subtitle[p_sys->i_subtitle].i_stop >= 0 ) { p_block->i_length = p_sys->subtitle[p_sys->i_subtitle].i_stop - p_block->i_pts; @@ -456,7 +443,7 @@ static int Demux( demux_t *p_demux ) memcpy( p_block->p_buffer, p_sys->subtitle[p_sys->i_subtitle].psz_text, i_len ); - if( p_block->i_pts > 0 ) + if( p_block->i_pts > VLC_TS_INVALID ) { es_out_Send( p_demux->out, p_sys->es, p_block ); }