Commit Graph

42444 Commits

Author SHA1 Message Date
Martin Herkt fc9eef3b81
man: fix grammar issues 2015-12-19 09:26:41 +01:00
wm4 58d45f7b3e vo_opengl: fix "win" backend name
Although the source file is named w32.c, the backend name was "win"
until recently. It was accidentally changed to "w32"; fix it.

Fixes #2608 (the manual is correct).
2015-12-19 08:39:14 +01:00
Paul B Mahol 8a9cde4999 csputils: update MP_STEREO3D_COUNT
This actually alows to playback alternating videos with mpv.
Tested with actual file found in wild remuxed to mkv and changed props
with following command:

mkvpropedit /tmp/o.mkv --edit track:1 -s stereo-mode=13

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-19 08:34:46 +01:00
Paul B Mahol 3925dff2e6 csputils: let mpv recognise frame sequenced 3D matroska videos
Do actually such files exist?

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-18 16:38:25 +01:00
Paul B Mahol f1909bc231 vf_stereo3d: add alternating modes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-18 15:35:06 +01:00
wm4 5dd5dc66c1 sub: remove unused video width/height headers
Apparently, this was replaced by the SD_CTRL_SET_VIDEO_PARAMS set
dimensions. But I can't find out when this happened - possibly, these
fields were never used by sd_lavc.c, and only by the (long removed)
MPlayer dvdsub decoder.
2015-12-18 03:59:52 +01:00
wm4 00135a87f0 sub: rename sd_lavc_conv.c to lavc_conv.c
The previous commit turned sd_lavc_conv from a sd_driver to
free-standing functions. Do the rename to reflect this change
separately to avoid confusing git's content tracking. (Or did
git solve this, making separating renames and content changes
unnecessary?)
2015-12-18 03:59:52 +01:00
wm4 687b552db1 sub: remove subtitle filter chain concept
It was stupid. The only thing that still effectively used it was
sd_lavc_conv - all other "filters" were the subtitle decoder/renderers
for text (sd_ass) and bitmap (sd_lavc) subtitles.

While having a subtitle filter chain was interesting (and actually
worked in almost the same way as the audio/video ones), I didn't
manage to use it in a meaningful way, and I couldn't e.g. factor
secondary features like fixing subtitle timing into filters.

Refactor the shit and drop unneeded things as it goes.
2015-12-18 03:52:57 +01:00
wm4 2c7db48195 sub: do not clear subtitle list on seeking
This affects non-ASS text subtitles (those which go through libavcodec's
subtitle converter), which are muxed with video/audio. (Typically srt
subs in mkv.)

The problem is that seeking in the file can send a subtitle packet to
the decoder multiple times. These packets are interlaved with video,
and thus can't be all read when opening the file. Rather, subtitle
packets can essentially be randomly skipped or repeated (by seeking).
Until recently, this was solved by scanning the libass event list for
duplicates. Then our builtin srt-to-ass converter was removed, and
the problem was handled by fully clearing the subtitle list on each
seek.

This resulted in sub-seek not working properly for this type of file.
Since the subtitle list was cleared on seek, it was not possible to
do e.g. sub-seeks to subtitles before the current playback position.

Fix this by not clearing the list, and intead explicitly rejecting
duplicate packets. We use the packet file position was unique ID for
subtitles; this is confirmed working for most file formats (although
it is slightly risky - new demuxers may not necessarily set the file
position to something unique, or at all).

The list of seen packets is sorted, and the lookup uses binary search.
This is to avoid quadratic complexity when subtitles are added in
bulks, such as when opening a text subtitle file.

In some places, the code has to be adjusted to pass through the packet
file position correctly.
2015-12-18 03:52:57 +01:00
Kevin Mitchell 7137afeb2c demux: check embedded cuesheet refers to only one file
If someone was "clever" enough to embed a cuesheet
referencing multiple files, mpv would create a bunch
of nonsense chapter markers.
2015-12-17 12:38:57 -08:00
Kevin Mitchell ad80cc4eee demux_cue: remove cue tracks which have a null filename.
This can happen if the file references a track, but does not specify
an INDEX 01 for it. This would cause mpv to just segfault due to
dereferencing the null pointer as a string.

A file causing this was observed in the wild by
ExactAudioCopy v0.99pb4 for a disk that contained a data track at the
end.
2015-12-17 12:38:53 -08:00
wm4 f36c17d715 demux_lavf: minor cleanups 2015-12-17 01:17:26 +01:00
wm4 04af005c35 sd_ass: remove dead code
With the FFmpeg subtitle decoder used for _all_ non-ASS text subtitle
format, this code is simply unused now.

Ironically, the FFmpeg subtitle decoder does not handle things correctly
in a bunch of cases. Should it turn out they actually matter, they will
have to hack back.

The extend_event one is a candidate, although even though there were
allegedly files which need it, I couldn't get samples from the user who
originally reported such files. As such, extend_event was only confirmed
to handle trailing events with no (endless) duration like with MicroDVD
and LRC, but FFmpeg "fudges" these anyway, so no special handling is
needed.

This code also had logic to handle seeking with muxed srt subtitles,
which made the sub-seek command work. But this has been broken before
this commit already. Currently, seeking with muxed srt subs will clear
all subtitles, as the broken FFmpeg ASS format output by the libavcodec
subtitle converters does not check for duplicates. Since the subtitles
are all cleared, ass_step_sub() can not work properly and sub-seek can
not seek to already seen subtitles.
2015-12-17 01:17:26 +01:00
wm4 74c11f0c84 sub: detect charset in demuxer
Slightly simpler, and removes the need to pre-read all subtitle packets.

This still does the subtitle charset conversion on the packet level
(instead converting when parsing the file), so in theory this still
could provide a way to change the charset at runtime. But maybe even
this should be removed, as FFmpeg is somewhat likely to get its own
charset detection and conversion mechanism in the future. (Would have
to keep the subtitle file in memory to allow changing the charset on
the fly, I guess.)
2015-12-17 01:17:23 +01:00
wm4 e798cf1ff6 sub: remove sd_srt.c
The FFmpeg subtitle converter does the same. There used to be some
deficiencies in FFmpeg's code, but it seems at least some of them have
been fixed. There also used to be the timestamp issue (see previous
commit messages), but this doesn't matter anymore. So no reason to
keep this code - get rid of it.
2015-12-15 21:05:48 +01:00
wm4 cab942acae sub: remove sd_microdvd.c
This can be dropped for the same reasons as in the previous commits. It
removes MicroDVD conversion support on Libav, although MicroDVD files
couldn't be read in the first place ever since demux_subreader.c was
removed.
2015-12-15 21:05:48 +01:00
wm4 c7985fe5f7 sub: remove sd_lavf_srt.c
This restored timestamps when demuxing srt subtitles in Libav, which
was important for avoiding slightly overlapping subtitles. Since the
way this works was changed, there is no real reason to maintain proper
timestamps anymore on this level - this can be dropped without issues.
2015-12-15 21:05:48 +01:00
wm4 29226e6a99 sub: remove sd_movtext.c
libavcodec's movtext-to-ass converter does the same and has more
features. On Libav, this commit disables mp4 subtitle display.
2015-12-15 21:05:48 +01:00
James Ross-Gowan d0fd68f6df vo_opengl: dxinterop: prevent crash after lost device
When a Direct3D 9Ex device fails to reset, it gets put into the lost
state, so set the lost_device flag and don't attempt to present until
the device moves out of that state. Failure to recreate the size-
dependent objects should set lost_device as well, since we shouldn't try
to present in that state.

Also, it looks like I was too eager to remove code that sets priv
members to NULL and I accidentally removed some that was needed.
2015-12-14 23:09:54 +11:00
James Ross-Gowan 8d0a6cd035 vo_opengl: dxinterop: prevent crash with 0-size window
Direct3D doesn't like 0-sized swapchain dimensions, even when those
dimensions are automatically set. Manually set them to a size that isn't
zero instead.
2015-12-14 01:11:56 +11:00
wm4 f24ba544cd vo_opengl: enable brightness/contrast controls for RGB
Why not.

Also, instead of disabling hue/saturation for RGB, just don't apply
them. (They don't make sense for conversion matrixes other than YUV, but
I can't be bothered to keep the fine-grained disabling of UI controls
either.)
2015-12-12 14:47:30 +01:00
wm4 000285ee8e mixer: fix volume initialization with --af=volume
A manually added af_volume could lead to muted audio when switching to a
new file. af_volume keeps the last volume set by AF_CONTROL_SET_VOLUME
to return it with AF_CONTROL_GET_VOLUME, but the initial value is 0. So
the mixer volume was forced to 0 when unintializing the filter chain and
reading back the previously set volume.
2015-12-11 20:52:37 +01:00
wm4 67a4892ee3 mixer: minor simplification
(Why is this code so complex?)
2015-12-11 20:52:37 +01:00
James Ross-Gowan 3d12312806
vo_opengl: add dxinterop backend
WGL_NV_DX_interop is widely supported by Nvidia and AMD drivers. It
allows a texture to be shared between Direct3D and WGL, so that
rendering can be done with WGL and presentation can be done with
Direct3D. This should allow us to work around some persistent WGL
issues, such as dropped frames with some driver/OS combos, drivers that
buffer frames to increase performance at the cost of latency, and the
inability to disable exclusive fullscreen mode when using WGL to render
to a fullscreen window.

The addition of a DX_interop backend might also enable some cool
Direct3D-specific enhancements in the future, such as using the
GetPresentStatistics API to get accurate frame presentation timestamps.

Note that due to a driver bug, this backend is currently broken on
Intel. It will appear to work as long as the window is not resized too
often, but after a few changes of size it will be unable to share the
newly created renderbuffer with GL. See:
https://software.intel.com/en-us/forums/graphics-driver-bug-reporting/topic/562051
2015-12-11 18:29:18 +01:00
wm4 a6521f3941 demux: remove old subtitle parser
All of these are supported by FFmpeg now. It was disabled by default
too (with FFmpeg).

If compiled against Libav, mpv will lose the ability to read some
subtitle formats (but the most important ones, srt and ass, still should
work).
2015-12-10 22:53:37 +01:00
wm4 475fe453cc stream: drop PVR support
This is only for specific Hauppage cards. According to the comments in
who is actively using this feature. Get it out of the way.

Anyone who still wants to use this should complain. Keeping this code
would not cause terribly much additional work, and it could be restored
again. (But not if the request comes months later.)
2015-12-10 22:53:02 +01:00
wm4 3da91a673a player: init playback speed correctly
Usually not a problem, but could not be initialized early enough in some
corner cases.
2015-12-10 22:53:02 +01:00
wm4 47e6ef0bdf vo_opengl: remove one more XYZ special-case
The XYZ colorspace on XYZ pixfmt is enforced in some sanitation routine.
2015-12-09 17:10:38 +01:00
Bin Jin 6d36c432ab vo_opengl: fix precision loss of fruit dithering matrix
With default setting, the matrix for fruit dithering requires 12 bits
precision (values from 0/4096 to 4095/4096). But 16-bit float
provides only 10 bits. In addition, when `dither-size-fruit=8` is
set, 16 bits are required from the texture format.

Fix this by attempting to use 16 bit integer texture first. This is
still not precise, but should be better than using a half float.
2015-12-09 00:36:48 +01:00
wm4 45ae0716be csputils: rename "yuv2rgb" functions
They're not necessarily restricted to YUV aka YCbCr.

vo_direct3d.c and demux_disc.c (DVD specific code) changes untested.
2015-12-09 00:23:36 +01:00
wm4 c5c7b239b6 csputils, vo_opengl: remove XYZ special case in color matrix retrieval
This just seems unnecessary. Refactor it a bit. There should be no
functional changes.
2015-12-09 00:16:51 +01:00
wm4 c2d0d7818f csputils: remove obscure int_bits matrix scaling
This has no reason to be there. Put the functionality into another
function instead. While we're at it, also adjust for possible accuracy
issues with high bit depth YUV (matters for rendering subtitles into
screenshots only).
2015-12-09 00:08:00 +01:00
wm4 0d7d935e88 vo_opengl: fix shader compilation regression
The recent LUT adjustment changes broke interpolation.

The concatenation of the shader stages is a bit messy, and it seems like
sampler_prelude is not a good place to add this macro. Always add the
macro to every shader instead. (While this doesn't seem too elegant,
this isn't too inelegant either, and goes these problems out of the
way.)
2015-12-08 03:18:47 +01:00
wm4 3d66a5d14e sub: increase gap/overlap fixing threshold to 210ms
Don't ask why.
2015-12-07 23:48:59 +01:00
wm4 c138505813 vo_opengl: enable colormatrix even for RGB input
Enables brightness/contrast controls, and handles gbrp10 correctly.
2015-12-07 23:48:59 +01:00
wm4 663415b914 vo_opengl: fix issues with some obscure pixel formats
The computation of the tex_mul variable was broken in multiple ways.
This variable is used e.g. by debanding for moving expansion of 10 bit
fixed-point input to normalized range to another stage of processing.

One obvious bug was that the rgb555 pixel format was broken. This format
has component_bits=5, but obviously it's already sampled in normalized
range, and does not need expansion. The tex_mul-free code path avoids
this by not using the colormatrix. (The code was originally designed to
work around dealing with the generally complicated pixel formats by only
using the colormatrix in the YUV case.)

Another possible bug was with 10 bit input. It expanded the input by
bringing the [0,2^10) range to [0,1], and then treating the expanded
input as 16 bit input. I didn't bother to check what this actually
computed, but it's somewhat likely it was wrong anyway. Now it uses
mp_get_csp_mul(), and disables expansion when computing the YUV matrix.
2015-12-07 23:48:59 +01:00
Bin Jin c569d4f6ed vo_opengl: decrease default lookup texture size to 64
It turns out that with accurate lookup we can decrease the
default size of texture now. Do it to compensate the performance
loss introduced by the LUT_POS macro.
2015-12-07 23:48:40 +01:00
Bin Jin e6058d3dc3 vo_opengl: make LOOKUP_TEXTURE_SIZE configurable 2015-12-07 23:48:18 +01:00
Bin Jin c1a96de41c vo_opengl: Fix minor LUT sampling error
Define a macro to correct the coordinate for lookup texture. Cache
the corrected coordinate for 1D filter and use mix() to minimize the
performance impact.
2015-12-07 23:48:15 +01:00
Bin Jin 18fe6e6dc8 filter_kernels: add warnings for potential LUT sampling error 2015-12-07 23:48:12 +01:00
wm4 aaa64b879e cocoa: fix recent regression
Commit 9db50c67 changed it so that the window title can now be a NULL
string.

Completely untested. Probably fixes #2570.
2015-12-07 00:49:36 +01:00
wm4 159eb3f962 win32: add option to set VO MMCSS profile
This was requested.
2015-12-06 19:20:23 +01:00
wm4 9db50c6760 vo: get rid of vo_get_window_title()
It always was a weird artifact - VOCTRLs are meant _not_ to require
special handling in the code that passes them through (like in vo.c).
Removing it is also interesting to further reduce the dependency of
backends on struct vo. Just get rid of it.

Removing it is somewhat inconvenient, because in many situations the UI
window is created after the first VOCTRL_UPDATE_WINDOW_TITLE. This means
these backends have to store it in a new field in their own context.
2015-12-06 18:41:31 +01:00
wm4 970606e491 sd_ass: slightly better heuristic for applying --sub-fix-timing
Fixes a reported sample, that has a sign interrupted by a few frames
(for which --sub-fix-timing would remove the wanted gap).

The list of tags in has_overrides() is taken from libass. It has a
similar function (which even checks whether the tag are within the { }
delimiters). Unfortunately, this function is not public, so we just have
a simpler one which does roughly the same. It doesn't matter that this
function sometimes returns false positives.
2015-12-06 18:22:30 +01:00
wm4 7d7ea72854 sub: another minor simplification 2015-12-06 18:17:14 +01:00
wm4 0262295c4b manpage: reflect recent subtitle changes 2015-12-06 01:15:08 +01:00
wm4 48ed48f7b8 sub: minor simplifications
The awkward "preprocess" step of putting the subtitles through single
filters before doing something else was made unnecessary by the recent
changes.

(Fun fact: I originally planned to move these extra things, like fixing
subtitle gaps/overlaps, to filters - but this would suffer from various
complications, and moving them to the renderers seems much simpler.)
2015-12-05 23:56:53 +01:00
wm4 94c062d0d2 sub: move subtitle FPS adjustment to sd_ass.c
I feel like it's better there. Note that there is no reduced
functionality, as bitmaps subs (i.e. not handled by sd_ass.c) were never
fully read on init, and thus never went through sub_read_all_packets().

On the other hand, this might lead to confusion, as --sub-fps etc. will
now also affect muxed subtitles (which makes not much sense).
2015-12-05 23:56:28 +01:00
wm4 04934e86dd sub: move --sub-fix-timing handling to renderer
Instead of messing with the subtitle packet timestamps, do it on output.
We work on the libass event list. If there is an unwanted gap or
overlap, we render the timestamp at another position where there is no
gap or overlap.

This is somewhat more robust, and even works with demuxed subs (to some
degree - depends whether the subs are prefected soon enough).

It's active even for native ASS subs. I wonder if this is a problem with
extended type setting. If it is, the heuristic that tries to avoid
interrupting such cases has to be improved.

While it probably would be ideal to do this after the subtitle decoder,
certain aspects are at least currently handled better in this place.
2015-12-05 23:56:07 +01:00
wm4 ff1eaea3e7 sd_lavc: remove small gaps between subtitles
Just like with text subtitles. Move the magic constants to a common
place too.
2015-12-05 23:55:56 +01:00