]> git.sesse.net Git - vlc/commitdiff
Fixed subtitle duration when rate != default.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 20 Jul 2008 21:09:29 +0000 (23:09 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 20 Jul 2008 21:09:29 +0000 (23:09 +0200)
modules/codec/csri.c
modules/codec/kate.c
modules/codec/subtitles/subsdec.c
modules/codec/subtitles/subsusf.c
modules/codec/telx.c

index 26f4c18077df5251c7892eb7b9bf974a042aa9eb..8a2fd0ecb02ca91a405a4043ca8c81a3f48931c8 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#   include "config.h"
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_vout.h>
@@ -36,6 +40,7 @@
 #include <vlc_block.h>
 #include <vlc_filter.h>
 #include <vlc_stream.h>
+#include <vlc_input.h>
 #include <vlc_xml.h>
 
 #include <math.h>
@@ -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' )
index ac6ba6372ca6c95d8a25f1ac5b130a6a58a86071..2b28a201864577e79a61ef08df56bf50e1b6fb8e 100644 (file)
@@ -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);
index 851a3b3fdd5ec8641f5f28f8bc2c52f969c4dce8..f6abcd9f3bc3002b7985deae2e2c04190675bffd 100644 (file)
@@ -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;
index a18017aa7d75496ca01734b6ae6431f316d5f479..6e074d712d0ca362fd15a06ade8cbb24201ced1c 100644 (file)
@@ -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;
index dbeda2d8bfeaeb11e65025bb7afaadb01320a26a..3e6a47756e0ab65b7b7dcfaa6557068c0be4c7ba 100644 (file)
@@ -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",