diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2002-06-23 22:51:16 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2002-06-23 22:51:16 +0000 |
commit | 06e39f2fdf2bca1722fde4d2e394c4ab9bb1bc67 (patch) | |
tree | 5cf534fe33f8d8516834d9426976e7b7e33846d1 | |
parent | b9651578b1da4f97585503731b2c6606d93df945 (diff) | |
download | xine-lib-06e39f2fdf2bca1722fde4d2e394c4ab9bb1bc67.tar.gz xine-lib-06e39f2fdf2bca1722fde4d2e394c4ab9bb1bc67.tar.bz2 |
Oops, i've pushed crap into CVS. Fix that.
CVS patchset: 2143
CVS date: 2002/06/23 22:51:16
-rw-r--r-- | src/libsputext/xine_decoder.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 16b562d8d..b270cc4ea 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.30 2002/06/23 22:33:00 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.31 2002/06/23 22:51:16 f1rmb Exp $ * * code based on mplayer module: * @@ -105,6 +105,7 @@ typedef struct sputext_decoder_s { char *dst_encoding; subtitle_size subtitle_size; + int64_t last_subtitle_end; /* no new subtitle before this vpts */ } sputext_decoder_t; #define FORMAT_MICRODVD 0 @@ -800,10 +801,10 @@ static void update_font_size (sputext_decoder_t *this) { this->line_height = this->font_size + 10; y = this->height - (SUB_MAX_TEXT * this->line_height) - 5; - + if( this->osd ) this->renderer->free_object (this->osd); - + if(this->renderer) { this->osd = this->renderer->new_object (this->renderer, this->width, @@ -843,9 +844,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } else { - int64_t pts, pts_end; - int64_t pts_factor; - int frame_num; + int64_t sub_start, sub_end; subtitle_t *subtitle; /* don't want to see subtitle */ @@ -853,16 +852,16 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { return; subtitle = NULL; - - pts = buf->pts; - pts_end = pts; - frame_num = buf->decoder_info[1]; /* * find out which subtitle to display */ if (!this->uses_time) { + int frame_num; + int64_t pts_factor; + + frame_num = buf->decoder_info[1]; while ( (this->cur < this->num) && (this->subtitles[this->cur].start < frame_num) ) @@ -881,15 +880,13 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { */ pts_factor = 3000; - pts += this->xine->metronom->vpts_offset; - - pts_end = pts + (subtitle->end - subtitle->start) * pts_factor; + sub_start = this->xine->metronom->got_spu_packet(this->xine->metronom, buf->pts); + sub_end = sub_start + (subtitle->end - subtitle->start) * pts_factor; } else { - uint32_t start_tenth; - start_tenth = pts/900; + start_tenth = buf->pts/900; #ifdef LOG printf ("sputext: searching for spu for %d\n", start_tenth); @@ -912,11 +909,13 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if (subtitle->start > (start_tenth+20)) return; - pts += this->xine->metronom->vpts_offset; - - pts_end = pts + (subtitle->end - subtitle->start)*900; + sub_start = this->xine->metronom->got_spu_packet(this->xine->metronom, subtitle->start*900); + sub_end = sub_start + (subtitle->end - subtitle->start)*900; } + if( !sub_start ) + return; + if (subtitle) { int line, y; int font_size; @@ -947,10 +946,15 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if( font_size != this->font_size ) this->renderer->set_font (this->osd, this->font, this->font_size); + + if( this->last_subtitle_end && sub_start < this->last_subtitle_end ) { + sub_start = this->last_subtitle_end; + } + this->last_subtitle_end = sub_end; this->renderer->set_text_palette (this->osd, -1, OSD_TEXT1); - this->renderer->show (this->osd, pts ); - this->renderer->hide (this->osd, pts_end); + this->renderer->show (this->osd, sub_start); + this->renderer->hide (this->osd, sub_end); #ifdef LOG printf ("sputext: scheduling subtitle >%s< at %lld until %lld, current time is %lld\n", |