diff options
-rw-r--r-- | demux/demux.c | 1 | ||||
-rw-r--r-- | demux/demux.h | 1 | ||||
-rw-r--r-- | demux/demux_disc.c | 2 | ||||
-rw-r--r-- | demux/demux_tv.c | 2 | ||||
-rw-r--r-- | player/command.c | 18 | ||||
-rw-r--r-- | stream/stream.h | 1 | ||||
-rw-r--r-- | stream/stream_dvb.c | 1 |
7 files changed, 18 insertions, 8 deletions
diff --git a/demux/demux.c b/demux/demux.c index 5f4c93b84f..ef420eb5ab 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -2211,6 +2211,7 @@ static struct demuxer *open_given_type(struct mpv_global *global, .access_references = opts->access_references, .events = DEMUX_EVENT_ALL, .duration = -1, + .extended_ctrls = stream->extended_ctrls, }; demuxer->seekable = stream->seekable; if (demuxer->stream->underlying && !demuxer->stream->underlying->seekable) diff --git a/demux/demux.h b/demux/demux.h index ccbc6ae94a..25cefd115f 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -202,6 +202,7 @@ typedef struct demuxer { bool fully_read; bool is_network; // opened directly from a network stream bool access_references; // allow opening other files/URLs + bool extended_ctrls; // supports some of BD/DVD/DVB/TV controls // Bitmask of DEMUX_EVENT_* int events; diff --git a/demux/demux_disc.c b/demux/demux_disc.c index 6ab17e69c8..2b81350ea4 100644 --- a/demux/demux_disc.c +++ b/demux/demux_disc.c @@ -342,6 +342,8 @@ static int d_open(demuxer_t *demuxer, enum demux_check check) if (stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, &len) >= 1) demuxer->duration = len; + demuxer->extended_ctrls = true; + return 0; } diff --git a/demux/demux_tv.c b/demux/demux_tv.c index 0e9bee4317..79cff5d79d 100644 --- a/demux/demux_tv.c +++ b/demux/demux_tv.c @@ -181,6 +181,8 @@ no_audio: if(funcs->control(tvh->priv,TVI_CONTROL_VID_SET_GAIN,&tvh->tv_param->gain)!=TVI_CONTROL_TRUE) MP_WARN(tvh, "Unable to set gain control!\n"); + demuxer->extended_ctrls = true; + return 0; } 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; } diff --git a/stream/stream.h b/stream/stream.h index 863c0cfd3c..2f59e5318f 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -184,6 +184,7 @@ typedef struct stream { bool is_local_file : 1; // from the filesystem bool is_directory : 1; // directory on the filesystem bool access_references : 1; // open other streams + bool extended_ctrls : 1; // supports some of BD/DVD/DVB/TV controls struct mp_log *log; struct mpv_global *global; diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 02c5878ca9..9821119cac 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -1120,6 +1120,7 @@ static int dvb_open(stream_t *stream) stream->allow_caching = true; stream->demuxer = "lavf"; stream->lavf_type = "mpegts"; + stream->extended_ctrls = true; return STREAM_OK; |