Commit Graph

467 Commits

Author SHA1 Message Date
wm4 77e1e8e38e audio: refactor mixer code and delete mixer.c
mixer.c didn't really deserve to be separate anymore, as half of its
contents were unnecessary glue code after recent changes. It also
created a weird split between audio.c and af.c due to the fact that
mixer.c could insert audio filters. With the code being in audio.c
directly, together with other code that unserts filters during runtime,
it will be possible to cleanup this code a bit and make it work like the
video filter code.

As part of this change, make the balance code work like the volume code,
and add an option to back the current balance value. Also, since the
balance semantics are unexpected for most users (panning between the
audio channels, instead of just changing the relative volume), and there
are some other volumes, formally deprecate both the old property and the
new option.
2016-07-17 19:21:28 +02:00
Timotej Lazar 91a1b17104 Use - as command-name separator everywhere
Old-style commands using _ as separator (e.g. show_progress) were still
used in some places, including documentation and configuration files.
This commit updates all such instances to the new style (show-progress)
so that commands are easier to find in the manual.
2016-07-14 22:37:42 +02:00
Niklas Haas a14f9249c4 command: add properties for HDR metadata
Since it turns out that knowing what exactly a file was tagged with can
be useful for debugging purposes, expose this as a property so I can
check it more easily.

This is mostly useful for sig-peak (since nom-peak is currently entirely
calculated by us), but I added both for consistency.
2016-07-13 11:03:42 +02:00
Uros Vampl c5827387fd audio: show an osd bar when changing ao-volume
also, make the osd msg prettier
2016-07-10 19:49:28 +02:00
wm4 995c47da9a audio: drop --softvol=no and --softvol=auto
Drop the code for switching the volume options and properties between
af_volume and AO volume controls. interface-changes.rst mentions the
changes in detail.

Do this because this was exceedingly complex and had other problems as
well. It was also very hard to test. It's just not worth the trouble.

Some leftovers like AOCONTROL_HAS_PER_APP_VOLUME will be removed at a
later point.

Fixes #3322.
2016-07-09 18:31:18 +02:00
wm4 71a8aa2e9a command: don't delay progress updates to next video frame 2016-07-08 13:46:15 +02:00
wm4 d72bcc8041 player: rewrite deinterlace filter auto-insertion
Instead of using the "vf" command code (which changes filters at runtime
on user input), use the general filter-insertion code. The latter was
added later, and is more suitable for automatically inserted filters.

The old code failed in particular when using watch-later saving, which
stored the filter list in the resume config file. If a user changed the
hardware decoding mode via command line, the stored filter chain was out
of date and could cause failure due to not working with hardware or
software decoding mode. Storing the deinterlace filter in the filter
list was unavoidable, because it was part of the user state. (The new
code only edits the actually instantiated filters.)
2016-07-05 21:10:26 +02:00
Niklas Haas d81fb97f45 mp_image: split colorimetry metadata into its own struct
This has two reasons:

1. I tend to add new fields to this metadata, and every time I've done
so I've consistently forgotten to update all of the dozens of places in
which this colorimetry metadata might end up getting used. While most
usages don't really care about most of the metadata, sometimes the
intend was simply to “copy” the colorimetry metadata from one struct to
another. With this being inside a substruct, those lines of code can now
simply read a.color = b.color without having to care about added or
removed fields.

2. It makes the type definitions nicer for upcoming refactors.

In going through all of the usages, I also expanded a few where I felt
that omitting the “young” fields was a bug.
2016-07-03 19:42:52 +02:00
wm4 549a9ea6fa command: pack sub image data in overlay-add command
Working towards refcounted sub images, and also for removing bitmap
packers from VOs.

I'm not sure why we even have this overlay-add command. It was sort of
"needed" before opengl-cb was introduced, and before Lua scripts could
put ASS drawings on OSD without conflicting with the OSC. But now trying
to use it doesn't make too much sense anymore.

Still keep it because we're trying to be nice, but throw performance out
of the window. Now image data is copied 2 more times before displaying
it. This also makes using the command a bit simpler.
2016-07-01 20:22:09 +02:00
wm4 22291a2587 command: improve playlist* properties change notifications
Until now, only the "playlist" property itself had proper change
notification. Extend it to all other properties as well.

Fixes #3267 (hopefully).
2016-06-20 21:35:59 +02:00
wm4 bb9aad097a player: do not update OSD all the time when paused
Normally, OSD is updated every time the playloop is run. This has to be
done, because the OSD may implicitly reference various properties,
without knowing whether they really need to be updated or not. (There's
a property update mechanism, but it's mostly unavailable, because OSD is
special-cased and can not use the client API mechanism properly.)

Normally, these updates are no problem, because the OSD is only actually
printed when the OSD text actually changes.

But commit d23ffd24 added a rate-limiting mechanism, which tries to
limit OSD updates at most every 50ms (or the next video frame). Since it
can't know in advance whether the OSD is going to change or not, this
simply waked up the player every 50ms.

Change this so that the player is updated only as part of general
updates determined through mp_notify(). (This function also notifies the
client API of changed properties.) The desired result is that the player
will not wake up at all in normal idle mode, but still update properties
that can change when paused, such as the cache.

This is mostly a cosmetic change (in the sense of making runtime
behavior just slightly better). It has the slightly more negative
consequence that properties which update implicitly (such as "clock")
will not update periodically anymore.
2016-06-11 18:40:08 +02:00
Niklas Haas ff37d7efec vo_opengl: refactor performance data properties
Instead of having 9 different properties, requiring 18 different
VOCTRLs to read them all, they are now exposed as a single property.
This is not only cleaner (since they're all together) but also allows
querying all 9 of them with only a single VOCTRL (by using
mp.get_property_native).

(The extra factor of 2 was due to an extra query being needed to get the
type, which is now also unnecessary)

This makes it much easier to access performance metrics from within a
lua script, and also makes it easier to just show a readable, formatted
version via show-text.
2016-06-08 22:11:38 +02:00
Niklas Haas 393a069112 vo_opengl: expose performance timers as properties
This is plumbed through a new VOCTRL, VOCTRL_PERFORMANCE_DATA, and
exposed as properties render-time-last, render-time-avg etc.

All of these numbers are in microseconds, which gives a good precision
range when just outputting them via show-text. (Lua scripts can
obviously still do their own formatting etc.)

Signed-off-by: wm4 <wm4@nowhere>
2016-06-07 12:17:25 +02:00
wm4 0348cd080f video: remove d3d11 video processor use from OpenGL interop
We now have a video filter that uses the d3d11 video processor, so it
makes no sense to have one in the VO interop code. The VO uses it for
formats not directly supported by ANGLE (so the video data is converted
to a RGB texture, which ANGLE can take in).

Change this so that the video filter is automatically inserted if
needed. Move the code that maps RGB surfaces to its own inteorp backend.
Add a bunch of new image formats, which are used to enforce the new
constraints, and to automatically insert the filter only when needed.

The added vf mechanism to auto-insert the d3d11vpp filter is very dumb
and primitive, and will work only for this specific purpose. The format
negotiation mechanism in the filter chain is generally not very pretty,
and mostly broken as well. (libavfilter has a different mechanism, and
these mechanisms don't match well, so vf_lavfi uses some sort of hack.
It only works because hwaccel and non-hwaccel formats are strictly
separated.)

The RGB interop is now only used with older ANGLE versions. The only
reason I'm keeping it is because it's relatively isolated (uses only
existing mechanisms and adds no new concepts), and because I want to be
able to compare the behavior of the old code with the new one for
testing. It will be removed eventually.

If ANGLE has NV12 interop, P010 is now handled by converting to NV12
with the video processor, instead of converting it to RGB and using the
old mechanism to import that as a texture.
2016-05-29 19:00:55 +02:00
wm4 49f73eaf7b vf_d3d11vpp: add a D3D11 video processor filter
Main use: deinterlacing.

I'm not sure how to select the deinterlacing mode at all. You can
enumate the available video processors, but at least on Intel, all of
them either signal support for all deinterlacers, or none (the latter is
apparently used for IVTC). I haven't found anything that actually tells
the processor _which_ algorithm to use.

Another strange detail is how to select top/bottom fields and field
dominance. At least I'm getting quite similar results to vavpp on Linux,
so I'm content with it for now.

Future plans include removing the D3D11 video processor use from the
ANGLE interop code.
2016-05-28 19:28:08 +02:00
wm4 ca87e623b5 command: add playlist-pos-1 property
This has often been requested for use on OSD. I don't really like having
such "special" properties, but whatever. Hopefully this will be the only
case.

Untested because I'm too damn lazy.

Fixes #2828.
2016-05-26 18:44:01 +02:00
wm4 70b3561270 video: add --hwdec=auto-copy mode
This uses the normal autoprobing rules like "auto", but rejects anything
that isn't flagged as copying data back to system memory.

The chunk in command.c was dead code, so remove it instead of updating
it.
2016-05-11 16:20:13 +02:00
wm4 46fff8d31a video: refactor how VO exports hwdec device handles
The main change is with video/hwdec.h. mp_hwdec_info is made opaque (and
renamed to mp_hwdec_devices). Its accessors are mainly thread-safe (or
documented where not), which makes the whole thing saner and cleaner. In
particular, thread-safety rules become less subtle and more obvious.

The new internal API makes it easier to support multiple OpenGL interop
backends. (Although this is not done yet, and it's not clear whether it
ever will.)

This also removes all the API-specific fields from mp_hwdec_ctx and
replaces them with a "ctx" field. For d3d in particular, we drop the
mp_d3d_ctx struct completely, and pass the interfaces directly.

Remove the emulation checks from vaapi.c and vdpau.c; they are
pointless, and the checks that matter are done on the VO layer.

The d3d hardware decoders might slightly change behavior: dxva2-copy
will not use the VO device anymore if the VO supports proper interop.
This pretty much assumes that any in such cases the VO will not use any
form of exclusive mode, which makes using the VO device in copy mode
unnecessary.

This is a big refactor. Some things may be untested and could be broken.
2016-05-09 20:03:22 +02:00
maniak1349 7d9eab15f0 win32: make taskbar progress indication optional
Add --taskbar-progress command line option and property which controls taskbar
progress indication rendering in Windows 7+. This option is on by default and
can be toggled during playback.

This option does not affect the creation process of ITaskbarList3. When the
option is turned off the progress bar is just hidden with TBPF_NOPROGRESS.

Closes #2535
2016-05-08 17:05:20 +02:00
wm4 e5e1088c92 command: use NBSP for spacing after current marker for OSD lists
Requested. Will prevent odd layout for playlists with URLs longer than
the screen.
2016-05-04 21:51:35 +02:00
wm4 833375f88d command: change some hwdec properties
Introduce hwdec-current and hwdec-interop properties.

Deprecate hwdec-detected, which never made a lot of sense, and which is
replaced by the new properties. hwdec-active also becomes useless, as
hwdec-current is a superset, so it's deprecated too (for now).
2016-05-04 16:55:26 +02:00
wm4 05c398fb6c command: slightly nicer OSD list formatting
For "current" markers on OSD properties like chapter-list. The marker is
now an actual arrow instead of "> ", and non-current entries will have
the same indentation as the current entry.

While I'm not entirely sure about the new look of those lists, it's a
bit better than the visual mess that was before.
2016-05-03 22:41:53 +02:00
wm4 485ae095f7 osd: make osd_ass_0/1 defines
So we can concatenate them with strings at compile time.
2016-05-03 22:29:12 +02:00
wm4 0ed206abd9 command: don't seek immediately when setting a-b loop when paused
Because it's annoying and feels unnatural.

If the B point is set while paused, don't seek. If not paused, it should
properly loop immediately.

In theory there's a chance that it will show at least 1 frame after the
loop point when setting the B point. But let's not care about that.
2016-04-28 22:46:49 +02:00
trUSTssc e232f1a731 player: fix memleak when using video-frame-info 2016-04-24 20:44:01 +02:00
wm4 1944a34c23 command: if only ab-loop-b is set, loop from start of file
Commit 382bafcb changed the behavior for ab-loop-a. This commit changes
ab-loop-b so that the behavior is symmetric.

Adjust the OSD rendering accordingly to the two changes.

Also fix mentions of the "ab_loop" command to the now preferred
"ab-loop".
2016-04-21 22:15:36 +02:00
wm4 8db9206c54 player: simplify an aspect of buffering determination
Calculate the buffering percentage in the same code which determines
whether the player is or should be buffering. In particular it can't
happen that percentage and buffering state are slightly out of sync due
to calling DEMUXER_CTRL_GET_READER_STATE and reusing it with the
previously determined buffering state.

Now it's also easier to guarantee that the buffering state is updated
properly.

Add some more verbose output as well.

(Damn I hate this code, why did I write it?)
2016-04-19 22:01:30 +02:00
wm4 382bafcb13 player: loop on end of file if ab-loop-b is unset
Possibly slightly more useful/intuitive.
2016-04-18 21:33:19 +02:00
wm4 fbb5da0010 command: log property set calls
And remove the same thing from the client API code.

The command.c code has to deal with many specialized M_PROPERTY_SET_*
actions, and we bother with a subset only.
2016-04-15 13:20:05 +02:00
wm4 177f5d9e9c command: allow setting panscan etc. properties if no video is active
In that case, it merely changes the underlying option value.
2016-04-15 11:32:40 +02:00
wm4 89571312bf command: add keepaspect property
Just a bridge to the option.

(Did I ever mention that I hate the property/option separation.)
2016-04-08 15:08:23 +02:00
wm4 57506b27ed cache: use a single STREAM_CTRL for various cache info
Instead of having a separate for each, which also requires separate
additional caching in the demuxer. (The demuxer adds an indirection,
since STREAM_CTRLs are not thread-safe.)

Since this includes the cache speed, this should fix #3003.
2016-03-29 11:29:52 +02:00
wm4 e1264d3976 command: add video-stereo-mode property
Enables runtime change of the option.

Fixes #2994.
2016-03-28 19:40:47 +02:00
wm4 ba4569cf70 command: change "cache-speed" OSD formatting
Also change the property to an int, since using double is questionable
and pointless.
2016-03-22 22:29:15 +01:00
wm4 5f1ff78516 command: add cache-speed property
Should reflect I/O speed.

This could go into the terminal status line. But I'm not sure how to put
it there, since it already uses too much space, so it's not there yet.
2016-03-20 19:51:22 +01:00
wm4 37aee2304a command: dump tracklist if sub-add is run with the "cached" flag
mp_switch_track() doesn't do it automatically for whatever reason, so do
it here.
2016-03-14 16:34:09 +01:00
wm4 953ff6b390 demux: replace demux_pause/demux_unpause with demux_run_on_thread
This pause stuff is bothersome and is needed only for a few corner-
cases. This commit removes it from the demuxer public API and replaces
it with a demux_run_on_thread() function and refactors the code which
needed demux_pause(). The next commit will change the implementation.
2016-03-09 23:55:34 +01:00
wm4 7387766445 command: change stream-pos semantics
Changing the byte stream position without cooperation of the demuxer
seems a bit insane, and is certainly useless. A user should do factor
seeks instead. For formats like ts, this will actually translate to byte
seeks, while treating the rest of the playback chain a bit more
gracefully. With this argument, remove write access to this property.

If someone really complains, proper byte seeks could be added as seek
mode (although I'm going to need a convincing argument for this).

Read access changes too, but in a more subtle way.
2016-03-09 23:34:04 +01:00
wm4 876a3bafc5 osd: cleanup: make OSDTYPE_ constants private to OSD code
No need to have them everywhere. The only exception/annoyance is
MAX_OSD_PARTS, which is now basically duplicated (and at runtime
initialization is checked with an assert()).
2016-03-08 22:01:57 +01:00
wm4 a888f08b78 command: fix property notification for cache-buffering-state 2016-03-02 13:57:30 +01:00
wm4 33774e18ed command: add encoder-list property
Also change decoder-list (for the sake of sharing the underlying code
for both properties).
2016-03-01 21:46:57 +01:00
wm4 4bb94f1306 command: export canonical ffmpeg version identifier
Was printed only with "mpv -h" or so.
2016-02-29 20:59:20 +01:00
wm4 d7de123110 command: export list of all decoders
Was only available via --vd=help and --ad=help (i.e. not at all via
client API). Not bothering with separating audio and video codecs, since
this list isn't all that useful anyway in general. If someone complains,
a type field could be added.
2016-02-29 20:57:56 +01:00
wm4 0a1e926670 command: export more information under track-list
Export a number of container fields, which may or may not be useful in
some scenarios. They are explicitly marked as originating from the
demuxer, in order to make it explicit that they might be unreliable.

I'd actually like to remove all other cases where container information
is exported, but those numerous cases are going to be somewhat hard to
deprecate.

Also, not directly related, export the description of the currently
active decoder. (This has been requested before.)
2016-02-29 20:56:08 +01:00
wm4 b5f620ae75 player: remove unused MPContext.stream field
It was just dead code.

Also fixes the stream-open-filename property, which is supposed to be
read-only if a file was already opened.
2016-02-23 23:08:24 +01:00
wm4 ae55896f42 player: remove old timeline/ordered chapters support 2016-02-15 21:03:51 +01:00
wm4 b7f6dfc19a player: force refresh seek when changing audio filters
Unfortunately I see no better solution.

The refresh seek is skipped if the amount of buffered audio is not
overly huge.

Unfortunately softvol af_volume insertion still can cause this issue,
because it's outside of the normal dynamic filter chain changing code.

Move the video refresh call to reinit_video_filters() to make it more
uniform along with the audio code.
2016-02-09 22:19:01 +01:00
wm4 b4f63cbbec input: ignore --input-cursor for events injected by input commands
Apparently useful for window embedding.

Fixes #2750.
2016-02-04 23:01:15 +01:00
wm4 155f7fac9d sub: implement "sub-seek 0"
For bitmap subs, implement it properly. For libass, you need newest git
master.

Fixes #2791.
2016-02-04 22:48:13 +01:00
wm4 35bdb63952 command: fix track cycling logic
Also remove the unused function argument.

Fixes #2784.
2016-02-03 09:05:05 +01:00