Commit Graph

39366 Commits

Author SHA1 Message Date
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
wm4 332808bc0d demux_lavf: blacklist jpeg files
We handle them under demux_mf.c for stupid reasons; mostly so that
an image is shown for a second instead of just flashing it.

CC: @mpv-player/stable
2014-10-06 21:49:32 +02:00
wm4 4b2f81a36f ao_pulse: don't use pa_format_info_to_sample_spec()
This function is available starting with PulseAudio 2.0, while we only
require 1.0. This broke compilation on Ubuntu 12.04.5 LTS.

Use our own function to calculate the buffer size, which is actually
simpler and needs slightly less code.

Hopefully fixes #1154.
CC: @mpv-player/stable
2014-10-06 21:49:26 +02:00
wm4 5fb05940f1 player: open stream and demuxer asynchronously
Run opening the stream and opening the demuxer in a separate thread.
This should remove the last code paths in which the player can normally
get blocked on network.

When the stream is opened, the player will still react to input and so
on. Commands to abort opening can also be handled properly, instead of
using some of the old hacks in input.c. The only thing the user can
really do is aborting loading by navigating the playlist or quitting.
Whether playback abort works depends on the stream implementation; with
normal network, this will depend on what libavformat (via "interrupt"
callback) does.

Some pain is caused by DVD/BD/DVB. These want to reload the demuxer
sometimes. DVB wants it in order to discard old, inactive streams.
DVD/BD for the same reason, and also for reloading stream languages
and similar metadata. This means the stream and the demuxer have to
be loaded separately.

One minor detail is that we now need to copy all global options. This
wasn't really needed before, because the options were accessed on
opening only, but since opening is now on a separate thread, this
obviously becomes a necessity.
2014-10-06 21:49:26 +02:00
wm4 d26104351b m_config: add function to copy all options
Needed to copy the global option struct in the next commit.
2014-10-06 21:49:26 +02:00
Stefano Pigozzi f440c0626e cocoa: try to fix sizing bugs on retina displays
untested, no hardware.
2014-10-06 09:58:59 +02:00
Stefano Pigozzi ba994bc0dd cocoa: fix mouse autohide
broken in 547b62f
2014-10-05 23:49:09 +02:00
Stefano Pigozzi 69508dc507 cocoa: remove a debug commento
fixup previous commit
2014-10-05 23:41:39 +02:00
Stefano Pigozzi 547b62f45e cocoa: separate video view and events view 2014-10-05 23:38:39 +02:00
Stefano Pigozzi cb0f342ab2 cocoa: fix fullscreen with bundle 2014-10-05 23:38:12 +02:00
wm4 9e3e5ca598 audio/out/push: fix some AOs freezing on exit
Caused by a dumb deadlock.
2014-10-05 23:05:54 +02:00
Stefano Pigozzi ea83a2b9bc cocoa: readd some function calls 2014-10-05 22:38:26 +02:00
Stefano Pigozzi c655fdc38f cocoa: actually reset the event flags 2014-10-05 22:32:23 +02:00
Stefano Pigozzi 62bc735c1a cocoa: remove some useless flags 2014-10-05 19:31:21 +02:00
Stefano Pigozzi 2cb97454f5 cocoa: disable some features when embedding in another window
ontop, fullscreen and window title change to be precise
2014-10-05 19:16:23 +02:00
Stefano Pigozzi c6b68c28f4 cocoa: remove --fs-missioncontrol
This is the first of a series of commits that will change the Cocoa way in a
way that is easily embeddable inside parent views. To reach that point common
code must avoid referencing the parent NSWindow since that could be the host
application's window.
2014-10-05 18:07:27 +02:00
Stefano Pigozzi 7968814470 cocoa: fix some pointer casts to be 32bit safe
credits: wm4
2014-10-05 15:22:17 +02:00
Stefano Pigozzi c8ed4736ef cocoa/libmpv: allow to embed mpv GL view in another window
This is just temporary code but is a good base for future work (and baby
steps are required for these changes). The 'final destination' is embedding
the video view into any NSView but that requires some more work (the mechanism
will be the same: pass the view's pointer casted to int64_t through -wid).

For instance we will need to remove as much usage of the window instance
as possible, and use nil guards where not possible. For this reason I will
remove stuff like the mission control fullscreen feature (it's a cute feature
but annoying to support and quite limited, go make your GUIs), and a way to
lookup the current screen directly from the NSView absolute coordinates
(this is needed for ICC detection mostly, and reporting back the screen to
mpv's core).

Moreover the current view.m will need to be separated into 2 views: the actual
video view that will be embedded, and a parent view that will not be embedded
and will be responsibile for tracking events.
2014-10-05 14:28:33 +02:00
Stefano Pigozzi 3137b7ac5f examples/cocoa: never instance NSApplication with new
Cocoa expects the you instance NSApplications only through the singleton
method sharedApplication.
2014-10-05 10:06:46 +02:00
Stefano Pigozzi 11609ab389 examples/cocoa: set activation policy to mimic nib applications 2014-10-05 09:33:56 +02:00
Stefano Pigozzi 0ec14ec597 cocoa: simplify the config code and run it on the main thread
This could be dangerous because we initialize the window asynchronously and
return immediately from config, but since the OpenGL context is already
created, this seems to work correctly and doesn't cause weird deadlock cases.
2014-10-05 09:33:00 +02:00
wm4 c5ebaca31e etc: add an input config file that reverts recent key binding changes
This is for users who don't like changes. I'm hoping it will make the
process of cleaning up key bindings less bumpy.

It should be mentioned in the release notes of the next release.
2014-10-05 01:58:12 +02:00
wm4 aeefb8511c audio/out/push: make draining more robust
It was more complicated than it had to be: the audio thread already
determines whether audio has ended, so we can use that. Remove the
separate logic for draining.
2014-10-05 00:31:20 +02:00
wm4 6431e09fb3 audio/out/push: limit fallback sleep time to reasonable limits 2014-10-05 00:13:00 +02:00
wm4 0d4e245de7 ao_pulse: change suspend circumvention logic
Commit 957097 attempted to use PA_STREAM_FAIL_ON_SUSPEND to make
ao_pulse exit if the stream was started suspended.

Unfortunately, PA_STREAM_FAIL_ON_SUSPEND is active even during playback.
If you pause mpv, pulseaudio will close the actual audio device after a
while (or something like this), and unpausing won't work. Instead, it
will spam "Entity killed" error messages.

Undo this change and check for suspended audio manually during init.

CC: @mpv-player/stable
2014-10-04 23:30:07 +02:00
wm4 80e10b0058 manpage: changes: random corrections and additions 2014-10-04 22:39:08 +02:00
wm4 36ee9a5e90 manpage: changes: move internal changes section to the end 2014-10-04 22:19:07 +02:00
wm4 bd169a313c options: add --no-keepaspect-window
Seems silly, but was requested.
2014-10-04 22:17:36 +02:00
Stefano Pigozzi 1651d96583 cocoa: don't reset presentation options on uninit
This doesn't look to be needed anymore. Fullscreening with both the NSView
and the NSWindow API works correctly. I guess this was forgotten in from older
code which changed presentation options directly for going fullscreen.
2014-10-04 19:10:36 +02:00
Stefano Pigozzi e75ce6c869 cocoa: only call resize for view changing frame 2014-10-04 17:39:43 +02:00
Stefano Pigozzi 0541151b40 cocoa: remove pointless drawRect
Apparently it causes deadlocks, and at the moment it does nothing.

Fixes #778
2014-10-04 17:31:18 +02:00
Stefano Pigozzi d980c30851 cocoa: make fullscreening look like an atomic operation
At the moment when you fullscreen mpv there is a very small time interval
where the fullscreen windows is semi-transparent. Apparently whem moving the
view to another parent it's better to make Cocoa not draw anything globally.

An Apple engineer said it, so it must be correct:
http://www.cocoabuilder.com/archive/cocoa/142020-preventing-flicker-on-moving-nsview-to-different-superview.html

I know I will regret this in the future.
2014-10-04 17:31:18 +02:00
Stefano Pigozzi b915852f9f cocoa: make resizing wake the vo thread 2014-10-04 17:31:18 +02:00
Stefano Pigozzi c1d5b182b4 cocoa: remove dead code 2014-10-04 17:31:18 +02:00