Commit Graph

2264 Commits

Author SHA1 Message Date
wm4 6238491688 vo_opengl: force redraw when framestepping with interpolation
This might fix some problems when framestepping with interpolation
enabled. The problem here is that we want to show the non-interpolated
frame while paused. Framestepping is like unpausing the video for a
frame, and then pausing again. This draws an interpolated frame, and
redrawing on pausing is supposed to take care of this.

This possibly didn't always work, because vo->want_redraw is not checked
by the vo_control() code path. So wake up the VO thread (which takes
care of servicing redraw requests, kind of) explicitly.

The correct solution is getting rid of the public-writable want_redraw
field and replacing it with a new vo_request_redraw() function, but this
can come later.
2015-08-25 21:31:37 +02:00
wm4 1ec1b4186c vd_lavc: bump number of allocated surfaces for hwdec with HEVC 2015-08-24 23:02:40 +02:00
wm4 2172c22ee3 vaapi: add HEVC profile entries
libavcodec does not support HEVC via VAAPI yet, so this won't work.
However, there is ongoing work to add HEVC support to VAAPI, and this
change might help with testing. (Or maybe not - but there is no harm in
this change.)
2015-08-24 23:00:45 +02:00
wm4 3bbcbc15a5 vda, videotoolbox: guard against unexpected pixel format
Should not happen, but since we don't control decoder video surface
allocation, anything could happen, and the code should be able to deal
with it. Untested.
2015-08-23 21:41:54 +02:00
wm4 fb5368b159 vda, videotoolbox: fix broken condition in screenshot code
Fixes #2237.
2015-08-23 11:32:49 +02:00
wm4 1e4113040c vo_opengl: remove dead code
Leftover from 3245bfef.
2015-08-22 21:05:32 +02:00
Jari Vetoniemi d29e699491 gl_wayland: Wait for frame callbacks
Keep glSwapInterval(0) on to avoid blocking on gl calls, but wait for
frame callbacks so we play nice with compositor.
2015-08-21 00:01:01 +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
Jari Vetoniemi 3245bfefc3 gl_wayland: eglSwapInterval(0) to avoid blocking
This makes mesa not wait for frame callback internally.
2015-08-21 00:01:01 +02:00
Niklas Haas e1fd80097c vo_opengl: add tscale-clamp option
This significantly reduces the amount of noticeable flashing when using
tscale kernels with negative lobes, by cutting them off completely.

I'm not sure if this has any negative effects. It needs a bit of
subjective testing over a period of time, so I just made it an option.

Fixes #2155.
2015-08-20 21:55:19 +02:00
wm4 96648169e3 vo_rpi: disable background by default
And add an option to enable it.
2015-08-20 19:07:18 +02:00
wm4 895c8801a2 gl_rpi: destroy the EGLSurface too
Most likely doesn't matter much.
2015-08-20 15:21:01 +02:00
wm4 0d5541af47 vo_rpi: use correct variable for osd layer
This is a cosmetic change, because the value is exactly the same. (The
old code just duplicates the logic, sort of.)
2015-08-20 15:20:20 +02:00
wm4 b8fe17f2e6 vo_rpi: fix blackscreen before the first subtitle/OSD is rendered
The OSD overlay wasn't initialized, so it remained solid black until the
first time a subtitle line or an OSD element became visible.
2015-08-20 10:36:32 +02:00
wm4 bffd78748f vd_lavc: remove unneeded hwdec parameters
All hwdec backends now use a single pixel format, and the format is
always checked.

Also, the init_decoder callback is now mandatory.
2015-08-19 21:33:18 +02:00
wm4 5eb6466e54 vo_rpi: redraw subtitles only on change
Since vo_rpi uses MMAL for video output, which is completely
independent from the GLES overlay, we can just not redraw the
GLES screen if subtitles do not change.

(As a furhter optimization, the dispmanx overlay could be removed
if nothing is visible. But I'm not sure if adding and removing the
overlay frequently is a good idea for performance, so this could
just as well go the other way.)
2015-08-18 23:09:37 +02:00
wm4 58ba2a9087 vo_rpi: use EGL to render subtitles
Slightly faster than using the dispmanx mess (perhaps to a large amount
due to the rather stupid C-only unoptimized ASS->RGBA blending code).

Do this by reusing vo_opengl's subtitle renderer, and vo_opengl's RPI
backend.
2015-08-18 23:01:09 +02:00
wm4 c36c596b7b rpi: factor out context creation
To be used by vo_rpi.c. No functional changes.
2015-08-18 23:00:51 +02:00
wm4 6894858bf2 video: fix VideoToolbox/VDA autodetection
This affects vo_opengl_cb in particular: it'll most likely auto-load
VDA, and then the VideoToolbox decoder won't work. And everything fails.

This is mainly caused by FFmpeg using separate pixfmts for the _same_
thing (CVPixelBuffers), simply because libavcodec's architecture demands
that hwaccel backends are selected by pixfmts. (Which makes no sense,
but now we have the mess.)

So instead of duplicating FFmpeg's misdesign, just change the format to
our own canonical one on the image output by the decoder. Now the GL
interop code is exactly the same for VDA and VT, and we use the VT name
only.
2015-08-17 23:51:31 +02:00
wm4 a6e33b4290 vo_rpi: fix NULL pointer deref
Can happen in obscure situations and with hw decoding disabled.
2015-08-14 13:20:00 +02:00
wm4 baeead7181 vo_rpi: simplify background handling
Apparently this is sufficient.
2015-08-13 17:25:15 +02:00
wm4 a6a585d470 vo_rpi: unregister vsync callback
Small bug, much pain.
2015-08-13 17:23:31 +02:00
wm4 0ba44d5fef vo_rpi: skip OSD rendering when repeating frames
It's unnecessary and slow. Doesn't help too much, though.
2015-08-13 12:23:18 +02:00
wm4 c7329e5118 vo: fix video EOF with display-sync
We must not use the frame PTS in any case. In this case, it fails
because nothing sets it up to wake up. This typically caused the player
to apparently "pause", until something else waked it up, like moving the
mouse and other events.
2015-08-12 10:46:29 +02:00
Rodger Combs 533e151feb cocoa: hide cursor using a blank image instead of a system-wide API
Fixes #503
2015-08-11 08:02:58 +02:00
wm4 e77bc570d7 vo_rpi: support display sync
This VO is special because it normally doesn't block on vsync, but can
be made to do so. Supposedly the MMAL video output API merely sets a
"current frame" field when sending an output frame, and the firmware
will pick up whatever frame that field is set to at the time of a
vsync.
2015-08-10 18:48:45 +02:00
wm4 031555fbe6 player: add display sync mode
If this mode is enabled, the player tries to strictly synchronize video
to display refresh. It will adjust playback speed to match the display,
so if you play 23.976 fps video on a 24 Hz screen, playback speed is
increased by approximately 1/1000. Audio wll be resampled to keep up
with playback.

This is different from the default sync mode, which will sync video to
audio, with the consequence that video might skip or repeat a frame once
in a while to make video keep up with audio.

This is still unpolished. There are some major problems as well; in
particular, mkv VFR files won't work well. The reason is that Matroska
is terrible and rounds timestamps to milliseconds. This makes it rather
hard to guess the framerate of a section of video that is playing. We
could probably fix this by just accepting jittery timestamps (instead
of explicitly disabling the sync code in this case), but I'm not ready
to accept such a solution yet.

Another issue is that we are extremely reliant on OS video and audio
APIs working in an expected manner, which of course is not too often
the case. Consequently, the new sync mode is a bit fragile.
2015-08-10 18:48:45 +02:00
wm4 8d66bd76e2 video: remove old vdpau hwaccel API usage
While the "old" libavcodec vdpau API is not deprecated (only the very-
old API is), it's still relatively complicated code that badly
duplicates the much simpler newer vdpau code. It exists only for the
sake of older FFmpeg releases; get rid of it.
2015-08-10 00:07:35 +02:00
Philip Langdale 0c23325b3a vf_vdpaurb: Don't segfault if input mpi is null
This will happen when input EOF is reached but output frames remain
to be shown.
2015-08-05 18:56:41 +02:00
Sebastien Zwickert 31b5a211f4 hwdec: add VideoToolbox support
VDA is being deprecated in OS X 10.11 so this is needed to keep hwdec working.
The code needs libavcodec support which was added recently (to FFmpeg git,
libav doesn't support it).

Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2015-08-05 17:47:30 +02:00
wm4 417e256c21 vo_vdpau: fix frame scheduling if display FPS is unknown
Pretty stupid: vo_get_vsync_interval() returns a negative value if the
display FPS is unknown (e.g. xrandr not compiled), and the comparison
whether the value is below 0 fails later because it's assigned to an
unsigned int.

Regression since commit e3d85ad4.

Also, fix some comments in vo.c.
2015-08-04 19:23:07 +02:00
wm4 c3803e3254 vo: fix inverted condition
When full_redraw is set, we always need to take the draw_image path. If
it's not set, we can try VOCTRL_REDRAW_FRAME (and fallback to draw_image
if that fails).

Fixes #2184.
2015-08-03 20:21:10 +02:00
wm4 aa0157d9b8 image_writer: don't use jpeg baseline, and remove useless jpeg options
The jpeg-optimize and jpeg-baseline options were undocumented, and
they're also pretty useless. There's no reason to ever change them.

Also, don't write jpeg baseline images. This just makes compression
worse for the sake of rather questionable compatibility with ancient
decoders.
2015-08-02 01:10:18 +02:00
wm4 ee58e7cfe5 vo: correctly account for dropped frames
If the framedrop count happens to be incremented with
vo_increment_drop_count() during rendering, these increments were
counted twice, because these events also set in->dropped_frame.
2015-08-01 22:16:52 +02:00
wm4 5b14ceb315 vo_opengl: minor simplifications
No functional changes.
2015-08-01 21:11:38 +02:00
wm4 41101c2996 win32: revert wchar_t changes
Revert "win32: more wchar_t -> WCHAR replacements"
Revert "win32: replace wchar_t with WCHAR"

Doing a "partial" port of this makes no sense anymore from my
perspective. Revert the changes, as they're confusing without
context, maintenance, and progress. These changes were a bit
premature anyway, and might actually cause other issues
(locale neutrality etc. as it was pointed out).
2015-08-01 21:09:11 +02:00
wm4 fefac2c941 win32: more wchar_t -> WCHAR replacements
This was essentially missing from commit 0b52ac8a.

Since L"..." string literals have the type wchar_t[], we can't use them
for UTF-16 strings. Use C11 u"..." string literals instead. These have
the type char16_t[], but we simply assume char16_t is the same
underlying type as WCHAR. In practice, they're both unsigned short.

For this reason use -std=c11 on Windows. Since Windows is a "special"
environment (we require either MinGW or Cygwin), we don't need to worry
too much about compiler compatibility.
2015-07-30 21:50:11 +02:00
wm4 c8fab7cc7b vo_direct3d: create multithreaded IDirect3DDevice9
A user complains that it leads to the dxva driver failing, leading to
messages like this:

[ffmpeg/video] h264: Failed to execute: 0x8007000e
[ffmpeg/video] h264: hardware accelerator failed to decode picture

Reportedly, this happens only with vo_direct3d, not with vo_opengl. The
only difference is that vo_direct3d attempts to share the D3D device
with the decoder. Possibly the error is that the device in the VO is not
created with D3DCREATE_MULTITHREADED. Change this.

Probably fixes #2178.
2015-07-30 21:26:42 +02:00
wm4 0b52ac8a78 win32: replace wchar_t with WCHAR
WCHAR is more portable. While at least MinGW, Cygwin, and MSVC actually
use 16 bit wchar_t, Midipix will have 32 bit wchar_t. In that context,
using WCHAR instead is more portable.

This affects only non-MinGW parts, so not all uses of wchar_t need to
be changed. For example, terminal-win.c won't be used on Midipix at
all. (Most of io.c won't either, so the search & replace here is more
than necessary, but also not harmful.)

(Midipix is not useable yet, so this is just preparation.)
2015-07-29 00:01:32 +02:00
wm4 f15e652dd4 vo_opengl: framebuffers work under GLES 2
They are not entirely full-featured in GLES 2, but they appear to
provide all we need. Thus we can enable them.
2015-07-27 23:27:49 +02:00
wm4 2cfd87ab15 vo_opengl: slightly more informative message when disabling scalers 2015-07-27 23:18:19 +02:00
wm4 51ca8a4b3e vo_rpi: determine and return display refresh rate
Reverse engineered from tvservice.c.
2015-07-27 21:09:24 +02:00
wm4 68d5e7a986 vo_opengl: minor cleanup to hwdec texture setting code
Instead of special-casing hwdec in the place where the video textures
are used, just set the textures in the image upload function. The
renderer code doesn't need to know whether hwdec interop is used at all.
2015-07-26 21:44:57 +02:00
wm4 bdc60daffa vo_opengl: remove legacy GL detection
This detected whether an OpenGL context still provided legacy OpenGL if
the OpenGL version is modern (>= 3.0). This was actually only needed for
vo_opengl_old, because it relied on legacy functions. Since it's gone,
this code isn't needed either.

(Also, the removed comment about OpenGL 3.0 was wrong: you could just
query GL_CONTEXT_FLAGS and see if the forward compatible bit was set.)
2015-07-24 23:34:43 +02:00
Niklas Haas 86a60a4dd2 vo_opengl: fix scale=oversample's threshold calculations
This resulted in wrong behavior for values of scale-param1 between 0.0
and 0.5 (not inclusive).
2015-07-23 21:53:03 +02:00
wm4 281c21b7f1 video: don't restrict --vd-lavc-threads to a maximum of 16
Only do it when the number of threads is autodetected, as more than 16
threads are still considered not recommended. (libavcodec prints a
warning.)
2015-07-23 17:17:26 +02:00
wm4 b492720c7c Revert "vo_opengl: make the size of interpolation textures exact"
This reverts commit fb8d158366.

Reallocating the FBOs on every resize is very slow. It affects resizing
the window, as well as changing the video size itself with e.g.
panscan. Since the original change was done based on a single user
complaint, but the change itself caused a lot of complaints, we decided
to just revert it.
2015-07-22 23:57:09 +02:00
wm4 e5fac76b3b vf_scale: cleanup log messages
In particular, get rid of the EUSERBROKEN message.
2015-07-20 21:16:37 +02:00
wm4 4a1657da01 vo: minor simplification for queue size handling
Instead of calling it "future frames" and adding or subtracting 1 from
it, always call it "requested frames". This simplifies it a bit.

MPContext.next_frames had 2 added to it; this was mainly to ensure a
minimum size of 2. Drop it and assume VO_MAX_REQ_FRAMES is at least 2;
together with the other changes, this can be the exact size of the
array.
2015-07-20 21:12:46 +02:00
Niklas Haas 6f7d04be21 vo_opengl: add temporal-dither-period option
This was requested multiple times by users, and it's not hard to
implement and/or maintain.
2015-07-20 19:32:58 +02:00