summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-14 01:11:38 +0100
committerwm4 <wm4@nowhere>2013-12-14 01:11:38 +0100
commit60025209061a6d6db41b678efc7fd61662d3c76e (patch)
treeecfbc9df4d428adf130ae588d7068bc73a3b74a8
parentdf4d7fd07294eb074b0858fa49108d7e9801259e (diff)
downloadmpv-60025209061a6d6db41b678efc7fd61662d3c76e.tar.bz2
mpv-60025209061a6d6db41b678efc7fd61662d3c76e.tar.xz
dvdnav: block when libdvdnav requests draining buffers
Not sure how this should work. Using libdvdnav with a large FIFO doesn't make sense either: data and control commands use the same stream, so if you want to send input to libdvdnav, you just have to read from libdvdnav all the time to get a reaction, which is not compatible with maintaining a buffer that could remain full for a long time. I have no idea either whether this improves or worsens anything, though it might be more correct.
-rw-r--r--mpvcore/player/dvdnav.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/mpvcore/player/dvdnav.c b/mpvcore/player/dvdnav.c
index 9ea061954a..98afa82138 100644
--- a/mpvcore/player/dvdnav.c
+++ b/mpvcore/player/dvdnav.c
@@ -38,6 +38,7 @@ struct mp_nav_state {
bool nav_still_frame;
bool nav_eof;
bool nav_menu;
+ bool nav_draining;
int hi_visible;
int highlight[4]; // x0 y0 x1 y1
int subsize[2];
@@ -79,10 +80,11 @@ void mp_nav_reset(struct MPContext *mpctx)
stream_control(mpctx->stream, STREAM_CTRL_NAV_CMD, &inp);
nav->hi_visible = 0;
nav->nav_menu = false;
+ nav->nav_draining = false;
mp_input_disable_section(mpctx->input, "dvdnav-menu");
// Prevent demuxer init code to seek to the "start"
- if (mpctx->stream)
- mpctx->stream->start_pos = stream_tell(mpctx->stream);
+ mpctx->stream->start_pos = stream_tell(mpctx->stream);
+ stream_control(mpctx->stream, STREAM_CTRL_RESUME_CACHE, NULL);
}
void mp_nav_destroy(struct MPContext *mpctx)
@@ -130,9 +132,8 @@ void mp_handle_nav(struct MPContext *mpctx)
break;
switch (ev->event) {
case MP_NAV_EVENT_DRAIN: {
- struct mp_nav_cmd inp = {MP_NAV_CMD_DRAIN_OK};
- stream_control(mpctx->stream, STREAM_CTRL_NAV_CMD, &inp);
- MP_VERBOSE(nav, "drain\n");
+ nav->nav_draining = true;
+ MP_VERBOSE(nav, "drain requested\n");
break;
}
case MP_NAV_EVENT_RESET_ALL: {
@@ -168,6 +169,13 @@ void mp_handle_nav(struct MPContext *mpctx)
}
talloc_free(ev);
}
+ if (nav->nav_draining && mpctx->stop_play == AT_END_OF_FILE) {
+ MP_VERBOSE(nav, "execute drain\n");
+ struct mp_nav_cmd inp = {MP_NAV_CMD_DRAIN_OK};
+ stream_control(mpctx->stream, STREAM_CTRL_NAV_CMD, &inp);
+ nav->nav_draining = false;
+ stream_control(mpctx->stream, STREAM_CTRL_RESUME_CACHE, NULL);
+ }
// E.g. keep displaying still frames
if (mpctx->stop_play == AT_END_OF_FILE && !nav->nav_eof)
mpctx->stop_play = KEEP_PLAYING;