summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-19 12:08:48 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:35 +0200
commitd7ca95c3ea90782c786a6a607d3713bb42a104b1 (patch)
treebff2d05fc0720e23686a896825626afba830be21 /player
parentb6214b2644148bf68ae781983ed81f972ebc5137 (diff)
downloadmpv-d7ca95c3ea90782c786a6a607d3713bb42a104b1.tar.bz2
mpv-d7ca95c3ea90782c786a6a607d3713bb42a104b1.tar.xz
command: whitelist some blocking accesses for certain demuxers/streams
The properties/commands touched in this commit are all for obscure special inputs (BD/DVD/DVB/TV), and they all block on the demuxer/stream layer. For network streams, this blocking is very unwelcome. They will affect playback and probably introduce pauses and frame drops. The player can even freeze fully, and the logic that tries to make playback abortable even if frozen complicates the player. Since the mentioned accesses are not needed for network streams, but they will block on network streams even though they're going to fail, add a flag that coarsely enables/disables these accesses. Essentially it establishes a whitelist of demuxers/streams which support them. In theory you could to access BD/DVD images over network (or add such support, I don't think it's a thing in mpv). In these cases these controls still can block and could even "freeze" the player completely. Writing to the "program" and "cache-size" properties still can block even for network streams. Just don't use them if you don't want freezes.
Diffstat (limited to 'player')
-rw-r--r--player/command.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/player/command.c b/player/command.c
index 55ad018c8c..292384f2d9 100644
--- a/player/command.c
+++ b/player/command.c
@@ -907,7 +907,7 @@ static int mp_property_disc_title(void *ctx, struct m_property *prop,
{
MPContext *mpctx = ctx;
struct demuxer *d = mpctx->demuxer;
- if (!d)
+ if (!d || !d->extended_ctrls)
return M_PROPERTY_UNAVAILABLE;
unsigned int title = -1;
switch (action) {
@@ -1224,8 +1224,9 @@ static int mp_property_disc_titles(void *ctx, struct m_property *prop,
MPContext *mpctx = ctx;
struct demuxer *demuxer = mpctx->demuxer;
unsigned int num_titles;
- if (!demuxer || demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
- &num_titles) < 1)
+ if (!demuxer || !demuxer->extended_ctrls ||
+ demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
+ &num_titles) < 1)
return M_PROPERTY_UNAVAILABLE;
return m_property_int_ro(action, arg, num_titles);
}
@@ -1255,8 +1256,9 @@ static int mp_property_list_disc_titles(void *ctx, struct m_property *prop,
MPContext *mpctx = ctx;
struct demuxer *demuxer = mpctx->demuxer;
unsigned int num_titles;
- if (!demuxer || demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
- &num_titles) < 1)
+ if (!demuxer || !demuxer->extended_ctrls ||
+ demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
+ &num_titles) < 1)
return M_PROPERTY_UNAVAILABLE;
return m_property_read_list(action, arg, num_titles,
get_disc_title_entry, mpctx);
@@ -1291,7 +1293,7 @@ static int mp_property_angle(void *ctx, struct m_property *prop,
{
MPContext *mpctx = ctx;
struct demuxer *demuxer = mpctx->demuxer;
- if (!demuxer)
+ if (!demuxer || !demuxer->extended_ctrls)
return M_PROPERTY_UNAVAILABLE;
int ris, angles = -1, angle = 1;
@@ -3117,7 +3119,7 @@ static int mp_property_cursor_autohide(void *ctx, struct m_property *prop,
static int prop_stream_ctrl(struct MPContext *mpctx, int ctrl, void *arg)
{
- if (!mpctx->demuxer)
+ if (!mpctx->demuxer || !mpctx->demuxer->extended_ctrls)
return M_PROPERTY_UNAVAILABLE;
int r = demux_stream_control(mpctx->demuxer, ctrl, arg);
switch (r) {
@@ -5506,7 +5508,7 @@ static void cmd_tv_last_channel(void *p)
struct mp_cmd_ctx *cmd = p;
struct MPContext *mpctx = cmd->mpctx;
- if (!mpctx->demuxer) {
+ if (!mpctx->demuxer || !mpctx->demuxer->extended_ctrls) {
cmd->success = false;
return;
}