osdep/w32_register: add register/unregister options for Windows - #15912
Conversation
|
Open questions:
I think users are more familiar with install word. There were voices that install has to move binary somewhere else, but looking at definition https://www.merriam-webster.com/dictionary/install
it is exactly what it does.
Anything else? EDIT: One more
Yes we don't have dedicated installer, which drops dozen of files everywhere. My objective is to make this as clean and light as possible, while still making things work in Windows.
The same as mpv, you can do Though I see no real issue, if someone uses mpv.exe and removes it, nothing bad happens... Worse case thay have stale entry in control panel, which will be pruned by windows. We can also completely skip uninstall entry in control panel if this is the main concern. But I still don't see why if user breaks it, it's mpv's fault.
and if it's two files and you remove |
2ff04f0 to
a61b6a5
Compare
|
Download the artifacts for this pull request: |
303fff9 to
64f22b0
Compare
|
Docs changes LGTM. Thanks. I don't feel strongly about any of the open questions. Moving the mpv binary would indeed make it a normal installer, but it's more work. I'd imagine there's a good reason that usually an installer application is used (inno setup etc), because it looks simple but I imagine there are many details to take care of - which personally I'm not familiar with. I think registering mpv inplace is enough. Adding an actual installer would be fine too, but I don't think it's required. Re the option name, I think the fact that it adds an uninstall entry at the control panel (which is a good thing) kind of makes us choose "install", for consistency. But "register" also a valid choice, because it is indeed a better description of the action. Bottom line, either one would be OK IMO. Re icon, not necessary IMO but it would be nicer to have one. I don't think mpv icon would be too bad, but also, there are enough free icons out there, and a generic cog icon or some such would do fine IMO. Or like the original PR did, pick an icon from an existing system file. Just ensure/test that it still works (does the registration/whatever) even if the file is missing. |
|
I vote for --register. Not a serious reason: Making it looks more different with mpv-install.bat. |
Ok, we can go with (software like madvr / lav filters, were for years using
After consideration this is not a job for this command. It looks simple if you forget that normally you have more than single executable to package. Creating installer is still possible and valid on top of this registration command. Note that it can be self-expanding archive, which would serve similar purpose. The point is if you have to handle more files, like additional .dlls, icons, whatever. It makes only sense to have separate packaging solution. But we need to distinguish what this PR does, which is registration of media plater from packaging the mpv into self-extracting or self-installing single-click solution. Also like I was hinting on IRC, once you start moving things, you end up looking like malware https://devblogs.microsoft.com/oldnewthing/20230911-00/?p=108749 :) That's of course a joke and not applicable to mpv, but if you want to uninstall the uninstall.exe itself, it's always funny exercise. Bonus chatter: If we were using cmake, we would have all sort of packaging solutions for free with cpack that integrates with install command. Meson doesn't have this convenience.
This is in fact detail. I went back and forth few times, changing this install/uninstall helpers from showing command line window and not. And I settled to show it, which means, it won't have manifest or icon. But that's fine... it shows little tiny command line icon. |
a180627 to
885fd00
Compare
Changed everything to
Added.
Added. Any more suggestions? I'm not sure what would be useful to add/change here. |
885fd00 to
b1cfb1b
Compare
Thanks. Apologies for wasting both out time due to me not reading the whole section carefully before embarking on a discussion. |
b1cfb1b to
2d4d22f
Compare
|
Is there any reason not to add it to 0.40.0? We hope to replace the old bat installer in shinchiro builds with this soon. |
I don't see the reason to rush this through. Windows users doesn't care about stable releases anyway and even if, they can wait. |
|
Can we move these functions to mpv.com? IMHO, mpv.exe should be a pure player, not installer or uninstaller. |
Your suggestion is pointless. mpv.com is just a legacy ugly workaround that has been abandoned by win32-subsystem=console. |
|
Then maybe we should create another utility exe for install/uninstall or other staff. Putting install/uninstall in the player is a waste. the install/uninstall function will be rarely used, once a year or never? But the bytes will be loaded every time when we play a thing. |
Waste of what? Bytes? You have over 100MiB static linked binary and worrying about maybe few hundreds bytes of code? Give me a break. EDIT: It's ~10kB, mostly strings, because I don't build them dynamically. |
Typical Windows builds are based on the MinGW toolchain, which has more statically linked bootstrap code than the MSVC toolchain. Note that every time one downloads an mpv build, the new exe creates some new waste that is far greater than the waste caused when you launch an registrar-integrated mpv.exe |
This was one of the proposals, or Inno Setup, that I personally wanted to avoid. The main design decision was to make this portable and lightweight, which is why it is embedded in mpv and can be used whenever needed, not only when you have a separate script or binary at hand. Of course, a proper installer would address concerns about removing the binary, binary bloat, or similar issues. However, it would no longer be "portable." Currently, we can easily switch between different mpv binaries just by reinstalling. There are registry keys and one shortcut, but no uninstallers or other unnecessary files left behind. I like the current system, but I'm open to proposals on how to improve it. However, I want to keep it as unobtrusive as possible. If someone wants to install it, they can do so at any time. Otherwise, they can simply choose not to. EDIT: Also probably it's not clear. But the extensions can be customized with existing mpv options. So it is handy to have it together. Else we would need to duplicate this logic. And frankly if you want external, just use a script, batch, powershell... |
|
After disabled those encoders, my mpv.exe is 51MB although I used libmpv-2.dll most of my time. I used .NET Framework to write the file association things for both mpv.exe and foobar.exe, hundred lines of code maybe. at lease it is easy to maintain. :) |
Yes, it does not. Set you environment correctly. PATH is only prepended when run from Windows shell. |
mpv may be launched by other applications, such as umpv, the |
2d4d22f to
37050be
Compare
User inability to understand the feature doesn't render such feature useless. No one is forcing you to use this, if it doesn't fit your workflow. I've added workaround to documentation. If you run mpv with Start-Process command it will inject PATH. You can create I've changed to using .bat scripts as per requests. The rest of the patch is mostly unchanged from the last time, I will merge it later, because it looks like this is one of the missing features in our CI builds. |
37050be to
c7ebb10
Compare
c7ebb10 to
3143ed3
Compare
On Linux, we have `mpv.desktop`, and on macOS, we have `osxbundle`, both of which handle file associations and protocol registration in the system environment. On Windows, this information is stored in the registry, so this commit adds support for it. It registers the application, supported file types, and supported protocols, and adds an uninstall entry so users can remove all registrations via the control panel. Note that this does not remove the binary itself. The implementation is fully portable. There are no external installers, as mpv handles everything automatically. This should improve usability when moving binaries and so on. - `mpv --register` registers mpv (see verbose output for a list of actions). - `mpv --unregister` reverts all changes made during installation. - `mpv --register-rpath <string>` allows specifying a string to be prepended to `PATH` before running mpv. This is useful when using external dependencies that shouldn't be added globally to `PATH`.
3143ed3 to
ac8d451
Compare
e19d338 to
be12303
Compare
They call `--register` / ``--unregister` for users who don't want to open console and do it manually, this is one-click solution.
be12303 to
e854195
Compare
|
is there an |
No it's part of register. And cleared on unregister too. |
|
This could be just a mistake on my part, but I'm having difficulties with migrating from Basically with the previous method of using So to summarize:
I'm using Win11 OS Build 26100.6584 |
|
@Obegg |
|
@kasper93
Got it.
That's the part I did not like, I feel it's a "downgrade" from |
|
mpv install never did that. That's must be done by yourself. |
Not at this point. I don't think register command should change your system wide settings for default applications. It's single time operation to select application. |
I'm 90% sure you're mistaken about that.
Uhm, I partially agree with that sentence. |
You can batch-associate multiple file extensions at once in Windows Settings. |
And if you want to use different application for any given ext, you can do that. Unlikely when it is forcefully changed. Not all exts should be open by mpv by default, for example |
I‘m 1000% sure your memory is not relibale. |
|
That's what |




I deleted the branch by accident and it nuked the PR, which cannot be reopened for recreated branches. Old PR: #15904