diff options
-rw-r--r-- | DOCS/interface-changes.rst | 1 | ||||
-rw-r--r-- | DOCS/man/input.rst | 22 | ||||
-rw-r--r-- | TOOLS/old-makefile | 1 | ||||
-rw-r--r-- | demux/demux.c | 17 | ||||
-rw-r--r-- | demux/demux.h | 1 | ||||
-rw-r--r-- | demux/demux_disc.c | 3 | ||||
-rw-r--r-- | etc/input.conf | 14 | ||||
-rw-r--r-- | etc/mplayer-input.conf | 25 | ||||
-rw-r--r-- | input/cmd_list.c | 3 | ||||
-rw-r--r-- | input/cmd_list.h | 2 | ||||
-rw-r--r-- | player/command.c | 24 | ||||
-rw-r--r-- | player/core.h | 10 | ||||
-rw-r--r-- | player/discnav.c | 378 | ||||
-rw-r--r-- | player/loadfile.c | 7 | ||||
-rw-r--r-- | player/lua/osc.lua | 9 | ||||
-rw-r--r-- | player/playloop.c | 2 | ||||
-rw-r--r-- | sub/osd.c | 11 | ||||
-rw-r--r-- | sub/osd.h | 8 | ||||
-rw-r--r-- | sub/osd_state.h | 3 | ||||
-rw-r--r-- | wscript_build.py | 1 |
20 files changed, 1 insertions, 541 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 79b8327f82..979b54c278 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -20,6 +20,7 @@ Interface changes :: --- mpv 0.10.0 will be released --- + - remove disc-nav (DVD, BD) related properties and commands - add "option-info/<name>/set-locally" property - add --cache-backbuffer; change --cache-default default to 75MB the new total cache size is the sum of backbuffer and the cache size diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 14c1f3f5fa..bbaa4bdb3a 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -357,18 +357,6 @@ List of Input Commands Show the progress bar, the elapsed time and the total duration of the file on the OSD. -``discnav "<command>"`` - Send a menu control command to the DVD/BD menu implementation. The following - commands are defined: ``up``, ``down``, ``left``, ``right``, - ``menu`` (request to enter menu), ``prev`` (previous screen), - ``select`` (activate current button), ``mouse`` (the mouse was clicked), - ``mouse_move`` (the mouse cursor changed position). - - ``mouse_move`` will use the current mouse position. - - Note that while the menu is active, the input section ``discnav-menu`` will - be enabled, so different key bindings can be mapped for menu mode. - ``write-watch-later-config`` Write the resume config file that the ``quit-watch-later`` command writes, but continue playback normally. @@ -948,16 +936,6 @@ Property list Current BD/DVD title number. Writing works only for ``dvdnav://`` and ``bd://`` (and aliases for these). -``disc-menu-active`` - Return ``yes`` if the BD/DVD menu is active, or ``no`` on normal video - playback. The property is unavailable when playing something that is not - a BD or DVD. Use the ``discnav menu`` command to actually enter or leave - menu mode. - -``disc-mouse-on-button`` - Return ``yes`` when the mouse cursor is located on a button, or ``no`` - when cursor is outside of any button for disc navigation. - ``chapters`` Number of chapters. diff --git a/TOOLS/old-makefile b/TOOLS/old-makefile index 940233d581..d36b013e21 100644 --- a/TOOLS/old-makefile +++ b/TOOLS/old-makefile @@ -205,7 +205,6 @@ SOURCES = audio/audio.c \ player/client.c \ player/configfiles.c \ player/command.c \ - player/discnav.c \ player/loadfile.c \ player/main.c \ player/misc.c \ diff --git a/demux/demux.c b/demux/demux.c index d936f51fd4..2d40643a71 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -127,7 +127,6 @@ struct demux_internal { // Cached state. bool force_cache_update; double time_length; - struct mp_nav_event *nav_event; struct mp_tags *stream_metadata; int64_t stream_size; int64_t stream_cache_size; @@ -243,7 +242,6 @@ void free_demuxer(demuxer_t *demuxer) ds_flush(demuxer->streams[n]->ds); pthread_mutex_destroy(&in->lock); pthread_cond_destroy(&in->wakeup); - talloc_free(in->nav_event); talloc_free(demuxer); } @@ -1297,17 +1295,10 @@ static void update_cache(struct demux_internal *in) int64_t stream_cache_size = -1; int64_t stream_cache_fill = -1; int stream_cache_idle = -1; - struct mp_nav_event *nav_event = NULL; - - pthread_mutex_lock(&in->lock); - bool need_nav_event = !in->nav_event;; - pthread_mutex_unlock(&in->lock); if (demuxer->desc->control) { demuxer->desc->control(demuxer, DEMUXER_CTRL_GET_TIME_LENGTH, &time_length); - if (need_nav_event) - demuxer->desc->control(demuxer, DEMUXER_CTRL_GET_NAV_EVENT, &nav_event); } stream_control(stream, STREAM_CTRL_GET_METADATA, &stream_metadata); @@ -1327,7 +1318,6 @@ static void update_cache(struct demux_internal *in) in->stream_metadata = talloc_steal(in, stream_metadata); in->d_buffer->events |= DEMUX_EVENT_METADATA; } - in->nav_event = nav_event ? nav_event : in->nav_event; pthread_mutex_unlock(&in->lock); } @@ -1426,13 +1416,6 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg) r->ts_duration = 0; return DEMUXER_CTRL_OK; } - case DEMUXER_CTRL_GET_NAV_EVENT: - if (!in->nav_event) - return DEMUXER_CTRL_NOTIMPL; - *(struct mp_nav_event **)arg = in->nav_event; - in->nav_event = NULL; - return DEMUXER_CTRL_OK; - } return DEMUXER_CTRL_DONTKNOW; } diff --git a/demux/demux.h b/demux/demux.h index 32c5d274f6..09b49bbf97 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -47,7 +47,6 @@ enum demux_ctrl { DEMUXER_CTRL_IDENTIFY_PROGRAM, DEMUXER_CTRL_STREAM_CTRL, DEMUXER_CTRL_GET_READER_STATE, - DEMUXER_CTRL_GET_NAV_EVENT, DEMUXER_CTRL_GET_BITRATE_STATS, // double[STREAM_TYPE_COUNT] }; diff --git a/demux/demux_disc.c b/demux/demux_disc.c index 11cbea9361..a816a74fa8 100644 --- a/demux/demux_disc.c +++ b/demux/demux_disc.c @@ -361,9 +361,6 @@ static int d_control(demuxer_t *demuxer, int cmd, void *arg) case DEMUXER_CTRL_SWITCHED_TRACKS: reselect_streams(demuxer); return DEMUXER_CTRL_OK; - case DEMUXER_CTRL_GET_NAV_EVENT: - return stream_control(demuxer->stream, STREAM_CTRL_GET_NAV_EVENT, arg) - == STREAM_OK ? DEMUXER_CTRL_OK : DEMUXER_CTRL_DONTKNOW; } return demux_control(p->slave, cmd, arg); } diff --git a/etc/input.conf b/etc/input.conf index 03e02deda2..b6cc8e76d5 100644 --- a/etc/input.conf +++ b/etc/input.conf @@ -160,20 +160,6 @@ #AR_VDOWN add volume -2 #AR_VDOWN_HOLD add chapter -1 -# For dvdnav:// and bdnav:// - -# navigation controls during playback -#ENTER {discnav} discnav menu # DISCNAV MENU -# BS {discnav} discnav prev # DISCNAV PREVIOUS menu (in the order chapter->title->root) -# navigation controls when showing menu (additionally to the controls above) -#UP {discnav-menu} discnav up # DISCNAV UP -#DOWN {discnav-menu} discnav down # DISCNAV DOWN -#LEFT {discnav-menu} discnav left # DISCNAV LEFT -#RIGHT {discnav-menu} discnav right # DISCNAV RIGHT -#ENTER {discnav-menu} discnav select # DISCNAV SELECT (ok) -#MOUSE_BTN0 {discnav-menu} discnav mouse -#MOUSE_MOVE {discnav-menu} discnav mouse_move - # For tv:// #h cycle tv-channel -1 # previous channel #k cycle tv-channel +1 # next channel diff --git a/etc/mplayer-input.conf b/etc/mplayer-input.conf index de60fdcca9..97eafaefea 100644 --- a/etc/mplayer-input.conf +++ b/etc/mplayer-input.conf @@ -93,31 +93,6 @@ AR_MENU_HOLD cycle mute AR_VUP add volume 1 AR_VDOWN add volume -1 -## -## DVD and Bluray menus -## -## Unlike MPlayer, input doesn't require blocking normal keys when no menu -## is active. The "discnav-menu" input section is active only when a menu -## is shown, while "discnav" is always active when a DVD/Bluray is played. -## -## The bindings were adjusted according to this. -## - -UP {discnav-menu} discnav up # DVDNav UP -DOWN {discnav-menu} discnav down # DVDNav DOWN -LEFT {discnav-menu} discnav left # DVDNav LEFT -RIGHT {discnav-menu} discnav right # DVDNav RIGHT -ESC {discnav} discnav menu # DVDNav MENU -ENTER {discnav-menu} discnav select # DVDNav SELECT (ok) -BS {discnav-menu} discnav prev # DVDNav PREVIOUS menu (in the order chapter->title->root) - -AR_VUP {discnav-menu} discnav up # DVDNav UP -AR_VDOWN {discnav-menu} discnav down # DVDNav DOWN -AR_PREV {discnav-menu} discnav left # DVDNav LEFT -AR_NEXT {discnav-menu} discnav right # DVDNav RIGHT -AR_MENU {discnav} discnav menu # DVDNav MENU -AR_PLAY {discnav-menu} discnav select # DVDNav SELECT (ok) - #? add chapter -1 # skip to previous dvd chapter #? add chapter +1 # next diff --git a/input/cmd_list.c b/input/cmd_list.c index 53e25cc41c..b1db2e4f0c 100644 --- a/input/cmd_list.c +++ b/input/cmd_list.c @@ -167,8 +167,6 @@ const struct mp_cmd_def mp_cmds[] = { }}, { MP_CMD_DISABLE_INPUT_SECTION, "disable-section", { ARG_STRING } }, - { MP_CMD_DISCNAV, "discnav", { ARG_STRING } }, - { MP_CMD_AB_LOOP, "ab-loop", }, { MP_CMD_DROP_BUFFERS, "drop-buffers", }, @@ -275,7 +273,6 @@ static const struct legacy_cmd legacy_cmds[] = { {"show_tracks", "show-text ${track-list}"}, {"show_playlist", "show-text ${playlist}"}, {"speed_mult", "multiply speed"}, - {"dvdnav", "discnav"}, // Approximate (can fail if user added additional whitespace) {"pt_step 1", "playlist-next"}, diff --git a/input/cmd_list.h b/input/cmd_list.h index 5870ff584b..a41807f9fe 100644 --- a/input/cmd_list.h +++ b/input/cmd_list.h @@ -80,8 +80,6 @@ enum mp_command_type { MP_CMD_ENABLE_INPUT_SECTION, MP_CMD_DISABLE_INPUT_SECTION, - MP_CMD_DISCNAV, - MP_CMD_AB_LOOP, MP_CMD_DROP_BUFFERS, diff --git a/player/command.c b/player/command.c index c8b61e5758..2c5d06cff8 100644 --- a/player/command.c +++ b/player/command.c @@ -686,24 +686,6 @@ static int mp_property_disc_title(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; } -static int mp_property_disc_menu(void *ctx, struct m_property *prop, - int action, void *arg) -{ - MPContext *mpctx = ctx; - int state = mp_nav_in_menu(mpctx); - if (state < 0) - return M_PROPERTY_UNAVAILABLE; - return m_property_flag_ro(action, arg, !!state); -} - -static int mp_property_mouse_on_button(void *ctx, struct m_property *prop, - int action, void *arg) -{ - MPContext *mpctx = ctx; - bool on = mp_nav_mouse_on_button(mpctx); - return m_property_flag_ro(action, arg, on); -} - /// Current chapter (RW) static int mp_property_chapter(void *ctx, struct m_property *prop, int action, void *arg) @@ -3351,8 +3333,6 @@ static const struct m_property mp_properties[] = { {"playtime-remaining", mp_property_playtime_remaining}, {"playback-time", mp_property_playback_time}, {"disc-title", mp_property_disc_title}, - {"disc-menu-active", mp_property_disc_menu}, - {"disc-mouse-on-button", mp_property_mouse_on_button}, {"chapter", mp_property_chapter}, {"edition", mp_property_edition}, {"disc-titles", mp_property_disc_titles}, @@ -4712,10 +4692,6 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re mp_input_disable_section(mpctx->input, cmd->args[0].v.s); break; - case MP_CMD_DISCNAV: - mp_nav_user_input(mpctx, cmd->args[0].v.s); - break; - case MP_CMD_AB_LOOP: { double now = get_current_time(mpctx); int r = 0; diff --git a/player/core.h b/player/core.h index c2fe74cb6b..c34d2ddd6d 100644 --- a/player/core.h +++ b/player/core.h @@ -344,7 +344,6 @@ typedef struct MPContext { struct screenshot_ctx *screenshot_ctx; struct command_ctx *command_ctx; struct encode_lavc_context *encode_lavc_ctx; - struct mp_nav_state *nav_state; struct mp_ipc_ctx *ipc_ctx; @@ -372,15 +371,6 @@ void mp_write_watch_later_conf(struct MPContext *mpctx); struct playlist_entry *mp_check_playlist_resume(struct MPContext *mpctx, struct playlist *playlist); -// discnav.c -void mp_nav_init(struct MPContext *mpctx); -void mp_nav_reset(struct MPContext *mpctx); -void mp_nav_destroy(struct MPContext *mpctx); -void mp_nav_user_input(struct MPContext *mpctx, char *command); -void mp_handle_nav(struct MPContext *mpctx); -int mp_nav_in_menu(struct MPContext *mpctx); -bool mp_nav_mouse_on_button(struct MPContext *mpctx); - // loadfile.c void uninit_player(struct MPContext *mpctx, unsigned int mask); struct track *mp_add_external_file(struct MPContext *mpctx, char *filename, diff --git a/player/discnav.c b/player/discnav.c deleted file mode 100644 index 0b4537e5e1..0000000000 --- a/player/discnav.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <limits.h> -#include <pthread.h> -#include <assert.h> - -#include "core.h" -#include "command.h" - -#include "common/msg.h" -#include "common/common.h" -#include "input/input.h" - -#include "demux/demux.h" -#include "stream/discnav.h" - -#include "sub/dec_sub.h" -#include "sub/osd.h" - -#include "video/mp_image.h" -#include "video/decode/dec_video.h" - -struct mp_nav_state { - struct mp_log *log; - - int nav_still_frame; - bool nav_eof; - bool nav_menu; - bool nav_draining; - bool nav_mouse_on_button; - - // Accessed by OSD (possibly separate thread) - // Protected by the given lock - pthread_mutex_t osd_lock; - int hi_visible; - int highlight[4]; // x0 y0 x1 y1 - int vidsize[2]; - int subsize[2]; - struct sub_bitmap *hi_elem; - struct sub_bitmap *overlays[2]; - struct sub_bitmap outputs[3]; -}; - -static inline bool is_valid_size(int size[2]) -{ - return size[0] >= 1 && size[1] >= 1; -} - -static void update_resolution(struct MPContext *mpctx) -{ - struct mp_nav_state *nav = mpctx->nav_state; - int size[2] = {0}; - if (mpctx->d_sub[0]) - sub_control(mpctx->d_sub[0], SD_CTRL_GET_RESOLUTION, size); - if (!is_valid_size(size)) { - struct mp_image_params vid = {0}; - if (mpctx->d_video) - vid = mpctx->d_video->decoder_output; - size[0] = vid.w; - size[1] = vid.h; - } - pthread_mutex_lock(&nav->osd_lock); - nav->vidsize[0] = size[0]; - nav->vidsize[1] = size[1]; - pthread_mutex_unlock(&nav->osd_lock); -} - -// Send update events and such. -static void update_state(struct MPContext *mpctx) -{ - mp_notify_property(mpctx, "disc-menu-active"); -} - -// Return 1 if in menu, 0 if in video, or <0 if no navigation possible. -int mp_nav_in_menu(struct MPContext *mpctx) -{ - return mpctx->nav_state ? mpctx->nav_state->nav_menu : -1; -} - -static void update_mouse_on_button(struct MPContext *mpctx) -{ - mp_notify_property(mpctx, "disc-mouse-on-button"); -} - -static void set_mouse_on_button(struct MPContext *mpctx, bool in) -{ - struct mp_nav_state *nav = mpctx->nav_state; - if (nav->nav_mouse_on_button != in) { - nav->nav_mouse_on_button = in; - update_mouse_on_button(mpctx); - } -} - -bool mp_nav_mouse_on_button(struct MPContext *mpctx) -{ - return mpctx->nav_state ? mpctx->nav_state->nav_mouse_on_button : false; -} - -// If a demuxer is accessing the stream, we have to use demux_stream_control() -// to avoid synchronization issues; otherwise access it directly. -static int run_stream_control(struct MPContext *mpctx, int cmd, void *arg) -{ - if (mpctx->demuxer) { - return demux_stream_control(mpctx->demuxer, cmd, arg); - } else if (mpctx->stream) { - return stream_control(mpctx->stream, cmd, arg); - } - return STREAM_ERROR; -} - -// Allocate state and enable navigation features. Must happen before -// initializing cache, because the cache would read data. Since stream_dvdnav is -// in a mode which skips all transitions on reading data (before enabling -// navigation), this would skip some menu screens. -void mp_nav_init(struct MPContext *mpctx) -{ - assert(!mpctx->nav_state); - - // dvdnav is interactive - if (mpctx->encode_lavc_ctx) - return; - -#if 0 - struct mp_nav_cmd inp = {MP_NAV_CMD_ENABLE}; - if (run_stream_control(mpctx, STREAM_CTRL_NAV_CMD, &inp) < 1) - return; - - mpctx->nav_state = talloc_zero(NULL, struct mp_nav_state); - mpctx->nav_state->log = mp_log_new(mpctx->nav_state, mpctx->log, "discnav"); - pthread_mutex_init(&mpctx->nav_state->osd_lock, NULL); - - MP_VERBOSE(mpctx->nav_state, "enabling\n"); - - mp_input_enable_section(mpctx->input, "discnav", - MP_INPUT_ALLOW_VO_DRAGGING | MP_INPUT_ALLOW_HIDE_CURSOR); - - update_state(mpctx); - update_mouse_on_button(mpctx); -#endif -} - -void mp_nav_reset(struct MPContext *mpctx) -{ - struct mp_nav_state *nav = mpctx->nav_state; - if (!nav) - return; - struct mp_nav_cmd inp = {MP_NAV_CMD_RESUME}; - run_stream_control(mpctx, STREAM_CTRL_NAV_CMD, &inp); - osd_set_nav_highlight(mpctx->osd, NULL); - nav->hi_visible = 0; - nav->nav_menu = false; - nav->nav_draining = false; - nav->nav_still_frame = 0; - mp_input_disable_section(mpctx->input, "discnav-menu"); - run_stream_control(mpctx, STREAM_CTRL_RESUME_CACHE, NULL); - update_state(mpctx); -} - -void mp_nav_destroy(struct MPContext *mpctx) -{ - osd_set_nav_highlight(mpctx->osd, NULL); - if (!mpctx->nav_state) - return; - mp_input_disable_section(mpctx->input, "discnav"); - mp_input_disable_section(mpctx->input, "discnav-menu"); - pthread_mutex_destroy(&mpctx->nav_state->osd_lock); - talloc_free(mpctx->nav_state); - mpctx->nav_state = NULL; - update_state(mpctx); - update_mouse_on_button(mpctx); -} - -void mp_nav_user_input(struct MPContext *mpctx, char *command) -{ - struct mp_nav_state *nav = mpctx->nav_state; - if (!nav) - return; - // In the short time while the demuxer is opened (running in a different - // thread) we can't access the stream directly. Once the demuxer is opened, - // we can access the stream via demux_stream_control() though. - if (!mpctx->demuxer) - return; - if (strcmp(command, "mouse_move") == 0) { - struct mp_image_params vid = {0}; - if (mpctx->d_video) - vid = mpctx->d_video->decoder_output; - struct mp_nav_cmd inp = {MP_NAV_CMD_MOUSE_POS}; - int x, y; - mp_input_get_mouse_pos(mpctx->input, &x, &y); - osd_coords_to_video(mpctx->osd, vid.w, vid.h, &x, &y); - inp.u.mouse_pos.x = x; - inp.u.mouse_pos.y = y; - run_stream_control(mpctx, STREAM_CTRL_NAV_CMD, &inp); - set_mouse_on_button(mpctx, inp.mouse_on_button); - } else { - struct mp_nav_cmd inp = {MP_NAV_CMD_MENU}; - inp.u.menu.action = command; - run_stream_control(mpctx, STREAM_CTRL_NAV_CMD, &inp); - } -} - -void mp_handle_nav(struct MPContext *mpctx) -{ - struct mp_nav_state *nav = mpctx->nav_state; - if (!nav) - return; - mpctx->sleeptime = MPMIN(mpctx->sleeptime, 0.5); - while (1) { - if (!mpctx->demuxer) - break; - struct mp_nav_event *ev = NULL; - demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_NAV_EVENT, &ev); - if (!ev) - break; - switch (ev->event) { - case MP_NAV_EVENT_DRAIN: { - nav->nav_draining = true; - MP_VERBOSE(nav, "drain requested\n"); - break; - } - case MP_NAV_EVENT_RESET_ALL: { - mpctx->stop_play = PT_RELOAD_FILE; // would wipe DVD state -> broken - MP_VERBOSE(nav, "reload\n"); - // return immediately. - // other events should be handled after reloaded. - talloc_free(ev); - return; - } - case MP_NAV_EVENT_RESET: { - nav->nav_still_frame = 0; - break; - } - case MP_NAV_EVENT_EOF: - nav->nav_eof = true; - break; - case MP_NAV_EVENT_STILL_FRAME: { - int len = ev->u.still_frame.seconds; - MP_VERBOSE(nav, "wait for %d seconds\n", len); - if (len > 0 && nav->nav_still_frame == 0) - nav->nav_still_frame = len; - break; - } - case MP_NAV_EVENT_MENU_MODE: - nav->nav_menu = ev->u.menu_mode.enable; - if (nav->nav_menu) { - mp_input_enable_section(mpctx->input, "discnav-menu", - MP_INPUT_ON_TOP); - } else { - mp_input_disable_section(mpctx->input, "discnav-menu"); - } - update_state(mpctx); - break; - case MP_NAV_EVENT_HIGHLIGHT: { - pthread_mutex_lock(&nav->osd_lock); - MP_VERBOSE(nav, "highlight: %d %d %d - %d %d\n", - ev->u.highlight.display, - ev->u.highlight.sx, ev->u.highlight.sy, - ev->u.highlight.ex, ev->u.highlight.ey); - nav->highlight[0] = ev->u.highlight.sx; - nav->highlight[1] = ev->u.highlight.sy; - nav->highlight[2] = ev->u.highlight.ex; - nav->highlight[3] = ev->u.highlight.ey; - nav->hi_visible = ev->u.highlight.display; - pthread_mutex_unlock(&nav->osd_lock); - update_resolution(mpctx); - osd_set_nav_highlight(mpctx->osd, mpctx); - break; - } - case MP_NAV_EVENT_OVERLAY: { - pthread_mutex_lock(&nav->osd_lock); - for (int i = 0; i < 2; i++) { - if (nav->overlays[i]) - talloc_free(nav->overlays[i]); - nav->overlays[i] = talloc_steal(nav, ev->u.overlay.images[i]); - } - pthread_mutex_unlock(&nav->osd_lock); - update_resolution(mpctx); - osd_set_nav_highlight(mpctx->osd, mpctx); - break; - } - default: ; // ignore - } - talloc_free(ev); - } - update_resolution(mpctx); - if (mpctx->stop_play == AT_END_OF_FILE) { - if (nav->nav_still_frame > 0) { - // gross hack - mpctx->time_frame += nav->nav_still_frame; - nav->nav_still_frame = -2; - } else if (nav->nav_still_frame == -2) { - struct mp_nav_cmd inp = {MP_NAV_CMD_SKIP_STILL}; - run_stream_control(mpctx, STREAM_CTRL_NAV_CMD, &inp); - } - } - 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}; - run_stream_control(mpctx, STREAM_CTRL_NAV_CMD, &inp); - nav->nav_draining = false; - run_stream_control(mpctx, 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; -} - -// Render "fake" highlights, because using actual dvd sub highlight elements -// is too hard, and would require changes to libavcodec's dvdsub decoder. -// Note: a proper solution would introduce something like -// SD_CTRL_APPLY_DVDNAV, which would crop the vobsub frame, -// and apply the current CLUT. -void mp_nav_get_highlight(void *priv, struct mp_osd_res res, - struct sub_bitmaps *out_imgs) -{ - struct MPContext *mpctx = priv; - struct mp_nav_state *nav = mpctx->nav_state; - - pthread_mutex_lock(&nav->osd_lock); - - struct sub_bitmap *sub = nav->hi_elem; - if (!sub) - sub = talloc_zero(nav, struct sub_bitmap); - - nav->hi_elem = sub; - if (!is_valid_size(nav->vidsize)) { - pthread_mutex_unlock(&nav->osd_lock); - return; - } - int sizes[2] = {nav->vidsize[0], nav->vidsize[1]}; - if (sizes[0] != nav->subsize[0] || sizes[1] != nav->subsize[1]) { - talloc_free(sub->bitmap); - sub->bitmap = talloc_array(sub, uint32_t, sizes[0] * sizes[1]); - memset(sub->bitmap, 0x80, talloc_get_size(sub->bitmap)); - nav->subsize[0] = sizes[0]; - nav->subsize[1] = sizes[1]; - } - - out_imgs->num_parts = 0; - - if (nav->hi_visible) { - sub->x = nav->highlight[0]; - sub->y = nav->highlight[1]; - sub->w = MPCLAMP(nav->highlight[2] - sub->x, 0, sizes[0]); - sub->h = MPCLAMP(nav->highlight[3] - sub->y, 0, sizes[1]); - sub->stride = sub->w * 4; - if (sub->w > 0 && sub->h > 0) - nav->outputs[out_imgs->num_parts++] = *sub; - } - - if (nav->overlays[0]) - nav->outputs[out_imgs->num_parts++] = *nav->overlays[0]; - if (nav->overlays[1]) - nav->outputs[out_imgs->num_parts++] = *nav->overlays[1]; - - if (out_imgs->num_parts) { - out_imgs->parts = nav->outputs; - out_imgs->format = SUBBITMAP_RGBA; - osd_rescale_bitmaps(out_imgs, sizes[0], sizes[1], res, 0); - } - - pthread_mutex_unlock(&nav->osd_lock); -} diff --git a/player/loadfile.c b/player/loadfile.c index 6f5d29d3c8..1a6dccd3e4 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1101,9 +1101,6 @@ reopen_file: if (!mpctx->stream) goto terminate_playback; - // Must be called before enabling cache. - mp_nav_init(mpctx); - stream_enable_cache(&mpctx->stream, &opts->stream_cache); mp_notify(mpctx, MP_EVENT_CHANGE_ALL, NULL); @@ -1113,8 +1110,6 @@ reopen_file: stream_set_capture_file(mpctx->stream, opts->stream_capture); - mp_nav_reset(mpctx); - open_demux_reentrant(mpctx); if (!mpctx->master_demuxer) { MP_ERR(mpctx, "Failed to recognize file format.\n"); @@ -1251,8 +1246,6 @@ terminate_playback: process_unload_hooks(mpctx); - mp_nav_destroy(mpctx); - if (mpctx->stop_play == KEEP_PLAYING) mpctx->stop_play = AT_END_OF_FILE; diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 09ca0eb5e9..6d181bc95c 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1975,15 +1975,6 @@ mp.observe_property("idle", "bool", mp.observe_property("pause", "bool", pause_state) mp.observe_property("cache-idle", "bool", cache_state) -mp.observe_property("disc-menu-active", "bool", function(name, val) - if val == true then - hide_osc() - mp.disable_key_bindings("showhide") - else - do_enable_keybindings() - end -end) - -- mouse show/hide bindings mp.set_key_bindings({ {"mouse_move", function(e) process_event("mouse_move", nil) end}, diff --git a/player/playloop.c b/player/playloop.c index 02908ed951..90e6fb8d5b 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -1025,8 +1025,6 @@ void run_playloop(struct MPContext *mpctx) handle_segment_switch(mpctx, end_is_new_segment); - mp_handle_nav(mpctx); - handle_loop_file(mpctx); handle_ab_loop(mpctx); @@ -224,14 +224,6 @@ void osd_set_external2(struct osd_state *osd, struct sub_bitmaps *imgs) pthread_mutex_unlock(&osd->lock); } -void osd_set_nav_highlight(struct osd_state *osd, void *priv) -{ - pthread_mutex_lock(&osd->lock); - osd->objs[OSDTYPE_NAV_HIGHLIGHT]->highlight_priv = priv; - osd_changed_unlocked(osd, OSDTYPE_NAV_HIGHLIGHT); - pthread_mutex_unlock(&osd->lock); -} - static void render_object(struct osd_state *osd, struct osd_object *obj, struct mp_osd_res res, double video_pts, const bool sub_formats[SUBBITMAP_COUNT], @@ -265,9 +257,6 @@ static void render_object(struct osd_state *osd, struct osd_object *obj, *out_imgs = *obj->external2; obj->external2->change_id = 0; } - } else if (obj->type == OSDTYPE_NAV_HIGHLIGHT) { - if (obj->highlight_priv) - mp_nav_get_highlight(obj->highlight_priv, obj->vo_res, out_imgs); } else { osd_object_get_bitmaps(osd, obj, out_imgs); } @@ -82,8 +82,6 @@ enum mp_osdtype { OSDTYPE_SUB, OSDTYPE_SUB2, - OSDTYPE_NAV_HIGHLIGHT, // dvdnav fake highlights - OSDTYPE_PROGBAR, OSDTYPE_OSD, @@ -175,8 +173,6 @@ void osd_set_external(struct osd_state *osd, int res_x, int res_y, char *text); void osd_set_external2(struct osd_state *osd, struct sub_bitmaps *imgs); -void osd_set_nav_highlight(struct osd_state *osd, void *priv); - enum mp_osd_draw_flags { OSD_DRAW_SUB_FILTER = (1 << 0), OSD_DRAW_SUB_ONLY = (1 << 1), @@ -228,8 +224,4 @@ extern const char *const osd_ass_1; void osd_object_get_resolution(struct osd_state *osd, int obj, int *out_w, int *out_h); -// defined in player -void mp_nav_get_highlight(void *priv, struct mp_osd_res res, - struct sub_bitmaps *out_imgs); - #endif /* MPLAYER_SUB_H */ diff --git a/sub/osd_state.h b/sub/osd_state.h index 73bfcdd7d3..6fa03abe77 100644 --- a/sub/osd_state.h +++ b/sub/osd_state.h @@ -28,9 +28,6 @@ struct osd_object { // OSDTYPE_EXTERNAL2 |