From 5afc2278c2e23353a411ae0b0dd8e2856eb94e86 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sat, 30 Oct 2004 12:45:26 +0000 Subject: fixed seeking unresponsiveness when using external subtitles do not flush slave subtitle streams. since the output ports are the same for both streams, they will get flushed twice causing frames to be discarded. (possible improvement: check if slave output port is the same as master's) CVS patchset: 7089 CVS date: 2004/10/30 12:45:26 --- ChangeLog | 1 + src/xine-engine/demux.c | 36 +++++++++++++++++++++--------------- src/xine-engine/xine.c | 30 ++++++++++++++++++------------ 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb6e98ccc..dc1a8f446 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,7 @@ bytes. may be disabled with MRL parameter "#nocache". * use monotonic clock where available (eg. linux 2.6) so system clock updates won't disturb xine playback. [bug #781532] + * fixed seeking unresponsiveness when using external subtitles xine-lib (1-rc6) * Moved win32 frontend into separate module. diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 0e0a4ee8e..4b4049464 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -20,7 +20,7 @@ * Demuxer helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $Id: demux.c,v 1.52 2004/10/27 16:41:34 miguelfreitas Exp $ + * $Id: demux.c,v 1.53 2004/10/30 12:45:27 miguelfreitas Exp $ */ @@ -69,13 +69,16 @@ void _x_demux_flush_engine (xine_stream_t *stream) { stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); - if (stream->video_out) { - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); - } - if (stream->audio_out) { - stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); + /* only flush/discard output ports on master streams */ + if( stream->master == stream ) { + if (stream->video_out) { + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); + } + if (stream->audio_out) { + stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); + } } - + stream->video_fifo->clear(stream->video_fifo); stream->audio_fifo->clear(stream->audio_fifo); @@ -97,16 +100,19 @@ void _x_demux_flush_engine (xine_stream_t *stream) { ovl->flush_events(ovl); } - if (stream->video_out) { - stream->video_out->flush(stream->video_out); - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); - } + /* only flush/discard output ports on master streams */ + if( stream->master == stream ) { + if (stream->video_out) { + stream->video_out->flush(stream->video_out); + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); + } - if (stream->audio_out) { - stream->audio_out->flush(stream->audio_out); - stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); + if (stream->audio_out) { + stream->audio_out->flush(stream->audio_out); + stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); + } } - + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); } diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 4baba394c..a63422e45 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.300 2004/10/27 13:09:07 miguelfreitas Exp $ + * $Id: xine.c,v 1.301 2004/10/30 12:45:27 miguelfreitas Exp $ */ /* @@ -1101,12 +1101,15 @@ static int __play_internal (xine_stream_t *stream, int start_pos, int start_time stream->xine->port_ticket->acquire(stream->xine->port_ticket, 1); - /* discard audio/video buffers to get engine going and take the lock faster */ - if (stream->audio_out) - stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); - if (stream->video_out) - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); - + /* only flush/discard output ports on master streams */ + if( stream->master == stream ) { + /* discard audio/video buffers to get engine going and take the lock faster */ + if (stream->audio_out) + stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 1); + if (stream->video_out) + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 1); + } + pthread_mutex_lock( &stream->demux_lock ); /* demux_lock taken. now demuxer is suspended */ stream->demux_action_pending = 0; @@ -1127,11 +1130,14 @@ static int __play_internal (xine_stream_t *stream, int start_pos, int start_time start_pos, start_time, stream->demux_thread_running); - if (stream->audio_out) - stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); - if (stream->video_out) - stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); - + /* only flush/discard output ports on master streams */ + if( stream->master == stream ) { + if (stream->audio_out) + stream->audio_out->set_property(stream->audio_out, AO_PROP_DISCARD_BUFFERS, 0); + if (stream->video_out) + stream->video_out->set_property(stream->video_out, VO_PROP_DISCARD_FRAMES, 0); + } + stream->xine->port_ticket->release(stream->xine->port_ticket, 1); /* before resuming the demuxer, set first_frame_flag */ -- cgit v1.2.3