Commit Graph

39474 Commits

Author SHA1 Message Date
wm4 aaa29eb81e stream: fix --stream-dump dropping the file header
stream_rar.c peeks the first few bytes when trying to open, which means
that opening any stream reads at least 2KB of data (internal buffer
size) on opening. This broke --stream-dump, which saved only the data
following this initial buffer.

Hack it around by writing the current buffer to the capture file too,
and move stream_capture_write() above stream_set_capture_file() for this
purpose.

Cleaner solutions might include: handling the terrible rar thing
differently, or using the "proper" stream API for dumping. (The latter
is not done, because --stream-dump shares code with the --stream-capture
misfeature.)

Fixes #1215.
2014-10-25 17:20:18 +02:00
wm4 1e919b4c12 stream: remove duplicate message 2014-10-25 17:20:17 +02:00
wm4 2c11dd5434 tv: remove duplicated crap
The logging functions already add a prefix. Original MPlayer devs must
have liked code duplication a lot.
2014-10-25 17:20:17 +02:00
wm4 3c9f2bef92 tv: unqueue buffers correctly (maybe, maybe not)
I clue no idea what I'm doing, but at least it doesn't hang anymore when
closing a tv:// stream using a v4l2 loopback device.
2014-10-25 17:20:15 +02:00
wm4 ef252b2314 lua: lua_tostring() on an error value can return NULL
Lua is so clever it allows values that can't be converted to strings, in
which case lua_tostring() returns NULL. Trigger undefined behavior.
2014-10-24 21:57:06 +02:00
wm4 55e3dab7eb command: finish hook execution if client fails
Translation: if the (to be added) youtube-dl Lua script crashes, don't
wait forever when opening something.
2014-10-24 21:57:02 +02:00
wm4 b330f16fed input: resolve ~ and similar for --input-file
Because why not.
2014-10-24 21:28:07 +02:00
wm4 51a3f13705 TOOLS/umpv: create FIFO in user directory
Makes these security measures unnecessary.
2014-10-24 21:27:38 +02:00
Stefano Pigozzi 7822b97033 cocoa: perform VOCTRL_SET_UNFS_WINDOW_SIZE asyncronously
Apparently if resizing a NSWindow from a secondary thread Cocoa will
automatically protect itself using NSViewHierarchyLock and in our case,
cause a deadlock.

Fixes #1210
2014-10-24 20:30:53 +02:00
wm4 480f82fa96 demux: don't access stream while lock is held
Although this is fine when the stream cache is active (which caches
these and returns the result immediately), it seems cleaner not to
rely on this detail.

Remove the update_cache() call from demux_thread(), because it's sort
of in the way. I forgot why it exists, and there's probably no good
reason for it to exist anyway.
2014-10-24 16:04:56 +02:00
wm4 07cca2500e demux: cache STREAM_CTRL_GET_BASE_FILENAME
It's needed for some obscure feature in combination with .rar reading.
However, it's unconditionally used by the subtitle loader code, so take
care of not blocking the main thread unnecessarily.

(Untested.)
2014-10-24 15:40:01 +02:00
wm4 f1481df0b6 command: add vo-configured property
So a client API user can know when a window is created or destroyed.

Also might be useful for the OSC: it could disable itself if video is
disabled.

Before this commit, there were only indirect ways of detecting this.
2014-10-24 15:34:53 +02:00
wm4 96b339fc07 player: disable --force-window if VO fails
Otherwise, it'd retry creating the window all the time.
2014-10-24 15:34:39 +02:00
wm4 f4ad398b28 video: send MPV_EVENT_VIDEO_RECONFIG on uninit
This event basically means "something about video changed", and uninit
is certainly an important change.
2014-10-24 15:34:28 +02:00
wm4 db86eaad3d player: adjust uninit order of components
Most things should be allowed to access the client API unconditionally
(for example for sending events), so move destroying the client API
down. Also, mp_uninit_ipc() should happen before the point at which all
clients are shutdown, or there will be a small time window in which new
clients can be created after destroying them all.
2014-10-24 15:34:04 +02:00
wm4 986d15ea9c command: fix debug output
It was a bit ugly/annoying.
2014-10-24 13:42:02 +02:00
ChrisK2 223d9b6bc9 osc: make text squuezing layout dependent
Wether and when the text of a button should be squeezed when it
gets too long can now be configured in the layout:

lo.button.maxchars = <number>
nil = no squeezing (default)

If the button text has more than <maxchars> characters, it will
be squeezed to the estimated width of <maxchars>.
2014-10-24 01:56:15 +02:00
ChrisK2 bff5948f00 osc: make tooltip_an default property 2014-10-24 01:16:04 +02:00
wm4 7593706af0 terminal: drop ncurses/terminfo/termcap support
It was disabled since the last release, and nobody complained loudly.

Further details see commit 4b5c3ea7.
2014-10-23 19:48:42 +02:00
wm4 a037f7b464 terminal: strictly don't read terminal input if stdout is not a terminal
Doing that doesn't make sense anyway: it's meant for interactive input,
and if the output of the player is not on the terminal, how will you
interact with it?

It was also quite in the way when trying to read verbose output with
e.g. less while the player was running, because the player would grab
half of all input meant for less (simply because stdin is still
connected to the terminal).

Remove the now redundant special-casing of pipe input.
2014-10-23 19:27:49 +02:00
wm4 c9234d769d player: fix exiting if both audio and video fail initializing
The player was supposed to exit playback if both video and audio failed
to initialize (or if one of the streams was not selected when the other
stream failed). This didn't work; for one this check was missing from
one of the failure paths. And more importantly, both checked the
current_track array incorrectly.

Fix these issues, and move the failure handling code into a common
function.

CC: @mpv-player/stable
2014-10-23 18:31:43 +02:00
wm4 809fbc6fc1 ao_alsa: move parameter append code to a function
Why not. (I thought I needed this, but my other experiments failed. So
this is merely a minor cleanup.)
2014-10-23 18:06:17 +02:00
wm4 626dcf1772 lua: fix non-sense
Let's actually test our code next time.
2014-10-23 15:13:05 +02:00
wm4 7cf18a8db9 client API: print properties set with -v
Useful for debugging. Considered doing this in command.c, but it's
easier here.
2014-10-23 15:13:05 +02:00
wm4 4590ac2082 m_option: format mpv_node as json
Useful for debugging and informational purposes. Not sure if it's sane
in any form.
2014-10-23 15:13:05 +02:00
wm4 dd77f0d37e command: print executed commands with -v 2014-10-23 15:13:05 +02:00
Martin Herkt 6f958be325 osd: slightly change default style
Wider vertical margins, slightly thicker border and larger font
size should be an improvement.
2014-10-23 14:33:11 +02:00
wm4 7e27663b7b command: add a "cached" mode to sub_add
This avoids reloading a subtitle if it was already added. In all cases,
the subtitle is selected.
2014-10-23 13:13:23 +02:00
Martin Herkt 5a3c6563e4 osc.lua: add “bottombar” and “topbar” layouts 2014-10-23 13:02:32 +02:00
wm4 41c91d87d6 command: return error on invalid/absent IDs with ff-sid/ff-aid
Instead of just disabling the stream.

Also, check if the selected track has the right type, or we'd crash.
2014-10-23 12:03:26 +02:00
wm4 df6435be50 manpage: ipc: comment about invalid UTF-8
Some rationale for the documented/suggested behavior:

It's not really clear what to do with invalid UTF-8, since JSON simply
can't transport this information. Maybe you could transfer such strings
as byte arrays, but that would be very verbose and inconvenient, and
would pose the problem that it's hard to distinguish between strings
encoded in this way and actual arrays.

There are many other ways how this could be handled. For example, you
could replace invalid sequences with '?'. Or you could do it like
Python, and use certain reserved unicode codepoints to "tunnel" through
invalid bytes.

Which of these works really depends on the application. And since this
can be done entirely on the byte level (invalid UTF-8 sequences can
appear only in strings in our case), it's best to leave this to the
receiver.
2014-10-23 11:13:59 +02:00
wm4 34373032b5 win32: change config path priorities
Assume mpv.exe is located in $mpv_exe_dir, then config files were
preferably loaded from "$mpv_exe_dir/mpv". This was mostly traditional,
and inherited from MPlayer times.

Reverse the config path priority order, and prefer $CSIDL_APPDATA/mpv as
main config path. This also fixes behavior when writing watch_later
configs, and mpv is installed in a not-writable path.

It's possible that this will cause regressions for some users, if the
change in preference suddenly prefers stale config files (which may
happen to longer around in the appdata config dir) over the user's
proper config.

Also explicitly document the behavior.
2014-10-23 10:51:51 +02:00
Stefano Pigozzi 474461244e rename ao_coreaudio_device.c -> ao_coreaudio_exclusive.c
This is so that the source file name matches the AO name
2014-10-23 09:55:17 +02:00
Stefano Pigozzi c5366dd337 reflect recent coreaudio changes in the manual 2014-10-23 09:50:54 +02:00
Stefano Pigozzi f8d0a75b50 coreaudio: redirect IEC61937 to coreaudio_exclusive 2014-10-23 09:16:39 +02:00
wm4 32720cdc17 audio/out: add redirection-on-init mechanism
Looks like this will help us with making --audio-device and spdif work
as expected on OSX. To be used ina  following commit.
2014-10-22 17:12:08 +02:00
wm4 42158b819a audio/out: missing error check
Oops.
2014-10-22 16:57:28 +02:00
wm4 67d63bc948 audio/out: don't add special devices to --audio-device list
Since the list associated with --audio-device is supposed to enable
simple user-selection, it doesn't make much sense to include overly
special things like ao_pcm or ao_null in the list. Specifically,
ao_pcm is harmful, because it will just dump all audio to a file
named audiodump.wav in the current working directory. The user can't
choose the filename (it can be customized, but not through this
option), and the working directory might be essentially random,
especially if this is used from a GUI.

Exclude "strange" entries. We reuse the fact that there's already a
simple list ordered by auto-probe priority in order to avoid having to
add an additional flag. This is also why coreaudio_exclusive was moved
above ao_null: ao_null ends auto-probing and marks the start of
"special" outputs, which don't show up on the device, but we want
coreaudio_exclusive to be selectable (I think).
2014-10-22 16:16:35 +02:00
wm4 2a74704d76 audio/out: include coreaudio_exclusive in auto-probing
Move it above ao_null, so that it can be selected during auto-probing
(even if it's only last). I see no reason why it should not be included,
and it makes the following commit slightly more elegant. (See
explanations there.)
2014-10-22 16:15:49 +02:00
wm4 be950351d9 player: show busy symbol on OSD if seeking takes too long
Same as it's done on the terminal.
2014-10-22 16:11:44 +02:00
wm4 0e4658c99c command: make trailing sub_add actually optional
This was always intended. Also fixes subtitle-file drag & drop.
2014-10-22 07:58:38 +02:00
wm4 65ba6f9f57 lua: don't let temporary values take the place of arguments
Because Lua is so terrible, it's easy to confuse temporary values pushed
to the Lua stack with arguments if the arguments are checked after that.

Add a hack that should fix this.
2014-10-22 01:10:15 +02:00
wm4 2e81698d28 osdep: NetBSD pthread_setname_np()
From: bugmen0t on github

Fixes #1207.
2014-10-22 01:04:52 +02:00
wm4 7eb047b241 command: make reverse cycle_values match up with forward one
The behavior of reverse cycling (with the "!reverse" magic value) was a
bit weird and acted with a "delay". This was because the command set the
value the _next_ command should use. Change this and make each command
invocation select and use the next command directly. This requires an
"uninitialized" special index in the counter, but that is no problem at
all.
2014-10-21 23:55:32 +02:00
wm4 4d5903f915 command: fix video-rotate update when paused
Due to the way video-rotate currently works, the state will be
automatically updated once new video is decoded. So the filter chain
doesn't need to be reinitialized automatically, but there is a need to
trigger the video instant refresh code path instead.

Also move the support function closer to an annoying similar yet
different function. They probably can be unified next time major changes
are done to this code.
2014-10-21 23:34:56 +02:00
wm4 bd315dfaf9 lua: don't use "output" as identifier
I suspect this clashes with libcs,w hich define "stdout" as macro.
Hopefully fixes #1206.
2014-10-21 13:44:21 +02:00
wm4 bc1893e036 command: add cursor-autohide property
Allows properly changing/updating the cursor state. Useful for client
API window embedding, because the host application may not want the mpv
window to grab mouse input, and this has to manually handle the cursor.
Changing the cursor of foreign windows is usually not sane.

It might make sense to allow changing the cursor icon, but that would be
much more complicated, so I won't add it unless someone actually
requests it.
2014-10-21 13:42:15 +02:00
wm4 0fa9e2bff0 command: add playback-abort property
Now this is obscure.
2014-10-21 13:38:41 +02:00
wm4 cdbc865ad0 command: add video-rotate property 2014-10-21 13:31:30 +02:00
wm4 f8e254864c options: allow selecting track ID 0 too
Blergh. Now needed for --ff-aid and friends.
2014-10-21 13:22:38 +02:00