summaryrefslogtreecommitdiffstats
path: root/player/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-29 01:35:52 +0100
committerwm4 <wm4@nowhere>2015-12-29 01:35:52 +0100
commitb47bf06f9734c6a7c0a6b95721a9e3200d0f6bbb (patch)
tree7e60cf54f359ac5bc70babb26e2dcd98e056fe78 /player/video.c
parent9b3daa49745dfdc8e53940a2a449f7107940e8c4 (diff)
downloadmpv-b47bf06f9734c6a7c0a6b95721a9e3200d0f6bbb.tar.bz2
mpv-b47bf06f9734c6a7c0a6b95721a9e3200d0f6bbb.tar.xz
sub: change how subtitles are read
Slightly change how it is decided when a new packet should be read. Switch to demux_read_packet_async(), and let the player "wait properly" until required subtitle packets arrive, instead of blocking everything. Move distinguishing the cases of passive and active reading into the demuxer, where it belongs.
Diffstat (limited to 'player/video.c')
-rw-r--r--player/video.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/player/video.c b/player/video.c
index 1178557e24..84981b1144 100644
--- a/player/video.c
+++ b/player/video.c
@@ -1206,6 +1206,11 @@ void write_video(struct MPContext *mpctx, double endpts)
mpctx->time_frame -= get_relative_time(mpctx);
update_avsync_before_frame(mpctx);
+ if (!update_subtitles(mpctx, mpctx->next_frames[0]->pts)) {
+ MP_WARN(mpctx, "subt wait\n");
+ return;
+ }
+
double time_frame = MPMAX(mpctx->time_frame, -1);
int64_t pts = mp_time_us() + (int64_t)(time_frame * 1e6);
@@ -1262,7 +1267,6 @@ void write_video(struct MPContext *mpctx, double endpts)
mpctx->osd_force_update = true;
update_osd_msg(mpctx);
- update_subtitles(mpctx);
vo_queue_frame(vo, frame);