comparison 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
comparison
equal deleted inserted replaced
29667:8cfbe411de01 29668:ecc719c6d7a9
1312 MPContext * mpctx) 1312 MPContext * mpctx)
1313 { 1313 {
1314 demux_stream_t *const d_sub = mpctx->d_sub; 1314 demux_stream_t *const d_sub = mpctx->d_sub;
1315 const int global_sub_size = mpctx->global_sub_size; 1315 const int global_sub_size = mpctx->global_sub_size;
1316 int source = -1, reset_spu = 0; 1316 int source = -1, reset_spu = 0;
1317 double pts = 0;
1317 char *sub_name; 1318 char *sub_name;
1318 1319
1319 if (global_sub_size <= 0) 1320 if (global_sub_size <= 0)
1320 return M_PROPERTY_UNAVAILABLE; 1321 return M_PROPERTY_UNAVAILABLE;
1321 1322
1498 && dvdsub_id < 0 && reset_spu) { 1499 && dvdsub_id < 0 && reset_spu) {
1499 dvdsub_id = -2; 1500 dvdsub_id = -2;
1500 d_sub->id = dvdsub_id; 1501 d_sub->id = dvdsub_id;
1501 } 1502 }
1502 #endif 1503 #endif
1503 update_subtitles(mpctx->sh_video, d_sub, 1); 1504 if (mpctx->sh_audio)
1505 pts = mpctx->sh_audio->pts;
1506 if (mpctx->sh_video)
1507 pts = mpctx->sh_video->pts;
1508 update_subtitles(mpctx->sh_video, pts, d_sub, 1);
1504 1509
1505 return M_PROPERTY_OK; 1510 return M_PROPERTY_OK;
1506 } 1511 }
1507 1512
1508 /// Selected sub source (RW) 1513 /// Selected sub source (RW)