[MPlayer-cvslog] r25883 - in trunk: libmpdemux/demux_mov.c mpcommon.c

reimar subversion at mplayerhq.hu
Sun Jan 27 17:13:21 CET 2008


Author: reimar
Date: Sun Jan 27 17:13:21 2008
New Revision: 25883

Log:
Support mov subtitle format directly instead of converting to text in the demuxer


Modified:
   trunk/libmpdemux/demux_mov.c
   trunk/mpcommon.c

Modified: trunk/libmpdemux/demux_mov.c
==============================================================================
--- trunk/libmpdemux/demux_mov.c	(original)
+++ trunk/libmpdemux/demux_mov.c	Sun Jan 27 17:13:21 2008
@@ -1327,8 +1327,10 @@ static void lschunks(demuxer_t* demuxer,
 			mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_SubtitleID, "mov", priv->track_db);
 			if (trak->fourcc == mmioFOURCC('m','p','4','s'))
 				init_vobsub(sh, trak);
-			else
-				sh->type = 't';
+			else {
+				sh->type = 'm';
+				sub_utf8 = 1;
+			}
 		} else
 		mp_msg(MSGT_DEMUX, MSGL_V, "Generic track - not completely understood! (id: %d)\n",
 		    trak->id);
@@ -2188,13 +2190,6 @@ if(trak->pos==0 && trak->stream_header_l
         int len = trak->samples[samplenr].size;
         double subpts = (double)trak->samples[samplenr].pts / (double)trak->timescale;
         stream_seek(demuxer->stream, pos);
-        if (sh->type != 'v') {
-          stream_skip(demuxer->stream, 2); // size
-          len -= 2;
-          if (len < 0) len = 0;
-          if (len > MOV_MAX_SUBLEN) len = MOV_MAX_SUBLEN;
-          sub_utf8 = 1;
-        }
         ds_read_packet(demuxer->sub, demuxer->stream, len, subpts, pos, 0);
         priv->current_sub = samplenr;
       }

Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c	(original)
+++ trunk/mpcommon.c	Sun Jan 27 17:13:21 2008
@@ -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_vid
 
         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_vid
                 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_vid
                                       (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;



More information about the MPlayer-cvslog mailing list