Ticket #611: movsubstest.diff
| File movsubstest.diff, 1.6 KB (added by , 20 years ago) |
|---|
-
libmpdemux/demux_mov.c
32 32 33 33 #include "bswap.h" 34 34 35 #include "libvo/sub.h" 36 extern subtitle *vo_sub; 37 35 38 #include "qtpalette.h" 36 39 #include "parse_mp4.h" // .MP4 specific stuff 37 40 … … 290 293 } 291 294 292 295 #define MOV_MAX_TRACKS 256 296 #define MOV_MAX_SUBLEN 1024 293 297 294 298 typedef struct { 295 299 off_t moov_start; … … 300 304 mov_track_t* tracks[MOV_MAX_TRACKS]; 301 305 int timescale; // movie timescale 302 306 int duration; // movie duration (in movie timescale units) 307 subtitle subs; 308 char subtext[MOV_MAX_SUBLEN + 1]; 303 309 } mov_priv_t; 304 310 305 311 #define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d)) … … 2115 2121 2116 2122 ++trak->pos; 2117 2123 2124 if (demuxer->sub->id >= 0 && demuxer->sub->id < priv->track_db) { 2125 int len; 2126 off_t pos; 2127 double subpts; 2128 trak = priv->tracks[demuxer->sub->id]; 2129 subpts = (double)trak->samples[trak->pos].pts / (double)trak->timescale; 2130 if (trak->pos < trak->samples_size - 1 && pts > subpts) 2131 trak->pos++; 2132 pos = trak->samples[trak->pos].pos + 2; 2133 len = trak->samples[trak->pos].size - 2; 2134 if (len < 0) len = 0; 2135 if (len > MOV_MAX_SUBLEN) len = MOV_MAX_SUBLEN; 2136 stream_seek(demuxer->stream, pos); 2137 stream_read(demuxer->stream, priv->subtext, len); 2138 priv->subtext[len] = 0; 2139 priv->subs.lines = 1; 2140 priv->subs.text[0] = &priv->subtext; 2141 vo_sub = &priv->subs; 2142 vo_osd_changed (OSDTYPE_SUBTITLE); 2143 } 2144 2118 2145 return 1; 2119 2146 2120 2147 }
