Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 577332 - media-video/mpv: Mac OS X support (Cocoa/Core Audio)
Summary: media-video/mpv: Mac OS X support (Cocoa/Core Audio)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All OS X
: Normal minor (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-13 19:53 UTC by *
Modified: 2017-04-09 11:12 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild patch (mpv-0.16.0-r1.ebuild.patch,1.65 KB, patch)
2016-03-13 19:53 UTC, *
Details | Diff
emerge.info (emerge.info.txt,4.20 KB, text/plain)
2016-03-15 06:17 UTC, *
Details
build.log (build.log.xz,11.08 KB, application/x-xz)
2016-03-15 06:17 UTC, *
Details
mpv-9999.ebuild (mpv-9999.ebuild,7.32 KB, text/plain)
2016-03-27 13:59 UTC, Coacher
Details
build.log for mpv-9999 (build.log.bz2,27.10 KB, application/x-bzip2)
2016-03-29 05:21 UTC, *
Details

Note You need to log in before you can comment on or make changes to this bug.
Description * 2016-03-13 19:53:17 UTC
My system is OS X El Capitan (10.11.3).
I'm using an installation built with a successful bootstrap from bug 564814.
The ebuild for media-video/mpv-0.16.0-r1 has --disable-cocoa hardcoded, however it seems to build on cocoa after changing a few use flags. I'll attach an ebuild patch.

A couple things that might need some work:
(1) It doesn't seem to support lua.
(2) I'm not sure hw decoding is working properly.

For (1), it appears that waf isn't finding the lua.h, even though it's installed:
../player/lua.c:27:10: fatal error: 'lua.h' file not found
#include <lua.h>
         ^
1 error generated.

For (2), the hw decoding is supposedly working, but I get a lot of errors about "Lock timeout" and cpu usage is just as high as with software decoding:
[vo/opengl] Initializing OpenGL backend 'cocoa'
2016-03-13 12:37:07.187 mpv[16477:29766158] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : Lock timeout
2016-03-13 12:37:07.255 mpv[16477:29766158] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : Lock timeout

Reproducible: Always
Comment 1 * 2016-03-13 19:53:59 UTC
Created attachment 428142 [details, diff]
ebuild patch
Comment 2 Coacher 2016-03-13 23:39:04 UTC
The initial support for Mac OS X will be added to 9999 ebuild once the PR referenced in the URL is merged.

Apple Remote support is disabled until somebody can test and confirm that it works. Video Toolbox HW acceleration is enabled automagically for now as ffmpeg (and probably libav) ships the required headers automagically though its build system allows to control their installation via a configure option.

rfc469@gmail.com, please test the 9999 ebuild after the mentioned PR is merged. Report back whether 'aqua' and 'coreaudio' USE flags work properly and also attach build.log and `emerge --info' output.
Comment 3 * 2016-03-15 06:13:40 UTC
Am I supposed to use +opengl? If I do, that pulls in some dependencies that fail to build (for which I can create tickets if necessary):

Calculating dependencies  ... done!
[ebuild  N     ] app-eselect/eselect-opengl-1.3.1-r4::gentoo_prefix  3 KiB
[ebuild  N     ] x11-proto/glproto-1.4.17-r1::gentoo_prefix  124 KiB
[ebuild  N     ] media-libs/opengl-apple-5::gentoo_prefix  0 KiB
[ebuild  N     ] virtual/opengl-7.0-r1::gentoo_prefix  0 KiB
[ebuild   R   *] media-video/mpv-9999::local  USE="aqua archive bluray cdda cli coreaudio dvd enca iconv jpeg libass opengl* -X (-alsa) -doc -drm -dvb -egl -encode -gbm -jack -lcms -libav -libcaca -libguess -libmpv -lua -luajit -openal (-oss) -pulseaudio -raspberry-pi -rubberband -samba -sdl (-selinux) {-test} (-uchardet) (-v4l) -vaapi (-vdpau) -vf-dlopen -wayland -xinerama -xscreensaver -xv -zsh-completion" 0 KiB

Total: 5 packages (4 new, 1 reinstall), Size of downloads: 127 KiB

If I don't use +opengl, then your ebuild emits --disable-gl-cocoa, and I don't have video.
Comment 4 * 2016-03-15 06:17:04 UTC
Created attachment 428270 [details]
emerge.info
Comment 5 * 2016-03-15 06:17:38 UTC
Created attachment 428272 [details]
build.log
Comment 6 Coacher 2016-03-15 06:40:32 UTC
(In reply to * from comment #3)
> Am I supposed to use +opengl? If I do, that pulls in some dependencies that
> fail to build (for which I can create tickets if necessary):
>
> If I don't use +opengl, then your ebuild emits --disable-gl-cocoa, and I
> don't have video.

Yes, you need to have 'opengl' USE enabled if you want video support. This USE flag is enabled by default, though. I will add it to REQUIRED_USE for 'aqua'. Good point.

If some deps fail to build, then please create separate bugreports per package.
Comment 7 Coacher 2016-03-15 06:43:35 UTC
(In reply to * from comment #3)
> If I don't use +opengl, then your ebuild emits --disable-gl-cocoa, and I
> don't have video.

What about audio? Does it work?
Comment 8 * 2016-03-16 05:26:10 UTC
To clarify, I meant to ask if USE=opengl was necessary, though if it is, then yes it would be good to have +opengl with aqua.

With my own ebuild, with -opengl, the "OpenGL Cocoa Backend" was enabled and the "OpenGL X11 Backend" was disabled. I thought that's what I wanted. Audio and video both worked, but like I said, I'm not sure the opengl was actually being used.

I went ahead and opened bug 577518 and bug 577520, but I'm not sure opengl-apple is still supported.
Comment 9 Coacher 2016-03-16 19:06:31 UTC
(In reply to * from comment #8)
> I went ahead and opened bug 577518 and bug 577520, but I'm not sure
> opengl-apple is still supported.
Thank you.
Comment 10 Coacher 2016-03-16 19:24:00 UTC
(In reply to * from comment #8)
> With my own ebuild, with -opengl, the "OpenGL Cocoa Backend" was enabled and
> the "OpenGL X11 Backend" was disabled. I thought that's what I wanted. Audio
> and video both worked, but like I said, I'm not sure the opengl was actually
> being used.
That's interesting. Did you have media-libs/opengl-apple installed atm?
AFAIK opengl-apple provides <OpenGL/gl{,3,ext}.h> headers, which are included when "OpenGL Cocoa Backend" is enabled.
Comment 11 * 2016-03-17 03:34:28 UTC
opengl-apple only creates links to the system opengl, for example:
/opt/gentoo/usr/include/GL/GLwDrawA.h -> /usr/X11R6/include/GL/GLwDrawA.h
/opt/gentoo/usr/include/GL/glu.h -> /usr/X11R6/include/GL/glu.h
/opt/gentoo/usr/include/GL/osmesa.h -> /usr/X11R6/include/GL/osmesa.h

As mentioned in bug 577520, it appears that Apple is no longer providing those.
Comment 12 * 2016-03-17 04:47:16 UTC
Update: I went back to mpv-0.16.0-r1 using my old ebuild and now, for some reason, it appears that hw decoding is working. I'm not getting the "Lock timeout" errors and the cpu is 20% as opposed to the 100% it was previously. Maybe the Mac just needed to be rebooted.

I think we can close this ticket after making the official ebuild work.

It would be nice to get lua working, but maybe that should be a new ticket. I get the missing lua.h error with both 0.16.0-r1 and 9999.
Comment 13 Coacher 2016-03-17 10:46:17 UTC
(In reply to * from comment #11)
> opengl-apple only creates links to the system opengl, for example:
> /opt/gentoo/usr/include/GL/GLwDrawA.h -> /usr/X11R6/include/GL/GLwDrawA.h
> /opt/gentoo/usr/include/GL/glu.h -> /usr/X11R6/include/GL/glu.h
> /opt/gentoo/usr/include/GL/osmesa.h -> /usr/X11R6/include/GL/osmesa.h

I see. Then you most probably doesn't need to have opengl-apple installed for video support to work. I'll adjust the build accordingly.
Comment 14 Coacher 2016-03-17 11:13:58 UTC
(In reply to * from comment #11)
> opengl-apple only creates links to the system opengl, for example:
> /opt/gentoo/usr/include/GL/GLwDrawA.h -> /usr/X11R6/include/GL/GLwDrawA.h
> /opt/gentoo/usr/include/GL/glu.h -> /usr/X11R6/include/GL/glu.h
> /opt/gentoo/usr/include/GL/osmesa.h -> /usr/X11R6/include/GL/osmesa.h
Is <GL/gl.h> link provided via opengl-apple package?
Comment 15 * 2016-03-17 15:44:32 UTC
Not explicitly but it's linking that dir. Here's the ebuild:
https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/opengl-apple/opengl-apple-5.ebuild
Comment 16 Coacher 2016-03-17 16:12:53 UTC
(In reply to * from comment #15)
> Not explicitly but it's linking that dir. Here's the ebuild:
> https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/opengl-apple/
> opengl-apple-5.ebuild
I've seen the ebuild. <Gl/gl.h> is not listed there and I don't have Mac OS to see what's actually in that dir. That's why I am asking.

So, you are saying that "#include <GL/gl.h>" only works with opengl-apple installed, right?
Comment 17 * 2016-03-19 17:42:30 UTC
Yes, as I tried to say in bug 577520, I have no /usr/X11R6/include on El Capitan. The only dirs there were, I think, bin and lib, which may have been from Yosemite or even Mavericks.
Comment 18 Coacher 2016-03-21 22:37:36 UTC
I've been trying to figure out a way to keep available functionality and workaround the fact that opengl-apple is broken atm. The problem is that some configure checks look for <GL/gl.h>, but the actual code works with <OpenGL/gl.h>. Thus even though the code is there it's disabled at configure time. I filed a bugreport upstream. Once it's resolved I'll be able move further and finally put all things in place properly.
Comment 19 Coacher 2016-03-27 00:36:44 UTC
The blocking upstream issue has been resolved. I've prepared another PR that should fix all of the aforementioned opengl-related problems. Once this PR is merged, please test the 9999 ebuild and report back how it works for you.

Remember that for video support you'll need both aqua and opengl USEs enabled, but now opengl-apple shouldn't be pulled.
Comment 20 Coacher 2016-03-27 00:39:43 UTC
Please also share build.log when you are going to test the updated 9999 ebuild.
Comment 21 Patrice Clement gentoo-dev 2016-03-27 08:27:36 UTC
commit 849e1c5905a056523091fc58a045124a4bb73e33 (HEAD -> master)
Author:     Ilya Tumaykin <itumaykin@gmail.com>
AuthorDate: Sun Mar 27 03:08:25 2016 +0300
Commit:     Patrice Clement <monsieurp@gentoo.org>
CommitDate: Sun Mar 27 08:13:36 2016 +0000

media-video/mpv: add more Mac OS X fixes wrt bug 577332 to 9999

Plus some minor style fixes.

Closes: https://github.com/gentoo/gentoo/pull/1145
Gentoo-Bug: https://bugs.gentoo.org/577332
Package-Manager: portage-2.2.28

Signed-off-by: Patrice Clement <monsieurp@gentoo.org>

media-video/mpv/mpv-9999.ebuild | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Comment 22 Coacher 2016-03-27 13:59:08 UTC
Created attachment 429106 [details]
mpv-9999.ebuild

As for that lua.h include problem, please grab the attached ebuild, try to build with lua USE enabled, and then attach build.log here.
Comment 23 Coacher 2016-03-27 14:01:33 UTC
It would also be helpful if you could attach a build.log with 'libmpv', 'aqua' and 'opengl' USEs enabled simultaneously.
Comment 24 * 2016-03-29 05:21:03 UTC
Thanks, that works. I'll attached a build.log with the requested USEs, including USE=lua.
Comment 25 * 2016-03-29 05:21:41 UTC
Created attachment 429212 [details]
build.log for mpv-9999
Comment 26 Coacher 2016-03-29 05:40:10 UTC
Great. Thank you very much for the feedback!

I don't see in your build.log any lua-related problems though. lua is properly detected by pkg-config during configure phase and player.lua.c is compiled fine.

Is that lua.h include problem now fixed on your machine?
Comment 27 * 2016-03-29 05:56:48 UTC
Yes, there are no problems with lua.h in the new build. It works.

I should say that I also tried USE=luajit and it builds, but doesn't work. I can create a separate bug for that if it's worth fixing, but I'm happy enough that lua works.
Comment 28 Coacher 2016-03-29 06:16:10 UTC
(In reply to * from comment #27)
> Yes, there are no problems with lua.h in the new build. It works.

Strange, because there were no lua-related changes in the ebuild and I cannot see anything related to this problem in recent upstream changes. Maybe it was smth with your system then. Anyway, I'm glad that it works for you in the end.

> I should say that I also tried USE=luajit and it builds, but doesn't work. I
> can create a separate bug for that if it's worth fixing, but I'm happy
> enough that lua works.

That's good to know. If you have the regular lua interpreter working for you, that's perfectly fine with me. I don't have access to Mac OS machine so I cannot really test/fix issues like this. Thus let's leave luajit as is for now.
Comment 29 Coacher 2016-03-29 07:00:31 UTC
Current mpv-9999 ebuild is reported to work fine on Mac OS X. The required changes will be also available in the next versioned ebuild (0.17.0). Keywording on *-macos won't happen now because many mpv deps aren't keyworded yet.
Thus closing this bug as resolved fixed.
Comment 30 Coacher 2017-04-08 10:36:33 UTC
Hello again, *.

Do you have Apple Remote or one of those recent Apple machines with touchbar?
Comment 31 * 2017-04-08 14:28:27 UTC
Sorry, only a 4-year-old MacBook Pro. Waiting for the new Mac Pro.
Comment 32 Coacher 2017-04-09 11:12:12 UTC
(In reply to * from comment #31)
> Sorry, only a 4-year-old MacBook Pro. Waiting for the new Mac Pro.
OK, thanks for the info :)