Commit Graph

40682 Commits

Author SHA1 Message Date
Niklas Haas a51045bddd
manpage: add recommended values to :gamma suboption
These were derived from dividing our assumed video gamut (1.961) by some
typical screen values (2.2 for dimly lit and 2.4 for pitch black):

1.961/2.4 = 0.8170833333333334 ~= 0.8
1.961/2.2 = 0.8913636363636364 ~= 0.9
2015-02-03 08:48:54 +01:00
Niklas Haas fa1698cb9a vo_opengl: always clamp the video to range 0-1
Before this, enabling :gamma in combination with :sigmoid and probably a few
other things results in ugly artifacts because the video isn't clamped until
after the :gamma was applied (or at all, if the cms_matrix is unused).
2015-02-03 08:47:48 +01:00
Stefano Pigozzi 5de7f1c5ac ao_coreaudio: fix small memory leak 2015-02-03 00:40:02 +01:00
Stefano Pigozzi de4f997752 ao_coreaudio: use device UID instead of ID for selection
Previously we let the user use the audio device ID, but this is not persistent
and can change when plugging in new devices. That of course made it quite
worthless for storing it as a user setting for GUIs, or for user scripts.

In theory getting the kAudioDevicePropertyDeviceUID can fail but it doesn't
on any of my devices, so I'm leaving the error reporting quite high and see if
someone complains.
2015-02-03 00:40:02 +01:00
Stefano Pigozzi a3be14683a command: add property returning detected audio device
This can be useful to adjust some other audio related properties
at runtime depending on the audio device being used.
2015-02-03 00:40:02 +01:00
wm4 dd287a3276 win32: don't resize when window is minimized
At least the opengl-hq VO allocates additional resources when
downscaling a lot, which is just a waste.

Also see #1547 (although I doubt that this is the cause; if it is,
a real fix will be required).
2015-02-02 22:52:13 +01:00
wm4 2a9534871d command: add property returning detected hwdec API
This is somewhat imperfect, because detection of hw decoding APIs is
mostly done on demand, and often avoided if not necessary. (For example,
we know very well that there are no hw decoders for certain codecs.)

This also requires every hwdec backend to identify itself (see hwdec.h
changes).
2015-02-02 22:43:13 +01:00
wm4 c07e046bfa player: add external audio file auto-loading
Apparently some people want this. Not enabled by default.

Fixes #967.
2015-02-02 21:23:12 +01:00
wm4 cf8fa2bdd4 options: slightly improve help output for choice and flag options 2015-02-02 18:07:37 +01:00
wm4 c8631b3b06 command: add properties returning the current VO and AO driver
This wasn't possible before.
2015-02-02 18:07:37 +01:00
wm4 ef827af06c client API: add mpv_wait_async_requests()
This does what it's documented to do.

The implementation reuses the code in mpv_detach_destroy(). Due to the
way async requests currently work, just sending a synchronous dummy
request (like a "ignore" command) would be enough to ensure
synchronization, but this code will continue to work even if this
changes.

The line "ctx->event_mask = 0;" is removed, but it shouldn't be needed.
(If a client is somehow very slow to terminate, this could silence an
annoying queue overflow message, but all in all it does nothing.)

Calling mpv_wait_async_requests() and mpv_wait_event() concurrently is
in theory allowed, so change pthread_cond_signal() to
pthread_cond_broadcast() to avoid missed wakeups.

As requested in issue #1542.
2015-02-02 18:07:37 +01:00
wm4 9d8b00f1d6 command: add dummy get implementation for tv-channel property
A small cosmetic change with the effect that pressing 'k' shows
"unavailable" instead of "error" (even if no  TV code is active).
2015-02-02 18:07:37 +01:00
wm4 c45f2fe0ee vo_opengl: fix breakage with rotated video on initial display
Resizing was happening before reconfig, so src_rect_rot was outdated and
didn't include the rotation. This resulted in corrupted rendering on
initial display, which fixed itself after the first time the window was
somehow resized.
2015-02-02 18:07:37 +01:00
Stefano Pigozzi 568a0157ff osxbundle: don't try to package Python
This fixes usage when the bundle is used on the same machine that Python/Cython
was compiled on. It doesn't fix the harder problem of packaging a full Python
installation in the mpv app bundle (and I'm not sure we actually want that).

Fixes #1549
2015-02-02 16:11:11 +01:00
wm4 1ba03f6813 build: disable pdf build by default
rst2pdf keeps having sporadic layouting failures, causing build
failures.
2015-02-02 12:06:06 +01:00
wm4 44429544f5 demux_mkv: use unique IDs for cover art pseudo-tracks
Might fix behavior with mkv files that use ordered chapters and have
cover art tags. In my opinion, this should actually have worked (because
cover art pseudo-tracks are strictly appended), but I don't have a
sample file to test at hand.
2015-02-01 18:34:49 +01:00
wm4 5af4c81e5b player: dump audio jitter to stats file
This allows us to plot the difference between video timestamps, and the
adjusted video timestamps due to syncing video to audio speed.
2015-02-01 18:32:26 +01:00
wm4 12dbbcbb15 TOOLS/stats-conv: change unit of X-axis to seconds
...instead of milliseconds.
2015-02-01 18:26:24 +01:00
wm4 720eb187fd command: send additional property change events in-between loading
Opening the stream and opening the demuxer are both done asynchronously,
meaning the player reacts to client API requests. They also can
potentially take a while. Thus it's better to process outstanding
property changes, so that change events are sent for properties that
were changed during opening.
2015-02-01 18:25:12 +01:00
wm4 77664895a1 command: improve observability of some audio properties
In particular, this would fix the sending the initial change event. It
was easily missed because MPV_EVENT_FILE_LOADED usually triggered it,
but the actual property could change only later, because audio
initialization really is kind of asynchronous to it.

This probably fixes #1544.
2015-02-01 18:21:48 +01:00
wm4 6f1357d876 build: fix v4l2 support on NetBSD
It was accidentally broken. Tested by a NetBSD user. May help with other
BSDs.
2015-01-31 16:14:14 +01:00
wm4 a169a2fb79 player: don't treat audio playback restart while paused special
I guess this was supposed to be some sort of optimization, but even
though it probably works, it's pretty meaningless and I couldn't measure
a difference. One special case killed.
2015-01-30 23:54:43 +01:00
wm4 48f96f43ec player: minor simplification in A/V-sync related code
Just minor things.
2015-01-30 23:49:30 +01:00
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