-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use libmpv on macOS (No render context set.) #12518
Comments
What is this bit exactly?
You're running Monterey in a VM? I also use Monterey, but on an actual mac computer and mpv works fine. Perhaps something is wrong in your VM setup. |
@mlindner |
I use mpv directly from the command line which uses the libmpv video output. I'm not embedding it in any application. |
Ok, maybe my issue description isn't clear enough. Mpv on the command line works fine. But when I try to call it from the application I am building, I experience the errors mentioned above. It's a pretty annoying edge-case, since most people either use mpv directly or write programs where they embed libmpv itself. |
Ah ok, sorry for the confusion. Is your application open source? I'm not busy at the moment and I could try testing it without the VM to eliminate that case. |
It's a CLI client for jellyfin and emby, so without having that already setup you can't test it. Don't bother with it, if it requires too much work. |
Ah okay, I've never heard of jellyfin or emby so sounds like learning everything required to set it up may be difficult. |
Yep, don't worry. I'll just wait for akemi or some macos dev to look into this. |
looking at the code, using though using the macvk vulkan/gpu-next backend, which is supposed to work, doesn't work either. i found one problem and it is something i broke. though fixing that one problem gets me to the next one. long story short, i need to look further into this. |
NSApp is only an Application when initialised from mpv itself. when used via libmpv an Application is never initialised and mpv would always immediately exit. make the retrieval of the vo and mac options static so they can be retrieved in all cases. Fixes mpv-player#12518
fixed the usage with macvk with #12947. though keep in mind, since macOS is a bit special about the main thread/queue libmpv needs to be used/created in its own thread (none main thread), see the basic cocoa example (https://github.com/mpv-player/mpv-examples/blob/57d26935c0525585482748b7236b60fe83d3f044/libmpv/cocoa/cocoabasic.m#L94-L126). otherwise it will create a deadlock in the main thread. |
Thank you so much! I'll try to test it as soon as possible with a fresh VM. |
Ok. I've built mpv with the changes from your pull request. Here is a log when using libmpv using my program: https://pastebin.com/wP2hNMLP (get's stuck / deadlock?) |
the log of your program seems incomplete? it only tries to initialise 'displayvk' and never 'macvk'. if the log is not incomplete something is wrong on your end with your build. the mpv log uses cocoa-cb/libmpv and not gpu-next and macvk. set a
|
oh. Yeah I'm sorry, I totally missed that they use different configurations. So if I'm correct, vulkan/gpu-next uses the GPU? I did see the Running the example code with your proposed edits: https://pastebin.com/Kg09YUDL |
yeah it uses the GPU, like VMs also have a GPU, it's just a software emulated one. it depends on the driver that are used in the VM itself and what it supports. mpv cli does the same as the example. if you get i suppose that just means that either your VM doesn't support it or the vulkan driver/sdk doesn't support the VM. it's not a limitation of mpv. |
Yes, vulkan is not supported in my VM. |
NSApp is only an Application when initialised from mpv itself. when used via libmpv an Application is never initialised and mpv would always immediately exit. make the retrieval of the vo and mac options static so they can be retrieved in all cases. Fixes #12518
NSApp is only an Application when initialised from mpv itself. when used via libmpv an Application is never initialised and mpv would always immediately exit. make the retrieval of the vo and mac options static so they can be retrieved in all cases. Fixes mpv-player#12518
NSApp is only an Application when initialised from mpv itself. when used via libmpv an Application is never initialised and mpv would always immediately exit. make the retrieval of the vo and mac options static so they can be retrieved in all cases. Fixes mpv-player#12518
Important Information
Reproduction steps
mpv.conf:
Just try to create the most basic simple libmpv handle and load a file.
I've stripped down the options and all of the unnecessary stuff (except for the above mpv.conf).
(the exact same code works on windows and linux)
Expected behavior
playing
Actual behavior
not playing
Log file
https://pastebin.com/t10dUGig
don't look at the comments!
I've tried troubleshooting this myself and ended up getting stuck at line
250
inmacosx_events.m
._is_application
is set to false (or NO in objc??), which results inrender_context
(at least) never being assigned.I have never written any macOS application, nor have I ever heard of objective c before yesterday.
I'm incompetent.
Please help.
The text was updated successfully, but these errors were encountered: