Commit Graph

1145 Commits

Author SHA1 Message Date
wm4 ec60669cd1 vdpau: add a postprocessing pseudo-filter
This factors out some code from vo_vdpau.c, especially deinterlacing
handling. The intention is to use this for vo_vdpau.c to make the logic
significantly easier, and to use it for vo_opengl (gl_hwdec_vdpau.c) to
allow selecting deinterlace and postprocessing modes.

As of this commit, the filter actually does nothing, since both vo_vdpau
and vo_opengl treat the generated images as normal vdpau images. This
will change in the following commits.
2014-05-02 01:08:02 +02:00
wm4 7fc999b577 vo: document draw_image 2014-04-30 22:25:11 +02:00
wm4 cb411ac520 vo_lavc: remove code with no effect
This field will also removed in the future.
2014-04-30 22:24:48 +02:00
wm4 ee574c67ea video: improve error messages 2014-04-30 22:20:08 +02:00
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 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
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 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
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 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
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 40c517cc41 vf_pp: PP_PICT_TYPE_QP2 is always defined 2014-04-25 19:21:17 +02:00
Martin Herkt 89a19aafd9 vo: do not check for events on unconfigured VO
fixes #741
2014-04-25 05:03:24 +02:00
wm4 8a74638dc7 video: add a "hwdec" property to enable or disable hw decoding at runtime 2014-04-23 01:58:12 +02:00
wm4 a45363a28a vo: simplify event_fd handling
Add the event FD after preinit, remove it before destroy. There's no
need to do it on vo_config, and there's no need to remove the event
FD when vo_config fails.
2014-04-22 21:06:23 +02:00
wm4 e156f8b052 vo: cosmetics: move around some code
Group together related functionality.
2014-04-22 21:03:57 +02:00
wm4 1e818b130a vo: minor cosmetic change 2014-04-22 21:03:35 +02:00
wm4 dd39b47f7c vf: print all image parameter information in verbose output 2014-04-22 01:42:57 +02:00
wm4 259fb392a5 vo: warn if the VO doesn't support certain flags
Unfortunately, if a VO can't display something as intended, we can just
complain to the user, and leave it at it. But it's still better than
silently displaying things differently with different VOs.

For now, this is used for rotation only. Other things that we should
check includes colorspace and colorlevels stuff.
2014-04-22 01:42:54 +02:00
wm4 ba1380223a vf: remove autoinserted filters on reconfig
When using rotation with hw decoding, and the VO does not support
rotation, vf_rotate is attempted to be inserted. This will go wrong, and
after that it can't recover because a vf_scale filter was autoinserted.
Just removing all autoinserted filters before reconfig fixes this.
2014-04-21 02:57:17 +02:00
wm4 f69312e329 vf: add function to remove a filter from the chain 2014-04-21 02:57:16 +02:00
wm4 7791b5cf7c vo_opengl: support rotation
This turned out much more complicated than I thought. It's not just a
matter of adjusting the texture coordinates, but you also have to
consider separated scaling and panscan clipping, which make everything
complicated.

This actually still doesn't clip 100% correctly, but the bug is only
visible when rotating (or flipping with --vf=flip), and using something
like --video-pan-x/y at the same time.
2014-04-21 02:57:16 +02:00
wm4 ef2885e771 vo: add some general support code for VOs that allow rotation
For rotation, we assume that the source image will be rotated within the
VO, so the aspect/panscan code needs to calculate its param using
rotated coordinates. VOs which support rotation natively can use this.
2014-04-21 02:57:16 +02:00
wm4 cc00b3ff36 vo_opengl: clean up rendering path
Shuffle the special cases around so that it looks cleaner. The result
should be equivalent to the code before.
2014-04-21 02:57:16 +02:00
wm4 fd2f40762f demux: export video rotation parameter
Now the rotation hint is propagated everywhere. It just isn't used
anywhere yet.
2014-04-21 02:57:16 +02:00
wm4 3b5a331c40 mp_image: add rotation parameter 2014-04-21 02:57:16 +02:00
wm4 5e4e248dc2 video: make mp_image use mp_image_params directly
Minor cleanup, so that we can stuff more information into
mp_image_params later.
2014-04-21 02:57:16 +02:00
wm4 44096073e9 vf_rotate: support all multiples of 90 degrees
This couldn't rotate by 180°. Add this, and also make the parameter in
degrees, instead of magic numbers.

For now, drop the flipping stuff. You can still flip with --vf=flip or
--vf=mirror. Drop the landscape/portrait stuff - I think this is
something almost nobody will use. If it turns out that we need some of
these things, they can be readded later.

Make it use libavfilter. Its vf_transpose implementation looks pretty
simple, except that it uses slice threading and should be much faster.
2014-04-21 02:56:48 +02:00
wm4 85998f6121 Fix some libav* include statements
Fix all include statements of the form:

   #include "libav.../..."

These come from MPlayer times, when FFmpeg was somehow part of the
MPlayer build tree, and this form was needed to prefer the local files
over system FFmpeg.

In some cases, the include statement wasn't needed or could be replaced
with mpv defined symbols.
2014-04-19 17:18:10 +02:00
wm4 0cff5836c3 Remove CPU detection and inline asm handling
Not needed anymore. I'm not opposed to having asm, but inline asm is too
much of a pain, and it was planned long ago to eventually get rid fo all
inline asm uses.

For the note, the inline asm use that was removed with the previous
commits was almost worthless. It was confined to video filters, and most
video filtering is now done with libavfilter. Some mpv filters (like
vf_pullup) actually redirect to libavfilter if possible.

If asm is added in the future, it should happen in the form of external
files.
2014-04-19 17:10:56 +02:00
wm4 061c7eba97 vf_pp: fix include statement 2014-04-19 17:10:20 +02:00
wm4 c56b1f2d90 vf_pp: use native libpostproc CPU detection 2014-04-19 17:10:20 +02:00
wm4 60fbce16bb vf_divtc: remove inline asm
Becomes a bit slower (tested with progressive solid color video only),
but this filter is pretty obscure and I'm not even sure what it's useful
for.
2014-04-19 17:10:20 +02:00
wm4 d0ebecb1c4 vf_pullup: remove inline asm
No change in speed (or even slightly faster, though I tested with
progressive solid color video only), and normally we use libavformat's
vf_pullup anyway.
2014-04-19 17:10:20 +02:00
wm4 d55ed011ab vf_noise: remove line asm
I didn't test the speed, but by default, this filter diverts to
libavfilter already. So this would help only if libavfilter is disabled,
or libavfilter doesn't have vf_noise (like on Libav). For these cases,
we still provide the (possibly but not necessarily) slower C
implementation of vf_noise.
2014-04-19 15:50:52 +02:00
wm4 b69c835945 vf_ilpack: remove inline asm
This makes it multiple times slower. However, the output format (packed
YUV) isn't handled efficiently by anything to begin with, and I have no
clue we even have this filter. I guess it's one of these filters which
find some use sometimes, but are not of higher importance, which
justifies removing the faster inline asm.
2014-04-19 15:48:30 +02:00
wm4 c4f5dc0d53 vf_eq: remove slow inline asm
Compiled with -O2, the C code runs just as far (or even slightly faster)
then the MMX inline asm.
2014-04-19 15:38:04 +02:00
James Ross-Gowan 0ab3482f73 w32_common: use ToUnicode to translate key input
This replaces translate_key_input with a solution that gives mpv more
control over how keyboard input is converted to unicode. As a result:

- Key up/down events are generated the same way for all keys.
- Dead keys generate their base character instead of being combined with
  the following character.
- Many Ctrl and Ctrl+Alt key combinations that were previously broken
  are fixed, since it's possible to discover the base keys.
- AltGr doesn't produce special characters when mp_input_use_alt_gr is
  false.

This also fixes some logic to do with detecting AltGr and adds proper
UTF-16 decoding.
2014-04-17 22:52:19 +02:00
wm4 491f5bc9ac vo_opengl: make spline36 default with --vo=opengl-hq 2014-04-17 21:53:42 +02:00
wm4 9dba2a52db player: add a --dump-stats option
This collects statistics and other things. The option dumps raw data
into a file. A script to visualize this data is included too.

Litter some of the player code with calls that generate these
statistics.

In general, this will be helpful to debug timing dependent issues, such
as A/V sync problems. Normally, one could argue that this is the task of
a real profiler, but then we'd have a hard time to include extra
information like audio/video PTS differences. We could also just
hardcode all statistics collection and processing in the player code,
but then we'd end up with something like mplayer's status line, which
was cluttered and required a centralized approach (i.e. getting the data
to the status line; so it was all in mplayer.c). Some players can
visualize such statistics on OSD, but that sounds even more complicated.
So the approach added with this commit sounds sensible.

The stats-conv.py script is rather primitive at the moment and its
output is semi-ugly. It uses matplotlib, so it could probably be
extended to do a lot, so it's not a dead-end.
2014-04-17 21:47:00 +02:00
Alexander Preisinger 49cbc174c1 wayland: unset input regions for osd
Set a zero sized input region for the osd surfaces in order to avoid getting
input for the subsurfaces which might dissapear any time.
2014-04-16 16:38:54 +02:00
Alexander Preisinger 5528ad3031 wayland/shm: Use subsurfaces for OSD 2014-04-16 16:38:54 +02:00
wm4 cad6425c46 video: remove use of deprecated AVFrame fields on Libav
qscale export has been completely removed from Libav 10, and FFmpeg has
an alternative API, so this code does nothing and only causes
deprecation warnings on Libav.
2014-04-15 19:55:26 +02:00
wm4 e1f1b0c275 vf_vapoursynth: handle destruction more gracefully
We were relying on vsscript_freeScript() to take care of proper
termination. But it doesn't do that: it doesn't wait for the filters to
finish and exit at all. Instead, it just destroys all objects, which
causes the worker threads to crash sometimes.

Also, we're supposed to wait for the frame callback to finish before
freeing the associated node.

Handle this by explicitly waiting as far as we can. Probably fixes
crashes on seeking, although VapourSynth itself might also need some
work to make this case completely stable.
2014-04-14 20:51:27 +02:00
wm4 186fd0311d video: change image format names, prefer mostly FFmpeg names
The most user visible change is that "420p" is now displayed as
"yuv420p". This is what FFmpeg uses (almost), and is also less confusing
since "420p" is often confused with "420 pixels vertical resolution".

In general, we return the FFmpeg pixel format name. We still use our own
old mechanism to keep a list of exceptions to provide compatibility for
a while.

Also, never return NULL for image format names. If the format is unset
(0/IMGFMT_NONE), return "none". If the format has no name (probably
never happens, FFmpeg seems to guarantee that a name is set), return
"unknown".
2014-04-14 20:51:27 +02:00
wm4 7178257bb6 vf_vapoursynth: wipe vapoursynth state completely on reloading
Before this commit, the filter attempted to keep the vsscript state
(p->se) even when the script was reloaded. Change it to destroy the
script state too on reloading. Now no workaround for LoadPlugin is
necessary, and this also fixes a weird theoretical race condition when
destroying and recreating the mpv source filter.
2014-04-14 18:03:13 +02:00
wm4 78128bddda Kill all tabs
I hate tabs.

This replaces all tabs in all source files with spaces. The only
exception is old-makefile. The replacement was made by running the
GNU coreutils "expand" command on every file. Since the replacement was
automatic, it's possible that some formatting was destroyed (but perhaps
only if it was assuming that the end of a tab does not correspond to
aligning the end to multiples of 8 spaces).
2014-04-13 18:03:01 +02:00
Kevin Mitchell f09134b76d vf_lavfi: copy AVFrame metadata into vf_lavfi priv
store it as mp_tas and add VFCTRL_GET_METADATA to access it from elsewhere

Signed-off-by: wm4 <wm4@nowhere>

old-configure test by wm4.
2014-04-13 18:03:01 +02:00
Kevin Mitchell 0a278f92e6 vf_lavfi: fix ffmpeg deprecation warning for avfilter_graph_parse
use avfilter_graph_parse_ptr for ffmpeg
2014-04-13 18:03:01 +02:00
Kevin Mitchell 7305140a8a vf: auto-label video filters if no label is specified
Signed-off-by: wm4 <wm4@nowhere>
2014-04-13 18:03:01 +02:00
Kevin Mitchell 7ae2eb8e2c vf: add vf_control_by_label to send vfctrl to specific filter 2014-04-13 18:03:01 +02:00
Ricardo Vieira 586b02e7bd wayland: don't schedule resize if going fullscreen
mpv was resizing to the same size before it went to fullscreen, we don't need to schedule a resize because the compositor will send a configure event with the new dimensions and thats when we should do it.
2014-04-13 15:30:23 +02:00
wm4 7ded55f667 vf_vapoursynth: print an error if VapourSynth returns an unknown format
Apparently there is no real format negotiation, so this can actually
happen.
2014-04-13 12:30:57 +02:00
wm4 8161f4374c vf_vapoursynth: error out early if the file sub-option is not set
Instead of crashing by possibly passing a NULL pointer to VapourSynth.
2014-04-13 12:29:40 +02:00
wm4 33f822b715 video: add VapourSynth filter bridge
Mainly meant to apply simple VapourSynth filters to video at runtime.
This has various restrictions, which are listed in the manpage.

Additionally, this actually copies video frames when converting frame
references from mpv to VapourSynth, and a second time when going from
VapourSynth to mpv. This is inefficient and could probably be easily
improved. But for now, this is simpler, and in fact I'm not sure if
we even can references VapourSynth frames after the core has been
destroyed.
2014-04-12 19:31:50 +02:00
wm4 04bcb539fd encode: write 2-pass stats only per-packet
The stats were retrieved and written on every encode call, instead of
every encode call that actually returned a packet. ffmpeg.c also does it
this way, so it must be "more correct". Fixes 2-pass encoding.
2014-04-11 00:08:32 +02:00
wm4 a20aa15969 sws_utils: remove custom GBRP conversion
We needed this because the OSD rendering path used GBRP for RGB
rendering, and not all swscale versions supported this conversion. But
recently we've dropped support for very old ffmpeg/libav versions, so
this isn't needed anymore.
2014-04-10 00:07:25 +02:00
wm4 708f32b746 vo_vdpau: add an additional check for timestamp robustness
This might be a good idea in order to prevent queuing a frame too far in
the future (causing apparent freezing of the video display), or dropping
an infinite number of frames (also apparent as freezing).

I think at this point this is most of what we can do if the vdpau time
source is unreliable (like with Mesa). There are still inherent race
conditions which can't be fixed.
2014-04-08 20:16:53 +02:00
wm4 a62276bf56 vo_vdpau: document what WRAP_ADD does
This wasn't necessarily clear.
2014-04-08 19:13:15 +02:00
wm4 a748b62709 vo_vdpau: simplify previous vsync timestamp calculation
The strange thing about this code was the shift parameter of the
prev_vs2 function. The parameter is used to handle timestamps before the
last vsync, since the % operator handles negative values incorrectly.
Most callers set shift to 0, and _usually_ pass a timestamp after the
last vsync. One caller sets it to 16, and can pass a timestamp before
the last timestamp.

The mystery is why prev_vs2 doesn't just compensate for the % operator
semantics in the most simple way: if the result of the operator is
negative, add the divisor to it. Instead, it adds a huge value to it
(how huge is influenced by shift). If shift is 0, the result of the
function will not be aligned to vsyncs.

I have no idea why it was written in this way. Were there concerns about
certain numeric overflows that could happen in the calculations? But I
can't think of any (the difference between ts and vc->recent_vsync_time
is usually not that huge). Or is there something more clever about it,
which is important for the timing code? I can't think of anything
either.

So scrap it and simplify it.
2014-04-08 19:02:57 +02:00
wm4 929793be7f vo_vdpau: simplify time management and make it more robust
vo_vdpau used a somewhat complicated and fragile mechanism to convert
the vdpau time to internal mpv time. This was fragile as in it couldn't
deal well with Mesa's (apparently) random timestamps, which can change
the base offset in multiple situations. It can happen when moving the
mpv window to a different screen, and somehow it also happens when
pausing the player.

It seems this mechanism to synchronize the vdpau time is not actually
needed. There are only 2 places where sync_vdptime() is used (i.e.
returning the current vdpau time interpolated by system time).

The first call is for determining the PTS used to queue a frame. This
also uses convert_to_vdptime(). It's easily replaced by querying the
time directly, and adding the wait time to it (rel_pts_ns in the patch).

The second call is pretty odd: it updates the vdpau time a second time
in the same function. From what I can see, this can matter only if
update_presentation_queue_status() is very slow. I'm not sure what to
make out of this, because the call merely queries the presentation
queue. Just assume it isn't slow, and that we don't have to update the
time.

Another potential issue with this is that we call VdpPresentationQueueGetTime()
every frame now, instead of every 5 seconds and interpolating the other
calls via system time. More over, this is per video frame (which can be
portantially dropped, and not per actually displayed frame. Assume this
doesn't matter.

This simplifies the code, and should make it more robust on Mesa. But
note that what Mesa does is obviously insane - this is one situation
where you really need a stable time source. There are still plenty of
race condition windows where things can go wrong, although this commit
should drastically reduce the possibility of this.

In my tests, everything worked well. But I have no access to a Mesa
system with vdpau, so it needs testing by others.

See github issues #520, #694, #695.
2014-04-07 18:37:12 +02:00
Stefano Pigozzi aa77f5dd3c gl_lcms: properly expand the cache filename being written
This is needed to preserve the same path used when opening the cache file, and
correctly expands ~ when icc-cache is added to the mpv config file.
2014-04-05 18:13:00 +02:00
wm4 d26db0662a vo_vdpau: more debugging output
Might help to debug certain problems with Mesa.
2014-04-03 19:41:09 +02:00
Stefano Pigozzi c2c9cb2bbf gl_lcms: fix build when lcms2 is not available
Was broken in b0ee9334e.
2014-03-31 22:31:24 +02:00
Stefano Pigozzi 12e2290703 vo_corevideo: remove unused variable 2014-03-31 22:10:33 +02:00
Stefano Pigozzi b0ee9334e3 vo_opengl, cocoa: allow to autoselect a color profile
This commit adds support for automatic selection of color profiles based on
the display where mpv is initialized, and automatically changes the color
profile when display is changed or the profile itself is changed from
System Preferences.

@UliZappe was responsible with the testing and implementation of a lot of this
commit, including the original implementation of `cocoa_get_icc_profile_path`
(See #594).

Fixes #594
2014-03-31 22:07:33 +02:00
wm4 9db08cf53b vf_eq: don't malloc priv struct
There wasn't any reason for this. In fact, it's a memory leak. The
proper priv struct is already allocated vf.c and the option parser.
2014-03-30 10:19:02 +02:00
wm4 d27613b690 Fix compilation on OSX and win32
Probably.
2014-03-29 03:40:49 +01:00
wm4 bd0618f01f video/out: remove legacy colorspace stuff
Reduce most dependencies on struct mp_csp_details, which was a bad first
attempt at dealing with colorspace stuff. Instead, consistently use
mp_image_params.

Code which retrieves colorspace matrices from csputils.c still uses this
type, though.
2014-03-29 00:25:08 +01:00
wm4 fdeda359f7 mp_image: add missing field to mp_image_params_equals()
This is pretty obscure, so it didn't matter much. It still breaks
switching output levels at runtime, because the video output is not
reinitialized with the new params.
2014-03-28 23:13:41 +01:00
wm4 7f39b4655e vo_opengl: runtime icc profile switching
The changes in vo_opengl.c are merely for adding the icc options to the
set of options than can be changed with the vo_cmdline command.
2014-03-24 23:33:10 +01:00
wm4 ba62e01cd3 x11_common: fix some problems with window dragging
There were some bad interactions with the OSC.

For one, dragging the OSC bar, and then moving the mouse outside of the
OSC (while mouse button still held) would suddenly initiate window
dragging. This was because win_drag_button1_down was not reset when
sending a normal mouse event, which means the window dragging code can
become active even after we've basically decided that the preceding
click didn't initiate window dragging.

Second, dragging the window and clicking on the OSC bar after that did
nothing. This was because no mouse button up event was sent to the core,
even though a mouse down event was sent. So make sure the key state is
erased with MP_INPUT_RELEASE_ALL.
2014-03-22 02:12:20 +01:00
wm4 9be93d6b60 vdpau: remove pointer indirection for a field
There's no reason to. This is basically a cosmetic change.
2014-03-19 19:57:08 +01:00
wm4 917650fefa vdpau: fix decoder init return value 2014-03-19 19:35:25 +01:00
wm4 19f101db68 x11: implement window dragging by grabbing
We don't check whether the WM supports _NET_WM_MOVERESIZE_MOVE, but
if it doesn't, nothing bad happens. There might be a race condition
when pressing a button, and then moving the mouse and releasing the
button at the same time; then the WM might get the message to initiate
moving the window after the mouse button has been released, in which
case the result will probably be annoying. This could possibly be fixed
by sending _NET_WM_MOVERESIZE_CANCEL on button release, but on the
other hand, we probably won't receive a button release event in this
situation, so ignore this problem.

The dragging is initiated only when moving the mouse pointer after a
click in order to reduce annoying behavior when the user is e.g.
doubleclicking.

Closes #608.
2014-03-18 20:43:45 +01:00
wm4 422af1b948 vaapi: solve potential problem with ambiguous image formats
VAAPI has some ambiguous image formats, like VA_FOURCC_I420,
VA_FOURCC_IYUV, VA_FOURCC_YV12 (the latter exactly the same as the first
two, just with swapped planes). There is potentially a problem when one
specific VAAPI format was picked, and converting it to a mpv format and
back to a VAAPI FourCC would result in a numerically different format
(even if it's actually the same). Then it could e.g. happen that
functions like va_surface_upload() reallocate the underlying VAImage,
which would be inefficient. Change the code so that this can't happen.

(Probably not a problem in practice with the current VAAPI usage.)
2014-03-17 18:23:24 +01:00
wm4 123c34a12e vaapi: simplify
Merge va_surface_priv into va_surface.
2014-03-17 18:22:48 +01:00
wm4 49d13f76ca vaapi: make struct va_surface private
It's not really needed to be public. Other code can just use mp_image.
The only disadvantage is that the other code needs to call an accessor
to get the VASurfaceID.
2014-03-17 18:22:35 +01:00
wm4 31fc5e8563 vaapi: replace image pool implementation with mp_image_pool
Although I at first thought it would be better to have a separate
implementation for hwaccels because the difference to software images
are too large, it turns out you can actually save some code with it.

Note that the old implementation had a small memory management bug. This
got painted over in commit 269c1e1, but is hereby solved properly.

Also note that I couldn't test vf_vavpp.c (due to lack of hardware), and
I hope I didn't accidentally break it.
2014-03-17 18:22:25 +01:00
wm4 88aa3b8c98 mp_image_pool: add features needed for use with hwaccel
The plan is to get rid of the custom VAAPI and possibly VDPAU surface
allocators.

Add custom surface allocation, because hwaccel surfaces are allocated
completely differently from software surfaces.

Add optional LRU allocation, which is (probably) helpful for hwaccel,
but (probably) less optimal for software surfaces.

mp_image_pool_get_no_alloc() is specifically for VAAPI, which can't
allocate new decoder surfaces after decoder init.
2014-03-17 18:21:29 +01:00
wm4 6389507314 vdpau: remove legacy pixel formats
They were used by ancient libavcodec versions. This also removes the
need to distinguish vdpau image formats at all (since there is only
one), and some code can be simplified.
2014-03-17 18:21:11 +01:00
wm4 4e70335c2f vdpau: remove unused type 2014-03-17 18:20:44 +01:00
wm4 5ed24862c0 video: change image format from unsigned int to int in some places
Image formats used to be FourCCs, so unsigned int was better. But now
it's annoying and the only difference is that unsigned int is more to
type than int.
2014-03-17 18:19:57 +01:00
wm4 6aa2d1f120 img_format: AV_PIX_FMT_FLAG_ALPHA is always available
We no more support ancient libavutil versions.
2014-03-17 18:19:28 +01:00
wm4 8fbf0300d8 vd_lavc: reinit hwdec on profile changes
Needed in theory. I don't know if there are even any real-world files
which change the profile mid-stream.
2014-03-17 18:19:03 +01:00
wm4 3db3653227 video: fix FFmpeg or Libav being a special snowflake 2014-03-16 16:23:12 +01:00