summaryrefslogtreecommitdiffstats
path: root/mpcommon.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-27 16:13:21 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-27 16:13:21 +0000
commit4ddc96baaeb59b9e8ef1d8ea07a3911ee465ade6 (patch)
tree3b8d37737156df64dd4fda2e4db187f414303be3 /mpcommon.c
parent0728cf9637920116e623d95081ed147d1993e623 (diff)
downloadmpv-4ddc96baaeb59b9e8ef1d8ea07a3911ee465ade6.tar.bz2
mpv-4ddc96baaeb59b9e8ef1d8ea07a3911ee465ade6.tar.xz
Support mov subtitle format directly instead of converting to text in the demuxer
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25883 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mpcommon.c')
-rw-r--r--mpcommon.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mpcommon.c b/mpcommon.c
index 1d1578c4e1..f6d4c940cb 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -10,6 +10,7 @@
#ifdef HAVE_TV_TELETEXT
#include "stream/tv.h"
#endif
+#include "libavutil/intreadwrite.h"
double sub_last_pts = -303;
@@ -99,7 +100,7 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
if (spudec_changed(vo_spudec))
vo_osd_changed(OSDTYPE_SPU);
- } else if (dvdsub_id >= 0 && (type == 't' || type == 'a')) {
+ } else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a')) {
double curpts = sh_video->pts + sub_delay;
double endpts;
vo_sub = &subs;
@@ -109,6 +110,11 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
break;
endpts = d_dvdsub->first->endpts;
len = ds_get_packet_sub(d_dvdsub, &packet);
+ if (type == 'm') {
+ if (len < 2) continue;
+ len = FFMIN(len - 2, AV_RB16(packet));
+ packet += 2;
+ }
#ifdef USE_ASS
if (type == 'a' && ass_enabled) { // ssa/ass subs with libass
sh_sub_t* sh = d_dvdsub->sh;
@@ -119,7 +125,7 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
(long long)((endpts-pts)*1000 + 0.5));
continue;
}
- if (type == 't' && ass_enabled) { // plaintext subs with libass
+ if ((type == 't' || type == 'm') && ass_enabled) { // plaintext subs with libass
sh_sub_t* sh = d_dvdsub->sh;
ass_track = sh ? sh->ass_track : NULL;
vo_sub = NULL;