diff mpcommon.c @ 29668:ecc719c6d7a9

Make update_subtitles work without sh_video for text subtitles. This fixes a crash with e.g. auto-enabled subtitles and -novideo due to command.c calling update_subtitles even without video and is a step toward subtitle support for audio-only files.
author reimar
date Wed, 23 Sep 2009 21:21:58 +0000
parents ca2030774a61
children 2e3751815a21
line wrap: on
line diff
--- a/mpcommon.c	Wed Sep 23 19:21:38 2009 +0000
+++ b/mpcommon.c	Wed Sep 23 21:21:58 2009 +0000
@@ -66,13 +66,12 @@
 }
 
 
-void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
+void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvdsub, int reset)
 {
     unsigned char *packet=NULL;
     int len;
     char type = d_dvdsub->sh ? ((sh_sub_t *)d_dvdsub->sh)->type : 'v';
     static subtitle subs;
-    double refpts = sh_video->pts;
     if (reset) {
         sub_clear_text(&subs, MP_NOPTS_VALUE);
         if (vo_sub) {
@@ -86,7 +85,7 @@
     }
     // find sub
     if (subdata) {
-        if (sub_fps==0) sub_fps = sh_video->fps;
+        if (sub_fps==0) sub_fps = sh_video ? sh_video->fps : 25;
         current_module = "find_sub";
         if (refpts > sub_last_pts || refpts < sub_last_pts-1.0) {
             find_sub(subdata, (refpts+sub_delay) *