Bug 203534

Summary: [PATCH] multimedia/mpv: Enable more options by default
Product: Ports & Packages Reporter: Tobias Kortkamp <tobik>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me CC: cjpm, jbeich
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (cjpm)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
mpv.diff
none
Poudriere log
none
Patch none

Description Tobias Kortkamp freebsd_committer freebsd_triage 2015-10-04 14:19:17 UTC
Created attachment 161695 [details]
mpv.diff

mpv could be more useful on FreeBSD desktops out of the box. The attached patch enables GPU video acceleration options VDPAU, OPENGL, VAAPI, and V4L for testing e.g. webcams. It also enables the ZSH option for completion support in zsh.
Comment 1 Tobias Kortkamp freebsd_committer freebsd_triage 2015-10-04 14:20:08 UTC
Created attachment 161696 [details]
Poudriere log
Comment 2 Carlos J Puga Medina 2015-10-05 12:48:07 UTC
Adding jbeich@ to decide if your proposal should be accepted :)
Comment 3 Carlos J Puga Medina 2015-10-05 16:44:53 UTC
Just for the record, multimedia/mpv port has been updated to a new release. See bug 203550.
Comment 4 Jan Beich freebsd_committer freebsd_triage 2015-10-05 17:25:54 UTC
VDPAU and VAAPI require corresponding support in multimedia/ffmpeg. Without it --vo=vdpau and --vo=vaapi would use hardware overlays and scaling but with software decoding. mplayer avoids this issue by using a bundled copy of ffmpeg. --vo=opengl also supports hardware decoding but you still need to build mpv with VDPAU or VAAPI.

With OPENGL --vo=opengl would be picked over --vo=xv by default, see the list in video_out_drivers[] in video/out/vo.c. It's going to improve non-video scaling (OSD and subtitles) but those stuck with swrast DRI (mainly non-x86) may want --vo=sdl:sw (VIDEO_OPENGL=off) or return of --vo=x11 [1] instead.

V4L should be fine as tv:// and pvr:// don't use v4l support in libavdevice for which there's av:// protocol.

[1] https://github.com/mpv-player/mpv/commit/ebb43f5176d52158dc6b115ce60305a2c8a63b76

multimedia/ffmpeg can enable VDPAU, VAAPI, V4L by default as well. It's probably a matter of how popular they are to burden package users with more dependencies. libv4l can be pulled by quite a few non-multimedia and non-video-chat packages e.g., blender (via opencv), firefox, wine-staging.
Comment 5 Carlos J Puga Medina 2015-10-07 10:29:18 UTC
So if we add such OPTIONS as default, we can break things. As jbeich@ pointed previously such OPTIONS should be enable in ffmpeg by default as well.
Comment 6 Tobias Kortkamp freebsd_committer freebsd_triage 2015-10-08 11:21:06 UTC
Let me summarize a bit.

Enabling OPENGL is out of the question because it might break mpv or make it less useful on some devices.

Enabling V4L is ok. It does not require changing other ports and does not
burden users with more dependencies as libv4l is probably installed anyway
through e.g. firefox, opencv, wine-staging, thunderbird, webcamd, ...

Enabling ZSH is ok.

Then there is VDPAU and VAAPI which require ffmpeg support.  How do we find out
how popular VDPAU/VAAPI are?
Comment 7 Carlos J Puga Medina 2015-10-08 11:43:51 UTC
(In reply to tobias.kortkamp from comment #6)

Yes, that's the first disadvantage to use pkg(8) instead use the ports tree to install software.

Probably, you will find interesting to check out the port stats:
http://bsdstats.org/ports.php
Comment 8 Chris Hutchinson 2015-10-08 15:32:56 UTC
> Probably, you will find interesting to check out the port stats:
> http://bsdstats.org/ports.php

Unfortunately, the pages produced at bsdstats.org/ports.php are
corrupt. :(
Comment 9 Jan Beich freebsd_committer freebsd_triage 2015-10-08 16:24:48 UTC
(In reply to Carlos J Puga Medina from comment #5)
> So if we add such OPTIONS as default, we can break things.

No. Only crappy drivers can, and --vo=xv wouldn't be safe in such a case. I think it's fine to enable the options listed here. User can still disable them via ~/.mpv/config.

LCMS2 can also be enabled by default because it's pulled by wine, gtk30 (via colord), cups (via cups-filters), libreoffice + many image manipulation apps/libs.
Comment 10 Carlos J Puga Medina 2015-10-08 16:48:34 UTC
Created attachment 161832 [details]
Patch
Comment 11 Carlos J Puga Medina 2015-10-08 16:52:09 UTC
New release was committed, so the patch has been reworked.
Comment 12 commit-hook freebsd_committer freebsd_triage 2015-10-09 05:28:45 UTC
A commit references this bug:

Author: jbeich
Date: Fri Oct  9 05:28:34 UTC 2015
New revision: 398901
URL: https://svnweb.freebsd.org/changeset/ports/398901

Log:
  multimedia/mpv: enable more options by default

  OPENGL, V4L, VAAPI, VDPAU, XINERAMA, ZSH are now enabled to make package
  more useful. OPENGL, VAAPI, VDPAU also support hardware decoding but only
  if multimedia/ffmpeg is built with VAAPI, VDPAU (currently off by default).

  PR:		203534
  Submitted by:	tobias.kortkamp@gmail.com
  Approved by:	Carlos J Puga Medina <cpm@fbsd.es> (maintainer)

Changes:
  head/multimedia/mpv/Makefile
Comment 13 Jan Beich freebsd_committer freebsd_triage 2015-10-09 05:29:09 UTC
Thanks. Committed.