Commit Graph

41826 Commits

Author SHA1 Message Date
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
wm4 514af9fbd1 ao_coreaudio: add exclusive suboption 2015-07-03 19:28:00 +02:00
wm4 e9e323f35d ao_coreaudio_exclusive: support PCM
Until now, this was for AC3 only. For PCM, we used AudioUnit in
ao_coreaudio, and the only reason ao_coreaudio_exclusive exists
is that there is no other way to passthrough AC3.

PCM support is actually rather simple. The most complicated
issue is that modern OS X versions actually do not support
copying through the data; instead everything must go through
float. So we have to deal with virtual and physical format
being different, which causes some complications.

This possibly also doesn't support some other things correctly.
For one, if the device allows non-interleaved output only, we
will probably fail. (I couldn't test it, so I don't even know
what is required. Supporting it would probably be rather
simple, and we already do it with AudioUnit.)
2015-07-03 19:28:00 +02:00
wm4 65e3657bc4 ao_coraudio: reject all non-PCM formats
Currently this is equivalent. On the other hand, all audio code should
reject formats that is not in a category known to it.
2015-07-03 19:28:00 +02:00
wm4 74e2c8a6ef ao_coreaudio_utils: reduce spam 2015-07-03 19:28:00 +02:00
wm4 ae3e151b27 ao_coreaudio_utils: fix format back-mapping
Mapping of spdif formats was imperfect. Since the first format on the
list is somehow AAC, it was returned first, which is confusing, because
CoreAudio calls all spdif formats AC3. Since the spdif formats have some
rather arbitrary, reverse mapping the formats didn"t actually work
either. Fix by explicitly ignoring these when spdif is used.

Also, don't forget to set the samplerate in ca_asbd_to_mpformat(), or it
will work only in some cases.
2015-07-03 19:28:00 +02:00
wm4 d4ab91f016 ao_coreaudio_exclusive: do not set ao->bps
This field is basically deprecated or for convenience only, and
this code doesn't need it.
2015-07-03 19:28:00 +02:00
wm4 597657110f ao_coreaudio_exclusive: dump all latency info in verbose mode 2015-07-03 19:28:00 +02:00
wm4 ec21be498f ao_coreaudio_exclusive: factor format selection 2015-07-03 19:28:00 +02:00
wm4 8a20e5306c ao_coreaudio_exclusive: separate out stream selection 2015-07-03 19:28:00 +02:00
wm4 561416597e client API, dxva2: add a workaround for OpenGL fullscreen issues
This is basically a hack for drivers which prevent the mpv DXVA2 decoder
glue from working if OpenGL is in fullscreen mode.

Since it doesn't add any "hard" new API to the client API, some of the
code would be required for a true zero-copy hw decoding pipeline, and
sine it isn't too much code after all, this is probably acceptable.
2015-07-03 16:38:12 +02:00
wm4 b85321d057 vo_direct3d, dxva2: use the same D3D device
Since we still read-back (and don't have hard plans on changing this),
this doesn't have much of an advantage.
2015-07-03 16:04:42 +02:00
wm4 b6dc11810b dxva2: move device creation code
Preparation for the following commit.
2015-07-03 15:42:52 +02:00
wm4 cc51dafa96 vo_opengl: log some more stuff in verbose mode 2015-07-03 15:12:42 +02:00
wm4 5446637e99 av_log: print FFmpeg version
The individual library versionsd are pretty useless. This will actually
tell us at least the git hash or git tag of the FFmpeg build.
2015-07-03 15:11:29 +02:00
wm4 a609877f00 player: simplify reload logic
Instead of only reloading the demuxer, reopen the stream as well.
2015-07-02 14:38:03 +02:00
wm4 a9bbaa5eb2 player: remove automatic DVB channel advancement on no data
For the sake of removing the separate stream/demuxer loading code.

This could probably be reimplemented in some other way, but I have no
DVB hardware for testing. The most preferred way would be making DVB to
not quit, and just rerun the stream selection.
2015-07-02 14:08:22 +02:00
wm4 899dfa957f player: unentangle --stream-dump
The final goal is making opening the demuxer and opening the stream the
same operation.

Stream dumping is a rather uninteresting feature, but has a small
number of vocal users, and it's easy to keep.
2015-07-02 14:02:37 +02:00
wm4 ff25c0ad7d vo_opengl: fix "freezes" after seeking with interpolation on
When seeking to a different position, and seeking takes long, the OSD
might get redrawn. This means that the VO will receive a request to
redraw an old frame using whatever the previous PTS was. This breaks the
interpolation logic: the old frame will be added to the queue, and then
the next frames (with lower PTS if you seeked backwards) are not drawn
as the logic assumes they're past frames.

Fix this by using the non-interpolation code path when redrawing after a
seek reset, and no "real" frame has been drawn yet.

It's a recent regression caused by the redrawing code simplification.
The old code simply sent a VOCTRL for redrawing the frame, and the VO
had to deal with retaining the old frame on its own.

This is a hack as in there's probably a better solution.

Fixes #2097.
2015-07-02 13:18:06 +02:00
wm4 53845d81f5 vo: reset frame timing when redrawing
bother vo_vdpau.c, which actually uses these times.
2015-07-02 13:03:58 +02:00
wm4 dc2b6ab6b7 vo_opengl: X11: don't leak when GL init fails 2015-07-02 00:30:13 +02:00
wm4 89713808ad vo_opengl: X11 EGL: more detailed error reporting 2015-07-02 00:28:25 +02:00
wm4 c169292902 vo_opengl: update EGL code
Use the newer internal GL backend API.
2015-07-02 00:25:30 +02:00
wm4 99bc049745 vo_opengl: remove unused GL API functions 2015-07-02 00:08:17 +02:00
wm4 6afef5839f x11: move GCs and background clearing to vo_xv
vo_xv.c is the only place where these things are used.
2015-07-01 23:55:10 +02:00
wm4 8dff03560a x11: remove clear on map
Less code, and avoids a black flash on start.

In theory it could happen that we map the window, and then don't have a
frame to draw - but mapping the window is done in the exact moment we
have a new frame to display.
2015-07-01 23:46:34 +02:00
wm4 89f05dc7d1 options: fix conversion of flags to strings
This flags stuff tried to be too clever - if there are overlapping flags
(e.g. exclusive or combined flags), the one matching with most bits has
to be chosen.

This fixes logging of the seek command. E.g. "relative" and "absolute"
overlap to make them exclusive, but "relative" was always printed as it
happened to match first.
2015-07-01 23:05:11 +02:00
wm4 e3d85ad46d vo: better magic value for unknown vsync interval
The value 1 is useful in some contexts, but not such a good choice
otherwise.
2015-07-01 22:38:22 +02:00
wm4 03e062d53e vo_opengl_cb: fix interpolation code path 2015-07-01 22:38:13 +02:00
Niklas Haas 8043063275 vo_opengl: fix framestepping/pausing + interpolation
This is not the most theoretically perfect solution, ideally we could
check to see if the frame in question has already been rendered
somewhere in the queue and then avoid re-rendering it, at the cost of a
few extra lines of code. But I don't think the performance trade-off is
dramatic enough here.
2015-07-01 22:38:06 +02:00
wm4 0739cfc209 vo: change internal API for drawing frames
draw_image_timed is renamed to draw_frame. struct frame_timing is
renamed to vo_frame. flip_page_timed is merged into draw_frame (the
additional parameters are part of struct vo_frame). draw_frame also
deprecates VOCTRL_REDRAW_FRAME, and replaces it with a method that
works for both VOs which can cache the current frame, and VOs which
need to redraw it anyway.

This is preparation to making the interpolation and (work in progress)
display sync code saner.

Lots of other refactoring, and also some simplifications.
2015-07-01 22:38:02 +02:00
Niklas Haas f166d12985 vo_opengl: adjust interpolation code for the new video-sync mechanism
This should make interpolation work much better in general, although
there still might be some side effects for unusual framerates (eg. 35 Hz
or 48 Hz). Most of the common framerates are tested and working fine.
(24 Hz, 30 Hz, 60 Hz)

The new code doesn't have support for oversample yet, so it's been
removed (and will most likely be reimplemented in a cleaner way if
there's enough demand). I would recommend using something like robidoux
or mitchell instead of oversample, though - they're much
smoother for the common cases.
2015-07-01 22:37:55 +02:00
wm4 c5e3613bba video: pass vsync offset to VO
For now, this is trivial (and actually redundant). The future display
sync code will make better use of it. The main point is that the new
internal API pretty much makes this transparent to the vo_opengl
interpolation code.
2015-07-01 22:37:51 +02:00
wm4 41ad9d8924 video: pass future frames to VO
Now the VO can request a number of future frames with the last parameter
of vo_set_queue_params(). This will be helpful to fix the interpolation
code.

Note that the first frame (after playback start or seeking) will usually
not have any future frames (to make seeking fast). Near the end of the
file, the number of future frames will become lower as well.
2015-07-01 22:37:46 +02:00
wm4 7faa80ace8 af_lavrresample: log actual channel layout conversions
With all the reordering etc. that can go on in this filter, it's useful
to see what upmix/downmix it's actually performing.
2015-06-30 22:39:57 +02:00
wm4 c0aba8e25a demux_lavf: check for NAN rotation angles
Yep, the FFmpeg API can return this.
2015-06-30 19:35:19 +02:00
wm4 aa42b6ba35 player: slim down A/V desync warning
I don't think most of these suggestions are overly helpful. Just get rid
of them.
2015-06-30 19:20:52 +02:00
wm4 dbf21467f0 build: always regenerate version hash
Until now, it only used the hash from the previous configure run,
instead of trying to get the latest hash. The "old" build system did
this correctly - we just have to use the existing logic in version.sh.

Since waf supports separate build dirs, extend version.sh with an
argument for setting the path of version.h.
2015-06-30 15:56:26 +02:00
wm4 bf739ca324 manpage: fix copy&paste mistakes
These are definitely not per-track.

(Maybe we should just provide a script or such which pretty-prints
"native" property output.
2015-06-30 12:17:58 +02:00