Commit Graph

41664 Commits

Author SHA1 Message Date
Stefano Pigozzi 78e771554c build: fix version.h creation
Previous code did not retrigger a relink when version.h changed since it
didn't use a waf task.
2015-07-12 10:09:49 +02:00
Philip Sequeira 4a4f788a68 player: use exit code 0 by default for quit, 4 for signals, etc.
Default key bindings in encoding mode also use code 4, because scripts
will probably want to fail if encoding is aborted (leaving an
incomplete file).
2015-07-11 23:46:49 +02:00
wm4 898855cc0d vo_opengl: reduce verbose output
Outputting the detected OpenGL features was useless and redundant with
the extension loading output.

Also, remove MPGL_CAP_3D_TEX from OpenGL(ES) 3.0. This block didn't
include the glTexImage3D function, so that was pointless and couldn't
have worked. The OpenGL 2.1 block does it correctly.
2015-07-11 20:01:28 +02:00
Philip Langdale 5776b0c940 vo_vdpau: Implement rotation support
VDPAU has explicit support for rotating surfaces, and it is far less
expensive than using the normal rotation filter (which would require
reading video frames back into system memory), it is desirable to
implement the VO rotation capability.

To do this, we need to render the video frames to an output surface,
without rotation, and then render from that surface to the final
output surface to apply the rotation. It is important that the
intermediate surface is the same size as the final one (only not
rotated) so that hqscaling can be applied if requested by the user.

(hqscaling is a mixer capability and so takes effect when the video
surface is rendered to an output surface)

Finally, we must remember to explicitly clear the final output
surface as VDPAU only auto-clears output surfaces when rendering video
surfaces.
2015-07-11 20:01:28 +02:00
Niklas Haas 3007250824
vo_opengl: reimplement tscale=oversample
Closes #2102.
2015-07-11 14:00:43 +02:00
Philip Langdale 4b0b9b515b vf_vdpaurb: Add a new filter for reading back vdpau decoded frames
Normally, vdpau decoded frames are passed directly to a suitable
vo (vo_vdpau or vo_opengl) without ever touching system memory. This
is efficient for output purposes, but prevents any of the regular
filters from being used with such frames.

This new filter implements a read-back step to pull the frames back
into system memory where they can be acted on by other filters.
Eventually the frames will be sent to the vo as if they were normal
software-decoded frames.

Note that a vdpau compatible vo must still be used to ensure that
the decoder is properly initialised.

Signed-off-by: wm4 <wm4@nowhere>
2015-07-11 10:44:34 +02:00
wm4 8e82a64f56 player: parse and expose m3u playlist titles
Requested. Closes #2100.
2015-07-10 21:22:35 +02:00
wm4 c2b61876c4 video: don't force video refresh if video is restarting 2015-07-10 18:07:39 +02:00
wm4 59b64ceb79 video: add a way to disable automatic stereo conversion
Fixes #2111.
2015-07-10 18:04:34 +02:00
wm4 140273cdec vf_stereo3d: drop internal implementation
Leave the libavfilter wrapper only.
2015-07-10 18:03:38 +02:00
wm4 01ce203ed7 stream_file: remove an indirection
Remove the "fd" local variable, and always use "p->fd" directly.
2015-07-10 12:47:53 +02:00
wm4 4c04f74a50 stream_file: cosmetics: shorten variable name
Can't be bothered to type this much.
2015-07-10 12:45:49 +02:00
wm4 707fe102b6 gl_hwdec: change wording in verbose message 2015-07-10 12:22:24 +02:00
wm4 4e76782630 player: refactor chapter seek code
mp_seek_chapter() had only 1 caller. Also the code was rather
roundabout; the entire function can be compressed to 5 lines of code.
(The new code is functionally the same - "mpctx->last_chapter_seek =
-2;" was effectively a dead assingment.)
2015-07-10 12:11:14 +02:00
wm4 a46de35abb client API: fix mpv_get_property_async() string case
The logic for this code didn't survive the previous refactor. It always
crashed in async mode.

Fixes #2121.
2015-07-10 11:03:09 +02:00
Ben Boeckel 731fc5b816 stream_file: initialize `fd`
Use the fd variable and delay assignment to priv->fd to mirror other
branches of the if/else tree.
2015-07-09 23:04:06 +02:00
wm4 f3d06e3e91 demux_mkv: improve video duration detection heuristic
Extend the --demuxer-mkv-probe-video-duration behavior to work with
files that are partial and are missing an index. Do this by finding a
cluster 10MB before the end of the file, and if that fails, just read
the entire file. This is actually pretty trivial to do and requires only
5 lines of code.

Also add a mode that always reads the entire file to estimate the video
duration.
2015-07-09 22:47:41 +02:00
wm4 d23d9dc394 stream_file: add fd:// protocol 2015-07-09 15:51:31 +02:00
wm4 23220db924 player: disable seeking even if the cache is enabled
Until now, if a stream wasn't seekable, but the stream cache was enabled
(--cache), we've enabled seeking anyway. The idea was that at least
short seeks would typically fall within the cache. And if not, the user
was out of luck and terrible things happened. In other words, it was
unreliable.

Be stricter about it and remove this behavior. Effectively, this will
for example disable seeking in piped data.

Instead of trying to be clever, add an --force-seekable option, which
will always enable seeking if the user really wants it.
2015-07-08 22:04:35 +02:00
wm4 15581f2209 player: never overwrite stop_play field
This is a real pain: if a quit command is received, it's set to PT_QUIT.
And then other code could overwrite it, making it not quit. The annoying
bit is that stop_play is written and read in many places. Just not
overwriting it unconditionally seems to be the best course of action.
2015-07-08 21:31:31 +02:00
wm4 0be07e1d86 input: fix exit code for quit-watch-later command
It should have the same default as the "quit" command.
2015-07-08 19:01:56 +02:00
wm4 9aadc0199f command: allow changing deinterlace property any time
Don't require video decoding to be active.
2015-07-08 15:24:34 +02:00
wm4 ef7278b4fd vf_vdpaupp: don't attempt to deinterlace progressive frames 2015-07-08 15:14:38 +02:00
wm4 d2c05cb559 mp_image: fix vf_vdpaupp references
Some code called by vf_vdpaupp.c calls mp_image_new_custom_ref(), but
out of convenience doesn't reset the buffers. Make this behavior ok.
(The assert() was there to catch usage errors, but the same error could
already happen before the refcount changes were made, so the check is
not overly helpful.)

Fixes #2115.
2015-07-08 14:48:17 +02:00
wm4 db2268d5b1 vaapi: drop compatibility crap and vo_vaapi deinterlacer
Drop libva versions below 0.34.0. These are ancient, so I don't care.

Drop the vo_vaapi deinterlacer as well. With 0.34.0, VPP is always
available, and deinterlacing is done with vf_vavpp.

The vaCreateSurfaces() function changes its signature - actually it did
in 0.34.0 or so, and the <va/va_compat.h> defined a macro to make it use
the old signature.
2015-07-08 14:48:11 +02:00
wm4 4781f9e69a vf_vavpp: don't attempt to deinterlace progressive frames 2015-07-08 14:48:11 +02:00
wm4 9620e37d6a vaapi: increase number of additional surfaces
Sometime recently, hardware decoding started to fail if h264 with full
reference frames was decoded, and --vo=vaapi was used. VAAPI requires
registering all surfaces that the decoder will ever use in advance, so
if the playback chain uses more surfaces than originally allocated, we
fail and drop back to software decoding.

I'm not really sure why or when this started happening. Commit 7b9d7265
for one is not the cause - it can be reproduced with earlier commits. It
also seems to be timing dependent. Possibly it has to do with the way
vo.c retains previous surfaces, and the way they can be queued/unqueued
asynchronously.

Increasing the number of reserved additional surfaces by 1 fixes it.

(Though I have no idea where exactly all these surfaces are being used.
Or rather, _when_.)
2015-07-08 12:18:29 +02:00
wm4 0ebf5979d1 command: make deinterlace property use interlaced-only yadif mode 2015-07-07 15:19:40 +02:00
wm4 25755f5fe7 vf_yadif: expose interlaced frame mode
Also remove the enabled suboption, which did nothing. (It was probably
broken at some point.)
2015-07-07 15:18:56 +02:00
wm4 92727e7332 vo_opengl_cb, vo_opengl: add option for preloading hwdec context
See manpage additions. This is mainly useful for vo_opengl_cb, but can
also be applied to vo_opengl.

On a side note, gl_hwdec_load_api() should stop using a name string, and
instead always use the IDs. This should be cleaned up another time.
2015-07-07 15:05:32 +02:00
wm4 1d29177c5c options: cleanup hwdec name mappings
Now there's a "canonical" table for mapping the names, that other code
can use, without having to rely too much on option code magic.

Also, use the central HWDEC constants, instead of magic values. (There
used to be semi-ok reasons to do this, but now it makes no sense
anymore.)
2015-07-07 15:05:32 +02:00
wm4 dc33eb56f4 vo_opengl_cb: drop frames eagerly if frames are not rendered
libmpv users might stop calling the frame render callback for stupid
reasons, at which point video frames would pile up.
2015-07-07 13:59:33 +02:00
wm4 459124f66f af: fix behavior with pathologic filter chains
Some filter chains require a huge number of auto-inserted conversion
filters. There is an overly stupid safeguard against infinite filter
insertions, which counts the number of conversion filters inserted. This
triggered accidentally in this case. Fix by resetting this counter after
a non-conversion filter was successfully configured.
2015-07-07 13:24:11 +02:00
wm4 daf32e2d2d sub: fix srt subs and other cases
Oops.
2015-07-07 01:26:26 +02:00
wm4 782c7acd16 player: add missing include directive 2015-07-06 22:28:28 +02:00
wm4 385febe276 sub: protect ASS_Renderer state
Each subtitle track gets its own decoder instance (sd_ass). But they use
a shared ASS_Renderer. This is done mainly because of fontconfig.
Initializing fontconfig is very slow when using it with memory fonts, so
there's a practical need to cache this memory font state, which is done
by not creating separate ASS_Renderers. This is very dirty and very
evil, but we probably can't get rid of it any time soon.

The shared ASS_Renderer was not properly synchronized. While the program
logic guarantees that only one sd_ass instance is visible at a time,
there are other interactions that require synchronization. In
particular, I suspect concurrent execution of mp_ass_configure_fonts()
and sd_ass.get_bitmaps cause issues in a newer libass development
branch.

So here's a shitty hack that hopefully fixes things, hopefully only
until libass becomes less dependent on fontconfig.
2015-07-06 21:55:37 +02:00
wm4 dcd167ca37 dxva2: fix handling of cropped video
Basically, we need to make sure to allocate enough data for the pretty
dumb copy_nv12 function. (It could be avoided by making the function
less dumb, but this fix is simpler.)
2015-07-06 21:25:07 +02:00
wm4 7c032bde3e ao_coreaudio: fix device latency, share the code
ao_coreaudio (using AudioUnit) accounted only for part of the latency -
move the code in ao_coreaudio_exclusive to utils, and use that for the
AudioUnit code.

(There's still the question why CoreAudio and AudioUnit require you to
jump through hoops this much, but apparently that's how it is.)
2015-07-06 17:49:28 +02:00
wm4 a56a7f3e8c ipc: fix undefined behavior in some error cases
goto jumping over an initialization.
2015-07-06 00:08:29 +02:00
wm4 e4b963e643 ao_coreaudio_exclusive: continue even if setting physical format fails
Makes it work with (apparently) crappy drivers, which refuse to set the
physical format in some cases.
2015-07-06 00:04:20 +02:00
wm4 7b9d726588 video: replace our own refcounting with libavutil's
mpv had refcounted frames before libav*, so we were not using
libavutil's facilities. Change this and drop our own code.

Since AVFrames are not actually refcounted, and only the image data
they reference, the semantics change a bit. This affects mainly
mp_image_pool, which was operating on whole images instead of buffers.
While we could work on AVBufferRefs instead (and use AVBufferPool),
this doesn't work for use with hardware decoding, which doesn't
map cleanly to FFmpeg's reference counting. But it worked out. One
weird consequence is that we still need our custom image data
allocation function (for normal image data), because AVFrame's uses
multiple buffers.

There also seems to be a timing-dependent problem with vaapi (the
pool appears to be "leaking" surfaces). I don't know if this is a new
problem, or whether the code changes just happened to cause it more
often. Raising the number of reserved surfaces seemed to fix it, but
since it appears to be timing dependent, and I couldn't find anything
wrong with the code, I'm just going to assume it's not a new bug.
2015-07-05 23:56:00 +02:00
wm4 34b223d730 mp_image: make image writeable before overwriting palette
This is an obscure but theoretically possible bug.
2015-07-05 23:55:47 +02:00
wm4 95424517a2 vo: free frames before killing VO
This caused issues with hardware decoding. The VOs by definition dictate
the lifetime of the hardware context, so no surface allocations must
survive the VO. Fixes assertions on exit with vdpau.
2015-07-04 17:27:13 +02:00
wm4 a4d5c19355 ao_coreaudio_exclusive: fix some verbose output 2015-07-04 17:25:12 +02:00
wm4 5728295dab timer: fix a corner case on clock changes
It's conceivable that the OS time source is subject to clock changes.
The time could jump back to before when mpv was started, which would
cause mp_time_us() to return values smaller than 1. This is unexpected
by the code and could trigger assertions. If there's no monotonic time
source there's not much we can do anyway, so just sanitize the return
value. It will cause strange behavior until the "lost" time offset has
passed, but if you make such huge changes to the system clock while
everything is running, you're asking for trouble anyway.

(Normally we try to get a monotonic time source, though. This problem
sometimes happened on Windows when compiled without winpthreads, when
the code was falling back to gettimeofday(). This was already fixed by
always using another method.)
2015-07-04 17:24:10 +02:00
James Ross-Gowan f544bcf105 win32: use QueryPerformanceCounter for timing
clock_gettime is implemented in winpthreads, so it's unavailable when
mpv is compiled with its internal pthreads implementation. This makes
mp_raw_time_us fall back to gettimeofday(), which can cause an assert
failure in mp_add_timeout() when the system clock is changed. Use
QueryPerformanceCounter instead.

The clock_gettime(CLOCK_MONOTONIC) implementation in winpthreads uses
QueryPerformanceCounter anyway, so there shouldn't be any change in
behaviour.
2015-07-04 15:54:14 +02:00
Preston Hunt 029da5abce ipc: add request_id to json
If the request contains a "request_id", copy it back into the
response. There is no interpretation of the request_id value by mpv; the
only purpose is to make it easier on the requester by providing an
ability to match up responses with requests.

Because the IPC mechanism sends events continously, it's possible for
the response to a request to arrive several events after the request was
made. This can make it very difficult on the requester to determine
which response goes to which request.
2015-07-03 22:26:54 +02:00
wm4 ed44f21289 manpage: fix dwmflush parameter 2015-07-03 19:40:15 +02:00
wm4 31f2cd03d0 vo: set correct frame parameters on redraw 2015-07-03 19:35:39 +02:00
wm4 fc79fd0474 ao: don't pass along AO arguments when redirecting
Only causes problems.
2015-07-03 19:28:01 +02:00