Commit Graph

37938 Commits

Author SHA1 Message Date
wm4 3f0f666d14 vf: print error if filtering a frame fails
The filters don't always print an error on their own, and printing an
error is better than silently dropping the frame.
2014-04-30 22:19:38 +02:00
Kevin Mitchell 8e8758dbe1 TOOLS: better documentation of lua scripts 2014-04-29 08:31:44 -07:00
Kevin Mitchell 4b0a760d86 TOOLS: improve autocrop.lua
It now inserts no filters and does nothing until the hot-key is pressed.
This makes it more suitable to be put in ~/.mpv/lua.

When the hot-key is pressed, it now inserts the cropdetect filter and
waits 1 second (or a --lua-opts specified duration) before gathering
the cropdetect metadata and inserting the appropriate crop filter. A
second press of the hotkey removes the crop.
2014-04-29 08:31:44 -07:00
Kevin Mitchell 479dab5718 vf_lavfi: reset metadata in reset()
It might have been nice not to do this so that metadata could
accumulate accross seeks, but it seems libavfilter looses its copy
anyway on recreate_graph.
2014-04-29 08:31:44 -07:00
Kevin Mitchell e3e565c194 vf-metadata: fix handling of NULL metadata
lavfi would segfault due to a NULL dereference if it was asked for its
metadata and none had been allocated (oops). This happens for libav
which has no concept of filter metadata.
2014-04-29 08:31:44 -07:00
Kevin Mitchell 164cfeba56 man: grammar tweak of mp.add_timeout() 2014-04-29 08:31:44 -07:00
wm4 f6f8dc7782 video: remove redundant mp_image display_w/_h members
Commit 5e4e248 added a mp_image_params field to mp_image, and moved many
parameters to that struct. display_w/h was left redundant with
mp_image_params.d_w/d_h. These fields were supposed to be always in
sync, but it seems some code forgot to do this correctly, such as
vf_fix_img_params() or mp_image_copy_attributes(). This led to the
problem in github issue #756, because display_w/_h could become
incorrect.

It turns out that most code didn't use the old fields anyway. Just
remove them. Note that mp_image_params.d_w/d_h are supposed to be always
valid, so the additional checks for 0 shouldn't be needed. Remove these
checks as well.

Fixes #756.
2014-04-29 13:31:59 +02:00
wm4 a69e91756d vo_vdpau: let vdpau scale anamorphic screenshots
In theory, returning the screenshot with original pixel aspect would
allow avoiding scaling them with image formats that support non-square
pixels, but in practice this isn't used anyway (nothing seems to
understand e.g. jpeg aspect ratio tags).
2014-04-29 13:27:07 +02:00
wm4 81171e37b2 common: add mp_snprintf_append() utility function 2014-04-29 13:14:48 +02:00
wm4 8562f53cf9 TOOLS/umpv: make it work with Python 3 (again)
Apparently, the 3rd (2nd) parameter to string.translate() function was
removed.

Also, make_abs() had a mistake - not sure how this passed testing.
2014-04-29 02:21:59 +02:00
wm4 2a8f7181e3 TOOLS/umpv: don't mangle URLs
This attempted to prefix the current directory to URLs, because it
didn't recognize them as already absolute paths.
2014-04-29 02:16:18 +02:00
wm4 fa1b9517bc TOOLS/umpv, mpv.desktop: use --no-terminal instead of --really-quiet
So this won't initialize terminal handling if stdout happens to be a
terminal. It also suppresses all output to stdout/stderr.
2014-04-29 02:09:59 +02:00
wm4 f2f19b3404 TOOLS/umpv: allow passing 0 files
Some might use that to just create an empty window with --force-window
--idle (for whatever reasons).
2014-04-29 02:06:40 +02:00
wm4 1800becf6a TOOLS/umpv: allow passing options
But only via a special environment variable.
2014-04-29 01:24:21 +02:00
wm4 6c87b50727 TOOLS/umpv: make it work with Python 3
Apparently they removed octal literals, and made them invalid syntax.
2014-04-29 01:21:21 +02:00
wm4 48587e88e0 vf_vapoursynth: add more VS frame properties
We only support them for input. The frame properties of output frames
are ignored (except frame durations).

Properties not set for now: _ChromaLocation, _Field, _FieldBased
2014-04-28 23:44:57 +02:00
wm4 6b0b8368a4 vf_vapoursynth: use frame durations instead of _AbsoluteTime
Set _DurationNum/_DurationDen on each VS frame, instead of
_AbsoluteTime. The duration is the difference between the timestamp of
the frame and the next frame, and when receiving filtered VS frames, we
convert them back to an absolute PTS by summing them.

We pass the timestamps with microsecond resolution. mpv uses double for
timestamps internally, so we don't know the "real" timebase or FPS. VS
on the other hand uses fractions for frame durations. We can't pass
through the numbers exactly, but microseconds ought to be enough to be
even safe from accumulating rounding errors.
2014-04-28 22:23:32 +02:00
wm4 062d5eea3b vf_vapoursynth: fix memory leak on error
Since this leaks video images, and the player keeps feeding new images
to the fitler even if it fails, this would probably have disastrous
consequences.
2014-04-28 22:23:32 +02:00
wm4 dffb7c2409 vf_vapoursynth: remove incorrect copyright notice
This file merely started out by copy&pasting vf_lavfi.c and removing
everything to have a basic skeleton.
2014-04-28 22:23:32 +02:00
wm4 f39e4210f7 vf_lavfi: distinguish real errors from other states
Don't just hide real errors, should a filter return them.
2014-04-28 22:23:31 +02:00
wm4 42f65ce108 video: don't drop last frame when deinterlacing with yadif
Or in other words, add support for properly draining remaining frames
from video filters. vf_yadif is buffering at least one frame, and the
buffered frame was not retrieved on EOF.

For most filters, ignore this for now, and just adjust them to the
changed semantics of filter_ext. But for vf_lavfi (used by vf_yadif),
real support is implemented. libavfilter handles this simply by passing
a NULL frame to av_buffersrc_add_frame(), so we just have to make
mp_to_av() handle NULL arguments.

In load_next_vo_frame(), we first try to output a frame buffered in the
VO, then the filter, and then (if EOF is reached and there's still no
new frame) the VO again, with draining enabled. I guess this was
implemented slightly incorrectly before, because the filter chain still
could have had remaining output frames.
2014-04-28 22:23:31 +02:00
wm4 a6dafb061f TOOLS: make youtube-dl_mpv.sh executable 2014-04-28 22:23:31 +02:00
Stefano Pigozzi 9d0c1d6913 cocoa: refactor sync scheduling to a function
This extracts the scheduling logic to a single function which is nicer to keep
it consistent.

Additionally make sure we don't schedule sync operations from a sync operation
itself since that could cause deadlocks (even if it should not be happening
with the current code).
2014-04-28 21:51:04 +02:00
Stefano Pigozzi fbc8ba5855 cocoa: use mainScreen as a fallback for window constraining 2014-04-28 21:32:59 +02:00
Stefano Pigozzi 8eb7e2aa0b cocoa: disallow the titlebar to exit the visibleFrame on the bottom edge 2014-04-28 21:32:59 +02:00
Stefano Pigozzi 2c08ab1c6a cocoa: add constraints to prevent the window to exit the screen
Previously the window could be made to completly exit the screen with a
combination or moving it close to an edge and halving it's size (via cmd+0).

This commit address the problem in the most simple way possibile by
constraining the window to the closest edge in these edge cases.
2014-04-28 21:32:58 +02:00
Ryan Goulden 80ec0bac43 cocoa: move sync section assignments in vo_control 2014-04-28 21:32:58 +02:00
Ryan Goulden 4d8489efae cocoa: cosmetics: use NSMakeSize 2014-04-28 21:32:58 +02:00
Ryan Goulden 2878c2a914 cocoa: fix native fullscreen
This fixes a couple of issues with the Cocoa `--native-fs` mode, primarily:

 - A ghost titlebar at the top of the screen in full screen:

   This was caused by the window constraining code kicking in during
   fullscreen. Simply returning the unconstrained rect from the constraining
   method fixes the problem.

 - Incorrect behavior when using the titlebar buttons to enter/exit
   fullscreen, as opposed to the OSD button.

   This was caused by mpv's internal fullscreen state going out of sync with
   the NSWindow's one. This was the case because `toggleFullScreen:`
   completely bypassed the normal event flow that mpv expects.

Signed-off-by: Ryan Goulden <percontation@gmail.com>

Change style for mpv, simplify and refactor some of the constraining code.

Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2014-04-28 21:32:58 +02:00
wm4 e8a996cede client API: add chapter change event
Also works for mpv_observe_property() on the "chapter" property.
2014-04-27 22:28:07 +02:00
wm4 b20416abe3 vf_vapoursynth: use official AbsoluteTime property
I thought the "_" in "_AbsoluteTime" was part of the documentation
markup.

This still doesn't help us with VS filters that change timing;
apparently you must use frame durations instead.
2014-04-27 22:16:56 +02:00
wm4 9e47bd11cc vf_vapoursynth: keep pixel aspect ratio
Make the filter apply the pixel aspect ratio of the input to the output.
This is more useful than forcing 1:1 PAR when playing anamorphic video
such as DVDs.

VapourSynth itself actually allows passing through the aspect ratio, but
it's in a not very useful form for us: it's per video-frame instead of
constant (i.e in VSVideoInfo). As long as we don't have a way to allow a
filter to spontaneously change output parameters, we can't use this.
(And I don't really feel like making this possible.)
2014-04-27 17:05:26 +02:00
Kevin Mitchell 4e973c059a TOOLS: indent lua scripts by 4 spaces instead of 3 2014-04-27 15:34:53 +02:00
Kevin Mitchell 7ef045555d TOOLS: add lua/drc-control
allows live insertion/deletion/adjustment of drc audio filter
2014-04-27 15:34:53 +02:00
Kevin Mitchell ae56b8d237 TOOLS: move autocrop.lua to TOOLS/lua
in anticipation of more lua scripts
2014-04-27 15:34:52 +02:00
Stefano Pigozzi ce48da9e02 build: use -pthread when available
Our code currently tries to link -lpthread and adds stuff like -D_REENTRANT
based on the target platform.

GCC actually supports to just pass a -pthread compiler and linker flag that
will automatically enable threading and define the correct symbols for the
platform, so let's try to just use that as our first choice.

clang also supports -pthread but it must be used only as a compiler flag,
so we also take care of that scenario with this commit.
2014-04-27 10:40:01 +02:00
Stefano Pigozzi ae0c8ca219 build: conditionally use -Wempty-body
-Wempty-body is not available on all gcc versions but we were using it
unconditionally. Also remove the usage from the clang case. clang still
defines `__GNUC__` so it still gets all the gcc specific flags.

This should fix the build on systems with older gcc versions like OpenBSD which
still comes bundled with gcc 4.2 for license issues.
2014-04-26 23:53:09 +02:00
wm4 cdafc2f7d7 terminal: always use SA_RESTART with sigaction()
One problem is that for example stdio functions won't restart syscalls
manually, and instead treat EINTR as an error. So passing SA_RESTART is
the only sane thing to do, unless you have special requirements, which
we don't.
2014-04-26 22:52:26 +02:00
wm4 eb3cc32f9b demux_mkv: enable parsing for VP9
VP9 packets can contain 2 frames in some video packets (from which 1
frame is invisible). Due to a design mismatch between libvpx and the
libavcodec vp9 decoder, libvpx can take the "full" packets, but lavc vp9
can not. The consequence is that we have to split the packets if we want
to feed them to the lavc codec.

This is not entirely correct yet: timestamp handling is missing.
--demuxer=lavf and ffmpeg native utilities have the same problem. We can
fix this only once the ffmpeg VP9 parser is fixed.
2014-04-26 22:24:15 +02:00
wm4 a29597cb65 input: fix mouse_leave/OSC behavior
This essentially reverts commit cca13efb. The code in the if was
supposed to be run only if the mouse button was down, because in this
case the mouse area is never considered to be left. Since it was run
for every mouse button, mouse_leave wasn't sent.

Fixes #745.
2014-04-26 20:30:24 +02:00
wm4 d44dd30ac7 input: fix inverted condition
pthread_equal() returns 0 if the threads are not the same, and somehow
I got that wrong. The worst is that I actually explicitly checked the
manpage when I wrote this code.
2014-04-26 16:58:23 +02:00
wm4 75d7d87e1b osd: make code C99
This used an unnamed union, which is allowed in GNU C and C11, but not
C99. This broke the build with some older compilers.

Replaces pull request #744.
2014-04-26 16:04:09 +02:00
Alexander Preisinger a5282e3a69 Revert "wayland: print waylands display erros"
This reverts commit 6e34b0ec1f.

There has always been an error message "proxy already has a listener" and
I couldn't reproduce where it is comming from until now. The display interface
already has a listener and we can't overwrite it. Now remove the code and avoid
this error message.

Conflicts:
	video/out/wayland_common.c
2014-04-26 14:51:48 +02:00
wm4 2584dcc873 manpage: fix grammar 2014-04-26 13:28:31 +02:00
wm4 3a80308e6d manpage: forced->used 2014-04-26 12:49:38 +02:00
wm4 40c517cc41 vf_pp: PP_PICT_TYPE_QP2 is always defined 2014-04-25 19:21:17 +02:00
wm4 1c2c09adf7 stream: use libavformat interrupt callback
This will allow to cancel opening slow/stuck network streams faster. How
well his work probably depends on the protocol implementation in
libavformat.
2014-04-25 19:13:12 +02:00
wm4 93de4c81b9 stream: make mp_input_check_interrupt thread-safe
The interrupt callback will can be called from another thread if the
cache is enabled, and the stream disconnects. Then stream_reconnect()
will call this function from within the cache thread.

mp_input_check_interrupt() is not thread-safe due to read_events() not
being thread-safe. It will call input callbacks added with
mp_input_add_fd() - these callbacks lead to code not protected by locks,
such as reading X11 events.

Solve this by adding a stupid hack, which checks whether the calling
thread is the main playback thread (i.e. calling the input callbacks
will be safe). We can remove this hack later, but it requires at least
moving the VO to its own thread first.
2014-04-25 19:13:03 +02:00
wm4 e0cf983e53 stream: remove interrupt callback global variables
This used global variables for the asynchronous interrupt callback.

Pick the simple and dumb solution and stuff the callback into
mpv_global. Do this because interrupt checking should also work in the
connect phase, and currently stream creation equates connecting.
Ideally, this would be passed to the stream on creation instead, or
connecting would be separated from creation. But since I don't know yet
which is better, and since moving stream/demuxer into their own thread
is something that will happen later, go with the mpv_global solution.
2014-04-25 19:12:24 +02:00
wm4 3d51ef3dc8 stream: use uninterruptible sleep on reconnecting
This is the only function which actually used the time argument of
stream_check_interrupt(). Considering that the whole player freezes
anyway, this is not worth the complication.

Also generally reduce the maximum wait time due to timeout. Introduce
exponential backoff, which makes the first reconnect retries faster, but
still waits up to 500ms in the later retries.
2014-04-25 19:11:58 +02:00