From 9b19a07597165946cb8ec2d1753ad237963e4e6b Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Sun, 20 Jul 2008 23:09:29 +0200 Subject: [PATCH] Fixed subtitle duration when rate != default. --- modules/codec/csri.c | 9 ++++++++- modules/codec/kate.c | 5 ++++- modules/codec/subtitles/subsdec.c | 14 ++++++++++---- modules/codec/subtitles/subsusf.c | 14 ++++++++++---- modules/codec/telx.c | 5 ++++- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/modules/codec/csri.c b/modules/codec/csri.c index 26f4c18077..8a2fd0ecb0 100644 --- a/modules/codec/csri.c +++ b/modules/codec/csri.c @@ -24,10 +24,14 @@ /***************************************************************************** * Preamble *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include -#include "config.h" #include #include #include @@ -36,6 +40,7 @@ #include #include #include +#include #include #include @@ -170,6 +175,8 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) return NULL; p_block = *pp_block; + if( p_block->i_rate != 0 ) + p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT; *pp_block = NULL; if( p_block->i_buffer == 0 || p_block->p_buffer[0] == '\0' ) diff --git a/modules/codec/kate.c b/modules/codec/kate.c index ac6ba6372c..2b28a20186 100644 --- a/modules/codec/kate.c +++ b/modules/codec/kate.c @@ -210,9 +210,12 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) block_t *p_block; kate_packet kp; - if( !pp_block || !*pp_block ) return NULL; + if( !pp_block || !*pp_block ) + return NULL; p_block = *pp_block; + if( p_block->i_rate != 0 ) + p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT; /* Block to Kate packet */ kate_packet_wrap(&kp, p_block->i_buffer, p_block->p_buffer); diff --git a/modules/codec/subtitles/subsdec.c b/modules/codec/subtitles/subsdec.c index 851a3b3fdd..f6abcd9f3b 100644 --- a/modules/codec/subtitles/subsdec.c +++ b/modules/codec/subtitles/subsdec.c @@ -252,13 +252,19 @@ static int OpenDecoder( vlc_object_t *p_this ) ****************************************************************************/ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) { - subpicture_t *p_spu = NULL; + subpicture_t *p_spu; + block_t *p_block; + + if( !pp_block || *pp_block == NULL ) + return NULL; - if( !pp_block || *pp_block == NULL ) return NULL; + p_block = *pp_block; + if( p_block->i_rate != 0 ) + p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT; - p_spu = ParseText( p_dec, *pp_block ); + p_spu = ParseText( p_dec, p_block ); - block_Release( *pp_block ); + block_Release( p_block ); *pp_block = NULL; return p_spu; diff --git a/modules/codec/subtitles/subsusf.c b/modules/codec/subtitles/subsusf.c index a18017aa7d..6e074d712d 100644 --- a/modules/codec/subtitles/subsusf.c +++ b/modules/codec/subtitles/subsusf.c @@ -118,13 +118,19 @@ static int OpenDecoder( vlc_object_t *p_this ) ****************************************************************************/ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) { - subpicture_t *p_spu = NULL; + subpicture_t *p_spu; + block_t *p_block; + + if( !pp_block || *pp_block == NULL ) + return NULL; - if( !pp_block || *pp_block == NULL ) return NULL; + p_block = *pp_block; + if( p_block->i_rate != 0 ) + p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT; - p_spu = ParseText( p_dec, *pp_block ); + p_spu = ParseText( p_dec, p_block ); - block_Release( *pp_block ); + block_Release( p_block ); *pp_block = NULL; return p_spu; diff --git a/modules/codec/telx.c b/modules/codec/telx.c index dbeda2d8bf..3e6a47756e 100644 --- a/modules/codec/telx.c +++ b/modules/codec/telx.c @@ -453,8 +453,11 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block ) char psz_line[256]; int i, total; - if( pp_block == NULL || *pp_block == NULL ) return NULL; + if( pp_block == NULL || *pp_block == NULL ) + return NULL; p_block = *pp_block; + if( p_block->i_rate != 0 ) + p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT; *pp_block = NULL; dbg((p_dec, "start of telx packet with header %2x\n", -- GitLab