Commit Graph

39405 Commits

Author SHA1 Message Date
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
wm4 f0f83ff366 player: add stream selection by ffmpeg index
Apparently using the stream index is the best way to refer to the same
streams across multiple FFmpeg-using programs, even if the stream index
itself is rarely meaningful in any way.

For Matroska, there are some possible problems, depending how FFmpeg
actually adds streams. Normally they seem to match though.
2014-10-21 13:19:20 +02:00
wm4 bcc3d72995 sd_lavc: strictly letter-box PGS subtitles
Getting subtitle scaling and positioning right even if there are video
filters, which completely change the image (like cropping), doesn't seem
to have a single, correct solution. To some degree, the results are
arbitrary, so we may as well do what is most useful to the user.

In this case, if the PGS resolution aspect ratio and the video output
aspect ratio mismatch, letter-box it, instead of stretching the subs
over the video frame. (This will require additional fixes, should it
turn out that there are PGS subtitles which are stretched by design.)

Fixes #1205.
2014-10-21 11:37:32 +02:00
wm4 38420eb49e json: handle >\\"< fragments correctly
It assumed that any >\"< sequence was an escape for >"<, but that is not
the case with JSON such as >{"ducks":"\\"}<. In this case, the second
>\< is obviously not starting an escape.
2014-10-21 02:59:30 +02:00
Kevin Mitchell bbf4a8aa5d TOOLS/lua: update README.md 2014-10-21 00:55:15 +02:00
Kevin Mitchell 3617399a46 TOOLS/lua: remove tabs from some lua scripts 2014-10-21 00:55:15 +02:00
Kevin Mitchell e68cc34c99 TOOLS/lua: add autodeint.lua
This isn't quite as robust as idet.sh as the default detection
interval is only 4 seconds vs 35 for idet.sh. idet.sh can have such a
large sample time since it turns off the vo and uses --untimed, which
is currently not possible from lua.
2014-10-21 00:55:15 +02:00
Kevin Mitchell 599c510902 command: add field-dominance property 2014-10-21 00:55:15 +02:00
wm4 40d6b5ca85 lua: add convenience function for hooks
So the user doesn't have to care about the awkward low-level details.
2014-10-21 00:38:56 +02:00
wm4 131633b4e5 command: extend sub_add command 2014-10-21 00:15:04 +02:00
wm4 b79f291f4b command: remove hook cancellation mechanism
I doubt anyone will actually use this correctly. Also, there was a bug
(a typo) which prevented it from working at all.
2014-10-20 23:43:10 +02:00
wm4 a67be5dd05 command: allow sub_add at an earlier stage 2014-10-20 23:33:46 +02:00
wm4 d38e36b98f osdep: shorten thread name on glibc only
Instead of affecting every platform, do this for glibc only (where it's
known to be a problem), and only if the right error is returned.
2014-10-20 21:50:49 +02:00
Ben Boeckel c918b8a3f3 manpage: fix a typo 2014-10-20 00:23:55 +02:00
wm4 600221e723 osdep: limit thread names to 16 characters
It turns out the glibc people are very clever and return an error if the
thread name exceeds the maximum supported kernel length, instead of
truncating the name. So everyone has to hardcode the currently allowed
Linux kernel name length limit, even if it gets extended later.

Also the Lua script filenames could get too long; use the client name
instead.

Another strange thing is that on Linux, unrelated threads "inherit" the
name by the thread they were created. This leads to random thread names,
because there's not necessarily a strong relation between these threads
(e.g. script command leads to filter recreation -> the filter's threads
are tagged with the script's thread name). Unfortunate.
2014-10-20 00:17:11 +02:00
wm4 1aae992585 stream: stupid compilation workaround for win32
On win32, open() is a function-like macro. The line of code changed
with this commit accidentally expanded the macro. Prevent this macro
expansion. Not sure why that happened now. Since as far as I remember
system functions can be defined as macros, this affects in theory not
only win32.
2014-10-19 23:49:42 +02:00
wm4 9ba6641879 Set thread name for debugging
Especially with other components (libavcodec, OSX stuff), the thread
list can get quite populated. Setting the thread name helps when
debugging.

Since this is not portable, we check the OS variants in waf configure.
old-configure just gets a special-case for glibc, since doing a full
check here would probably be a waste of effort.
2014-10-19 23:48:40 +02:00
wm4 c6dca55665 manpage: ipc: mention unavailability on Windows
Windows doesn't have unix domain sockets, and can't handle sockets and
pipes in an uniform way. Only the libwaio fallback code is available,
which doesn't do JSON.
2014-10-19 22:35:45 +02:00
wm4 2f559ac70b player: shutdown all clients before actual uninit
This seems safer. It might be possible that commands sent by the clients
could recreate e.g. audio or video outputs.
2014-10-19 22:34:37 +02:00
wm4 2cd25891b6 manpage: ipc: mention the socat tool
This is not realy obvious, so I assume this is a helpful hint.

Although the usefulness of such an approach is probably influenced by
the fact that the player might send events that arrive in the short
window while the socket is connected.
2014-10-19 22:34:37 +02:00