Commit Graph

39449 Commits

Author SHA1 Message Date
wm4 3fc9f9d132 player: don't mess up cursor visibility state
Manually setting can break things forever, because it puts the VO cursor
state out of sync with the remembered state by handle_cursor_autohide().
Use the normal autohide code during idle mode too instead. (Originally
the idea was to make the cursor always visible in idle mode, but not so
important.)

Regression since e1e8b07c. Fixes #1166.

CC: @mpv-player/stable
2014-10-10 18:51:44 +02:00
wm4 f432a584b9 ao_pulse: implement AO device listing API
While conceptually this sink stuff in PulseAudio does just the right
thing, actually listing the sinks is unbelievable complicated. Not only
is the idea that listing them should happen asynchronously completely
bullshit (who the fuck runs the PulseAudio server on a separate
computer), but the way this is done is full of bullshit too. Why
separate callbacks for each device? Why this obtuse mainloop shit?
Especially the mainloop shit makes it actively worse than doing things
manually with pthread primitives, and the reason for that (different
mainloop implementations for GUIs?) is laughable too. It's like they
chose the most complicated API possible just because they attempted
to "abstract" basic mechanisms in order to handle "everything". While
I don't claim to design the best APIs, this API is fucking terrible
without any excuse. (End of rant.)
2014-10-10 18:42:43 +02:00
wm4 a25e936540 ao_pulse: move setup code to separate function
All the dumb crap in pa_init_boilerplate() is needed to talk to the
audio server at all. Might also fix some subtle bugs in the init code
(which is strange, because the original file was contributed by the
devil himself).
2014-10-10 18:42:06 +02:00
wm4 edad4fc29b audio: change internal device listing API
Now we run ao_driver->list_devs on a dummy AO instance, which will
probably confuse everyone. This is done for the sake of PulseAudio.
2014-10-10 18:27:21 +02:00
wm4 19d21103e5 player: exit if audio init fails and there's no video
Seems logical. For some reason, the player allows deselecting both audio
and video stream without quitting (a deliberate feature of which I have
no idea why it was added years ago), so this is needed.
2014-10-10 15:15:58 +02:00
wm4 299bf5c017 player: signal EOF when using --frames 2014-10-10 15:14:11 +02:00
wm4 4758866a18 player: minor simplification 2014-10-10 15:13:04 +02:00
wm4 ad541c26f7 player: don't close audio device in gapless mode
I don't see much of a reason for this extra corner case.
2014-10-10 14:49:18 +02:00
wm4 f93419f6b2 player: --save-position-on-quit should always work (2)
This reimplements the feature reverted in the previous commit in a
different way.
2014-10-10 14:44:22 +02:00
wm4 d4b2a96d90 Revert "player: --save-position-on-quit should always work"
This reverts commit 45c8b97efb.

Some else complained (github issue #1163).

The feature requested in #1148 will be implemented differently in
the following commit.
2014-10-10 14:27:45 +02:00
wm4 26bc6b4831 Add some missing "const"s
The one in msg.c was mistakenly removed with commit e99a37f6.

I didn't actually test the change in ao_sndio.c (but obviously "ap"
shouldn't be static).
2014-10-10 13:44:08 +02:00
wm4 7e4491a7a7 audio/out/push: make draining slightly more robust
Don't wait after the audio thread has pushed the remaining audio to the
AO. Avoids hard hangs if the heuristic fails completely (could still
happen if get_delay returns absurd values).

CC: @mpv-player/stable
2014-10-10 13:21:43 +02:00
wm4 bd41fc7723 audio/out/push: fix EOF heuristic
Since the internal AO driver API has no proper way to determine EOF, we
need to guess by querying get_delay. But some AOs (e.g. ao_pulse with
no-latency-hacks set) may never reach 0, maybe because they naively add
the latency to the buffer level. In this case our heuristic can break.

Fix by always using the delay to estimate the EOF time. It's not even
that important - it's mostly used to avoid blocking draining. So this
should be ok.

CC: @mpv-player/stable (maybe)
2014-10-10 13:18:53 +02:00
Stefano Pigozzi a8ec044d54 fix -Wvisibility warnings with clang
Now everything compiles with no warnings! yay!
2014-10-09 22:22:48 +02:00
Stefano Pigozzi 8a25a4af65 cocoa: post keydown and keyup events without event monitor
Our code worked under the assumption that the event monitor is always active
and we did remove the keydown and keyup overrides from our cocoa view.
2014-10-09 22:14:41 +02:00
Stefano Pigozzi e99a37f635 fix -Wduplicate-decl-specifier warnings with clang 2014-10-09 22:14:41 +02:00
Stefano Pigozzi dba2b90d9a libmpv/cocoa: don't start the event monitor
The event monitor is used to get keyboard events when there is no window, but
since it is a global monitor to the current process, we don't want it in a
library setting.
2014-10-09 22:14:41 +02:00
Stefano Pigozzi 58f62891fa cocoa: fix 'uninitalized' access
I think this doesn't make a difference, since in Objective-C nil responds as
a NullObject, but better not depend on this crappy language feature.
2014-10-09 22:14:41 +02:00
Stefano Pigozzi ca353fcf92 libmpv/cocoa: make global events work and get rid of is_cplayer
After @frau's split of macosx_events from macosx_application, `is_cplayer' is
not needed anymore. At the moment only global events such as Media Keys and
Apple Remote work, because the VO-level ones were hardcoded to be disabled.
(that will be fix in a later commit ).
2014-10-09 22:14:41 +02:00
Alessandro Ghedini d1e8bb0f9b manpage: fix --audio-pitch-correction description
Add closing ">" and specify what is the default value.
2014-10-09 22:07:41 +02:00
wm4 a13e01cc3e x11: fix inverted condition
Worryingly wrong. Fixes #1162.

Also fix another issue (window title was set anyway), which was why I
didn't notice this and testing it seemed to be fine.
2014-10-09 21:26:03 +02:00
wm4 e96d6197d7 client API: add an explanatory comment
So someone reading this at least has a chance to find out what this is
needed for.
2014-10-09 21:23:46 +02:00
wm4 f1efd83ef7 ao_alsa: implement device listing & selection
Unfortunately, ALSA is particularly bad with this, because mpv has to
add all sorts of magic crap to the device name to make things work. The
device selection overrides this, so explicitly selecting devices will
most likely break your audio. This has yet to be solved.
2014-10-09 21:22:44 +02:00
wm4 35649a990a audio: add device selection & listing with --audio-device
Not sure how good of an idea this is.

This commit doesn't add support for this to any AO yet; the AO
implementations will follow later.
2014-10-09 21:21:31 +02:00
wm4 8989019271 manpage: improve --wid description
In particular, add a basic description of how Cocoa embedding works.
2014-10-09 20:17:52 +02:00
wm4 e294656cb1 client API: rename --input-x11-keyboard to --input-vo-keyboard
Apparently we need this for Cocoa too. (The option was X11 specific in
the hope that only X11 would need this hack.)
2014-10-09 18:28:37 +02:00
wm4 fef9ea5f62 vf_lavfi: proper rounding for lavfi->mpv aspect ratio
Or so I think. Not like it matters anyway.
2014-10-09 18:18:05 +02:00
wm4 bc6b8caa6d video: try harder to decode cover art picture only once
For cover art, we pretend that the video stream is infinite, but also
stop decoding once we have an image on the VO (this seems advantageous
for the case when strange filters are inserted or the VO image gets
lost). Since a while ago, the video chain started decoding 2 images
though ("Non-monotonic video pts: 0.000000 <= 0.000000"), which is
annoying and wasteful.

Improve this by handling a certain corner case at initialization, which
will decode a second image while the first one is still stuck in the
filter chain. Also, just in case there are filters which buffer a lot,
also force EOF filtering (which means we tell the filters to flush
buffered frames).

CC: @mpv-player/stable
2014-10-09 17:57:17 +02:00
wm4 69673271e8 player: don't reset buffering pausing state on seeks
This was added with commit 3cbd79b3, but it turns out this
unintentionally enables "real" pausing when seeking while buffering. It
was done for ensuring correct state of the "cache-buffering-state"
property, but it also turns out that this was unneeded (another variable
that is reset when seeking happens to take care of this).
2014-10-09 17:57:10 +02:00
Stefano Pigozzi 69fa956f50 cocoa: allow to embed into an arbitrary NSView
Basically add if guards on all the problematic features. I'm still thinking
about a better way to handle this, but for the time being, this will do.
2014-10-08 19:38:35 +02:00
wm4 06ecf54fdf msg: fix unwanted blank lines
Was broken in a commit earlier this day.
2014-10-08 15:03:48 +02:00
wm4 0ec5d35d57 client API: introduce numeric log levels
Maybe using strings for log levels was a mistake (too broad and too
impractical), so I'm adding numeric log level at least for the receiver
side. This makes it easier to map mpv log levels to other logging
systems.

I'm still too stingy to add a function to set the log level by a numeric
value, though.

The numeric values are not directly mapped to the internal mpv values,
because then almost every file in mpv would have to include the client
API header.

Coalesce this into API version 1.6, since 1.6 was bumped just yesterday.
2014-10-08 14:17:33 +02:00
wm4 ab5d58c3d9 DOCS/client_api_examples: qtexample: add a log window
For the purpose of demonstration.

Also make the windows larger. I'm not exactly sure how Qt determines
the default window sizes, but here they are a bit tiny, so force them
larger.
2014-10-08 13:34:06 +02:00
wm4 f73778ad82 msg, client API: buffer partial lines
The API could return partial lines, meaning the message could stop
in the middle of a line, and the next message would have the rest of
it (or just the next part of it). This was a pain for the user, so do
the nasty task of buffering the lines ourselves.

Now only complete lines are sent. To make things even easier for the
API user, don't put multiple lines into a single event, but split them.

The terminal output code needed something similar (inserting a prefix
header on start of each line). To avoid code duplication, this commit
refactors the terminal output so that lines are split in a single
place.
2014-10-08 13:11:55 +02:00
wm4 2632ea3de6 msg, client API: never send the status line as log message
The status line is a bit special; for example it uses special control
codes by design and is not terminated with a newline character in order
to update it on the terminal without scrolling. It's not helpful for
client API users either, and would require special-casing them
(emulating aspects of a terminal?). Also, the status line code is
explicitly disabled on osd.c unless the --terminal option is enabled,
so there was no good way to even enable the status line for the API.

Just pretend that the status line does not exist as far as the client
API is concerned. It won't be sent as MPV_EVENT_LOG_MESSAGE.
2014-10-08 12:51:12 +02:00
wm4 046ad8c5ae msg: set an explicit overflow message
So client API users don't have to worry about this specifically.

Also document the overflow case. (Not sure if we really need to do
this; maybe it'd be better not to, since this just adds more noise
to the docs.)
2014-10-08 12:49:04 +02:00
wm4 014547bdc2 vf_lavfi: fix compilation failure
Apparently this fails to compile with clang6. Patch by someone else.

CC: @mpv-player/stable
2014-10-08 12:44:47 +02:00
wm4 8d90528826 stream: change internal instead of external pos when dropping buffers
stream provides a read buffer (so even something like stream_read_char()
is very fast). This means the stream reads ahead by a few KBs, and
implies that the internal position (s->pos, which would match e.g. the
file position in stream_file.c), and the external position
(stream_tell()) can be different. stream_tell() shows how these are
related.

When dropping buffers, which happens on byte-level discontinuities with
a bunch of streams (including DVB), we should not change the position as
seen by the demuxer. On the other hand, the internal position is not
really meaningful, since these streams aren't seekable anyway. So just
change the code such that stream_drop_buffers() doesn't change the
demuxer visible position.

I'm hoping that this will fix a few problems with DVB. (Also see
previous commit.)
2014-10-08 00:58:21 +02:00
wm4 34571b3c24 stream_dvb: use stream_drop_buffers() 2014-10-08 00:52:39 +02:00
wm4 cd367198c0 player: minor cosmetic change 2014-10-08 00:24:35 +02:00
wm4 f47269a074 x11: disable various features when embedding the window 2014-10-07 23:37:47 +02:00
wm4 ac54f10490 player: remove unnecessary code
This part is already done by open_stream_async().
2014-10-07 22:13:36 +02:00
wm4 3cbd79b35b command: add cache-buffering-state property 2014-10-07 22:13:36 +02:00
wm4 5feec17ca8 client API: improve mpv_observe_property docs
Document the "normal" behavior (if MPV_FORMAT_NONE is not used) first,
and then introduce MPV_FORMAT_NONE as exception.

The actual semantics didn't change in mpv; this is only clarification.
2014-10-07 21:22:05 +02:00
wm4 128bb68d29 client API: clarify pause/unpause events, modify core-idle property
Whether you consider the semantics weird or not depends on your use
case, but I suppose it's a bit confusing anyway. At this point, we keep
MPV_EVENT_PAUSE/UNPAUSE for compatibility only.

Make the "core-idle" property somewhat more useful in this context.
2014-10-07 21:01:19 +02:00
James Ross-Gowan 9541537e32 DOCS/client_api_examples: qtexample: set the locale
QApplication sets the locale, so change the LC_NUMERIC category back to
"C" for libmpv.

See: http://qt-project.org/doc/qt-5/qcoreapplication.html#locale-settings
2014-10-07 08:45:48 +02:00
James Ross-Gowan 476fc65b0f bstr: check strings before memcmp/strncasecmp
bstr.start can be NULL when bstr.len is 0, so don't call memcmp or
strncasecmp if that's the case. Passing NULL to string functions is
invalid C, even when the length is 0, and it causes Windows to raise an
invalid parameter error.

Should fix #1155
2014-10-07 08:45:27 +02:00
wm4 ec7bc388d1 matroska: look for all known matroska file extensions
For segment linking (this mechanism matches file extensions to avoid
opening files which are most likely not Matroska files in order to speed
up scanning).
2014-10-06 22:33:21 +02:00
wm4 a9e6ba1b9a osd: don't let slow commands cut OSD messages short
Done for screenshot commands, requested by a user.
2014-10-06 22:19:24 +02:00
wm4 45c8b97efb player: --save-position-on-quit should always work
Now any action that stops playback of a file (even playlist navigation)
will save the position. Normal EOF is of course excluded from this, as
well as commands that just reload the current file.

The option name is now slightly off, although you could argue what the
word "quit" means.

Fixes #1148 (or at least this is how I understood it).
2014-10-06 22:07:35 +02:00