Commit Graph

42514 Commits

Author SHA1 Message Date
wm4 bbb65ed84b sub: use macros to remove code duplication
Meh.
2015-12-24 17:32:10 +01:00
wm4 30074f8440 sub: merge bitmap render functions into one for each kind
Merge blend_src8_alpha and blend_src16_alpha into blend_src_alpha, and
the same for blend_const_alpha.

One thing that changes is that the vertical loop is now shared for both
code paths.

I think this is slightly easier to read, and it's a bit shorter as well.
2015-12-24 17:24:55 +01:00
wm4 a042dcc700 sub: remove "inaccurate" code path
The "accurate" one always has been enabled, and I can't find much
evidence that the "inaccurate" one is much faster on my particular
machine anyway.
2015-12-24 17:08:02 +01:00
wm4 3973a953df sub: find GBRP format automatically when rendering to RGB
This removes the need to define IMGFMT_GBRAP, which fixes compilation
with the current Libav release.

This also makes it automatically pick up a GBRP format with the same bit
width. (Unfortunately, it seems libswscale does not support conversion
to AV_PIX_FMT_GBRAP16, so our code falls back to 8 bit, removing
precision for video covered by subtitles in cases this code is used.)

Also, when the source video is e.g. 10 bit YUV, upsample to 16 bit.
Whether this is good or bad, it fixes behavior with alpha. Although I'm
not sure if the alpha range is really correct ([0,2^16-1] vs.
[0,255*256]). Keep in mind that libswscale doesn't even agree with the
way we do it.
2015-12-24 16:42:21 +01:00
wm4 082c23515f vo_opengl: fix operation on GLSL versions earlier than 1.30
GLSL below version 1.30 does not support mix() with a boolean
interpolation value. Use ?: instead. Untested, but probably works.
2015-12-24 14:44:46 +01:00
wm4 6bec6ac558 sub: better alpha blending when rendering to alpha surfaces
This actually treats destination alpha correctly, and gives much better
results than before. I don't know if this is perfectly correct yet,
though. Slight difference with vo_opengl behavior suggests it might not
be.

Note that this does not affect VOs with true alpha support. vo_opengl
does not use this code at all, and does the alpha calculations in OpenGL
instead.
2015-12-24 14:43:23 +01:00
wm4 946bd52a1d vo_opengl: fall back to gcc thread local storage (2)
Commit 1a6f3c56 added a fallback for the case when C11 TLS was not
available, but GCC TLS was. But it forget to enable VAAPI EGL interop in
the build system in this case.

Just remove the build system check. Should someone find a compiler that
works on Linux and does not support GCC extensions or C11, it will still
compile and just fail to init at runtime.

Actually fixes #2631 (hopefully).
2015-12-23 22:00:04 +01:00
wm4 25497226cf demux_mf: fix previous commit
It was total crap.
2015-12-23 21:58:01 +01:00
wm4 f9ba1a3ddf demux: remove weird tripple-buffering for the sh_stream list
The demuxer infrastructure was originally single-threaded. To make it
suitable for multithreading (specifically, demuxing and decoding on
separate threads), some sort of tripple-buffering was introduced. There
are separate "struct demuxer" allocations. The demuxer thread sets the
state on d_thread. If anything changes, the state is copied to d_buffer
(the copy is protected by a lock), and the decoder thread is notified.
Then the decoder thread copies the state from d_buffer to d_user (again
while holding a lock). This avoids the need for locking in the
demuxer/decoder code itself (only demux.c needs an internal, "invisible"
lock.)

Remove the streams/num_streams fields from this tripple-buffering
schema. Move them to the internal struct, and protect them with the
internal lock. Use accessors for read access outside of demux.c.

Other than replacing all field accesses with accessors, this separates
allocating and adding sh_streams. This is needed to avoid race
conditions. Before this change, this was awkwardly handled by first
initializing the sh_stream, and then sending a stream change event. Now
the stream is allocated, then initialized, and then declared as
immutable and added (at which point it becomes visible to the decoder
thread immediately).

This change is useful for PR #2626. And eventually, we should probably
get entirely of the tripple buffering, and this makes a nice first step.
2015-12-23 21:52:16 +01:00
wm4 b0381d27eb input: add a catch-all "unmapped" command
This can be used to grab all unmapped keys.

Fixes #2612.
2015-12-23 19:13:45 +01:00
wm4 3e1aed8f40 input: add key name to script-binding command response
The "script-binding" command is used by the Lua scripting wrapper to
register key bindings on the fly. It's also the only way to get fine-
grained information about key events (such as separate key up/down
events). This information is sent via a "key-binding" message when the
state of a key changes.

Extend it to send name of the mapped key itself. Previously, it was
assumed that the user just uses an unique identifier for the binding's
name, so it wasn't needed. With this change, a user can map exactly the
same command to multiple keys, which is useful especially with the next
commit.

Part of #2612.
2015-12-23 19:10:48 +01:00
wm4 ff520054c8 old-configure: add a missing define
(Why am I maintaining 2 build systems?)
2015-12-23 17:59:54 +01:00
wm4 1a6f3c56ea vo_opengl: fall back to gcc thread local storage
gcc 4.8 does not support C11 thread local storage. This is a bit
annoying, so add a hack to use the gcc specific __thread extension if
C11 TLS is not available.

(This is used for the extremely silly mpv-internal way hwdec modules
access some platform specific handles. Disabling it simply made
hwdec_vaegl.c always fail initialization.)

Fixes #2631.
2015-12-23 17:59:35 +01:00
wm4 af958221a1 CONTRIBUTING.md: add some more hints 2015-12-23 15:56:13 +01:00
wm4 2037426a65 player: minor simplification
This tmp thing had not much of a purpose anymore.
2015-12-23 15:49:20 +01:00
wm4 e8960c69e9 CONTRIBUTING.md: add missing words 2015-12-22 23:30:09 +01:00
wm4 23a5329690 stream_lavf: remove tabs
Death to tabs.
2015-12-22 23:18:46 +01:00
wm4 eac0665b8d vo_opengl: blend transparent video against tiles by default
Add a "blend-tiles" choice to the "alpha" sub-option. This is pretty
simplistic and uses the GL raster position to derive the tiles. A weird
consequence is that using --vo=opengl and --vo=opengl-hq gives different
scaling behavior (screenspace pixel size vs. source video pixel size
16x16 tiles), but it seems we don't have easy access to the original
texture coordinates. Using the rasterpos is probably simpler.

Make this option the default.
2015-12-22 23:18:46 +01:00
wm4 3de6c9aa42 Add a CONTRIBUTING.md file
Github will display a link to it when a user wants to create an issue or
pull request.

Also make some minor adjustments to DOCS/contribute.md, which is
developer oriented, and for which I see no reason to merge it with
the new file.
2015-12-22 23:18:46 +01:00
Ilya Tumaykin 8673343957 tests: fix #include 2015-12-22 15:18:50 +01:00
wm4 d1119cc069 input.conf: remove a redundant and a broken example
window-scale is now mapped to Alt+0 etc. by default (although these
bindings just use "set", not "cycle-values").

colormatrix can't be cycled anymore (would require using vf_format).
2015-12-22 14:22:54 +01:00
openingnow ad25de5903 input.conf: erase `audio-delay` from `Not assigned by default`
`ctrl+ +`is assigned as `add audio-delay` by default.
Tested by running `mpv --input-test --force-window --idle`

Signed-off-by: wm4 <wm4@nowhere>
2015-12-22 13:00:05 +01:00
Aman Gupta f8b09658f4 dec_sub: avoid segfault on sub_init_decoder failure
Broken by commit 687b552d.

Signed-off-by: wm4 <wm4@nowhere>
2015-12-22 13:00:05 +01:00
Aman Gupta d5274d9298 demux_lavf: rename to handle_new_stream to clarify intent 2015-12-22 13:00:05 +01:00
Kevin Mitchell 5afa68835a ao_wasapi: fix delay calculation
Make sure that subtraction of performance counters is done correctly.
Follow the *exact* instructions for converting performance counter to something
comparable to the QPCposition returned by IAudioClient::GetPosition
https://msdn.microsoft.com/en-us/library/windows/desktop/dd370889%28v=vs.85%29.aspx

Also make sure that subtraction of unsigned integers is stored into a signed
integer to avoid nastiness. Also be more careful about overflow in the
conversion of the device position into number of samples.

Avoid casting mp_time_us() to a double, and use llrint to convert the
double precision delay_us back to integer for ao_read_data.

Finally, actually check the return value of ao_read_data and add a verbose
message if it is not the expected value. Unfortunately,
there is no way to tell WASAPI when this happens since the frame_count in
ReleaseBuffer must match GetBuffer.
2015-12-21 16:58:51 -08:00
Aman Gupta 5360baa49e demux_lavf: make trace output for mp_seek easier to digest
Signed-off-by: wm4 <wm4@nowhere>
2015-12-21 22:29:38 +01:00
Aman Gupta fccc3d3894 Fix some typos in code comments
Signed-off-by: wm4 <wm4@nowhere>
2015-12-21 22:28:12 +01:00
wm4 7fa06e46c4 vf_yadif: change defaults
This is for the sake of command.c and the "deinterlace" option/property.
Instead of forcing certain "better" defaults when inserting yadif,
change the actual "yadif" defaults.

I pondered not changing vf_yadif, and instead adding a trivial "yadif-
auto" wrapper filter, which would merely have different defaults. But
thinking about it, it doesn't make any sense for "deinterlace" to have
different defaults from vf_yadif, with vf_yadif having the "worse"
defaults. If someone wants the old behavior, the old behavior can be
forced in a backward and forward compatible way by setting the
suboptions.

Fixes #2539 (kind of).
2015-12-21 22:05:40 +01:00
Kevin Mitchell 0afb1acab3 ao_wasapi: move volume control init to it's own function
also make failure non-fatal
2015-12-21 05:23:26 -08:00
Kevin Mitchell 05b6646d7a ao_wasapi: correctly handle audio session display failure
In particular, try and release/null the interface so that it won't be
marshalled.
2015-12-21 05:23:26 -08:00
Kevin Mitchell 35296c1f33 ao_wasapi: non-fatal error handling for COM marshalling
Also make sure that CoReleaseMarshalData is called if errors occur before
unmarshalling.
2015-12-21 05:23:22 -08:00
Kevin Mitchell 3ae726e8dd ao_wasapi: wrap long lines and use only c99 comment style
also remove a log message in AOCONTROL_UPDATE_STREAM_TITLE since
none of the other controls have one.
2015-12-21 05:03:09 -08:00
Kevin Mitchell c188240ab9 ao_wasapi: reorganize private structure 2015-12-21 05:03:09 -08:00
Kevin Mitchell 099fdde7a4 ao_wasapi: remove useless buffer_block_size
this was only ever used for a verbose message
2015-12-21 05:03:09 -08:00
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