* Web interface: dark color-scheme support and small cleanups
- Declare color-scheme light dark on every page and in the stylesheet
so browsers render UA colors correctly in dark mode; keep the player
text black since it sits on light background images, and use gray
borders for the file browser table in dark mode.
- Add a viewport meta to the plain pages and make the stylesheet and
favicon links absolute so they resolve from any path.
- Show variable names on variables.html via CSS generated content.
- Read volume/mute state through CMainFrame::GetVolume()/IsMuted()
instead of poking toolbar internals from the web socket code.
Salvaged from PR #3403; the API changes bundled there are not
included.
* Web interface: fix wrong Options command, dialog hang and gzip waste
The Options button on the controls page sent 886 (on-top while playing
video) instead of 815, so it silently toggled always-on-top.
A command that opens a modal dialog never returned to the web server
thread until that dialog was dismissed at the player, which blocked
every other web client indefinitely. Bound the wait instead: the
command still runs, we just stop waiting for it to finish.
Snapshots were run through the gzip compressor on every poll because
the exclusion list covered .jpeg but not .jpg; .ico had the same
problem.
Also add the viewport meta the controls and player pages were missing,
so phones stop rendering them at a 980px virtual width.
* Add JSON API endpoints to the web interface
Add /status.json, /playlist.json, /commands.json and /browse.json so that a
web UI can drive the player without scraping the HTML pages. The existing
pages are left untouched, since third-party scripts rely on their output.
The track lists in /status.json report, for every audio and subtitle track,
the exact command id that selects it. Those ids are not the plain
ID_AUDIO_SUBITEM_START/ID_SUBTITLES_SUBITEM_START plus the track index: the
menus put an options entry (and, for the subtitles, five more entries) before
the actual tracks, so the ids mirror the arithmetic of OnPlayAudio() and
OnPlaySubtitles() instead. Modes whose ids cannot be computed safely report
no track rather than an id that could open a modal dialog.
The strings are escaped properly, which EscapeJSONString() from text.h does
not do: it escapes the quotes before the backslashes, thereby escaping the
backslashes it has just added itself, and it ignores the control characters.
* Add a responsive remote page to the web interface
The existing pages were built for a mouse on a desktop: fixed pixel
widths, image sliders that cannot be dragged or focused, and a full
page reload for every button press. remote.html is a single
self-contained page that works on a phone and on a desktop, driven by
the JSON endpoints instead of scraped HTML.
It uses one container-query layout, so the same markup shows a stacked
player with a tab bar on a narrow screen and a player with a docked
side panel on a wide one. Controls are real buttons and range inputs,
so seeking and volume can be dragged, reached by keyboard and read by
a screen reader, and the icons are one inline SVG sheet inheriting
currentColor rather than 30 separate images. It follows the player's
own dark theme colours and the browser's light or dark preference.
Playback, the playlist, a file browser and a searchable list of every
command are all reachable without leaving the page. Polling stops
while the page is hidden. The classic pages are untouched, and the
existing endpoints keep their exact output for the scripts that use
them.
* Draw the remote's buttons with the player's own toolbar icons
The remote now loads res/buttons24.svg, the same artwork the toolbar
draws from, instead of carrying its own hand-drawn icon set. The sheet
is 26 columns by 4 rows of states, where rows 0 and 2 are the light and
dark variants, so the remote picks the row that matches the browser's
colour scheme and the icons stay consistent with the application.
Serving it needed three small additions: an image/svg+xml MIME entry,
the SVG resource type in the download path, and the route itself. The
artwork is not duplicated, so it follows the player's icons.
* Follow the selected toolbar in the remote, including external ones
MPC-HC can load a toolbar from disk instead of the built-in artwork, so
serve whichever one is in use rather than always the internal sheet.
The lookup mirrors the player's own: the toolbars folder beside the
program and in the app data folder, SVG before PNG, falling back to the
built-in resource when nothing is configured or found.
External toolbars are usually bitmaps, so a larger sheet is preferred
and the response is cacheable to keep it off every page load. The page
measures the sheet instead of assuming 26 columns, since a custom
toolbar can have a different number of buttons.
Only two functions were still backed by them: BitBltFromRGBToRGB and
BitBltFromRGBToRGBStretch. All YUV blitters in vd.h/vd.cpp were dead
code left over from the removed standalone VSFilter, along with the
vd_asm SSE2/MMX helpers and the old CPU detection they carried.
BitBltFromRGBToRGB is now implemented directly in vd.cpp with the row
converters transcribed verbatim from Kasumi's blt_reference_rgb.cpp.
Bit-exact equivalence with the old code was verified exhaustively over
every possible input value for all six conversion paths (16/24/32 bpp
combinations), both X-byte patterns, and bottom-up negative-pitch
orientation.
The one BitBltFromRGBToRGBStretch call site (CMemSubPic::Unlock)
now uses stb_image_resize2 like the neighboring UnlockARGB already
did, with straight 4-channel Catmull-Rom parameters to match the
former VDPixmapResample XRGB cubic behavior. deinterlace.cpp loses
its vd2 header dependency via a local uint32 typedef and a native
architecture guard.
Every SyncRead previously reopened the archive and walked volumes one
at a time from the file's first volume until reaching the requested
offset — an O(volumes) sequence of file opens and header parses per
read call, paid again on every subsequent read.
Since only stored (Method==0) files are playable, the mapping from an
unpacked file offset to a byte position inside a specific volume is
exact arithmetic once each volume's chunk extent is known. CRFSFile now
builds that index lazily (one entry per volume, extended only as far as
reads require, using the same volume-name sequencing as MergeArchive
including the old-numbering fallback) and serves reads by opening the
right volume directly and reading the stored bytes raw.
Sequential reads become one open+seek per call, backward seeks a binary
search, and the unrar extraction machinery (CmdExtract/ComprDataIO) is
no longer involved in the read path at all. This restores the direct
indexing behavior the old custom RAR4-subset reader had before RAR5
support switched reads to the unrar decompression loop.
Verified by playing a 32-volume set: playback starting at a deep seek
position (volume 29) plays to completion, sequential playback from the
start behaves normally.
Wholesale source refresh from the rarlab tarball. The five local
MPC-HC patches are re-applied and now documented in UPDATING.md
(replacing custom_code.txt), together with the update procedure.
unrar 7.x modernized its internals (std::wstring paths, std::vector
instead of the removed Array template, GetVolNumPart deleted), so
RARFileSource is adapted accordingly; a local copy of the old
GetVolNumPart lives in RFS.cpp. New upstream files largepage.cpp and
motw.cpp are added to the project; array.hpp is gone.
Part of #3990.
The ShiftMediaProject forks are no longer maintained. Neither fork
carried source patches; only their SMP build directories were used.
fribidi: now tracks fribidi/fribidi at v1.0.16 (the same upstream
commit the SMP fork had merged). The generated config headers and
Unicode tables previously taken from SMP/lib are vendored under
generated/; they only change with Unicode data updates.
harfbuzz: now tracks harfbuzz/harfbuzz at 14.3.0 (from 11.2.1) and
builds via the upstream amalgamated source (src/harfbuzz.cc) with
HAVE_FREETYPE, making the project immune to per-version source file
list changes. /bigobj is required for Debug builds of the amalgam.
Part of #3990.
These libraries existed solely as a libass font provider chain
(fontconfig -> libxml2 -> liblzma). libass selects its font provider
with ASS_FONTPROVIDER_AUTODETECT, which prefers DirectWrite whenever
dwrite.dll is available (always, on supported Windows versions), so the
fontconfig provider was compiled and linked but never used at runtime.
* Optimize libass rendering by compositing directly in inverted alpha
* Copy flattened libass image into subpic instead of alpha blending
* Update unused C version of AssFlatten as reference and comment it out