Commit 06844395 authored by Gildas Bazin's avatar Gildas Bazin

* ALL: use p_block->i_length for text subtitles duration (instead of the i_dts hack).

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