diff --git a/options/options.h b/options/options.h index 41719edf76..62d9fa94d4 100644 --- a/options/options.h +++ b/options/options.h @@ -154,6 +154,11 @@ struct mp_osd_render_opts { int osd_shaper; }; +struct mp_bluray_opts { + char *bluray_device; + int angle; +}; + typedef struct MPOpts { bool property_print_help; bool use_terminal; @@ -354,7 +359,7 @@ typedef struct MPOpts { int w32_priority; bool media_controls; - struct bluray_opts *stream_bluray_opts; + struct mp_bluray_opts *stream_bluray_opts; struct cdda_opts *stream_cdda_opts; struct dvb_opts *stream_dvb_opts; struct lavf_opts *stream_lavf_opts; diff --git a/player/command.c b/player/command.c index baa71228a7..e448ad3d32 100644 --- a/player/command.c +++ b/player/command.c @@ -8035,6 +8035,17 @@ void mp_option_run_callback(struct MPContext *mpctx, struct mp_option_callback * } } +#if HAVE_LIBBLURAY + if (opt_ptr == &opts->stream_bluray_opts->angle) { + struct demuxer *demuxer = mpctx->demuxer; + if (mpctx->playback_initialized && demuxer && demuxer->stream && strcmp(demuxer->stream->info->name, "bdvm/bluray")) { + int angle = opts->stream_bluray_opts->angle - 1; + stream_control(demuxer->stream, STREAM_CTRL_SET_ANGLE, &angle); + demux_flush(demuxer); + } + } +#endif + if (opt_ptr == &opts->pause) set_pause_state(mpctx, opts->pause); diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index 4225b77178..42a27b5253 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -74,20 +74,15 @@ #define AACS_ERROR_NO_DK -8 /* no matching device key */ -struct bluray_opts { - char *bluray_device; - int angle; -}; - -#define OPT_BASE_STRUCT struct bluray_opts +#define OPT_BASE_STRUCT struct mp_bluray_opts const struct m_sub_options stream_bluray_conf = { .opts = (const struct m_option[]) { {"device", OPT_STRING(bluray_device), .flags = M_OPT_FILE}, {"angle", OPT_INT(angle), M_RANGE(1, 999)}, {0}, }, - .size = sizeof(struct bluray_opts), - .defaults = &(const struct bluray_opts){ + .size = sizeof(struct mp_bluray_opts), + .defaults = &(const struct mp_bluray_opts){ .angle = 1, }, }; @@ -104,7 +99,7 @@ struct bluray_priv_s { int cfg_playlist; char *cfg_device; - struct bluray_opts *opts; + struct mp_bluray_opts *opts; struct m_config_cache *opts_cache; };