Commit Graph

261 Commits

Author SHA1 Message Date
wm4 63a414c708 command: make empty vf-metadata not an error
If a filter exists, but has no metadata, just return success. This
allows the user to distinguish between no metadata available, and filter
not inserted.

See #1408.
2014-12-30 14:04:53 +01:00
wm4 97ab40290e command: add filtered-metadata property
Goes in hand with the previous commit; the main purpose is to easily
show on OSD what is shown on terminal.
2014-12-29 23:03:39 +01:00
wm4 6618e5d69a player: make --shuffle/--merge-files affect runtime loaded playlists
Until now, these options took effect only at program start. This could
be confusing when e.g. doing "mpv list.m3u --shuffle". Make them always
take effect when a playlist is loaded either via a playlist file, or
with the "loadlist" command.
2014-12-29 22:08:22 +01:00
wm4 a608a0cd8e command: stip path from playlist OSD display
But only if it's not e.g. a http URL.

Fixes #1388.
2014-12-27 21:20:57 +01:00
wm4 6659de707b player: cosmetics: rename a function
Something which has this many important sideffects shouldn't start have
a "get" prefix.
2014-12-27 12:23:00 +01:00
wm4 adf7f0661e command: overlay_add: more flexible treatment of offset parameter
Essentially, don't make it the mmap() argument, and just add it to the
memory address. This hides tricky things like alignment reequirements
from the user.

Strictly speaking, this is not entirely backwards compatible: this adds
the regression that you can't access past 2 or 4 GB of a file on 32 bit
systems anymore. But I doubt anyone cared about this.

In theory, we could be clever, and just align the offset manually and
pass that to mmap(). This would also be transparent to the user, but
minimally more effort, so this is left as exercise to the reader.
2014-12-26 18:11:22 +01:00
wm4 3fdb6be316 win32: add mmap() emulation
Makes all of overlay_add work on windows/mingw.

Since we now don't explicitly check for mmap() anymore (it's always
present), this also requires us to make af_export.c compile, but I
haven't tested it.
2014-12-26 17:30:10 +01:00
wm4 7d43a7ea84 player: don't show "0%" percentage in infinite streams 2014-12-20 17:31:58 +01:00
wm4 c721948efe command: extend revert_seek command
"revert_seek mark" basically forces the seekback point. It's basically a
one-way bookmark.
2014-12-17 22:56:45 +01:00
wm4 c8727ed9fc command: format ${avsync} like on terminal status line
Padding with spaces is very useless for OSD (because most fonts are
variable width), but it's good when using it on the terminal, e.g. for
reproducing the default terminal status line.
2014-12-16 05:07:38 +01:00
wm4 5b618ef629 command, dvd: add property which returns list of DVD titles
This was requested.

It seems libdvdread can't get the duration for titlesets other than the
currently opened title. The data structures contain dangling pointers
for these, and MPlayer works this around by opening every title
separately for the purpose of dumping the title list.
2014-12-13 20:25:56 +01:00
wm4 d17c3b63c3 command: add properties for current bitrate
Fixes #1192.
2014-12-12 01:00:58 +01:00
wm4 efd3f6f0d2 command: fix crash with some forms of script_binding
"script_binding name ..." just crashed it. Oops.
2014-12-10 18:28:09 +01:00
wm4 f0cdd673a8 player: update chapter marks when switching files
This wasn't done, so the chapter marks of the previous file were
visible. It's harmless, but looks unpolished, so fix it.
2014-12-10 17:52:21 +01:00
wm4 c6dc0c6d99 command: add "idle" property
Yes, it's redundant with events.
2014-12-10 14:42:57 +01:00
wm4 900c2e9f78 player: change interaction between revert_seek and ab-loops
The result isn't quite what I imagined, because the A-point is never
marked as a seek point (so you can't jump between A and B), but it's
still slightly better than before.
2014-12-09 21:55:27 +01:00
wm4 b9f5daf9c3 player: make chapter seek to end jump to last frame with --keep-open
There were complaints that a chapter seek past the last chapter was
quitting the player. Change the behavior to what is expected: the last
frame.

If no chapters are available, this still does nothing.
2014-12-08 17:27:07 +01:00
wm4 87f5ba6ab3 command: avoid returning invalid FPS values
It's possible that fps is sometimes 0 in case it's unset.
2014-11-29 00:37:34 +01:00
wm4 78f0cb9281 command: sub_add with "auto" should not always select a subtitle track
Running "sub_add file.srt auto" during hook execution automatically
selected the first added track. This happened because all tracks added
with sub_add are marked as "external", and external subtitles are always
selected by default.

Fix this by negating the "external" flag when autoselecting subtitles
during loading. The no_default flag exists for this purpose; it was
probably added for libquvi originally, where we had the same issue.
2014-11-27 18:57:18 +01:00
wm4 28b6ce39d3 audio: make mp_chmap_to_str() return a stack-allocated string
Simplifies memory management.
2014-11-24 19:56:01 +01:00
wm4 5bbd734fff command: don't queue framesteps
If repeated framestep commands are sent, just unpause the player, instead
of playing N frames for N repeated commands.
2014-11-23 15:31:32 +01:00
wm4 ae5df9be98 input, lua: redo input handling
Much of it is the same, but now there's the possibility to distinguish
key down/up events in the Lua API.
2014-11-23 15:13:35 +01:00
wm4 85fb2af369 Remove some superfluous NULL checks
In all of these situations, NULL is logically not allowed, making the
checks redundant.

Coverity complained about accessing the pointers before checking them
for NULL later.
2014-11-21 05:18:09 +01:00
wm4 a1811211a2 command: dvd: better audio/video recovery on angle switching
Does the same thing as the drop_buffers command. When implementing that
command, it turned out that resetting the higher level playback state
was more effective for achieving smooth recovery.

Untested; I don't even have any DVDs or DVD images with multiple angles.
2014-11-20 22:45:02 +01:00
wm4 2d039e691f command: add drop_buffers
This command was actually requested on IRC ages ago, but I forgot about
it.

The main purpose is that the decoding state can be reset without issuing
a seek, in particular in situations where you can't seek.

This restarts decoding from the middle of the packet stream; since it
discards the packet buffer intentionally, and the decoder will typically
not output "incomplete" frames until it has recovered, it can skip a
large amount of data.

It doesn't clear the byte stream cache - I'm not sure if it should.
2014-11-20 22:41:50 +01:00
wm4 534b08e6ba command: add an ab_loop command
As suggested in #1241; to make using the feature easier.

Also add better OSD-formatting for the ab-loop-a/b properties.
2014-11-18 21:34:57 +01:00
wm4 5d1a3fb406 command: improve A-B loop behavior
If the B point is set, then loop back to A.

Also, update the OSD bar if necessary.
2014-11-18 20:28:54 +01:00
wm4 4bd6c91d9b command: implement A-B loops
Probably needs to be polished a bit more. Also, might require a key
binding that can set/clear the loop points in a more intuitive way.

For now, something like this can be put into input.conf to use it:

ctrl+y set ab-loop-a ${time-pos}    # set A
ctrl+x set ab-loop-b ${time-pos}    # set B
ctrl+c set ab-loop-a no             # clear (mostly)

Fixes #1241.
2014-11-18 01:36:35 +01:00
wm4 469eb321e8 command: adjust previous commit
Due to the current code structure, the "current" entry and the entry
which is playing can be different. This is probably silly, but still
try to mark the entries correctly.

Refs #1260.
2014-11-17 22:48:38 +01:00
wm4 ebd41bdf6c command: playlist property: return if an entry is currently playing
This actually doesn't even write/return the new sub-property, because
I dislike the idea of dumping that field for every single playlist
entry, even though it's "needed" only for one.

Fixes #1260.
2014-11-17 22:16:52 +01:00
wm4 508d236c9a command: list filters/VOs/AOs with option-info
Another special-case, but pretty simple after all.
2014-11-14 14:52:51 +01:00
wm4 5d12a2696e command: export some option metadata
This might be interesting for GUIs and such.

It's probably still a little bit insufficient. For example, the filter
and audio/video output lists are not available through this.
2014-11-13 18:01:27 +01:00
wm4 71168e740e command: rename "option-flags" property to "option-info" 2014-11-13 17:27:31 +01:00
wm4 13033ce2c4 command: make sub-properties more flexible
This makes it work with all kind of types, instead of just some simple
ones.
2014-11-13 17:26:22 +01:00
wm4 23e0682dd4 command: export mpv configure arguments as property
It seems strange that a client API user can't get this string, other
than analyzing the mpv log output.
2014-11-13 16:18:40 +01:00
wm4 88762cd6a7 player: make the osd-msg prefix work for playlist_next/prev
If input.conf e.g. contains "n osd-msg playlist_next", then pressing the
n key will switch to the next file, and display the filename on OSD.
2014-11-11 22:07:16 +01:00
wm4 5fd8a1e04c audio: make decoders output refcounted frames
This rewrites the audio decode loop to some degree. Audio filters don't
do refcounted frames yet, so af.c contains a hacky "emulation".

Remove some of the weird heuristic-heavy code in dec_audio.c. Instead of
estimating how much audio we need to filter, we always filter full
frames. Maybe this should be adjusted later: in case filtering increases
the volume of the audio data, we should try not to buffer too much
filter output by reducing the input that is fed at once.

For ad_spdif.c and ad_mpg123.c, we don't avoid extra copying yet - it
doesn't seem worth the trouble.
2014-11-10 22:02:05 +01:00
wm4 cb13d7fadb dvd, bluray: reload demuxer on title changes
Causes the player to reload the demuxer and to relist the found
streams. Probably slightly dangerous/broken, because the demuxer
thread and possibly even the decoders will keep reading data from
the new title before the new demuxer takes over.

Fixes #1250.
2014-11-10 10:50:55 +01:00
Alessandro Ghedini 5f175b0bdc command: send property-change event on playlist change 2014-11-09 15:31:48 +01:00
wm4 b021d038c2 audio/out: make ao_request_reload() idempotent
This is what you would expect. Before this commit, each
ao_request_reload() call would just queue a reload command, and then
recreate the AO for the number of times the function was called.

Instead of sending a command, introduce some sort of event retrieval
mechanism. At least for the reload case, use atomics, because we're too
lazy to setup an extra mutex.
2014-11-09 09:58:44 +01:00
wm4 9f239464da command: silence a warning on win32
Same goal as a change in the #1255 PR, but IMO slightly less
ifdefferish.
2014-11-08 10:24:26 +01:00
wm4 64f6e88c45 command: fix option-flags property
The sub-path wasn't adjusted, and it worked only in some situations.
2014-11-08 10:19:17 +01:00
wm4 1a5650b628 command: export the flag whether an option was set on commandline
Can be useful for certain scripts; I think someone requested this.
2014-11-07 16:33:41 +01:00
Kevin Mitchell 351608e5cc command: add display-names property
Call VOCTRL_GET_DISPLAY_NAMES it when the property is
requested. The vo should return the names of the displays that the mpv
window is covering.  For example, with x11 vos, xrandr names LVDS1,
HDMI1, etc.
2014-11-07 01:14:03 -08:00
wm4 ea613c2592 command: use playback time as reference for sub_seek
update_subtitle() already uees playback_pts to make subtitles work
better in no-audio mode. Using get_current_time() usually gets
playback_pts, but also has the advantage that it will use the seek
target time during seeks. This will result in multiple sub_seek commands
doing the right thing (at least as long as they're far enough apart so
that seeking is actually initiated when the second command is run).
2014-11-05 18:47:12 +01:00
wm4 416c86f3cb command: add window-minimized property (X11 only)
More or less requested by #1237.

Should be simple to extend this to other backends.
2014-11-02 20:55:07 +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
wm4 3a95a0887c command: expose mpv version as property
A client API user has no other way to know the version.
2014-11-02 17:44:24 +01:00
wm4 969757baa0 player: always use demux_chapter
Instead of defining a separate data structure in the core.

For some odd reason, demux_chapter exported the chapter time in
nano-seconds. Change that to the usual timestamps (rename the field
to make any code relying on this to fail compilation), and also remove
the unused chapter end time.
2014-11-02 17:29:41 +01:00
wm4 dab6cbca16 player: update meaning of drop_frame_cnt
Rename the variable, update comments, and update the documentation of
the property which returns its value.
2014-11-01 01:07:21 +01:00