]> git.sesse.net Git - vlc/commitdiff
* ALL: use p_block->i_length for text subtitles duration (instead of the i_dts hack).
authorGildas Bazin <gbazin@videolan.org>
Wed, 7 Apr 2004 21:13:35 +0000 (21:13 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 7 Apr 2004 21:13:35 +0000 (21:13 +0000)
modules/codec/subsdec.c
modules/demux/mkv.cpp
modules/demux/ogg.c
modules/demux/util/sub.c

index cdd0dcb5f43f89327beb8251458ecdf2a5371d3a..76756b49a4ee5f717adfb9d649d89d995b5120a8 100644 (file)
@@ -371,9 +371,9 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
     }
 
     vout_ShowTextAbsolute( p_vout, psz_subtitle, NULL, 
-                           OSD_ALIGN_BOTTOM | p_sys->i_align,
-                           i_align_h, i_align_v, 
-                           p_block->i_pts, p_block->i_dts );
+        OSD_ALIGN_BOTTOM | p_sys->i_align, i_align_h,
+        i_align_v, p_block->i_pts,
+        p_block->i_length ? p_block->i_pts + p_block->i_length : 0 );
 
     free( psz_subtitle );
 }
index abf3a342795c031f8598bd6e2559be523caaf95c..65b0c067bc0badcbe6898d76dea272f18d4db4a7 100644 (file)
@@ -1532,14 +1532,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts, mtime
 
         if( tk.fmt.i_cat == SPU_ES && strcmp( tk.psz_codec, "S_VOBSUB" ) )
         {
-            if( i_duration > 0 )
-            {
-                p_block->i_dts += i_duration * 1000;
-            }
-            else
-            {
-                p_block->i_dts = 0;
-            }
+            p_block->i_length = i_duration * 1000;
         }
         es_out_Send( p_demux->out, tk.p_es, p_block );
 
index 58455a25204c73e7c7a3ffb954e61c275a93ad91..96b37c54ce1eb3e476f1c2a83b46d8cf451d0abf 100644 (file)
@@ -327,7 +327,8 @@ static int Demux( demux_t * p_demux )
                     }
                     else
                     {
-                        es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_stream->i_pcr );
+                        es_out_Control( p_demux->out, ES_OUT_SET_PCR,
+                                        p_stream->i_pcr );
                     }
                     continue;
                 }
@@ -394,9 +395,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             ogg_sync_reset( &p_sys->oy );
 
         default:
-            return demux2_vaControlHelper( p_demux->s,
-                                           0, -1,
-                                           p_sys->i_bitrate, 1, i_query, args );
+            return demux2_vaControlHelper( p_demux->s, 0, -1, p_sys->i_bitrate,
+                                           1, i_query, args );
     }
 }
 
@@ -464,8 +464,9 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
             /* 1 frame per packet */
             p_stream->i_interpolated_pcr += (I64C(1000000) / p_stream->f_rate);
         else if( p_stream->fmt.i_bitrate )
-            p_stream->i_interpolated_pcr += ( p_oggpacket->bytes * I64C(1000000)
-                                              / p_stream->fmt.i_bitrate / 8 );
+            p_stream->i_interpolated_pcr +=
+                ( p_oggpacket->bytes * I64C(1000000) /
+                  p_stream->fmt.i_bitrate / 8 );
     }
 }
 
@@ -615,7 +616,8 @@ static void Ogg_DecodePacket( demux_t *p_demux,
             {
                 /* Set correct starting date in header packets */
                 p_stream->p_packets_backup[i].granulepos =
-                    p_stream->i_interpolated_pcr * p_stream->f_rate / I64C(1000000);
+                    p_stream->i_interpolated_pcr * p_stream->f_rate /
+                    I64C(1000000);
 
                 Ogg_DecodePacket( p_demux, p_stream,
                                   &p_stream->p_packets_backup[i] );
@@ -638,7 +640,8 @@ static void Ogg_DecodePacket( demux_t *p_demux,
                 es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
 
                 /* Call the pace control */
-                es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_stream->i_pcr );
+                es_out_Control( p_demux->out, ES_OUT_SET_PCR,
+                                p_stream->i_pcr );
             }
 
             p_stream->i_previous_pcr = p_stream->i_pcr;
@@ -690,8 +693,8 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         p_block->i_dts = p_block->i_pts = i_pts;
     else if( p_stream->fmt.i_cat == SPU_ES )
     {
-        p_block->i_pts = i_pts;
-        p_block->i_dts = 0;
+        p_block->i_dts = p_block->i_pts = i_pts;
+        p_block->i_length = 0;
     }
     else if( p_stream->fmt.i_codec == VLC_FOURCC( 't','h','e','o' ) )
         p_block->i_dts = p_block->i_pts = i_pts;
@@ -731,7 +734,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
                   p_oggpacket->packet[i_header_len + 1] != '\n' &&
                   p_oggpacket->packet[i_header_len + 1] != '\r' ) )
             {
-                p_block->i_dts = p_block->i_pts + (mtime_t)lenbytes * 1000;
+                p_block->i_length = (mtime_t)lenbytes * 1000;
             }
         }
 
index fd7cd0951622d9151e4aee3f1ad67b3745515c6f..a06175b8cdd9774143d5216956ffac0523d5489a 100644 (file)
@@ -566,14 +566,15 @@ static int  sub_demux( subtitle_demux_t *p_sub, mtime_t i_maxdate )
             }
 
             p_block->i_pts = p_sub->subtitle[p_sub->i_subtitle].i_start;
-            p_block->i_dts = 0;
+            p_block->i_dts = p_block->i_pts;
             if( p_sub->subtitle[p_sub->i_subtitle].i_stop > 0 )
             {
-                /* FIXME kludge i_dts means end of display... */
-                p_block->i_dts = p_sub->subtitle[p_sub->i_subtitle].i_stop;
+                p_block->i_length =
+                    p_sub->subtitle[p_sub->i_subtitle].i_stop - p_block->i_pts;
             }
 
-            memcpy( p_block->p_buffer, p_sub->subtitle[p_sub->i_subtitle].psz_text, i_len );
+            memcpy( p_block->p_buffer,
+                    p_sub->subtitle[p_sub->i_subtitle].psz_text, i_len );
             if( p_block->i_pts > 0 )
             {
                 es_out_Send( p_input->p_es_out, p_sub->p_es, p_block );
@@ -1329,8 +1330,8 @@ static int  DemuxVobSub( subtitle_demux_t *p_demux, block_t *p_bk )
         /* FIXME i_spu == determines which of the spu tracks we will show. */
         if( p_demux->p_es && i_spu == 0 )
         {
-            p_pkt->i_pts = p_bk->i_pts;
-            p_pkt->i_dts = 0;
+            p_pkt->i_dts = p_pkt->i_pts = p_bk->i_pts;
+            p_pkt->i_length = 0;
             es_out_Send( p_demux->p_input->p_es_out, p_demux->p_es, p_pkt );
 
             p_bk->i_pts = 0;    /* only first packet has a pts */