| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
(cherry picked from commit 9251fa125f6ebc0f485c93af1809efb7b6da19bd)
|
|
|
|
|
|
|
|
|
| |
There is not much of a reason to have these wrappers around. Use POSIX
standard functions directly, and use a separate utility function to take
care of the timespec calculations. (Course POSIX for using this weird
format for time values.)
(cherry picked from commit 92b9d75d7256be71d8c8b18438af9494b78f0e96)
|
|
|
|
|
|
|
| |
The main reason for this was compatibility; but some associated problems
have been solved in the previous commit.
(cherry picked from commit ca9964a4fb6b1faa0155da43b3c815db0075e2d5)
|
|
|
|
|
|
|
|
|
|
|
|
| |
As usual, we prefer plain C11 names and semantics, and have to emulate
them if C11 atomics are not available.
For the non-atomic fallback (which is just there to make code compile in
situations the atomic property is not overly important), we require a
gross hack to make the generic macros work without using compiler-
specific extensions.
(cherry picked from commit cc24ec5b3cf7709bbd16a9505a6acc8156f63af1)
|
|
|
|
|
|
|
|
| |
This was a mistake, it should definitely be using the device namespace
rather than the file namespace. As it says in the docs, all pipe names
must start with \\.\pipe\
(cherry picked from commit b6381a0ee383acb1ee7a9562b166c18066747b7f)
|
|
|
|
|
|
| |
The folder argument wasn't used, so it always returned the APPDATA dir.
(cherry picked from commit a2da53027b3fcb232121c38e79d7daae651f099d)
|
|
|
|
|
|
|
| |
This will probably disable this code for Cygwin. I don't know if this
matters, since Cygwin should strictly behave like a Unix anyway.
(cherry picked from commit 3508a3fbd12b93e0414acb7996417dd91f369170)
|
|
|
|
|
|
|
|
| |
And split the Cocoa and Unix cases. Simplify the Cocoa case slightly by
calling mpv_main directly, instead of passing a function pointer. Also
add a comment explaining why Cocoa needs a special case at all.
(cherry picked from commit 1e7831070f6ae1af0a1a29b0d680ef2907bf8cf6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This unbreaks compiling command line player and libmpv at the same
time. The problem was that doing so silently disabled the OSX
application thing - but the command line player can not use the
vo_opengl Cocoa backend without it.
The OSX application code is basically dead in libmpv, but it's not
that much code anyway.
If you want a mpv binary that does not create an OSX application
singleton (and creates a menu etc.), you must disable cocoa
completely, as cocoa can't be used anyway in this case.
(cherry picked from commit 19a5b20752ecc7465cf17781f908e12bf4ca136d)
|
|
|
|
| |
(cherry picked from commit 6814830b9a7740e789a6965f6e4f8da4ba67dd42)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Somewhat less ifdeffery, higher flexibility. Now there are 3 separate
config file resolvers for 3 platforms (unix, win, osx), and they can
still interact with each other somewhat. For example, OSX for now uses
most of Unix, but adds the OSX bundle path.
This can be extended to resolve very specific platform paths, such as
location of the desktop.
Most of the Unix specific code moves to path-unix.c.
The behavior should be the same - if not, it is likely a bug.
(cherry picked from commit d3a3cfe54c26055c0686ea1b9a245eb7f88af521)
|
|
|
|
| |
We shouldn't call it from a signal handler.
|
| |
|
|
|
|
|
|
|
|
| |
It appears youtube-dl sometimes asks for a password on stdin. This won't
work, because mpv already uses the terminal.
(I wonder if this could be simpler, like simply closing FD 0, but let's
not. The FD would be reused by something random.)
|
|
|
|
| |
Signed-off-by: wm4 <wm4@nowhere>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, mpv.exe used the --terminal option to decide whether to
attach to the parent process's console, which made it impossible to tell
whether mpv would attach to the console before the config files were
parsed. Instead, make mpv always attach to the console when launched
from the console wrapper (mpv.com) and never attach otherwise. This will
be useful for the next commit, which will use the presence of the
console to decide whether to use the pseudo-gui profile.
This change should also be an improvement in behavior. The old code
would attach to the parent process's console, regardless of whether it
was mpv.com or some other program like cmd.exe. This could be confusing,
since mpv.exe is marked as a Windows GUI program and shouldn't write
text to its parent process's console when launched directly. (See #768.)
Visual Studio does something similar with its devenv.com wrapper.
devenv.exe only attaches to the console when launched from devenv.com.
|
|
|
|
|
|
|
|
|
|
| |
Add a platform-specific entry-point for Windows. This will allow some
platform-specific initialization to be added without the need for ugly
ifdeffery in main.c.
As an immediate advantage, mpv can now use a unicode entry-point and
convert the command line arguments to UTF-8 before passing them to
mpv_main, so osdep_preinit can be simplified a little bit.
|
|
|
|
| |
This bit always seemed confusing to me.
|
| |
|
|
|
|
|
|
|
| |
The player now relies on the (slightly obscure) requirement that argv is
NULL-terminated.
Might fix #1652.
|
| |
|
|
|
|
|
|
| |
This should be sufficient.
If stdatomic.h is not available, we make no difference.
|
| |
|
|
|
|
|
|
|
|
| |
Commit e920a00eb assumed that terminate_cocoa_application() actually
would exit. But apparently that is not always the case; e.g. mpv --help
will just hang. The old code had a dummy exit(0), which was apparently
actually called. Fix by explicitly exiting if mpv_main() returns and
terminate_cocoa_application() does nothing.
|
|
|
|
| |
This is almost equivalent, and gets rid of the ifdef.
|
|
|
|
| |
Pointed out in #935 (again).
|
|
|
|
|
| |
It's the wrong thing to check. For example it doesn't work on cygwin.
Just live with the warning.
|
|
|
|
|
|
|
|
|
| |
This allows getting the log at all with --no-terminal and without having
to retrieve log messages manually with the client API. The log level is
hardcoded to -v. A higher log level would lead to too much log output
(huge file sizes and latency issues due to waiting on the disk), and
isn't too useful in general anyway. For debugging, the terminal can be
used instead.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the program name isn't quoted and the .exe it refers to isn't found,
CreateProcess will add the program arguments to the program name and
continue searching, so for "program arg1 arg2", CreateProcess would try
"program.exe", "program arg1.exe", then "program arg1 arg2.exe". This
behaviour is weird and not really desirable, so prevent it by always
quoting the program name.
When quoting argv[0], escape sequences shouldn't be used. msvcrt, .NET
and CommandLineToArgvW all treat argv[0] literally and end it on the
trailing quote, without processing escape sequences.
|
|
|
|
|
| |
Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into
the build system, instead of defining them over and over in the code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function terminal_in_background() reports whether the player was
backgrounded. In this case, we don't want to annoy the user by still
printing the status to stderr. If no terminal interaction is assumed,
this mechanism is disabled, and stderr is always used. The read_terminal
variable signals this case.
Oddly, just redirecting stderr will disable output to stderr, because
the background check with tcgetpgrp() is done on stderr, but
read_terminal is still true (because that one depends on stdin and
stdout).
Explicitly disable this mechanism if --no-input-terminal is used by
setting read_terminal to true only if terminal input is actually
initialized.
|
|
|
|
|
|
|
|
|
|
|
| |
Our own code was introduced when FFmpeg didn't provide this API (or
maybe didn't even have a way to determine the CPU count). But now,
av_cpu_count() is available for all FFmpeg/Libav versions we support,
and there's no reason to have our own code.
libavutil's code seems to be slightly more sophisticated than our's, and
it's possible that the detected CPU count is different on some platforms
after this change.
|
|
|
|
|
|
|
|
|
| |
If the stdout or stderr write callback is NULL, then don't redirect this
stream. Preparation for the next commit.
Not sure what to do on Windows; it seems STARTUPINFO doesn't allow
redirection only one of them. So just let them write nothing. For our
intended use-case (next commit), this is probably sensible.
|
|
|
|
|
|
|
| |
Off by default, use --enable-win32-internal-pthreads .
This probably still needs a lot more testing. It also won't work on
Windows XP.
|
| |
|
|
|
|
|
|
|
|
| |
Makes all of overlay_add work on windows/mingw.
Since we now don't explicitly check for mmap() anymore (it's always
present), this also requires us to make af_export.c compile, but I
haven't tested it.
|
|
|
|
|
|
|
|
|
| |
I noticed that the IPC code does not use MSG_NOSIGNAL or SO_NOSIGPIPE.
The former is "only" POSIX 2008 and also requires switching to sendto(),
while the latter is even less portable.
Not going to bother with this obsolete 80ies crap, just block SIGPIPE,
and instruct client API users to do the same.
|
|
|
| |
similar to some of the code deleted in 685b8b7a but simpler
|
|
|
|
|
| |
Previously when using the bundle we used a custom bizarro thing to wait for
events. Just use `--idle` and greatly simplify the code.
|
|
|
|
| |
fixes #635
|
|
|
|
|
|
| |
This fixes using the mpv:// custom protocol on Yosemite were apparently
we receive an url which is automatically urlencoded by the system.
/cc mpv-player/stable
|
|
|
|
|
|
| |
Fixes #1202
/cc @mpv-player/stable
|
|
|
|
|
| |
PIPE_REJECT_REMOTE_CLIENTS isn't supported on XP. It's not really
needed, so remove it. Also fix error checking for CreateNamedPipe.
|
|
|
|
|
| |
Don't recursively include the whole stream.h header; only include what's
minimally needed, and handle the rest with forward declarations.
|
|
|
|
|
|
| |
The subprocess code was already split into fairly general functions,
separate from the Lua code. It's getting pretty big though, especially
the Windows-specific parts, so move it into its own files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Avoids a crash if OpenSSL tries to write to a broken connection with
write().
Obviously OpenSSL really should use send() with MSG_NOSIGNAL, but for
some reason it doesn't. This should probably be considered an OpenSSL
bug, but since in this case we "own" the process, there is no harm in
ignoring the signal.
This is not done with libmpv, because as a library we don't want to mess
with global state. It's also not done if terminal handling is disabled -
this is a bit arbitrary, but I don't care much.
|
| |
|
|
|
|
|
|
| |
When mpv is backgrounded initially (via & in the shell), do no longer
change terminal settings on startup. This fixes broken local echo after
launching a backgrounded mpv.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As usual, we use C11 semantics, and emulate it if <stdatomic.h> is not
available.
It's a bit messy with __sync_val_compare_and_swap(). We assume it has
"strong" semantics (it can't fail sporadically), but I'm not sure if
this is really the case. On the other hand, weak semantics don't seem to
be possible, since the builtin can't distinguish between the two failure
cases that could occur. Also, to match the C11 interface, use of gcc
builtins is unavoidable. Add a check to the build system to make sure
the compiler supports them (although I don't think there's any compiler
which supports __sync_*, but not these extensions).
Needed for the following commit.
|
|
|
|
| |
Signed-off-by: wm4 <wm4@nowhere>
|
|
|
|
|
| |
The <pthread_np.h> header expects that <pthread.h> was already included.
We were including <pthread.h> only later via our threads.h.
|
|
|
|
|
| |
Or in other words, a pipe that has the CLOEXEC flag set. Needed since
Linux' pipe2() is not in POSIX yet.
|
|
|
|
|
|
| |
It was disabled since the last release, and nobody complained loudly.
Further details see commit 4b5c3ea7.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
From: bugmen0t on github
Fixes #1207.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Instead of relying on the macro-defined lseek(), just use _lseeki64
directly, and avoid a minor mess.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
mp_stat() instead of stat() was used in the normal code (i.e. even
on Unix), because MinGW-w64 has an unbelievable macro-mess in place,
which prevents solving this elegantly.
Add some dirty workarounds to hide mp_stat() from the normal code
properly. This now requires replacing all functions that use the
struct stat type. This includes fstat, lstat, fstatat, and possibly
others. (mpv currently uses stat and fstat only.)
|
|
|