Commit Graph

40409 Commits

Author SHA1 Message Date
wm4 3813c3804f Revert "player: allow seeking audio between video frames"
This reverts commit 7b3feecbc2.

It's broken, hr-seek never ends at a video position before seek pts.
Not sure what I was thinking, although it did work anyway when
artificially forcing a video frame to display before seek pts.
2015-01-30 23:42:01 +01:00
wm4 12d822ce44 ao_null: add emulation for certain broken behavior
I'm not sure how common this behavior possibly is; well whatever. This
option will allow reproducing such behavior, and help debugging it.
2015-01-30 21:30:54 +01:00
wm4 a7c43babb7 player: print desync message on negative A/V-sync too
At least there is _some_ problem if this happens. It would mean that
audio is playing slower than video. Normally, video is synced to audio,
so if audio stops playback completely, video will not advance at all.
But using things like --autosync, it's well possible that this kind of
desync happens.
2015-01-30 21:26:29 +01:00
wm4 e123c1dfcd player: rearrange some A/V-sync related code
Move the update_avsync_before_frame() call further down. Moving it
closer to where the time_frame value is used (and which the function
updates) should make the code more readable. With this change, there's
no need anymore to reset the time_frame value on the video reconfig
path.

Move the update_avsync_after_frame() up. Now no meaningful amount of
time passes since the previous get_relative_time() call anymore, and the
second one can be removed.
2015-01-30 21:18:30 +01:00
wm4 9d57e7d23c player: use correct type for some relative times
We use double for these things everywhere, just this code didn't. It
likely doesn't matter much, and this code is for an optional feature
too.
2015-01-30 21:10:39 +01:00
wm4 5f7de39942 av_common: add comment about using now-deprecated libavcodec field
FFmpeg and Libav have the stupid practice of replacing and deprecating
API symbols on the same day. So with FFmpeg git, this is useless and
will print a compile time warning, while it's required with all stable
releases, and might lead to decoding errors with xvid/avi (apparently).

Add a comment before someone writes a patch and I have to explain it all
over again.
2015-01-30 15:57:40 +01:00
wm4 697309fc48 vo_opengl: use triangle strip for video
A small simplification. Couldn't be done before, because it was also
used by the OSD code, which required disjoint quads in a single draw
call.

Also mess with the unrelated code in gl_osd.c to simplify it a little
as well.
2015-01-30 15:57:40 +01:00
wm4 1a26d1a01c README: mention that youtube-dl integration requires Lua 2015-01-30 11:13:14 +01:00
wm4 e6ddb1fe3f vo_opengl: don't unnecessarily call glDebugMessageCallback()
We still do redundant calls to it, but obviously we can avoid calling it
if we don't want to set a callback at all. May or may not help with
default.
2015-01-30 11:12:58 +01:00
wm4 c5e5f38563 vo_opengl: fix a cast
Basically, the OpenGL API is crap (it takes an offset as pointer).
2015-01-29 21:13:06 +01:00
wm4 1cd11c43ee command: change sub-visibility OSD message
Now it shows one of:
- "Subtitles hidden" (sub-visibility=no)
- "Subtitles visible" (sub-visibility=yes, sub!=no)
- "Subtitles visible (but no subtitles selected)" (otherwise)

It should be a bit more self-explanatory than before. On the other hand,
I have no clue about UI issues.

This also gets close to what's reasonably possible with the OSD
expansion string syntax, which is why it looks so awful.
2015-01-29 20:28:39 +01:00
wm4 547fd2a229 vf_vapoursynth: load Lua stdlib in Lua mode
If you can call this a "stdlib".
2015-01-29 19:57:40 +01:00
wm4 c80a1b7aa9 vo_opengl: let hwdec driver report the exact image format
Hardware decoding/displaying with vo_opengl is done by replacing the
normal video textures with textures provided by the hardware decoding
API OpenGL interop code. Often, this changes the format (vaglx and vdpau
return RGBA, vda returns packed YUV).

If the format is changed, there was a chance (or at least a higher
potential for bugs) that the shader generation code could be confused by
the mismatch of formats, and would create incorrect conversions.

Simplify this by requiring the hwdec interop driver to set the format it
will return to us. This affects all fields, not just some (done by
replacing the format with the value of the converted_imgfmt field in
init_format), in particular fields like colorlevels.

Currently, no hwdec interop driver does anything sophisticated, and the
win is mostly from the mp_image_params_guess_csp() function, which will
reset fields like colorlevels to expected value if RGBA is used.
2015-01-29 19:53:49 +01:00
wm4 e0e06f0f0c vo_opengl: move remaining OSD rendering parts to gl_osd.c
Reduces the size of gl_video.c a bit further.

This also uses a separate vertex array object for OSD elements, so the
video one can be simplified slightly.

OSD shader generation is still in gl_video.c, which leads to the strange
additional parameter to mpgl_osd_init(). The issue is that video
parameters influence the OSD shader (????), and also OSD needs to go
through the screen colormanagement.
2015-01-29 18:29:28 +01:00
wm4 20c5c7e521 vo_opengl: split out a helper for drawing primitives
Useful if we want to reduce the size of gl_video.c further.

To some degree this emulates traditional glDrawArrays() usage. It also
leaves a loophole for avoiding a reupload every time by leaving
ptr==NULL, although this is unused for now.
2015-01-29 17:19:01 +01:00
wm4 0bd147bd14 vo_opengl: some minor cleanups
default_tex_params() and texture_size() are each called only once, so
move inline/reimplement them at the caller.

image_dw/dh were unused. texture_w/h, image_format, and component_bits
were rarely used, and can be replaced. Regroup some other fields.

Rename surface_num to surface_idx, because the former sounded like a
count, and not an index. Move fbosurface_next() closer to its callers
too.

Move the DebugMessageCallback() code to gl_utils.c (also simplify it
by always setting the callback, instead of only when it changes).
2015-01-29 16:21:02 +01:00
wm4 1e67ce74d8 vo_opengl: force redraw on command line changes 2015-01-29 15:16:30 +01:00
wm4 14bbbffa99 vo_opengl: move FBO helper to gl_utils
This is somewhat messy, because fbotex_init() itself was depending on
some gl_video parameters unrelated to FBO creation (like what scaler was
in use - what the fuck did this check do in this function?), so this
commit does a bit more than moving code around. In particular, the FBO
for the separate scaling intermediate step now always uses GL_NEAREST
sampling, and all FBOs are destroyed/recreated on renderer
reinitialization.

This also moves the function matrix_ortho2d() - trivial enough not to
put it into a separate commit.
2015-01-29 15:16:17 +01:00
wm4 bf8abc0ca9 vo_opengl: fix shader issue with Intel drivers
Windows Intel drivers seem to reject some (AFAIK) valid GLSL. Make them
happy.

<rossy> GL_RENDERER='Intel(R) HD Graphics 4400'
<rossy> GL_VERSION='3.0.0 - Build 10.18.14.4080'
<rossy> GL_SHADING_LANGUAGE_VERSION='1.30 - Build 10.18.14.4080'
2015-01-29 15:15:14 +01:00
wm4 cd41d1c7eb player: move more code out of central playloop function
...into its own functions. The central playloop function is still too
big, but looks much cleaner now.

No changes in functionality. The code moved to handle_playback_restart()
is unindented by 1 level and moving it out of the if condition around.
The if condition is inverted and early-exits from the function. Also
some comments are changed.
2015-01-29 15:15:13 +01:00
wm4 86d4094b98 player: remove redundant variable
mpctx->audio_delay always has the same value as opts->audio_delay. (This
was not the case a long time ago, when the audio-delay property didn't
actually write to opts->audio_delay. I think.)
2015-01-29 15:15:01 +01:00
wm4 34d3a27f28 vo_opengl: create abstraction for VAOs
Handles stupid boilerplate OpenGL requires you to handle. It's the same
code as in gl_video.c, although if no VAOs are available, the fallback
code rebinds them on every draw call instead of just once.
2015-01-28 22:22:29 +01:00
wm4 616481ad29 vo_opengl: remove some unused functions
These were intended for some plans that were never realized.

Also move some comments around and fix them.
2015-01-28 19:40:52 +01:00
wm4 3583559164 vo_opengl: move utility functions from loader to a separate file
gl_common.c contained the function loader (which is big) and additional
utility functions (not so big, but will grow when moving more out of
gl_video.c). Just split them. There are no changes other than some
modifications to comments.
2015-01-28 19:40:46 +01:00
wm4 7b3feecbc2 player: allow seeking audio between video frames
This allows seeking audio between two video frames that are relatively
far away.

The implementation of this is a bit subtle. It pretend the audio
position is different, and the actual PTS adjustment happens in audio.c
with this line:

    sync_pts -= mpctx->audio_delay - mpctx->delay;

Effectively this is the same as setting sync_pts to hrseek_pts after
this line, though. (I'm actually not sure if this could be written in a
more straightforward way; probably yes.)
2015-01-28 19:40:12 +01:00
wm4 7f7340ce76 player: enable hr-seek on audio after video end
Some files can have audio after video has ended, and playback of the
audio-only remainder is supposed to work just fine.

Seeking is broken-ish though. Not much can be done about this, since
it's the way demuxers work. Also, such files are obscure corner cases.
But enabling hr-seek for audio after video end can improve the situation
a lot.

This helps with issue #1533. The reported also provided a command line
to produce such a file:

    ffmpeg -i image.jpg -i audio.flac -threads $(nproc) \
        -c:v libvpx -crf 10 -qmin 5 -qmax 55 \
        -vf scale=360:-1 -sws_flags lanczos -c:a libvorbis -ac 2 \
        -b:a 128K out.webm
2015-01-28 19:40:12 +01:00
Niklas Haas 8d15f7583c
vo_opengl: remove is_linear_rgb and clean up code
This opportunity for refactoring was enabled by f3c84a3.
2015-01-28 18:52:33 +01:00
Stefano Pigozzi 0a38d69ac0 man: expand on the smoothmotion documentation
Hopefully this will clear up how the thing is supposed to work (and that it's
not SVP, nor MVTools).
2015-01-28 14:19:32 +01:00
wm4 cbd2de6884 vo_opengl: fix the fix for fixing odd video sizes
Commit acb40644 fixed video with unaligned luma/chroma sizes. It
attempted to disable the fix for videos where it effectively does
nothing (just some minor performance paranoia), but this check was
broken - fix it by not duplicating the logic for this.
2015-01-28 13:50:39 +01:00
wm4 f3c84a322d vo_opengl: fix display of ARGB ith color management enabled
PNG uses a different component order from GL_RGBA, so we upload the
surface using the "wrong" order, and then fix it in the shader. This
breaks if a sRGB texture (GL_SRGB) is used: the hardware will not touch
the alpha channel, which means that the B component is not adjusted,
leading to incorrect output.

Just remove the use of sRGB textures completely. It might lead to a
slight slow down when playing RGB with color management enabled, but
with this combination of obscure use case with minor performance impact
it's not a meaningful disadvantage.

Unfortunately this also means that alpha is handled incorrectly with our
own color management, but alpha isn't so important and can be fixed
later. (0.0 and 1.0 are unchanged by the transfer function, so it
"mostly" works.)

Fixes #1530.
2015-01-28 13:36:07 +01:00
Diogo Franco (Kovensky) 631c256819 player: demote matroska ordered chapter scanning messages to Verbose
Causes a lot of terminal spam on large folders and is not actually
useful except maybe for debugging.
2015-01-28 11:43:48 +09:00
wm4 b473477fc5 vf_ilpack: remove this filter
This was apparently useful for correct interlaced scaling (although I
don't know anyone who used this). It was rarely used (if at all), had an
inconvenient output format (packed YUV), and now has a better solution
in libavfilter (using the libavfilter "scale" filter via vf_lavfi).
There is no reason to keep this filter any longer.
2015-01-27 19:13:51 +01:00
wm4 86bba0dc5b vf_divtc: remove this filter
Better solutions are available in vf_vapoursynth and vf_lavfi. The only
user I know who used this is now using vf_vapoursynth.
2015-01-27 19:10:13 +01:00
wm4 97f32fdb23 vf_phase: remove this filter
If you really want it, it's in libavfilter and can be used via vf_lavfi.
2015-01-27 19:06:59 +01:00
wm4 82e3d06f09 vf_swapuv: remove this filter
It's entirely useless. I left it in for a while, because the analog TV
code had a transitional bug that could switch chroma planes, but it was
fixed long ago. It's also available in libavfilter.
2015-01-27 19:04:02 +01:00
wm4 c92f4a1126 vf_softpulldown: remove this filter
Apparently it was completely broken and essentially did nothing. This
was broken sometime in early mpv or mplayer2 times.

Get rid of it. If you _really_ need it, wait until FFmpeg ports it from
MPlayer, which will happen very soon.
2015-01-27 18:58:16 +01:00
wm4 69e5dd9bce vf_pullup: remove builtin implementation
Now it requires libavfilter. The wrapper is left in place, so FFmpeg
users will not notice any change. On Libav, the filter stops working.
2015-01-27 18:53:28 +01:00
Ben Boeckel 2bbad06bfc ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAIL
The macro actually returns the *available* space in the array, not how
much is actually filled in.
2015-01-27 18:09:36 +01:00
wm4 acb40644db vo_opengl: change the way unaligned chroma size is handled
This deals with subsampled YUV video that has odd sizes, for example a
5x5 image with 4:2:0 subsampling.

It would be easy to handle if we actually passed separate texture
coordinates for each plane to the shader, but as of now the luma
coordinates are implicitly rescaled to chroma one. If luma and chroma
sizes don't match up, and this is not handled, you'd get a chroma shift
by 1 pixel.

The existing hack worked, but broke separable scaling. This was exposed
by a recent commit which switched to GL_NEAREST sampling for FBOs. The
rendering was accidentally scaled by 1 pixel, because the FBO size used
the original video size, while textures_sizes[0] was set to the padded
texture size (i.e. one pixel larger).

It could be fixed by setting the padded texture size only on the first
shader. But somehow that is annoying, so do something else. Don't pad
textures anymore, and rescale the chroma coordinates in the shader
instead.

Seems like this somehow doesn't work with rectangle textures (and
introduces a chroma shift), but since it's only used when doing VDA
hardware decoding, and the bug occurs only with unaligned video sizes, I
don't care much.

Fixes #1523.
2015-01-27 18:09:03 +01:00
Martin Herkt f6e05b14b2 manpage: fix rst2pdf build
Uhhh… What???
2015-01-27 08:46:46 +01:00
wm4 00b2611352 command: export more details about file seekability
If a file is unseekable (consider e.g. a http server without resume
functionality), but the stream cache is active, the player will enable
seeking anyway. Until know, client API user couldn't know that this
happens, and it has implications on how well seeking will work. So add a
property which exports whether this situation applies.

Fixes #1522.
2015-01-26 13:46:33 +01:00
wm4 792db4eee3 player: fix framestep over timeline segment boundaries
This was subtly broken by commit a937ba20. Instead of framestepping over
the timeline segment boundary, it would just unpause playback, because
seeking now resets mpctx->step_frames. This was especially apparent when
doing something like "mpv *.jpg --merge-files".

Fix by restoring the step_frames field specifically if the seek is done
for switching segment boundaries. Hopefully the number fields which need
such an exception on seeking won't grow and turn this code into a mess.
2015-01-26 12:29:27 +01:00
wm4 751830da32 vo: handle very long frame durations with smoothmotion enabled
With mf://, rather long frame durations are common. By default, one
frame takes 1 second. This causes the if branch changed with this commit
to always being taken, which in turn leads to the player not being woken
up correctly. (As a consequence, it "freezes" by waiting for events that
never come, and moving the mouse cursor over the window will wake it up
again and advance video.)

Obviously, the code should account for how long the video frame takes.
The code is probably still not fully correct, but for now this fixes the
issue at hand.

Fixes #1521.
2015-01-26 12:06:45 +01:00
wm4 9b8d3acc8b options: list correct default value for --screenshot-template
Make the default value part of the option metadata, instead of doing
this in the screenshot code. Makes more sense with --list-options and
the command.c option metadata properties.
2015-01-26 11:38:23 +01:00
wm4 96f7c96da0 msg: add --log-file option
This allows getting the log at all with --no-terminal and without having
to retrieve log messages manually with the client API. The log level is
hardcoded to -v. A higher log level would lead to too much log output
(huge file sizes and latency issues due to waiting on the disk), and
isn't too useful in general anyway. For debugging, the terminal can be
used instead.
2015-01-26 11:31:02 +01:00
wm4 637e3e975c manpage: document 'A' key
Of course this was forgotten in commit 189087c.
2015-01-26 10:01:17 +01:00
Diogo Franco (Kovensky) 484e9f8090 manpage: fix typo 2015-01-26 15:15:42 +09:00
wm4 06b1a2f145 manpage: fix smoothmotion-threshold value range 2015-01-26 07:05:59 +01:00
wm4 4a06a66501 vo_opengl: drop sRGB framebuffer detection
We've stopped using them some time ago (we're doing things manually
instead).
2015-01-26 06:12:35 +01:00
wm4 f033eaff9b options: make --hls-bitrate=max the default
The previous default ("no") seemed to be equivalent to "min" in practice
(though it might depend on the website, which is even worse).

Better just select the best stream by default.
2015-01-26 03:58:13 +01:00