diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-06 19:07:58 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-06 19:07:58 +0000 |
commit | 61e4a801913f76695aa8445206d27720ba7bac8b (patch) | |
tree | fbf798e232b50df044361d232d3899e69e90b3f8 /mplayer.c | |
parent | 20a7d46a88825b08eea0a3641bedfd53fcd5998d (diff) | |
download | mpv-61e4a801913f76695aa8445206d27720ba7bac8b.tar.bz2 mpv-61e4a801913f76695aa8445206d27720ba7bac8b.tar.xz |
Subtitle handling cleanup: factor out code for parsing embedded subtitles
and adding and removing of lines in subtitle struct into subreader.c.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21845 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -2893,6 +2893,9 @@ static double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio, static void update_subtitles(void) { + unsigned char *packet=NULL; + int len; + char type = d_dvdsub->sh ? ((sh_sub_t *)d_dvdsub->sh)->type : 'v'; // find sub if (subdata) { double pts = sh_video->pts; @@ -2908,9 +2911,8 @@ static void update_subtitles(void) } // DVD sub: - if (vo_config_count && vo_spudec) { - unsigned char* packet=NULL; - int len, timestamp; + if (vo_config_count && vo_spudec && type == 'v') { + int timestamp; current_module = "spudec"; spudec_heartbeat(vo_spudec, 90000*sh_video->timer); /* Get a sub packet from the DVD or a vobsub and make a timestamp @@ -2953,6 +2955,22 @@ static void update_subtitles(void) if (spudec_changed(vo_spudec)) vo_osd_changed(OSDTYPE_SPU); + } else if (dvdsub_id >= 0 && type == 't') { + double pts = MP_NOPTS_VALUE; + while (d_dvdsub->first) { + double nextpts = ds_get_next_pts(d_dvdsub); + if (nextpts == MP_NOPTS_VALUE || nextpts - sub_delay > sh_video->pts) + break; + len = ds_get_packet_sub(d_dvdsub, &packet); + pts = nextpts - sub_delay; + } + if (pts != MP_NOPTS_VALUE) { + static subtitle subs; + sub_clear_text(&subs, MP_NOPTS_VALUE); + sub_add_text(&subs, packet, len, MP_NOPTS_VALUE); + vo_sub = &subs; + vo_osd_changed(OSDTYPE_SUBTITLE); + } } current_module=NULL; } |