Commit Graph

42630 Commits

Author SHA1 Message Date
Kevin Mitchell cbc951d491 ao_wasapi: move exclusive and shared-specific controls to functions 2015-12-21 05:03:03 -08:00
wm4 fc7212b214 charset_conv: check for UTF-8 if uchardet returns unknown
When libuchardet returns an empty string, it can be either ASCII, UTF-8,
or an unknown encoding. Try to distinguish it from the unknown case by
checking for UTF-8. This avoids an annoying message, and avoids
unnecessary processing (we convert invalid UTF-8 sequences to latin1 to
workaround libavcodec's braindead UTF-8 check).
2015-12-20 20:55:24 +01:00
wm4 f2187de8bb demux_disc: fix aspect ratio retrieval (again)
Commit 127da161 was not properly tested either - it did nothing, and
just made it use the video bitstream aspect ratio determined by
libavformat (which isn't always the correct one).
2015-12-20 20:50:54 +01:00
wm4 31c29495ca vo_opengl: x11: fix alpha windows
long is 64 bits on x86_64 on Linux, which means the check for the corner
case of computing the depth mask is wrong.

Also, X11 compositors seem to expect premultiplied alpha.
2015-12-20 13:26:25 +01:00
Kevin Mitchell a191712169 ao_wasapi: call the class-specific release functions
IUnknown_Release() might be alright, but stay on the safe
side.
2015-12-20 03:30:28 -08:00
Kevin Mitchell 517a35da94 ao_wasapi: check for proxy availability in control
Make sure that the proxy has been created before using it. This will be
used when a future commit makes proxy setup optional.
2015-12-20 03:30:28 -08:00
Kevin Mitchell 821e8fb9d0 ao_wasapi: actually use hw volume support information for exclusive mode
Do not try and set/get master volume in exclusive if there is no
hardware support. This would just uselessly change the master slider,
but have no effect on the actual volume.

Furthermore if getting hardware volume support information fails, then assume
it has none.
2015-12-20 03:30:28 -08:00
Kevin Mitchell 4b81398b4e ao_wasapi: don't cast control arg to something it isn't
the ao_control_vol_t cast was happening outside AOCONTROL_GET/SET_VOLUME
which is the only place that would be valid
2015-12-20 03:30:28 -08:00
Kevin Mitchell d1cbff37be ao_wasapi: remove volume "restore" on exit
It was complicated and not even very intuitive to the user.
If you are controlling the master volume, you just have to be
prepared to deal with the consequences.
2015-12-20 03:30:28 -08:00
Kevin Mitchell aa5f04c7a0 ao_wasapi: split exclusive/shared specific ao controls
this avoids having to check if we're exclusive or
shared for every control
2015-12-20 03:30:28 -08:00
Kevin Mitchell e15526153e ao_wasapi: add E_NOINTERFACE to error list
this is encountered trying to set up COM proxies in wine
2015-12-20 03:30:28 -08:00
Kevin Mitchell 48b103cad7 path-win: include initguid.h
cygwin was giving undefined reference to `FOLDERID_Desktop' at link time
2015-12-20 03:24:35 -08:00
wm4 7f313afd08 DOCS/compile-windows: pthreads is not needed anymore
Both mpv and ffmpeg have their own internal pthreads wrappers. The mpv
one has been recently enabled by default as well. (It didn't work on XP,
but we dropped XP support.)
2015-12-20 11:18:02 +01:00
James Ross-Gowan 7558d1ed7b win32: input: use Vista CancelIoEx
libwaio was added due to the complete inability to cancel synchronous
I/O cleanly using the public Windows API in Windows XP. Even calling
TerminateThread on the thread performing I/O was a bad solution, because
the TerminateThread function in XP would leak the thread's stack.

In Vista and up, however, this is no longer a problem. CancelIoEx can
cancel synchronous I/O running on other threads, allowing the thread to
exit cleanly, so replace libwaio usage with native Vista API functions.

It should be noted that this change also removes the hack added in
8a27025 for preventing a deadlock that only seemed to happen in Windows
XP. KB2009703 says that Vista and up are not affected by this, due to a
change in the implementation of GetFileType, so the hack should not be
needed anymore.
2015-12-20 21:06:02 +11:00
James Ross-Gowan 0563eb914f win32: add Windows 10 compatibility GUID
This suppresses the Program Compatibility Assistant on Windows 10. mpv
is regularly tested on Windows 10, so this should be okay.
2015-12-20 21:06:02 +11:00
James Ross-Gowan abbb43759a win32: build: set subsystem version
This sets the minimum supported Windows version to Windows Vista. The
subsystem version also affects some Windows API functions, including
GetSystemMetrics(SM_CXPADDEDBORDER).
2015-12-20 21:06:02 +11:00
James Ross-Gowan 6205d87a7f win32: path: use Known Folder IDs
CSIDLs have been deprecated in Windows Vista and are not recommended for
use in new code. They have been replaced with Known Folder IDs, which
are pretty much the same thing, except they use GUIDs.
2015-12-20 21:06:02 +11:00
James Ross-Gowan 491958a724 win32: use PIPE_REJECT_REMOTE_CLIENTS
This partially reverts c670488. mpv only supports Vista and up, so this
flag is fine.
2015-12-20 21:06:02 +11:00
James Ross-Gowan 808653a9b6 win32: remove ProcThreadAttributeList dynamic loading
These are always available in supported Windows versions, as is the
EXTENDED_STARTUPINFO_PRESENT flag.
2015-12-20 21:06:02 +11:00
James Ross-Gowan d2013b3f50 win32: remove SetDllDirectoryW dynamic loading
All Windows versions we support have this API.
2015-12-20 21:06:02 +11:00
BtbN 5790bbba61 vaapi: add VP9 profile entires 2015-12-20 10:40:06 +01:00
wm4 f1a2610c4f sd_ass: handle --sub-clear-on-seek correctly with non-ASS subs
Converted subtitles use a different method to avoid adding repeated
packets as duplicate subtitle events. The state for this mechanism must
be cleared as well if --sub-clear-on-seek is used.
2015-12-20 10:14:14 +01:00
wm4 2da533bec3 vf_vapoursynth: fix everything
Broken by commit 0a0bb905. The changes to this filter were accidentally
simply not tested, and it was obviously broken in a bunch of ways.

Fixes #2616.
2015-12-20 09:55:26 +01:00
wm4 127da1613f demux_disc: fix aspect ratio
Broken by commit 0a0bb905. STREAM_CTRL_GET_ASPECT_RATIO returns a
display aspect ratio, not a pixel aspect ratio.
2015-12-20 09:36:56 +01:00
wm4 c01935986c lavc_conv: fix invalid write
Well shit. Restructure it such that the returned list is always NULL-
terminated with the same mechanism.
2015-12-19 21:21:36 +01:00
wm4 0a0bb9059f video: switch from using display aspect to sample aspect
MPlayer traditionally always used the display aspect ratio, e.g. 16:9,
while FFmpeg uses the sample (aka pixel) aspect ratio.

Both have a bunch of advantages and disadvantages. Actually, it seems
using sample aspect ratio is generally nicer. The main reason for the
change is making mpv closer to how FFmpeg works in order to make life
easier. It's also nice that everything uses integer fractions instead
of floats now (except --video-aspect option/property).

Note that there is at least 1 user-visible change: vf_dsize now does
not set the display size, only the display aspect ratio. This is
because the image_params d_w/d_h fields did not just set the display
aspect, but also the size (except in encoding mode).
2015-12-19 20:45:36 +01:00
wm4 1f7c099dc0 vf: remove old config() callback 2015-12-19 18:35:58 +01:00
wm4 78bfee53dd vf: flush before reconfig 2015-12-19 17:39:58 +01:00
wm4 cd24fdcd5a vo_opengl: disable pbo by defaults for opengl-hq
Too many problems.
2015-12-19 16:26:36 +01:00
wm4 47f2f554a3 vo_opengl: handle alpha with odd bit widths too
Since alpha isn't pulled through the colormatrix (maybe it should?), we
reject alpha formats with odd sizes, such as yuva444p10.

But the awful tex_mul path in vo_opengl does this anyway (at some points
even explicitly), which means there will be a subtle difference in
handling of 16 bit yuv alpha formats. Make it consistent and always
apply the range adjustment to the alpha component. This also means odd
sizes like 10 bit are supported now.

This assumes alpha uses the same "shifted" range as the yuv color
channels for depths larger than 8 bit. I'm not sure whether this is
actually the case.
2015-12-19 16:11:34 +01:00
wm4 a0519f1d18 vo_opengl: cocoa: output premultiplied alpha
Which is apparently what is expected here. (I'm pretty sure X11
compositors want stright alpha, so 2 code paths are needed.)
2015-12-19 14:14:12 +01:00
wm4 4cc1861378 vo_opengl: prefix per-backend source files with context_ 2015-12-19 14:14:12 +01:00
wm4 6154c1d06d vo_opengl: split backend code from common.c to context.c
Now common.c only contains the code for the function loader, while
context.c contains the backend loader/dispatcher.

Not calling it "backend.c", because the central struct is called
MPGLContext.
2015-12-19 14:14:12 +01:00
wm4 32cd85bc7e vo_opengl: x11egl: retrieve framebuffer depth
This is used for dithering, although I'm not aware of anyone who got
higher than 8 bit depth support to work on Linux.

Also put this into egl_helpers.c. Since EGL is pseudo-portable at best I
have no hope that the EGL context creation code in all the backends can
be fully shared. But some self-contained functionality can definitely be
shared.
2015-12-19 14:14:12 +01:00
wm4 3394d37b4e vo_opengl: refactor how framebuffer depth is passed from backends
Store the determined framebuffer depth in struct GL instead of
MPGLContext. This means gl_video_set_output_depth() can be removed, and
also justifies adding new fields describing framebuffer/backend
properties to struct GL instead of having to add more functions just to
shovel the information around.

Keep in mind that mpgl_load_functions() will wipe struct GL, so the
new fields must be set before calling it.
2015-12-19 14:14:12 +01:00
wm4 d2baaaa7df vo_opengl: cocoa: implement alpha window support
With --vo=opengl:alpha=yes, the Cocoa backend will now render alpha
video without background.
2015-12-19 10:24:03 +01:00
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