Commit Graph

159 Commits

Author SHA1 Message Date
wm4 e267ff93f3 video: rename VOCTRL_GET_WINDOW_SIZE
Make it clear that this accesses the un-fullscreened window size.
2014-09-05 01:52:16 +02:00
wm4 bf74a4cc46 player: add --media-title option
Requested by ChrisK2.
2014-09-02 22:28:11 +02:00
wm4 8d92128f6b command: remove broken quvi-format property
Never really worked, and libquvi is probably a lost cause anyway.
2014-09-01 23:27:33 +02:00
wm4 2f537bafa5 demux: get rid of old wrapper
demux_info_get() used to be central, but was turned into a wrapper, and
now there was only one caller left. Get rid of it.
2014-09-01 22:12:39 +02:00
wm4 4124a175e1 command: disable some commands/properties properly in idle mode
In particular, don't allow to add any external subtitle tracks in idle
mode. This make no sense and would just lead to leaks or worse.
2014-09-01 21:44:54 +02:00
Ryan Jacobs 66f158b89b command: remove extra space
Signed-off-by: wm4 <wm4@nowhere>
2014-08-29 11:58:25 +02:00
wm4 e47a9bd721 command: export demuxer cache info properties 2014-08-28 17:49:10 +02:00
wm4 f9f436a490 audio: restore old speed change behavior
Don't attempt to resync after speed changes. Note that most other cases
of audio reinit (like switching tracks etc.) still resync, but other
code paths take care of setting the audio_status accordingly.

This restores the old behavior of not trying to fix audio desync, which
was probably changed with commit 261506e3.

Note that the code as of now wasn't even entirely correct, since the A/V
sync values are slightly shifted. The dsync depends on the audio buffer
size, so a larger buffer size will show more extreme desync. Also see
mplayer2 commit 213a224e, which should fixed this - it was not merged
into mpv, because it disabled audio for too long, resulting in a worse
user experience. This is similar to the issue this commit attempts to
fix.

Fixes: #1042 (probably)
CC: @mpv-player-stable
2014-08-28 14:26:38 +02:00
wm4 95286cd8b8 command: change OSD formatting of "speed" property
The "x   " prefix annoyed some users.
2014-08-25 00:48:55 +02:00
wm4 5afc025cc9 video: get rid of video_next_pts field
Not really needed anymore. Code should be mostly equivalent.

Also get rid of some other now-unused or outdated things.
2014-08-22 14:22:06 +02:00
Andrey Morozov 1cb15316b0 command: add estimated-frame-count & estimated-frame-number properties
Signed-off-by: wm4 <wm4@nowhere>
2014-08-19 21:47:14 +02:00
wm4 52ead45f05 command: drop " %" from "cache" property OSD-formatting 2014-08-18 01:42:43 +02:00
wm4 543ba6c114 video: add VO framedropping mode
This mostly uses the same idea as with vo_vdpau.c, but much simplified.

On X11, it tries to get the display framerate with XF86VM, and limits
the frequency of new video frames against it. Note that this is an old
extension, and is confirmed not to work correctly with multi-monitor
setups. But we're using it because it was already around (it is also
used by vo_vdpau).

This attempts to predict the next vsync event by using the time of the
last frame and the display FPS. Even if that goes completely wrong,
the results are still relatively good.

On other systems, or if the X11 code doesn't return a display FPS, a
framerate of 1000 is assumed. This is infinite for all practical
purposes, and means that only frames which are definitely too late are
dropped. This probably has worse results, but is still useful.

"--framedrop=yes" is basically replaced with "--framedrop=decoder". The
old framedropping mode is kept around, and should perhaps be improved.
Dropping on the decoder level is still useful if decoding itself is too
slow.
2014-08-15 23:33:33 +02:00
wm4 a87005b7fa command: for OSD, format cache property as integer
For convenience. Use ${=cache} to get the old formatting.
2014-08-11 13:30:08 +02:00
wm4 b016f92309 command: fix dangling pointer issue in script key bindings code
This code was sending a string to a different thread, and then
deallocated the string shortly after, which means most of the time
the other thread was accessing a dangling pointer.

It's possible that this is the cause for #1002.
2014-08-11 13:00:57 +02:00
wm4 26d69758f6 command: run OSD display code even if a property is unavailable
Trying to jump chapters in a gile that has no chapters does nothing,
not even show a warning. This is confusing. The reason is that the
"add chapter" command will just bail out completely if the property
is unavailable.

This was because it exited when it couldn't get the property type.
Instead of exiting, just don't enter the code that needs the type.

(I'm not sure when this behavior changed. I consider it a regression.
It was probably caused by changes to the chapter code, which perhaps
started returning UNAVAILABLE instead of OK if there are no chapters.)
2014-08-09 00:08:04 +02:00
wm4 fa682af6ee command: add a "seeking" property
The client API exports this state via events already, but maybe it's
better to explicitly provide this property in order to facilitate use on
OSD and similar cases.
2014-08-08 00:16:20 +02:00
wm4 733bdebcb9 client API: minor optimizations for property notification
Internally, there are two mechanisms which can trigger property
notification as used with "observed" properties in the client API.

The first mechanism associates events with a group of properties that
are potentially changed by a certain event. mp_event_property_change[]
declares these associations, and maps each event to a set of strings.
When an event happens, the set of strings is matched against the list of
observed properties of each client. Make this more efficient by
comparing bitsets of events instead. This way, only a bit-wise "and" is
needed for each observed property. Even better, we can completely skip
clients which have no observed properties that match.

The second mechanism just updates individual properties explicitly by
name. Optimize this by using the property index instead. It would be
nice if we could reuse the first mechanism for the second one, but
there are too many properties to fit into a 64 bit mask.

(Though the limit on 64 events might get us into trouble later...)
2014-08-02 01:53:22 +02:00
wm4 be337aa415 command: add a property that returns a list of all properties
Also remove the undocumented Lua mp.property_list() function.
2014-08-02 01:53:21 +02:00
wm4 a1b54d3b89 client API: don't send internal events to the clients
"Internal" events were added in the previous commits to leverage the
client API property mechanism, without making weird properties public.

But they were sent to clients too (and returned by mpv_wait_event()).
2014-07-31 04:35:23 +02:00
wm4 c1b64cc693 command: add cache-idle property 2014-07-31 04:25:39 +02:00
wm4 b4f24544bb client API: make "cache" property and similar observable
Achieve this by polling. Will be used by the OSC. Basically a bad hack -
but the point is that the mpv core itself is in the best position to
improve this later.
2014-07-31 04:19:41 +02:00
wm4 593ad996e0 player: fix time display wheen seeking past EOF with --keep-open
Regression since commit 261506e3. Internally speaking, playback was
often not properly terminated, and the main part of handle_keep_open()
was just executed once, instead of any time the user tries to seek. This
means playback_pts was not set, and the "current time" was determined by
the seek target PTS.

So fix this aspect of video EOF handling, and also remove the now
unnecessary eof_reached field.

The pause check before calling pause_player() is a lazy workaround for
a strange event feedback loop that happens on EOF with --keep-open.
2014-07-30 00:22:38 +02:00
wm4 f24f960ec7 command: fix and simplify overlay_add
Actually free the old mmap region when readding an overlay of the same
ID without removing it before. (This is explicitly documented as
working.)

Replace the OSD atomically. Before this commit, the overlays were
removed and then readded to avoid synchronization problems.

Simplify the code: now there is no weird mapping between index and ID.
The OSD sub-bitmap list still needs to be prepared to skip unused IDs
(since each sub-bitmap list entry must be in use), but the code for this
is relatively separated now.

Fixes issue #956.
2014-07-25 14:32:45 +02:00
Alessandro Ghedini 08415933db command: append entries to the end of the playlist with loadlist append
Currently entries are added after the current playlist element. This is kinda
confusing, more so given that "loadfile append" appends at the end of the
playlist.
2014-07-25 14:32:34 +02:00
wm4 843f5f4723 command: add append-play loadfile mode
"loadfile filename append-play" will now always append the file to the
playlist, and if nothing is playing yet, start playback. I don't want to
change the semantics of "append" mode, so a new mode is needed.

Probably fixes issue #950.
2014-07-23 00:20:53 +02:00
wm4 d320695207 command: potentially fix dvd angle setting
This called demux_flush(), but that doesn't make any sense with an
asynchronously running demuxer. It would just keep reading and add new
packets again. Explicitly pause the demuxer, so that this can't happen.
Also, when flushing, data will be missing, so the decoders should
always be reinitialized, even if the operation fails.
2014-07-20 20:13:07 +02:00
wm4 1301a90761 demux: add a demuxer thread
This adds a thread to the demuxer which reads packets asynchronously.
It will do so until a configurable minimum packet queue size is
reached. (See options.rst additions.)

For now, the thread is disabled by default. There are some corner cases
that have to be fixed, such as fixing cache behavior with webradios.

Note that most interaction with the demuxer is still blocking, so if
e.g. network dies, the player will still freeze. But this change will
make it possible to remove most causes for freezing.

Most of the new code in demux.c actually consists of weird caches to
compensate for thread-safety issues (with the previously single-threaded
design), or to avoid blocking by having to wait on the demuxer thread.

Most of the changes in the player are due to the fact that we must not
access the source stream directly. the demuxer thread already accesses
it, and the stream stuff is not thread-safe.

For timeline stuff (like ordered chapters), we enable the thread for the
current segment only. We also clear its packet queue on seek, so that
the remaining (unconsumed) readahead buffer doesn't waste memory.

Keep in mind that insane subtitles (such as ASS typesetting muxed into
mkv files) will practically disable the readahead, because the total
queue size is considered when checking whether the minimum queue size
was reached.
2014-07-16 23:25:56 +02:00
wm4 23a7257cca Revert "Remove DVD and Bluray support"
This reverts commit 4b93210e0c.

*shrug*
2014-07-15 01:49:02 +02:00
wm4 4b93210e0c Remove DVD and Bluray support
It never worked well. Just remux your DVD and BD images to mkv.
2014-07-14 14:34:14 +02:00
wm4 9fadc92eb1 command: don't show VO information in colorspace properties
Until now, changing the properties showed the VO colorspace parameters
on OSD. This didn't work quite well, because it showed the VO parameters
_before_ the change. This is because at least one video frame with the
new parameters has to be shown, and this doesn't happen right after
changing the property, but a bit later.

Also fix a random typo in unrelated code.
2014-07-13 20:12:55 +02:00
wm4 ae7228c6a3 audio: drop buffered audio when switching tracks or filters
No reason to wait until the audio has been played. This isn't a problem
with gapless audio disabled, and since gapless is now default, this
behavior might be perceived as regression.

CC: @mpv-player/stable
2014-07-13 20:07:14 +02:00
wm4 acd60736ef Remove stream_pts stuff
This was used by DVD/BD, but its usage was removed with one of the
previous commits.
2014-07-06 19:05:59 +02:00
wm4 de71b50249 dvd: move angle switching code
No need to provide a "nice" API for it; just do this stuff directly in
the command code.
2014-07-05 17:07:15 +02:00
wm4 4d9ce2993f command: include new "playback-time" property in update mechanism 2014-07-03 01:26:19 +02:00
wm4 4b5fbb3ee0 command: remove some code duplication in cache properties
This also means that the printed size is always rounded to KBs, because
the cache properties are returned in KB. I think this doesn't matter
much. But if it does, the cache properties should probably changed to
return bytes in the first place.
2014-07-02 01:46:04 +02:00
wm4 94450bf410 command: cache can actually have full-size 0
Then it's simply empty.
2014-07-02 01:32:05 +02:00
Andrey Morozov b1969c0eba command: change cache perentage to float, add cache-free and cache-used 2014-07-02 01:28:11 +02:00
Tsukasa OMOTO a73415584c player: make the time display relative to start PTS
This commit makes the playback start time always at time 0.

Signed-off-by: wm4 <wm4@nowhere>
2014-06-29 20:39:49 +02:00
wm4 1dc760f911 command: fix tv-channel property
Now it's at least actually relayed to the TV code. I didn't/couldn't
test whether it actually works, though.
2014-06-25 17:41:16 +02:00
Niklas Haas ef6db24366 options: Expose --colormatrix-primaries to the user
Signed-off-by: wm4 <wm4@nowhere>
2014-06-22 19:01:25 +02:00
wm4 e00aad18cb command: redo the property type
Instead of absuing m_option to store the property list, introduce a
separate type for properties. m_option is still used to handle data
types. The property declaration itself now never contains the option
type, and instead it's always queried with M_PROPERTY_GET_TYPE. (This
was already done with some properties, now all properties use it.)

This also fixes that the function signatures did not match the function
type with which these functions were called. They were called as:

   int (*)(const m_option_t*, int, void*, void*)

but the actual function signatures were:

   int (*)(m_option_t*, int, void*, MPContext *)

Two arguments were mismatched.

This adds one line per property implementation. With additional the
reordering of the parameters, this makes most of the changes in this
commit.
2014-06-13 02:11:39 +02:00
wm4 99f5fef0ea Add more const
While I'm not very fond of "const", it's important for declarations
(it decides whether a symbol is emitted in a read-only or read/write
section). Fix all these cases, so we have writeable global data only
when we really need.
2014-06-11 00:39:14 +02:00
wm4 e033f3c8bc command: redo ancient TV/DVB/PVR commands
Convert all these commands to properties. (Except tv_last_channel, not
sure what to do with this.) Also, internally, don't access stream
details directly, but dispatch commands with stream ctrls.

Many of the new properties are a bit strange, because they're write-
only. Also remove some OSD output these commands produced, because I
couldn't be bothered to port these.

In general, this makes everything much cleaner, and will also make it
easier to e.g. move the demuxer to its own thread.

Don't bother updating input.conf, but changes.rst documents how old
commands map to the new ones.

Mostly untested, due to lack of hardware.
2014-06-11 00:34:41 +02:00
wm4 da89af1076 player: show "neutral" position markers for OSD bars
This commit implements them for volume and some video properties.
2014-06-08 23:52:58 +02:00
Marcoen Hirschberg af25e0aba8 command: format_bitrate: fix conversion to kbits and mbits
Bitrates are now expressed in bits/second. This commit fixes conversions
which assumed it was still in bytes/second.

Signed-off-by: wm4 <wm4@nowhere>
2014-06-02 22:20:25 +02:00
Andrey Morozov b5e40e15a3 command: improve video-bitrate property
Signed-off-by: wm4 <wm4@nowhere>

Includes some cosmetic changes over the original PR.
2014-06-01 17:27:17 +02:00
wm4 5a5a3c53f7 client API: report success status when running commands
Until now, an error was reported only if the command couldn't be parsed.
Attempt to do more fine-grained reporting. This is not necessarily
perfect, but it's an improvement.
2014-06-01 03:41:46 +02:00
wm4 c84f873596 command: property notification when changing af/vf 2014-06-01 03:41:43 +02:00
wm4 69ad734af8 command: add const to mp_notify_property 2014-06-01 03:41:36 +02:00