Add DVD / Blu-Ray menu support#18080
Conversation
072b324 to
499ba28
Compare
e2c0128 to
d698b40
Compare
Don't try to select dependent track as main and feedback to base track. To avoid situations where tracks are deselected only to select the same group again.
This is refactor only.
This joins Dolby Vision EL track with base one. libbluray current (as of 1.4.1) doesn't even expose this info, it will be available in next version, but it is less code to ask lavf for this info in fact.
To avoid truncated description.
It's always true now.
DVDNAV_VTS_CHANGE casts the just-written event payload to dvdnav_vts_change_event_t. The cast was reading from s->buffer (the stream's ring buffer, untouched by this read), not buf (the demuxer's destination that dvdnav_get_next_block actually wrote into). While here, drop the message to MP_VERBOSE and fix its wording. "switched to title" is misleading because this is a VTS-change event. not a title change.
This is connected to standard DVD subs renderer, with additional state passed for highlight color.
They are expected in normal operation of libdvdread, where changing titles, causes natural jump in PTS.
Define three new stream controls so disc backends (libdvdnav, libbluray) can expose their in-disc menu/highlight state to the player. STREAM_CTRL_NAV_CMD - send a navigation action STREAM_CTRL_GET_NAV_STATE - get current menu state STREAM_CTRL_GET_NAV_OVERLAY - get BGRA overlay that should be drawn (BD) Not used yet, will get use in next commits.
Drive libdvdnav's menu state through the new disc-nav protocol so the player can show / interact with VMGM and VTSM menus:
Add HDMV menu support to stream_bluray. Activated by opening with "bd://menu/..." or by the global --disc-menu option Lots of plumbing the libbluary event loop. Menus are read though different function even. STREAM_CTRL_NAV_CMD maps arrow/select/menu/popup/mouse onto bd_user_input and bd_mouse_select. SELECT and MOUSE_CLICK queue an HDMV VM command (often PlayPlaylist) that won't execute until the next demuxer read, so we bump discontinuity_id pre-emptively; the player's post-action check then sees the change and flushes cached audio/video that would otherwise keep playing for seconds while the new playlist is already arriving.
Playing a disc through the menu means crossing playlist boundaries at runtime: menu -> title (and back), sub-menu -> sub-menu, title -> title on a "Play next" button. Each new playlist can have a different stream count and/or a different codec mix (a MPEG-2 menu into an H.264 main feature is common on BD-Video). The previous slave demuxer was probed once at open and never refreshed, so after a hop the player either kept decoding stale streams or saw nothing at all. Tear down and re-open the slave on every nav discontinuity. add_stream_editions() now appends a synthetic "Disc Menu" entry at index num_titles.
New player/discnav.c owns the state for the in-disc menu UI. Used to display menu and control the DVD / BD playback. This is common part between stream_bluray.c and stream_dvdnav.c.
play_current_file picks default tracks once, then leaves them alone. That leaves later-surfacing streams without a default selection.
User-facing entry point for in-disc menu navigation. The command forwards an action (up/down/left/right/select/menu/title-menu/popup/ prev/mouse-move/mouse-click) to the current disc stream handler The new `discnav` input section is defined to allow binding specific controls only for disc menu.
Fixes track switching on some discs.
Adds support for ARGB callback from libbluray. For some reason they don't have unified support, and sometimes it uses ARGB (for BD-J) and RLE (for HDMV), while they could convery RLE encoded menus into ARGB bitmaps, if only one is supproted. We have to support both. When Java VM is not available, fallbacks to non-menu playback.
VM events are processed in fill_buffer callback, which are called by the demuxer thread. In some cases even if we don't need data, we have to drive the event loop, to actually get the playlist/menu switch request from the VM.
| @@ -0,0 +1,449 @@ | |||
| /* | |||
There was a problem hiding this comment.
This whole file could be a builtin client.
As long as mpv provides the overlay images, the clients have all the necessary parts to display and control menu with discnav and overlay-add commands.
There are code later using osd_set_external2 which overwrite user added overlay-add overlays. This does not belong to the core.
| { | ||
| for (int i = 0; i < 256; i++) { | ||
| int Y = pg[i].Y, Cb = pg[i].Cb, Cr = pg[i].Cr, T = pg[i].T; | ||
| // BT.709 limited->full. |
There was a problem hiding this comment.
IG/PG can be 601, 709, or 2020. Matrix should be inferred from the base layer.
|
Just to mention it in case it might need some adjustment with all these changes before they finalize, but how easily would potential future DVD-Audio support slot in amongst this? I'm not sure if it employs any visual menuing, since most DVD players would pick up the VIDEO_TS part of the disc instead. libdvd{css,read} can properly handle DVD-Audio now, and VLC has it enabled in the nightlies, but I don't know if it can easily be bolted onto mpv's existing DVD-Video parsing or if it would require much deeper changes (or at worst, just get siloed off into its own component if it's too different and accessed via dvda://whatever). |
It's rebased on top of #17932, because I don't want to rebase those conflicts again. (The DV pull request got stalled unfortunatelly)