Commit Graph

44920 Commits

Author SHA1 Message Date
wm4 5bfbe6dfde external_files: change license to LGPL
While we could easily ifdef-out this file for a LGPL core, it's still
annoying, and also the only GPL file remaining in player/ that is not
based on mplayer.c.

This file originates from subreader.c. It's not clear whether the
original author of it gave us permission to relicense to LGPL (he
probably did, but without further clarification it's sort of ambiguous),
but the subtitle file search code was written by other authors anyway
(see 7eef93819f).

One contribution (574eb892ea) is a bit of a corner case, as
test_ext_list() now does a bstrcasecmp(). But I don't think the
copyright remains here. (I asked the author anyway, just in case. But
I didn't wait for the answer.)

In some other cases, contributors who could not be reached added some
subtitle extensions. I don't think those are copyrightable on their own,
but I dropped them anyway just to be sure.
2017-06-20 14:22:10 +02:00
wm4 bc108bece2 Copyright: stream.c/.h was relicensed 2017-06-20 14:22:10 +02:00
wm4 44d30c986d input: mention GPL exceptions in license header
(Just to make our HAVE_GPL business explicit.)
2017-06-20 14:22:06 +02:00
wm4 f34e1a0dee demux: replace custom return codes with CONTROL_ ones
This is more uniform, and potentially gets rid of some past copyrights.

It might be that this subtly changes caching behavior (it seems before
this, it synced to the demuxer if the length was unknown, which is not
what we want.)
2017-06-19 17:56:51 +02:00
wm4 e0c50289d6 stream: change license to LGPL
All relevant authors have agreed.

There are two exceptions, patches by authors who could not be reached.
This commit tries to remove their copyright.

a0f08fbe: messes with the seeking code corner cases. The EOF flag logic
was changed at some point, and always had a flaky history (see e.g.
347cf972 50274ca3 70411f27 5999efb9 0d5e6084 ff08d0c3 2e2f77e3 de5566f0
9554a844, all which happened after that patch, MPlayer ones without that
patch). I claim that all of the copyright the patch might have added is
gone. Except the message in stream_seek(), which this commit removes.
The other code removed/changed in stream_seek() is probably not from
that patch, but it doesn't hurt to be sure, and also makes it more
readable. (It might change the behavior so that sometimes the eof flag
is set after a seek, but it doesn't matter here.)

2aa6acd9: it looks like the seek_forward() modified by this patch was
later moved to stream.c and renamed to stream_skip_read() in a790f2133.
(Looking closer at it, it was actually modified again a bunch of times,
fixing the logic.) I rewrote it in this commit. The code ended up rather
similar, which probably could lead to doubts whether this was done
properly, but I guess the reader of this will just have to believe me. I
knew what stream_skip_read() was supposed to do (which was reinforced
when I tried to replace it on the caller side), without reading the
pre-existing code in detail. I had to "relearn" the logic how buf_pos
and bug_len work - it was actually easy to see from stream_read_char()
how to skip the data, essentially by generalizing its logic from 1 byte
to N bytes. From the old code I only "used" the fact that it's obviously
a while(len>0) look, that has to call stream_fill_buffer repeatedly to
make progress. At first I actually didn't use stream_fill_buffer_by(),
but the variant without _by, but readded it when I checked why the old
code used it (see cd7ec016e7). This has to be good enough. In the end,
it's hard to argue that this could be implemented in a way not using
such a loop.

Other than this, I could add the usual remarks about how this code was
not modularized in the past, and how stream.c contained DVD code, and
how this was later modularized, moving the copyright to other files, and
so on. Also, if someone wrote a stream module, and was not asked about
LGPL relicensing, we don't consider the entry in stream_list[]
copyrightable.
2017-06-19 16:10:10 +02:00
wm4 2e84934be7 input: change license to LGPL
cehoyos adds the step_property command in 7a71da01d, and it could be
argued that copyright of this still applies to the later add/cycle
commands (a668ae0ff9). While I'm not sure if this is really the case,
stay conservative for now and mark these commands as GPL-only. Mark the
command.c code too, although that is not being relicensed yet.

I'm leaving the MP_CMD_* enum items, as they are obviously different.

In commit 116ca0c768, "veal" (essentially an anonymous author) adds an
"osd_show_property_text" command (well, the commit message says "based
on" that person's code, so it's not clear how much is from him or from
albeu, who agreed to LGPL). This was later merged again with the
"osd_show_text" command, and then all original code was removed in
commit 58cc0f637f, so I claim that no copyright applies anymore. (Though
technically the input.conf addition still might be copyrighted, so I'm
just dropping it to get rid of the thought.)

"kiriuja" added 2f376d1b39 (sub_load etc.) and be54f4813 (switch_audio).
The latter is gone. I would argue that the former is fully rewritten
with commits b7052b431c and 0f155921b0. But like in the step_property
case, I will be overly conservative for now, and mark them as GPL-only,
as this is potentially shaky and should be thought through first. (Not
bothering with the command define/enum in the header, as it will be
unused in LGPL mode anyway.)

keycodes.c/h can be GPL, except for commit 2b1f95dcc2, which is a
patch by someone who wasn't asked yet. Before doing something radical, I
will wait for a reply.
2017-06-19 13:28:19 +02:00
jrodatus ab19b3c9d3 player: seek backward for type MPSEEK_FACTOR
Choosing the seek direction for MPSEEK_FACTOR based on the location of
seek_pts is nonsense, and can cause the seek position to oscillate
between adjacent keyframes, such as when dragging the OSC bar on short
videos.

Fix this by always seeking backward for type MPSEEK_FACTOR, i.e. seek
to the keyframe for the group of pictures (GOP) in which seek_pts is
located.

Fixes #4183.

Signed-off-by: wm4 <wm4@nowhere>
2017-06-18 20:54:45 +02:00
quilloss 2ba2062e5b context_dxinterop: lock rendertarget after present when swapping buffers
Moves the DXLockObjectsNV call to after PresentEx. This fixes an issue
where the presented image is a single frame late. This may be due to
DXLockObjectsNV locking the render target before StretchRect is done.
The spec indicates that the lock call should provide synchronization
for the resource, so this may be due to a driver bug.
2017-06-18 20:54:44 +02:00
Anton Kindestam 3d75ba971d vo_drm: nake drm mode help output also output refresh rate
The printout of available modes that you can get with --drm-mode=-1
(with -vo drm or --opengl-backend=drm) does not include the refresh
rate in the printout, which is quite useful to know, if one is to
choose for instance 23.98, or 24 Hz for film material.

Signed-off-by: wm4 <wm4@nowhere>
2017-06-18 20:54:44 +02:00
Niklas Haas 2e45b8fa1a vo_opengl: implement sony s-log2 trc
Apparently this is virtually identical to Panasonic's V-Log, but using
the constants from S-Log1 and an extra scaling coefficient to make the
S-Log1 curve less limited. Whatever floats their NIH boat, I guess.

Source: https://pro.sony.com/bbsccms/assets/files/micro/dmpc/training/S-Log2_Technical_PaperV1_0.pdf
2017-06-18 20:54:44 +02:00
Niklas Haas 326e02e955 vo_opengl: implement sony s-log1 trc
Source: https://pro.sony.com/bbsccms/assets/files/mkt/cinema/solutions/slog_manual.pdf

Not 100% confident in the implementation since the values from the spec
seem to be very subtly off (~1%), but it should be close enough for
practical purposes.
2017-06-18 20:54:44 +02:00
Niklas Haas da7ae75e26 csputils: implement sony s-gamut
The S-Log "matching" colorspace
2017-06-18 20:54:44 +02:00
Niklas Haas c3f32f3a6e vo_opengl: tone map in linear XYZ instead of RGB
This preserves channel balance better and helps reduce discoloration due
to nonlinear tone mapping.

I wasn't sure whether to stuff this inside pass_color_manage or
pass_tone_map but decided for the former because adding the extra
mp_csp_prim would have made the signature of the latter longer than
80col, and also because the `mp_get_cms_matrix` below it basically does
the same thing anyway, so it doesn't look that out of place. Also why is
this justification longer than the actual description of the algorithm
and what it's good for?
2017-06-18 20:54:44 +02:00
Niklas Haas 6a4ce39648 vf_format: also reset gamma-related attributes when changing gamma
This prevents nasty surprises like the sig-peak still being left at 1.0
when reinterpreting SDR as HDR, or the OOTF for HLG being left as
display-referred.
2017-06-18 20:54:44 +02:00
Niklas Haas 1f3000b03c vo_opengl: implement support for OOTFs and non-display referred content
This introduces (yet another..) mp_colorspace members, an enum `light`
(for lack of a better name) which basically tells us whether we're
dealing with scene-referred or display-referred light, but also a bit
more metadata (in which way is the scene-referred light expected to be
mapped to the display?).

The addition of this parameter accomplishes two goals:

1. Allows us to actually support HLG more-or-less correctly[1]
2. Allows people playing back direct “camera” content (e.g. v-log or
   s-log2) to treat it as scene-referred instead of display-referred

[1] Even better would be to use the display-referred OOTF instead of the
idealized OOTF, but this would require either native HLG support in
LittleCMS (unlikely) or more communication between lcms.c and
video_shaders.c than I'm remotely comfortable with

That being said, in principle we could switch our usage of the BT.1886
EOTF to the BT.709 OETF instead and treat BT.709 content as being
scene-referred under application of the 709+1886 OOTF; which moves that
particular conversion from the 3dlut to the shader code; but also allows
a) users like UliZappe to turn it off and b) supporting the full HLG
OOTF in the same framework. But I think I prefer things as they are
right now.
2017-06-18 20:54:44 +02:00
Niklas Haas fe1227883a csputils: rename HDR curves
st2084 and std-b67 are really weird names for PQ and HLG, which is what
everybody else (including e.g. the ITU-R) calls them. Follow their
example.

I decided against naming them bt2020-pq and bt2020-hlg because it's not
necessary in this case. The standard name is only used for the other
colorspaces etc. because those literally have no other names.
2017-06-18 20:54:44 +02:00
Niklas Haas deb9370779 vd: use ST.2086 / HDR10 MaxCLL in addition to mastering metadata
MaxCLL is the more authoritative source for the metadata we are
interested in. The use of mastering metadata is sort of a hack anyway,
since there's no clearly-defined relationship between the mastering peak
brightness and the actual content. (Unlike MaxCLL, which is an explicit
relationship)

Also move the parameter fixing to `fix_image_params`

I don't know if the avutil check is strictly necessary but I've included
it anyway to be on the safe side.
2017-06-18 20:54:44 +02:00
Niklas Haas c335e84230 video: refactor HDR implementation
List of changes:

1. Kill nom_peak, since it's a pointless non-field that stores nothing
   of value and is _always_ derived from ref_white anyway.

2. Kill ref_white/--target-brightness, because the only case it really
   existed for (PQ) actually doesn't need to be this general: According
   to ITU-R BT.2100, PQ *always* assumes a reference monitor with a
   white point of 100 cd/m².

3. Improve documentation and comments surrounding this stuff.
4. Clean up some of the code in general. Move stuff where it belongs.
2017-06-18 20:48:23 +02:00
wm4 642e963c86 dec_video: change license to LGPL (almost)
"Almost" because this might contain copyright by michael, who agreed
with LGPL, but only once the core is LGPL. This is preparation for that
to happen.

Apart from that, the usual remarks apply. In particular, dec_video.c
started out quite chaotic with no modularization, but was later
basically gutted, and in general rewritten a bunch of times. Not going
to give a history lesson.

Special attention needs to be given to 3 patches by cehosos, who did not
agree to the relicensing:

240b743ebdf: --field-dominance
e32cbbf7dc3: reinit VO if aspect ratio changes
306f6243fdf: use container aspect if codec aspect unset (?)

The first patch is pretty clearly still in the current code, and needs
to be disabled for LGPL.

The functionality of the second patch is still active, but implemented
completely different, and as part of general frame parameter changes (at
the time of the patch, MPlayer already reinitialized the VO on frame
size and pixel format changes - all this was merged into a single check
for changing image parameters).

The third patch makes me a bit more uncomfortable. It appears the code
was moved to dec_video.c in de68b8f23c, and further changed in
82f0d373, 0a0bb905, and bf13bd0d. You could claim that cehoyos'
copyright still sticks. Fortunately, we implement alternative aspect
detection, which is simpler and probably preferable, and which arguably
contains none of the original code and logic, and thus should be fully
safe.

While I don't know if cehoyos' copyright actually still applies, I'm
more comfortable with making the code GPL-only for now. Also change the
default to use the (in future) plain LGPL code, and deprecate the one
associated with the GPL code, so we can eventually remove the GPL code.

But it's also possible we decide that the copyright doesn't apply, and
undo the deprecation and GPL guards.

I expect that users won't notice anything. If you ask me, the old aspect
method was probably an accidental bug instead of intentional behavior.

Although, the new aspect method was broken too, so I had to fix it.
2017-06-18 18:58:36 +02:00
wm4 078b275514 image_writer, vo_image: change license to LGPL
image_writer.c has code originating from vf_screenshot.c, vo_jpeg.c, and
potentially others. vo_image.c is based on a bunch of those VOs as well,
and the intention was to replace them with a single codebase.

vo_tga.c was written by someone who was not or not could be contacted,
but it doesn't matter anyway, as no code from that initial patch was
used.

One rather old patch (57f77bb41a) reordered by libjpeg patch API calls,
and the author of the patch was not contacted. But at least with the
smoothing_factor override removed, this pretty much exactly corresponds
to the official libjpeg API example (and might even reflect a change to
those - didn't dig deeper). This removes the -jpeg-smooth option. While
we're at it, remove all the other dropped jpeg options from the manpage
(which was forgotten in past changes).
2017-06-18 15:45:24 +02:00
wm4 5ea851feae video/fmt-conversion, img_format: change license to LGPL
The problem with fmt-conversion.h is that "lucabe", who disagreed with
LGPL, originally wrote it. But it was actually rewritten by "reimar"
later. The original switch statement was replaced with a lookup table.
No code other than the imgfmt2pixfmt() function signature survives.
Neither the format pairs (PIXFMT<->IMGFMT), nor the concept of mapping
them, can be copyrighted.

So changing the license should be fine, because reimar and all other
authors involved with the new code agreed to LGPL.

We also don't consider format pairs added later as copyrightable.

(The direct-mapping idea mentioned in the "Copyright" file seems
attractive, and I might implement in later anyway.)

Likewise, there might be some format names added to img_format.h, which
are not covered by relicensing agreements. These all affect "later"
additions, and they follow either the FFmpeg PIXFMT naming or some other
pre-existing logic, so this should be fine.
2017-06-18 15:15:07 +02:00
wm4 456c2ad222 img_format: drop unused aliases
vo_opengl uses those automatically via pixdesc.
2017-06-18 15:15:07 +02:00
wm4 b6d0b57e85 Drop/move img_fourcc.h
This file is an leftover from when img_format.h was changed from using
the ancient FourCCs (based on Microsoft multimedia conventions) for
pixel formats to a simple enum. The remaining cases still inherently
used FourCCs for whatever reasons.

Instead of worrying about residual copyrights in this file, just move it
into code we don't want to relicense (the ancient Linux TV code). We
have to fix some other code depending on it. For the most part, we just
replace the MP_FOURCC macro with libavutil's MKTAG (although the macro
definition is exactly the same). In demux_raw, we drop some pre-defined
FourCCs, but it's not like it matters. (Instead of
--demuxer-rawvideo-format use --demuxer-rawvideo-mp-format.)
2017-06-18 15:13:45 +02:00
wm4 32833fa3d1 img_format: minor simplification 2017-06-18 13:58:42 +02:00
wm4 c680cfd18a vf_dlopen: remove this filter
It was an attempt to move some MPlayer filters (which were removed from
mpv) to external, loadable filters. That worked well, but then the
MPlayer filters were ported to libavfilter (independently), so they're
available again. Also there is a more widely supported and more advanced
loadable filter system supported by mpv: vapoursynth.

In conclusion, vf_dlopen is not useful anymore, confusing, and requires
quite a bit of code (and probably wouldn't survive the rewrite of the
mpv video filter chain, which has to come at some point). It has some
implicit dependencies on internal conventions, like possibly the format
names dropped in the previous commit.

We also deprecated it last release. Drop it.
2017-06-18 13:55:40 +02:00
wm4 937dcc25ad img_format: drop legacy name mappings
Not needed anymore.
2017-06-18 13:46:34 +02:00
wm4 0bac1a52e8 win_state: change license to LGPL
All relevant authors have agreed.

Also correct an unrelated entry in the "Copyright" file.
2017-06-17 21:10:24 +02:00
wm4 53a5cf4732 Copyright: correct a statement
It seems "lucabe" didn't actually write the current fmt-conversion.c/.h
code. He added the first version of the pixfmt mapping, which was later
changed into a table. So his agreement might not be required for
copyright purposes. Still, all those later additions of pixfmts by
various authors may or may not matter, so the situation is still
complex.
2017-06-17 17:10:55 +02:00
wm4 9c0239ca63 aspect: change license to LGPL
Quite chaotic history, which code being moved, refactored, duplicated,
unified a bunch of times. But I think everything is covered by LGPL
agreements.

In one case, cehoyos (who didn't agree) applied a patch by someone who
agreed, but didn't change anything (except weirdly adding German
translations). In another case, cehoyos moved code covered by LGPL
agreements (without changing it), which was later used for some other
code. We consider both cases not relevant for copyright.

win_state.c/.h is similar, but pending for reply by the author of
2ab259e68 (I guess).
2017-06-17 17:08:51 +02:00
wm4 0086897b72 etc/input.conf: change license to LGPL
This file didn't have a license in the first place. The fact that this
file was supposed to be a template, to be copied and modified by
individual users, might weaken the assumption that it's GPL. (It was
only later that mpv replaced the duplicate code in input.c with
input.conf essentially.)

All involved authors agreed to LGPL. On exception is an anonymous
contribution in commit 116ca0c768. This "veal" could not be found.
So the I key is noted as exception. input.conf does not support
conditional guards, so I'm not sure what to do here. Either we could
argue it's a joint work, or the fact that the I key won't work anyway
with a LGPL mpv might count.

etc/builtin.conf and etc/encoding-profiles.conf are mpv original things,
written by developers who agreed to LGPL. So mark them as LGPL too.
2017-06-17 15:08:46 +02:00
wm4 aa690e3997 javascript: replace custom MIN macro with MPMIN 2017-06-17 14:28:42 +02:00
wm4 1e074a85f9 version.sh: change license to LGPL
Surprisingly long history, but it's covered by LGPL agreements. One
exception is a7fc969ff62e5ca: someone who hasn't asked changes the
copyright year, but that change was obviously overwritten again later.
2017-06-17 14:25:40 +02:00
wm4 10126d3c81 Copyright: minor fix
Other files might require action too - just not to get a LGPL core,
which is the priority.
2017-06-17 13:58:23 +02:00
wm4 182bbb5917 vo_opengl: fall back to ordered dither instead of blowing up
In GLES 2 mode, we can do dither, but "fruit" dithering is still out of
the question, because it does not support any high depth textures.
(Actually we probably could use an 8 bit texture too for this, at least
with small matrix sizes, but it's still too much of a pain to convert
the data, so why bother.)

This is actually a regression; before this, forcibly enabling dumb mode
due to low GL caps actually happened to avoid this case.

Fixes #4519.
2017-06-17 13:55:07 +02:00
sfan5 2a0028aa13 stream_file: option to close fd after use -> fdclose://
fdclose://123 will instruct mpv to close the file descriptor
when it is no longer needed (usually when playing finishes).
2017-06-16 22:48:44 +02:00
wm4 986e10901d command: avoid going through prop->opt bridge from opt->prop bridge
The option->property bridge can't (and shouldn't) preserve option flags.
This is a problem if the flags are actually used by the option
implementation, beyond calling m_config_mark_co_flags().

This was true so far, but b8193e4071 changed this. Now setting the
--profile option (usually from a config file or as recursive profile)
can have side-effects that depend on the flags contents. Solve this by
avoiding going through the "double bridge" altogether.

This fixes a regression if an auto-profile is active, and the user
specifies an option on the command line that is supposed to override an
item in a profile recursively referenced by the auto-profile. The
command line option will not override it, because the auto-profile is
set later, and during application of the auto-profile, the
M_SETOPT_PRESERVE_CMDLINE flag gets lost.

Having to add something to m_property is not nice, and I'll probbaly
regret later. On the other hand, there is a chance that this helps
towards true option/property unification.
2017-06-16 21:31:24 +02:00
wm4 b7d9b72686 Copyright: mark files which still require action for a LGPL core
Thus is just a broad guess.

The "Other" section contains things which are not part of the C code,
but which still need to be checked in addition.
2017-06-16 19:49:41 +02:00
wm4 6ba14eb267 mp_image: change license to LGPL (almost)
Since michael was somewhat involved in it, wait with the actual license
change until the core is relicensed. Thus mark it as "Almost LGPL.".

The worrisome part about mp_image.c is that it was created by cehoyos
(which disagreed with LGPL) in commit f2dee327b2. But it turns out it
was a patch by someone else (who agreed with LGPL).

For some reason, the patch was actually slightly modified by cehoyos for
no reason (messed with the include statements), so we mess them back,
just to be sure.

Other than this, there were some commits that added support for new
IMGFMTs over the years. Some of these were by people we didn't ask or we
didn't get permission from. But since the original mp_image code was
replaced by more generic code using FFmpeg pixdesc, none of these
changes are left anyway.

One additional change by cehoyos (115bfb9762) has been removed as well
(when "direct rendering" was dropped from the filter chain).
2017-06-16 19:35:58 +02:00
Niklas Haas a86b0ffa6b
version.sh: append -dirty if the working tree contains modifications
This allows us to detect users who run mpv with custom patches.
2017-06-16 17:20:44 +02:00
wm4 546ae3db4f stream_lavf: change license to LGPL
All authors agreed.

The author of 1ee8ce75 did not respond, but it was a mpv pull request,
and at this time DOCS/contribute.md and the "Copyright" file stated that
all contributions must include LGPL relicensing permission. But you
could claim that this was too "hidden". Sort of a corner case, I guess,
but not my problem.
2017-06-16 16:32:02 +02:00
wm4 cd019ba602 demux_lavf: change license to LGPL (almost)
Since this demuxer is based on code by michael, this file can become
LGPL only once the mpv core becomes LGPL, and this is preparation for
it.

There were quite a lot of changes for rearranging preferred libavformat
vs. internal MPlayer demuxers, codec mappings, and filename extensions,
but all this got removed, so some of the relevant authors weren't asked.

cehoyos, who disagreed with LGPL, made a few changes in the past (mostly
codec mapping and deinterlacing related things), but all of them were
removed, mostly due to libavformat API cleanups.

adland, who could not be reached, did commit 057916ee65, but it's easy
to essentially revert the change (this is what the source changes in
this commit do), so we don't need to think about it.

Chris Welton, who could not be reached, made a simple change in commit
958c41d9b6. Fortunately, the API changed again, and his changes were
removed, so we don't need to think about this either.

There is an anonymous contribution in commit 085f35f4b4 - since this
did not introduce any original code, and the probe code was heavily
rewritten multiple times, I don't consider it relevant.
2017-06-16 15:50:00 +02:00
Avi Halachmi (:avih) 071118e4d2 js: wscript: use pkgconfig for mujs (recently added .pc and 1.0.0 tag) 2017-06-16 15:24:24 +03:00
wm4 fa929eb0d0 win32: pthread: avoid using TLS, simplify pthread_t
Don't use __thread, which requires heavy runtime in some cases (such as
MinGW-w64, at least under some configurations, forcing you to link to
its pthread runtime DLL).

The pthread_t struct was needed over a simple thread ID, because
pthread_join() needed to access some sort of context from pthread_t.
Further, pthread_exit() and pthread_detach() need the context of the
current thread, for which we relied on TLS.

Replace these uses by a global thread array. This includes all threads
created by the thread wrapper. Hopefully the number of threads created
by mpv is low (say, below 20), and threads are not that often created or
destroyed. So just keeping them in an array with linear search lookup
should be reasonable.
2017-06-15 16:33:42 +02:00
wm4 a3f0bf916d vd, vd_lavc: change license to LGPL (almost)
iive agreed only to LGPL 3.0+ only. All of his relevant changes are for
XvMC, for which mpv completely dropped support back in mplayer2 times.
But you could claim that the get_format code represents some residual
copyright (everything else added by iive was removed, only get_format
still is around in some form). While I doubt that this is relly
copyright-relevant, consider it is for now.

michael is the original author of vd_lavc.c, so this file can become
LGPL only after the core becomes LGPL.

cehoyos did not agree with the LGPL relicensing, but all of his code is
gone.

Some others could not be reached, but their code is gone as well. In
particular, vdpau support, which was originally done by Nvidia, had
larger impact on vd_lavc.c, but vdpau support was first refactored a few
times (for the purpose of modularization) and moved to different files,
and then decoding was completely moved to libavcodec.

Lastly, assigning the "opaque" field was moved by Gwenole Beauchesne in
commit 8e5edec13e. Agreement is pending (due to copyright apparently
owned by the author's employer). So just undo the change, so we don't
have to think about whether the change is copyrightable.
2017-06-15 16:32:47 +02:00
wm4 b8193e4071 command: add all options to property->option bridge
Before this, options with co->data==NULL (i.e. no storage) were not
added to the bridge (except alias options). There are a few options
which might make sense to allow via the bridge ("profile" and
"include"). So allow them.

In command_init(), we merely remove the co->data check, the rest of the
diff is due to switching the if/else branches for convenience.

We also must explicitly error on M_PROPERTY_GET if co->data==NULL. All
other cases check it in some way.

Explicitly exclude options from the property bridge, which would be
added due this, and the result would be pointless.
2017-06-15 15:29:54 +02:00
wm4 fd7de84833 options: make mess to allow setting profile option with libmpv
Certain options, such as --profile, --help, and many others require
special-handling, because they don't fit conceptually into the option
and property model. They don't store data, but perform actions.

This caused the situation that profiles could not be set when using
libmpv in encoding mode (although you should probably not used libmpv in
encoding mode). Using libmpv always ends up in calling
m_config_set_option_raw_direct(), while --profile was handled in
m_config_parse_option().

Solve this by moving the handling of this from m_config_parse_option()
to m_config_set_option_raw_direct(). Actually we just stuff most of this
into m_config_handle_special_options(), which is only called by the
aforementioned function.

Strangely this also means that the --h/--help option declarations need
to be changed, because they used OPT_PRINT, and now the option "parser"
is always invoked before the special code. Thus, make them a string.
Them being OPT_PRINT was apparently always redundant. (The other option
declarations are moved for cosmetic purposes only.)

The most weird change is how co->data==NULL is handled. We now allow
passing down involved options to m_config_set_option_raw_direct(). The
thing is that we don't want them to error if the command line parser is
using them (with special handling done there), while all other code
paths should raise an error. We try using M_SETOPT_FROM_CMDLINE to
distinguish these cases.

Note that normal libmpv users are supposed to use the "apply-profile"
command instead.

This probably contains a bunch of bugs, which you should report.
2017-06-15 15:23:25 +02:00
wm4 6489b112ad dec_audio, ad_lavc: change license to LGPL
All relevant authors of the current code have agreed.

As always, there are the usual historical artifacts that could be
mentioned. For example, there used to be a large number of decoders
by various authors who were not asked, but whose code was all 100%
removed. (Mostly due to FFmpeg providing all codecs.)

One point of contention is that Nick Kurshev might have refactored the
old audio decoder code in 2001. Basically, there are hints that it might
have been done by him, such as Arpi's commit message stating that the
code was imported from MPlayerXP (Nick's fork), or all the files having
his name in the "maintainer" field. On the other hand, the murky history
of ad.h weakens this - it could be that Arpi started this work, and Nick
took it (and possibly finished it).

In any case, Nick could not be reached, so there is no agreement for
LGPL relicensing from him. We're changing the license anyway, and assume
that his change in itself is not copyrightable. He only moved code, and
in addition used the equivalent video decoder framework (done by Arpi,
who agreed) as template. For example, ad_functions_s was basically
vd_functions_s, which the signature of the decode callback changed to
the same as audio_decode(). ad_functions_s also had a comment that said
it interfaces with "video decoder drivers" (I'm fixing this comment in
this commit).

I verified that no additional code was added that is copyright-relevant,
still in today's code, and not copied from the existing code at the time
(either from the previous audio decoder code or the video framework
code). What apparently matters here is that none of the old code was not
written by Nick, and the authors of the old code have given his
agreement, and (probably) that Nick didn't add actual new code (none
that would have survived), that was not trivially based on the old one
(i.e. no new copyrightable "work").

A copyright expert told me that this kind of change can be considered
not relevant for copyright, so here we go.

Rewriting this would end with the same code anyway, and the naming
conventions can't be copyrighted.
2017-06-14 21:08:59 +02:00
wm4 5b3ca8ed41 terminal: change license to LGPL
All authors of the current code have agreed.

The code probably originates from a software named GySmail (as the
copyright header indicates). As far as I can tell, it was written by
Arpi (who has agreed), possibly with unknown co-authors. This is most
likely OK, as none of the original code is around anymore anyway. I
could not find a working download of GySmail, that actually contained
the original getch2.c code.

This also has a wild history of random people adding ifdef guards to
control ioctl() vs. tcgetattr() calls. (See for example 2b1310abba4c1.)
Later, the ioctl() was removed in favor of the POSIX tcgetattr(), and
the ifdeffery was removed. So these people were not contacted.
2017-06-14 14:28:05 +02:00
Avi Halachmi (:avih) d223a63bc5 js: add javascript scripting support using MuJS
Implements JS with almost identical API to the Lua support.

Key differences from Lua:
- The global mp, mp.msg and mp.utils are always available.
- Instead of returning x, error, return x and expose mp.last_error().
- Timers are JS standard set/clear Timeout/Interval.
- Supports CommonJS modules/require.
- Added at mp.utils: getenv, read_file, write_file and few more.
- Global print and dump (expand objects) functions.
- mp.options currently not supported.

See DOCS/man/javascript.rst for more details.
2017-06-14 12:29:32 +02:00
wm4 82aa1ea87f client API: document mpv_request_log_messages() return value 2017-06-14 10:23:13 +02:00