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.
This commit is contained in:
wm4 2017-06-18 18:27:48 +02:00
parent 078b275514
commit 642e963c86
6 changed files with 26 additions and 4 deletions

View File

@ -267,7 +267,7 @@ x stream/stream.h hard
sub/* LGPL
ta/* LGPL (ISC)
video/decode/d3d.* LGPL
x video/decode/dec_video.* hard
video/decode/dec_video.* almost LGPL
video/decode/hw_cuda.c LGPL
video/decode/hw_d3d11va.c LGPL
video/decode/hw_dxva2.c LGPL

View File

@ -27,6 +27,8 @@ Interface changes
- drop the internal "mp-rawvideo" codec (used by --demuxer=rawvideo)
- rename --sub-ass-style-override to --sub-ass-override, and rename the
`--sub-ass-override=signfs` setting to `--sub-ass-override=scale`.
- change default of --video-aspect-method to "bitstream". The "hybrid"
method (old default) is deprecated.
--- mpv 0.25.0 ---
- remove opengl-cb dxva2 dummy hwdec interop
(see git "vo_opengl: remove dxva2 dummy hwdec backend")

View File

@ -823,12 +823,13 @@ Video
:hybrid: Prefer the container aspect ratio. If the bitstream aspect
switches mid-stream, switch to preferring the bitstream aspect.
This is the default behavior in mpv and mplayer2.
This was the default in older mpv and mplayer2. Deprecated.
:container: Strictly prefer the container aspect ratio. This is apparently
the default behavior with VLC, at least with Matroska.
:bitstream: Strictly prefer the bitstream aspect ratio, unless the bitstream
aspect ratio is not set. This is apparently the default behavior
with XBMC/kodi, at least with Matroska.
with XBMC/kodi, at least with Matroska, and the current default
for mpv.
Normally you should not set this. Try the ``container`` and ``bitstream``
choices if you encounter video that has the wrong aspect ratio in mpv,

View File

@ -943,6 +943,7 @@ const struct MPOpts mp_default_opts = {
.playback_speed = 1.,
.pitch_correction = 1,
.movie_aspect = -1.,
.aspect_method = 1,
.field_dominance = -1,
.sub_auto = 0,
.audiofile_auto = -1,

View File

@ -13,6 +13,10 @@
*
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*
* Almost LGPL.
*
* Parts under HAVE_GPL are licensed under GNU General Public License forever.
*/
#include <stdio.h>
@ -197,12 +201,16 @@ static void fix_image_params(struct dec_video *d_video,
// While mp_image_params normally always have to have d_w/d_h set, the
// decoder signals unknown bitstream aspect ratio with both set to 0.
float dec_aspect = p.p_w > 0 && p.p_h > 0 ? p.p_w / (float)p.p_h : 0;
#if HAVE_GPL
if (d_video->initial_decoder_aspect == 0)
d_video->initial_decoder_aspect = dec_aspect;
#endif
bool use_container = true;
switch (opts->aspect_method) {
case 0:
#if HAVE_GPL
// We normally prefer the container aspect, unless the decoder aspect
// changes at least once.
if (dec_aspect > 0 && d_video->initial_decoder_aspect != dec_aspect) {
@ -212,8 +220,14 @@ static void fix_image_params(struct dec_video *d_video,
use_container = false;
}
break;
#else
/* fall through, behave as "bitstream" */
#endif
case 1:
use_container = false;
if (dec_aspect) {
MP_VERBOSE(d_video, "Using bitstream aspect ratio.\n");
use_container = false;
}
break;
}
@ -300,12 +314,14 @@ static bool receive_frame(struct dec_video *d_video, struct mp_image **out_image
if (!mpi)
return progress;
#if HAVE_GPL
if (opts->field_dominance == 0) {
mpi->fields |= MP_IMGFIELD_TOP_FIRST | MP_IMGFIELD_INTERLACED;
} else if (opts->field_dominance == 1) {
mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
mpi->fields |= MP_IMGFIELD_INTERLACED;
}
#endif
// Note: the PTS is reordered, but the DTS is not. Both should be monotonic.
double pts = mpi->pts;

View File

@ -13,6 +13,8 @@
*
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*
* Almost LGPL.
*/
#ifndef MPLAYER_DEC_VIDEO_H