diff command.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 3343d5151134
children d287e2785570
line wrap: on
line diff
--- a/command.c	Wed Sep 23 19:21:38 2009 +0000
+++ b/command.c	Wed Sep 23 21:21:58 2009 +0000
@@ -1314,6 +1314,7 @@
     demux_stream_t *const d_sub = mpctx->d_sub;
     const int global_sub_size = mpctx->global_sub_size;
     int source = -1, reset_spu = 0;
+    double pts = 0;
     char *sub_name;
 
     if (global_sub_size <= 0)
@@ -1500,7 +1501,11 @@
 	d_sub->id = dvdsub_id;
     }
 #endif
-    update_subtitles(mpctx->sh_video, d_sub, 1);
+    if (mpctx->sh_audio)
+        pts = mpctx->sh_audio->pts;
+    if (mpctx->sh_video)
+        pts = mpctx->sh_video->pts;
+    update_subtitles(mpctx->sh_video, pts, d_sub, 1);
 
     return M_PROPERTY_OK;
 }