diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-17 20:53:46 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-17 20:53:46 +0000 |
commit | 4101fdeea5081b0c03ddf8e5c59556cb51189fb6 (patch) | |
tree | b5ddd24e9ae0a3a29e6e164947a53a220389267f | |
parent | af3d8974a6cc0d7e3f8dd886e5fd33cc89612bfa (diff) | |
download | xine-lib-4101fdeea5081b0c03ddf8e5c59556cb51189fb6.tar.gz xine-lib-4101fdeea5081b0c03ddf8e5c59556cb51189fb6.tar.bz2 |
fix problem where subtitles were discarded on a fast machine
CVS patchset: 3949
CVS date: 2003/01/17 20:53:46
-rw-r--r-- | src/libsputext/xine_decoder.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 40437427d..b892a8c9b 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.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_decoder.c,v 1.51 2003/01/13 14:26:17 mroi Exp $ + * $Id: xine_decoder.c,v 1.52 2003/01/17 20:53:46 miguelfreitas Exp $ * */ @@ -76,6 +76,8 @@ typedef struct sputext_decoder_s { int font_size; int line_height; int seek_count; + int master_started; + int slave_started; char *font; subtitle_size subtitle_size; @@ -244,8 +246,12 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { diff = end - extra_info.frame_number; /* discard old subtitles */ - if( diff < 0 ) + if( diff < 0 ) { +#ifdef LOG + printf("libsputext: discarding old\n"); +#endif return; + } diff = start - extra_info.frame_number; @@ -269,8 +275,12 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { diff = end - extra_info.input_time; /* discard old subtitles */ - if( diff < 0 ) + if( diff < 0 ) { +#ifdef LOG + printf("libsputext: discarding old\n"); +#endif return; + } diff = start - extra_info.input_time; @@ -287,22 +297,37 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { status = xine_get_status (this->stream->master); - if( status == XINE_STATUS_QUIT || status == XINE_STATUS_STOP ) { + if( this->master_started && (status == XINE_STATUS_QUIT || + status == XINE_STATUS_STOP) ) { +#ifdef LOG + printf("libsputext: master stopped\n"); +#endif this->width = this->height = 0; return; } + if( status == XINE_STATUS_PLAY ) + this->master_started = 1; status = xine_get_status (this->stream); - if( status == XINE_STATUS_QUIT || status == XINE_STATUS_STOP ) { + if( this->slave_started && (status == XINE_STATUS_QUIT || + status == XINE_STATUS_STOP) ) { +#ifdef LOG + printf("libsputext: slave stopped\n"); +#endif this->width = this->height = 0; return; } + if( status == XINE_STATUS_PLAY ) + this->slave_started = 1; xine_usec_sleep (50000); xine_get_current_info (this->stream->master, &extra_info, sizeof(extra_info) ); } +#ifdef LOG + printf("libsputext: seek_count mismatch\n"); +#endif } |