Commit Graph

71 Commits

Author SHA1 Message Date
wm4 1a2319f3e4 options: remove deprecated sub-option handling for --vo and --ao
Long planned. Leads to some sanity.

There still are some rather gross things. Especially g_groups is ugly,
and a hack that can hopefully be removed. (There is a plan for it, but
whether it's implemented depends on how much energy is left.)
2016-11-25 21:17:25 +01:00
wm4 7177ef3e1c vo: remove unused VOCTRL_GET_PANSCAN
It was used to determine whether the VO supports VOCTRL_SET_PANSCAN.
With all those changes to property semantics this became unnecessary,
and its only use was dropped at some point.
2016-09-08 18:59:21 +02:00
wm4 69283bc0f8 options: deprecate suboptions for the remaining AO/VOs 2016-09-05 21:26:39 +02:00
Rostislav Pehlivanov 45687c17f7 wayland_common: fix fullscreen image switching bug
The problem was that when in fullscreen, switching between images did
not issue a resize event, causing none of the images to be rendered
correctly.
This fixes the problem by issuing a resize event with the screen width
and height.
This commit also moves the zeroing of the events field to when it gets
retrieved by mpv rather than randomly after a resize in the vo/backend
code.
2016-07-30 15:33:00 +02:00
Rostislav Pehlivanov c0ef3cf9c2 wayland: port to the new wakeup/wait_events framework
This fits natively into the vo/backend and allows to simplify the
polling code.
One new change is the fact that surface_handle_enter flags VO_EVENT_WIN_STATE
and VO_EVENT_RESIZE instead of only VO_EVENT_WIN_STATE. Before this, the code
hackily relied on the timeout and the loop in the wait_frame function to track
and set the scaling factor. Instead, this triggers mpv to run a schedule_resize
and adjust the new VO output dimensions immediately. This is also more accurate
since surface_handle_enter() gets called when a surface is created, moved and
resized, which is exactly what the rest of the player might be interested in.
2016-07-21 14:45:38 +02:00
Rostislav Pehlivanov 098ff4174c wayland: implement HIDPI support
The wayland protocol exposes scaling done by the compositor to
compensate for small window sizes on small high DPI displays. If the
program ignores the scaling done, what'll happen is the compositor is
going to ask the program to be scaled down by N times the window size and
then it'll upscale the program's surface by N times. The scaling
algorithm seems to be bilinear so the scaling is quite obvious.

This commit sets up callbacks to listen for the scaling factor of each
output and, on rescale events, notifies the compositor that the
surface's scale is what the compositor asked for and changes the
player's surface to the appropriate size, causing no scaling to be done
by the compositor.

Compositors not supporting this interface will ignore the callbacks and do
nothing, keeping program behaviour the same. For compositors supporting
and using this interface (mutter), this will fix the rendering to be pixel
precise as it should be.

Both the opengl wayland backend and the wayland vo have been fixed to support
this. Verified to not break either on weston and mutter.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2016-05-30 20:17:26 +02:00
wm4 3a015b9ec7 video: remove some useless old RGB formats
Some VOs had support for these - remove them.

Typically, these formats will have only some use in cases where using
RGB software conversion with libswscale is faster than letting the
VO/GPU do it (i.e. almost never). For the sake of testing this case,
keep IMGFMT_RGB565. This is the least messy format, because it has no
padding/alpha bits with unknown semantics.

Note that decoding to these formats still works. We'll let libswscale
repack the data to whatever the VO in use can take.
2016-01-25 10:43:35 +01:00
wm4 8a9b64329c Relicense some non-MPlayer source files to LGPL 2.1 or later
This covers source files which were added in mplayer2 and mpv times
only, and where all code is covered by LGPL relicensing agreements.

There are probably more files to which this applies, but I'm being
conservative here.

A file named ao_sdl.c exists in MPlayer too, but the mpv one is a
complete rewrite, and was added some time after the original ao_sdl.c
was removed. The same applies to vo_sdl.c, for which the SDL2 API is
radically different in addition (MPlayer supports SDL 1.2 only).

common.c contains only code written by me. But common.h is a strange
case: although it originally was named mp_common.h and exists in MPlayer
too, by now it contains only definitions written by uau and me. The
exceptions are the CONTROL_ defines - thus not changing the license of
common.h yet.

codec_tags.c contained once large tables generated from MPlayer's
codecs.conf, but all of these tables were removed.

From demux_playlist.c I'm removing a code fragment from someone who was
not asked; this probably could be done later (see commit 15dccc37).

misc.c is a bit complicated to reason about (it was split off mplayer.c
and thus contains random functions out of this file), but actually all
functions have been added post-MPlayer. Except get_relative_time(),
which was written by uau, but looks similar to 3 different versions of
something similar in each of the Unix/win32/OSX timer source files. I'm
not sure what that means in regards to copyright, so I've just moved it
into another still-GPL source file for now.

screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but
they're all gone.
2016-01-19 18:36:06 +01:00
wm4 0a0bb9059f video: switch from using display aspect to sample aspect
MPlayer traditionally always used the display aspect ratio, e.g. 16:9,
while FFmpeg uses the sample (aka pixel) aspect ratio.

Both have a bunch of advantages and disadvantages. Actually, it seems
using sample aspect ratio is generally nicer. The main reason for the
change is making mpv closer to how FFmpeg works in order to make life
easier. It's also nice that everything uses integer fractions instead
of floats now (except --video-aspect option/property).

Note that there is at least 1 user-visible change: vf_dsize now does
not set the display size, only the display aspect ratio. This is
because the image_params d_w/d_h fields did not just set the display
aspect, but also the size (except in encoding mode).
2015-12-19 20:45:36 +01:00
wm4 2e401201ad vo: remove VOCTRL_GET_RECENT_FLIP_TIME
It doesn't have any real purpose anymore. Up until now, it was still
implemented by vo_wayland, but since we changed how the frame callbacks
work, even that appears to be pointless.

Originally, the plan was to somehow extend this mechanism to all
backends and to magically fix frame scheduling, but since we can't hope
for proper mechanisms even on wayland, this idea looks way less
interesting.
2015-11-23 16:54:53 +01:00
wm4 291f301c10 video/out: remove an unused parameter
This parameter has been unused for years (the last flag was removed in
commit d658b115). Get rid of it.

This affects the general VO API, as well as the vo_opengl backend API,
so it touches a lot of files.

The VOFLAGs are still used to control OpenGL context creation, so move
them to the OpenGL backend code.
2015-10-03 18:20:16 +02:00
wm4 bd87598af9 vo_opengl: wayland: switch to new internal API 2015-10-01 22:57:02 +02:00
Jari Vetoniemi e05dc7bfb7 vo_wayland: Wait for frame callbacks
Privdes small api for vo_wayland where one can request frame callback
and then wait for it.

This will make vo_wayland play video smoothly.
2015-08-21 00:01:01 +02:00
Marcin Kurczewski 797277a233 Various spelling fixes
Signed-off-by: wm4 <wm4@nowhere>
2015-06-18 19:36:58 +02:00
Jari Vetoniemi 3f4e154ec6 vo_wayland: fix null dereference
If compositor sends configure event before back_buffer is allocated, it
will cause null dereference.
2015-03-23 21:53:32 +01:00
Jari Vetoniemi 3714430cdf vo_wayland: share frame callbacks.
Define frame callback logic in wayland_common.c
As this should be used by opengl renderer as well.

Preferably drawing should be skipped entierly when no frame callbacks
are received. However, for now only swap buffers is skipped.
2015-03-23 21:53:32 +01:00
wm4 5f2a8474ae video: uninline memcpy_pic functions
There's literally no reason why these functions have to be inline (they
might be performance critical, but then the function call overhead isn't
going to matter at all).

Uninline them and move them to mp_image.c. Drop the header file and fix
all uses of it.
2015-03-20 00:21:23 +01:00
wm4 51befc9deb osd: simplify an aspect of change detection handling
There was a somewhat obscure optimization in the OSD and subtitle
rendering path: if only the position of the sub-images changed, and not
the actual image data, uploading of the image data could be skipped. In
theory, this could speed up things like scrolling subtitles.

But it turns out that even in the rare cases subtitles have such scrolls
or axis-aligned movement, modern libass rarely signals this kind of
change. Possibly this is because of sub-pixel handling and such, which
break this.

As such, it's a worthless optimization and just introduces additional
complexity and subtle bugs (especially in cases libass does the
opposite: incorrectly signaling a position change only, which happened
before). Remove this optimization, and rename bitmap_pos_id to
change_id.
2015-03-18 13:15:20 +01:00
wm4 2858232220 vo: simplify VOs by adding generic screenshot support
At the time screenshot support was added, images weren't refcounted yet,
so screenshots required specialized implementations in the VOs. But now
we can handle these things much simpler. Also see commit 5bb24980.

If there are VOs in the future which can't do this (e.g. they need to
write to the image passed to vo_driver->draw_image), this still could be
disabled on a per-VO basis etc., so we lose no potential performance
advantages.
2015-01-24 23:16:27 +01:00
wm4 5e9f791667 video: separate screenshot modes
Use different VOCTRLs for "window" and normal screenshot modes. The
normal one will probably be removed, and replaced by generic code in
vo.c, and this commit is preparation for this. (Doing it the other way
around would be slightly simpler, but I haven't decided yet about the
second one, and touching every VO is needed anyway in order to remove
the unneeded crap. E.g. has_osd has been unused for a long time.)
2015-01-23 22:08:20 +01:00
wm4 a1ed13869c video: remove vfcap.h
And remove all uses of the VFCAP_CSP_SUPPORTED* constants. This is
supposed to reduce conversions if many filters are used (with many
incompatible pixel formats), and also for preferring the VO's natively
supported pixel formats (as opposed to conversion).

This is worthless by now. Not only do the main VOs not use software
conversion, but also the way vf_lavfi and libavfilter work mostly break
the way the old MPlayer mechanism worked. Other important filters like
vf_vapoursynth do not support "proper" format negotation either.

Part of this was already removed with the vf_scale cleanup from today.

While I'm touching every single VO, also fix the query_format argument
(it's not a FourCC anymore).
2015-01-21 22:08:24 +01:00
wm4 97b4b4c8e0 vo_wayland: drop redundant "const" 2014-11-07 09:28:58 +01:00
wm4 fce77c05f5 vo_wayland: don't use endian-specific defines
Instead, use the native-endian alias, and switch the wayland format
depending on the target platform's endian.

This drops support for swapped-endian formats, but I think that is ok.
Not only are the affected formats rather ancient and backwards, but
using swapped formats probably does not make any sense for performance
either.

Untested.
2014-11-05 01:52:20 +01:00
wm4 4e2574f025 command: make window-scale property observable
Add a generic mechanism to the VO to relay "extra" events from VO to
player. Use it to notify the core of window resizes, which in turn will
be used to mark all affected properties ("window-scale" in this case) as
changed.

(I refrained from hacking this as internal command into input_ctx, or to
poll the state change, etc. - but in the end, maybe it would be best to
actually pass the client API context directly to the places where events
can happen.)
2014-11-02 20:53:56 +01:00
Alexander Preisinger 95053ba78b vo_wayland: remove unnecessary check
buffer_pool_get_front now returns always a valid buffer.
No need for corner cases.
2014-09-16 15:54:10 +02:00
Alexander Preisinger 94fe57856d vo_wayland: pixel perfect buffers
1.  Separate buffer and temporary file handling from the vo to make maintenance
    and reading code easier

2.  Skip resizing as much as possible if back buffer is still busy.

3.  Detach and mark osd buffers for deletion if we want to redraw them and they
    are still busy. This could be a possible case for the video buffers as
    well. Maybe better than double buffering.

All the above steps made it possible to have resizing without any artifacts
even for subtitles. Also fixes dozen of bugs only I knew, like broken subtitles
for rgb565 buffers. I can now sleep at night again.
2014-09-10 19:10:19 +02:00
Alexander Preisinger 759fdcb2f9 vo_wayland: fix formatting inconsistencies 2014-08-20 16:40:33 +02:00
Alexander Preisinger 3bf83f7642 vo_wayand: save the flip time in the frame handler
This value is more accurate than the default value.
2014-08-20 16:35:06 +02:00
wm4 a4cfab7ee0 vo_wayland: fix redrawing logic
I must have broken it some time ago. The error case dealing with an
unavailable backbuffer was broken, and didn't handle memory management
correctly.
2014-08-16 17:09:59 +02:00
wm4 89391e7c94 vo: different hack for VOs which need to mangle mouse input
Follow up on commit 760548da. Mouse handling is a bit confusing, because
there are at least 3 coordinate systems associated with it, and it
should be cleaned up. But that is hard, so just apply a hack which gets
the currently-annoying issue (VO backends needing access to the VO) out
of the way.
2014-07-27 21:33:11 +02:00
wm4 760548da28 vo: hack to avoid threading issues with mouse input
VO backends which are or will run in their own thread have a problem
with vo_mouse_movement() calling vo_control(). Restrict this to VOs
which actually need this.
2014-07-26 20:31:26 +02:00
wm4 d9b1661895 vo_wayland: fix clearing the screen on reconfig
Do this simply by clearing the mapped buffer on every draw_image() call
without an actual video frame. (Maybe this is a bit expensive, but at
least not more expensive than regular video display.)
2014-06-18 20:22:10 +02:00
wm4 9accfe0426 video/out: fix redrawing with no video frame for some VOs
With the change to merge osd drawing into video frame drawing, some
bogus logic got in: they skipped drawing the OSD if no video frame is
available. This broke --no-video --force-window mode.
2014-06-18 20:04:59 +02:00
wm4 90cd5aa8c8 vo: make draw_image and vo_queue_image transfer image ownership
Basically a cosmetic change. This is probably more intuitive.
2014-06-17 23:05:50 +02:00
wm4 716285782d video/out: change aspects of OSD handling
Let the VOs draw the OSD on their own, instead of making OSD drawing a
separate VO driver call. Further, let it be the VOs responsibility to
request subtitles with the correct PTS. We also basically allow the VO
to request OSD/subtitles at any time.

OSX changes untested.
2014-06-15 20:53:15 +02:00
Alexander Preisinger 73121dbcc1 wayland: move subsurfaces to wayland vo
Subsurfaces are only used by the wayland vo. Thats why it makes sense to move
all osd and subsurface specific parts to the vo_wayland.c

Also destroy the subsurfaces and subcompositor properly.
2014-06-15 14:46:27 +02:00
wm4 a9538e17ad video: synchronize mpv rgb pixel format names with ffmpeg names
This affects packed RGB formats up to 16 bits per pixel. The old mplayer
names used LSB-to-MSB order, while FFmpeg (and some other libraries) use
MSB-to-LSB.

Nothing should change with this commit, i.e. no bit order or endian bugs
should be added or fixed. In some cases, the name stays the same, even
though the byte order changes, e.g. RGB8->BGR8 and BGR8->RGB8, and this
affects the user-visible names too; this might cause confusion.
2014-06-14 10:03:04 +02:00
wm4 fd5207f56d options: remove global variables for swscale options; rename them
Additionally to removing the global variables, this makes the options
more uniform. --ssf-... becomes --sws-..., and --sws becomes --sws-
scaler. For --sws-scaler, use choices instead of magic integer values.
2014-06-11 00:39:13 +02:00
wm4 f0ee4e8766 vo_wayland: always assume resize on reconfigure
It doesn't look like vo_wayland_config() necessarily sets this flag, so
it seems safer to trigger an explicit resize. This accounts for the case
when playing a new file with different size than the one before.
2014-05-06 23:18:57 +02:00
wm4 b51664c04a wayland: don't use VOCTRL_UPDATE_SCREENINFO
Not very tested. Appears to work.
2014-05-06 23:16:18 +02:00
Alexander Preisinger 5528ad3031 wayland/shm: Use subsurfaces for OSD 2014-04-16 16:38:54 +02:00
Alexander Preisinger a9eae4276d wayland/shm: fix leak in buffer pool
Rename it to reinit and check if parts of the pool are already allocated.
2014-03-06 14:43:20 +01:00
Alexander Preisinger 891268955e wayland/shm: remove unused define 2014-02-16 18:14:17 +01:00
wm4 958455ac39 vo_wayland: silence shadowing warning 2014-02-12 22:00:23 +01:00
Alexander Preisinger 0920dc1e26 wayland/shm: rewrite buffer handling
I was unhappy with the old way of handling buffers, especially resizing. But my
original plan to use wl_shm_pool_resize wasn't as good as I initially thought.
I might get back to it.

With the new buffer pools it now possible to select triple buffering. Also the
buffer pools are also needed for the upcoming subsurfaces for osd and subtitles.

I hope this change was worth it.
2014-02-11 18:44:53 +01:00
Alexander Preisinger 0670c541a5 wayland/shm: prevent the window from flying away
With the new xdg_shell the problem will be no gone by itself.
2014-02-11 18:11:14 +01:00
Alexander Preisinger 44bfe3b14a wayland: change minimum version
Change minimum version to 1.3 and remove the version checking in the source
code.
2014-02-02 08:46:13 +01:00
wm4 5c8ec31ba3 vo_wayland: silence shadowing warning
No real problem.
2014-01-29 17:16:36 +01:00
Alexander Preisinger cd2cfc8056 wayland/shm: RGB888 as default, change options
RGB565 is one of the fastest and most supported formats on low end consumer
devices, but ffmpeg spams warning when using it. Make it opt-in instead of
opt-out.
2014-01-28 13:52:12 +01:00
Alexander Preisinger 0f90288bf6 wayland/shm: fix memory leak 2014-01-28 13:30:58 +01:00