Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca8dc9147b | ||
|
|
df8b99490c | ||
|
|
c78142a973 | ||
|
|
a8e6caf56b | ||
|
|
e6cca1e43b | ||
|
|
d7538d3597 | ||
|
|
f3eb5b143c | ||
|
|
9993fd8888 | ||
|
|
d9c3a51d87 | ||
|
|
619fa761af | ||
|
|
717d729dcb | ||
|
|
4eb5b62e5a | ||
|
|
b9e32d0d3d | ||
|
|
28e2b95f58 | ||
|
|
491f633a20 | ||
|
|
eb5e45855a | ||
|
|
59e55bb0e1 | ||
|
|
9f46be7373 | ||
|
|
3623fb38ee | ||
|
|
1ad9e322e3 | ||
|
|
cad63810c5 | ||
|
|
da17c64c76 | ||
|
|
57f32f7ca8 | ||
|
|
3d85137495 | ||
|
|
4aff0076a0 | ||
|
|
70f8ea228d | ||
|
|
3196f4cdd7 | ||
|
|
4fa0853c34 | ||
|
|
6598b55c35 | ||
|
|
848d7979e5 | ||
|
|
13301daf6a | ||
|
|
763a38f889 | ||
|
|
ed1e4de452 | ||
|
|
0e2fe55fde | ||
|
|
22cfb48b52 | ||
|
|
4a07120f83 | ||
|
|
d06ff691ed | ||
|
|
34cee2a77d | ||
|
|
8f5eb7b780 | ||
|
|
b991c072f6 | ||
|
|
3c2777994b | ||
|
|
80741f27f3 | ||
|
|
3d18ab77b3 | ||
|
|
8d2baaa318 |
No files matched your search
+1
-1
@@ -134,9 +134,9 @@ What works
|
||||
* Deinterlacing/Inverse Telecine with any of mpv's filters for that
|
||||
* Audio file converting: mpv -o outfile.mp3 infile.flac -no-video -oac
|
||||
libmp3lame -oacopts ab=320k
|
||||
* inverse telecine filters (confirmed working: detc, pullup, filmdint)
|
||||
|
||||
What does not work yet
|
||||
======================
|
||||
|
||||
* 3-pass encoding (ensuring constant total size and bitrate constraints while
|
||||
having VBR audio; mencoder calls this "frameno")
|
||||
|
||||
+25
-1
@@ -18,7 +18,12 @@ normal driver parameters.
|
||||
|
||||
.. note::
|
||||
|
||||
See ``--ao=help`` for a list of compiled-in audio output drivers.
|
||||
See ``--ao=help`` for a list of compiled-in audio output drivers. The
|
||||
driver ``--ao=alsa`` is preferred. ``--ao=pulse`` is preferred on systems
|
||||
where PulseAudio is used. On Windows, ``--ao=wasapi`` is preferred,
|
||||
though it might cause trouble sometimes, in which case ``--ao=dsound``
|
||||
should be used. On BSD systems, ``--ao=oss`` or `--ao=sndio`` may work
|
||||
(the latter being experimental). On OSX systems, use ``--ao=coreaudio``.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
@@ -118,6 +123,9 @@ Available audio output drivers are:
|
||||
``openal``
|
||||
Experimental OpenAL audio output driver
|
||||
|
||||
.. note:: This driver is not very useful. Playing multi-channel audio with
|
||||
it is slow.
|
||||
|
||||
``pulse``
|
||||
PulseAudio audio output driver
|
||||
|
||||
@@ -130,6 +138,10 @@ Available audio output drivers are:
|
||||
PortAudio audio output driver. This works on all platforms, and has
|
||||
extensive MS Windows support.
|
||||
|
||||
.. note:: This driver is not very useful. It was added in the hope of
|
||||
providing portable audio API across all platforms, but turned
|
||||
out semi-broken and underfeatured.
|
||||
|
||||
``device``
|
||||
Specify the subdevice to use. Giving ``help`` as device name lists all
|
||||
devices found by PortAudio. Devices can be given as numeric values,
|
||||
@@ -138,6 +150,8 @@ Available audio output drivers are:
|
||||
``dsound`` (Windows only)
|
||||
DirectX DirectSound audio output driver
|
||||
|
||||
.. note:: This driver is for compatibility with old systems.
|
||||
|
||||
``device=<devicenum>``
|
||||
Sets the device number to use. Playing a file with ``-v`` will show a
|
||||
list of available devices.
|
||||
@@ -147,6 +161,10 @@ Available audio output drivers are:
|
||||
1.2, but may require the ``SDL_AUDIODRIVER`` environment variable to be set
|
||||
appropriately for your system.
|
||||
|
||||
.. note:: This driver is for compatibility with extremely foreign
|
||||
environments, such as systems where none of the other drivers
|
||||
are available.
|
||||
|
||||
``buflen=<length>``
|
||||
Sets the audio buffer length in seconds. Is used only as a hint by the
|
||||
sound system. Playing a file with ``-v`` will show the requested and
|
||||
@@ -186,6 +204,10 @@ Available audio output drivers are:
|
||||
``rsound``
|
||||
Audio output to an RSound daemon
|
||||
|
||||
.. note:: Completely useless, unless you intend to run RSound. Not to be
|
||||
confused with RoarAudio, which is something completely
|
||||
different.
|
||||
|
||||
``host=<name/path>``
|
||||
Set the address of the server (default: localhost). Can be either a
|
||||
network hostname for TCP connections or a Unix domain socket path
|
||||
@@ -197,6 +219,8 @@ Available audio output drivers are:
|
||||
``sndio``
|
||||
Audio output to the OpenBSD sndio sound system
|
||||
|
||||
.. note:: Experimental. There are known bugs and issues.
|
||||
|
||||
(Note: only supports mono, stereo, 4.0, 5.1 and 7.1 channel
|
||||
layouts.)
|
||||
|
||||
|
||||
@@ -1558,10 +1558,10 @@ OPTIONS
|
||||
``--osd-level=<0-3>``
|
||||
Specifies which mode the OSD should start in.
|
||||
|
||||
:0: subtitles only
|
||||
:1: volume + seek (default)
|
||||
:2: volume + seek + timer + percentage
|
||||
:3: volume + seek + timer + percentage + total time
|
||||
:0: OSD completely disabled (subtitles only)
|
||||
:1: enabled (shows up only on user interaction)
|
||||
:2: enabled + current time visible by default
|
||||
:3: enabled + ``--osd-status-msg`` (current time and status by default)
|
||||
|
||||
``--osd-margin-x=<size>, --sub-text-margin-x=<size>``
|
||||
Left and right screen margin for the OSD/subs in scaled pixels (see
|
||||
|
||||
+3
-3
@@ -98,7 +98,7 @@ Available filters are:
|
||||
:2: Rotate by 90 degrees counterclockwise.
|
||||
:3: Rotate by 90 degrees counterclockwise and flip.
|
||||
|
||||
``scale[=w:h[:interlaced[:chr_drop[:par[:par2[:noup[:arnd]]]]]]]``
|
||||
``scale[=w:h[:interlaced[:chr-drop[:param[:param2[:noup[:arnd]]]]]]]``
|
||||
Scales the image with the software scaler (slow) and performs a YUV<->RGB
|
||||
colorspace conversion (see also ``--sws``).
|
||||
|
||||
@@ -114,7 +114,7 @@ Available filters are:
|
||||
:-(n+8): Like -n above, but rounding the dimension to the closest
|
||||
multiple of 16.
|
||||
|
||||
``<chr_drop>``
|
||||
``<chr-drop>``
|
||||
chroma skipping
|
||||
|
||||
:0: Use all available input lines for chroma.
|
||||
@@ -122,7 +122,7 @@ Available filters are:
|
||||
:2: Use only every 4. input line for chroma.
|
||||
:3: Use only every 8. input line for chroma.
|
||||
|
||||
``<par>[:<par2>]`` (see also ``--sws``)
|
||||
``<param>[:<param2>]`` (see also ``--sws``)
|
||||
Set some scaling parameters depending on the type of scaler selected
|
||||
with ``--sws``::
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ normal driver parameters.
|
||||
|
||||
See ``--vo=help`` for a list of compiled-in video output drivers.
|
||||
|
||||
The recommended output drivers are ``--vo=vdpau`` and ``--vo=opengl-hq``.
|
||||
All other drivers are just for compatibility or special purposes.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``--vo=opengl,xv,``
|
||||
@@ -32,6 +35,8 @@ Available video output drivers are:
|
||||
the most compatible VO on X, but may be low-quality, and has issues with
|
||||
OSD and subtitle display.
|
||||
|
||||
.. note:: This driver is for compatibility with old systems.
|
||||
|
||||
``adaptor=<number>``
|
||||
Select a specific XVideo adaptor (check xvinfo results).
|
||||
``port=<number>``
|
||||
@@ -172,6 +177,9 @@ Available video output drivers are:
|
||||
``direct3d_shaders`` (Windows only)
|
||||
Video output driver that uses the Direct3D interface.
|
||||
|
||||
.. note:: This driver is for compatibility with systems that don't provide
|
||||
proper OpenGL drivers.
|
||||
|
||||
``prefer-stretchrect``
|
||||
Use ``IDirect3DDevice9::StretchRect`` over other methods if possible.
|
||||
|
||||
@@ -228,11 +236,15 @@ Available video output drivers are:
|
||||
Same as ``direct3d_shaders``, but with the options ``disable-textures``
|
||||
and ``disable-shaders`` forced.
|
||||
|
||||
.. note:: This driver is for compatibility with old systems.
|
||||
|
||||
``corevideo`` (Mac OS X 10.6 and later)
|
||||
Mac OS X CoreVideo video output driver. Uses the CoreVideo APIs to fill
|
||||
PixelBuffers and generate OpenGL textures from them (useful as a fallback
|
||||
for ``opengl``).
|
||||
|
||||
.. note:: This driver is for compatibility with old systems.
|
||||
|
||||
``opengl``
|
||||
OpenGL video output driver. It supports extended scaling methods, dithering
|
||||
and color management.
|
||||
@@ -519,6 +531,8 @@ Available video output drivers are:
|
||||
implementation, even if you do not get any error message. Use ``glxinfo``
|
||||
or a similar tool to display the supported OpenGL extensions.
|
||||
|
||||
.. note:: This driver is for compatibility with old systems.
|
||||
|
||||
``(no-)ati-hack``
|
||||
ATI drivers may give a corrupted image when PBOs are used (when using
|
||||
``force-pbo``). This option fixes this, at the expense of using a bit
|
||||
@@ -692,6 +706,9 @@ Available video output drivers are:
|
||||
hardware acceleration. Should work on all platforms supported by SDL 2.0.
|
||||
For tuning, refer to your copy of the file ``SDL_hints.h``.
|
||||
|
||||
.. note:: This driver is for compatibility with systems that don't provide
|
||||
proper graphics drivers, or which support GLES only.
|
||||
|
||||
``sw``
|
||||
Continue even if a software renderer is detected.
|
||||
|
||||
@@ -704,6 +721,9 @@ Available video output drivers are:
|
||||
hardware decoding to save power on laptops, or possibly preventing video
|
||||
tearing with some setups.
|
||||
|
||||
.. note:: This driver is for compatibility with crappy systems. You can
|
||||
use vaapi hardware decoding with ``--vo=opengl`` too.
|
||||
|
||||
``scaling=<algorithm>``
|
||||
default
|
||||
Driver default (mpv default as well).
|
||||
@@ -744,6 +764,8 @@ Available video output drivers are:
|
||||
``caca``
|
||||
Color ASCII art video output driver that works on a text console.
|
||||
|
||||
.. note:: This driver is a joke.
|
||||
|
||||
``image``
|
||||
Output each frame into an image file in the current directory. Each file
|
||||
takes the frame number padded with leading zeros as name.
|
||||
@@ -789,6 +811,9 @@ Available video output drivers are:
|
||||
``wayland`` (Wayland only)
|
||||
Wayland shared memory video output as fallback for ``opengl``.
|
||||
|
||||
.. note:: This driver is for compatibility with systems that don't provide
|
||||
working OpenGL drivers.
|
||||
|
||||
``default-format``
|
||||
Use the default RGB32 format instead of an auto-detected one.
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ Essential dependencies (incomplete list):
|
||||
- X development headers (xlib, X extensions, libvdpau, libGL, libXv, ...)
|
||||
- Audio output development headers (libasound, pulseaudio)
|
||||
- FFmpeg libraries (libavutil libavcodec libavformat libswscale libavresample)
|
||||
At least FFmpeg 1.2.4 or Libav 9.10 is required. (If FFmpeg was compiled
|
||||
without libavresample, at least FFmpeg 2.0 is required.)
|
||||
- libjpeg (for screenshots)
|
||||
- libquvi if you want to play Youtube videos directly
|
||||
|
||||
|
||||
+35
-6
@@ -23,6 +23,11 @@ Note that you can control the mpv instance by writing to the command fifo:
|
||||
|
||||
echo "cycle fullscreen" > /tmp/umpv-fifo-*
|
||||
|
||||
Note: you can supply custom options with the UMPV_OPTIONS environment variable.
|
||||
The environment variable will be split on whitespace, and each item is
|
||||
passed as option to mpv _if_ the script starts mpv. If mpv is not started
|
||||
by the script (i.e. mpv is already running), the options will be ignored.
|
||||
|
||||
Warning:
|
||||
|
||||
The script attempts to make sure the FIFO is safely created (i.e. not world-
|
||||
@@ -38,13 +43,33 @@ import errno
|
||||
import subprocess
|
||||
import fcntl
|
||||
import stat
|
||||
import string
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("error: needs at least one file as argument.")
|
||||
if len(sys.argv) < 1:
|
||||
sys.exit(1)
|
||||
files = sys.argv[1:]
|
||||
|
||||
# this is about the same method mpv uses to decide this
|
||||
def is_url(filename):
|
||||
parts = filename.split(":", 1)
|
||||
if len(parts) < 2:
|
||||
return False
|
||||
# protocol prefix has no special characters => it's an URL
|
||||
prefix = parts[0]
|
||||
for c in prefix:
|
||||
if string.ascii_letters.find(c) < 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
# make them absolute; also makes them safe against interpretation as options
|
||||
files = [os.path.abspath(f) for f in files]
|
||||
def make_abs(filename):
|
||||
if not is_url(filename):
|
||||
return os.path.abspath(filename)
|
||||
return filename
|
||||
files = [make_abs(f) for f in files]
|
||||
|
||||
opts_env = os.getenv("UMPV_OPTIONS")
|
||||
opts_env = opts_env.split() if opts_env else []
|
||||
|
||||
FIFO = "/tmp/umpv-fifo-" + os.getenv("USER")
|
||||
|
||||
@@ -87,7 +112,11 @@ else:
|
||||
pass
|
||||
else:
|
||||
raise e
|
||||
os.mkfifo(FIFO, 0600)
|
||||
os.mkfifo(FIFO, int("0600", 8))
|
||||
|
||||
subprocess.check_call(["mpv", "--really-quiet", "--force-window",
|
||||
"--input-file=" + FIFO, "--"] + files)
|
||||
opts = ["mpv", "--really-quiet", "--force-window", "--input-file=" + FIFO]
|
||||
opts.extend(opts_env)
|
||||
opts.append("--")
|
||||
opts.extend(files)
|
||||
|
||||
subprocess.check_call(opts)
|
||||
+7
-2
@@ -173,10 +173,15 @@ void mp_audio_realloc(struct mp_audio *mpa, int samples)
|
||||
}
|
||||
|
||||
// Like mp_audio_realloc(), but only reallocate if the audio grows in size.
|
||||
// If the buffer is reallocated, also preallocate.
|
||||
void mp_audio_realloc_min(struct mp_audio *mpa, int samples)
|
||||
{
|
||||
if (samples > mp_audio_get_allocated_size(mpa))
|
||||
mp_audio_realloc(mpa, samples);
|
||||
if (samples > mp_audio_get_allocated_size(mpa)) {
|
||||
size_t alloc = ta_calc_prealloc_elems(samples);
|
||||
if (alloc > INT_MAX)
|
||||
abort(); // oom
|
||||
mp_audio_realloc(mpa, alloc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the size allocated for the data, in number of samples. If the allocated
|
||||
|
||||
@@ -74,7 +74,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
||||
struct mp_audio *in = arg;
|
||||
struct mp_audio orig_in = *in;
|
||||
|
||||
if (AF_FORMAT_IS_AC3(in->format) || in->nch < s->cfg_min_channel_num)
|
||||
if (AF_FORMAT_IS_SPECIAL(in->format) || in->nch < s->cfg_min_channel_num)
|
||||
return AF_DETACH;
|
||||
|
||||
mp_audio_set_format(in, s->in_sampleformat);
|
||||
|
||||
@@ -431,6 +431,32 @@ static bool ca_bitmap_from_ch_tag(struct ao *ao, AudioChannelLayout *layout,
|
||||
}
|
||||
}
|
||||
|
||||
static void ca_log_layout(struct ao *ao, AudioChannelLayout layout)
|
||||
{
|
||||
if (!mp_msg_test(ao->log, MSGL_V))
|
||||
return;
|
||||
|
||||
AudioChannelDescription *descs = layout.mChannelDescriptions;
|
||||
|
||||
MP_VERBOSE(ao, "layout: tag: <%d>, bitmap: <%d>, "
|
||||
"descriptions <%d>\n",
|
||||
layout.mChannelLayoutTag,
|
||||
layout.mChannelBitmap,
|
||||
layout.mNumberChannelDescriptions);
|
||||
|
||||
for (int i = 0; i < layout.mNumberChannelDescriptions; i++) {
|
||||
AudioChannelDescription d = descs[i];
|
||||
MP_VERBOSE(ao, " - description %d: label <%d, %d>, flags: <%u>, "
|
||||
"coords: <%f, %f, %f>\n", i,
|
||||
d.mChannelLabel,
|
||||
ca_label_to_mp_speaker_id(d.mChannelLabel),
|
||||
d.mChannelFlags,
|
||||
d.mCoordinates[0],
|
||||
d.mCoordinates[1],
|
||||
d.mCoordinates[2]);
|
||||
}
|
||||
}
|
||||
|
||||
void ca_bitmaps_from_layouts(struct ao *ao,
|
||||
AudioChannelLayout *layouts, size_t n_layouts,
|
||||
uint32_t **bitmaps, size_t *n_bitmaps)
|
||||
@@ -440,6 +466,7 @@ void ca_bitmaps_from_layouts(struct ao *ao,
|
||||
|
||||
for (int i=0; i < n_layouts; i++) {
|
||||
uint32_t bitmap = 0;
|
||||
ca_log_layout(ao, layouts[i]);
|
||||
|
||||
switch (layouts[i].mChannelLayoutTag) {
|
||||
case kAudioChannelLayoutTag_UseChannelBitmap:
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ static void uninit(struct ao *ao, bool cut_audio)
|
||||
struct encode_lavc_context *ectx = ao->encode_lavc_ctx;
|
||||
|
||||
if (!encode_lavc_start(ectx)) {
|
||||
MP_WARN(ao, "not even ready to encode audio at end -> dropped");
|
||||
MP_WARN(ao, "not even ready to encode audio at end -> dropped\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -522,6 +522,7 @@ static struct demuxer *open_given_type(struct mpv_global *global,
|
||||
.glog = log,
|
||||
.filename = talloc_strdup(demuxer, stream->url),
|
||||
.metadata = talloc_zero(demuxer, struct mp_tags),
|
||||
.initializing = true,
|
||||
};
|
||||
demuxer->params = params; // temporary during open()
|
||||
stream_seek(stream, stream->start_pos);
|
||||
@@ -554,6 +555,7 @@ static struct demuxer *open_given_type(struct mpv_global *global,
|
||||
"File is not seekable, but there's a cache: enabling seeking.\n");
|
||||
demuxer->seekable = true;
|
||||
}
|
||||
demuxer->initializing = false;
|
||||
return demuxer;
|
||||
}
|
||||
|
||||
@@ -724,6 +726,8 @@ int demux_info_add_bstr(demuxer_t *demuxer, struct bstr opt, struct bstr param)
|
||||
if (oldval) {
|
||||
if (bstrcmp0(param, oldval) == 0)
|
||||
return 0;
|
||||
}
|
||||
if (!demuxer->initializing) {
|
||||
MP_INFO(demuxer, "Demuxer info %.*s changed to %.*s\n",
|
||||
BSTR_P(opt), BSTR_P(param));
|
||||
}
|
||||
@@ -740,6 +744,8 @@ int demux_info_print(demuxer_t *demuxer)
|
||||
if (!info || !info->num_keys)
|
||||
return 0;
|
||||
|
||||
demux_info_update(demuxer);
|
||||
|
||||
mp_info(demuxer->glog, "Clip info:\n");
|
||||
for (n = 0; n < info->num_keys; n++) {
|
||||
mp_info(demuxer->glog, " %s: %s\n", info->keys[n], info->values[n]);
|
||||
|
||||
@@ -170,6 +170,7 @@ typedef struct demuxer {
|
||||
// File format allows PTS resets (even if the current file is without)
|
||||
bool ts_resets_possible;
|
||||
bool warned_queue_overflow;
|
||||
bool initializing;
|
||||
|
||||
struct sh_stream **streams;
|
||||
int num_streams;
|
||||
|
||||
+5
-3
@@ -1173,6 +1173,7 @@ typedef struct {
|
||||
char *id;
|
||||
int fourcc;
|
||||
int extradata;
|
||||
bool parse;
|
||||
} videocodec_info_t;
|
||||
|
||||
static const videocodec_info_t vinfo[] = {
|
||||
@@ -1185,11 +1186,11 @@ static const videocodec_info_t vinfo[] = {
|
||||
{MKV_V_MPEG4_AVC, MP_FOURCC('a', 'v', 'c', '1'), 1},
|
||||
{MKV_V_THEORA, MP_FOURCC('t', 'h', 'e', 'o'), 1},
|
||||
{MKV_V_VP8, MP_FOURCC('V', 'P', '8', '0'), 0},
|
||||
{MKV_V_VP9, MP_FOURCC('V', 'P', '9', '0'), 0},
|
||||
{MKV_V_VP9, MP_FOURCC('V', 'P', '9', '0'), 0, true},
|
||||
{MKV_V_DIRAC, MP_FOURCC('d', 'r', 'a', 'c'), 0},
|
||||
{MKV_V_PRORES, MP_FOURCC('p', 'r', '0', '0'), 0},
|
||||
{MKV_V_HEVC, MP_FOURCC('H', 'E', 'V', 'C'), 1},
|
||||
{NULL, 0, 0}
|
||||
{0}
|
||||
};
|
||||
|
||||
static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track)
|
||||
@@ -1273,6 +1274,7 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track)
|
||||
extradata = track->private_data;
|
||||
extradata_size = track->private_size;
|
||||
}
|
||||
track->parse = vi->parse;
|
||||
if (!vi->id) {
|
||||
MP_WARN(demuxer, "Unknown/unsupported "
|
||||
"CodecID (%s) or missing/bad CodecPrivate\n"
|
||||
@@ -1336,7 +1338,7 @@ static struct mkv_audio_tag {
|
||||
bool parse;
|
||||
} mkv_audio_tags[] = {
|
||||
{ MKV_A_MP2, 0, 0x0055 },
|
||||
{ MKV_A_MP3, 0, 0x0055 },
|
||||
{ MKV_A_MP3, 0, 0x0055, true },
|
||||
{ MKV_A_AC3, 1, 0x2000 },
|
||||
{ MKV_A_EAC3, 1, MP_FOURCC('E', 'A', 'C', '3') },
|
||||
{ MKV_A_DTS, 0, 0x2001 },
|
||||
|
||||
@@ -86,6 +86,9 @@ static char *term_smkx = NULL;
|
||||
#endif
|
||||
|
||||
static keycode_st *keys_push(char *p, int code) {
|
||||
if (strlen(p) > 8)
|
||||
return NULL;
|
||||
|
||||
if (getch2_keys.len == getch2_keys.cap) {
|
||||
getch2_keys.cap *= 2;
|
||||
if (getch2_keys.cap == 0)
|
||||
@@ -515,7 +518,7 @@ static int setsigaction(int signo, void (*handler) (int),
|
||||
else
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
sa.sa_flags = flags;
|
||||
sa.sa_flags = flags | SA_RESTART;
|
||||
return sigaction(signo, &sa, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -401,8 +401,10 @@ static int mpv_main(int argc, char *argv[])
|
||||
m_config_set_option0(mpctx->mconfig, "vo", "lavc");
|
||||
m_config_set_option0(mpctx->mconfig, "ao", "lavc");
|
||||
m_config_set_option0(mpctx->mconfig, "fixed-vo", "yes");
|
||||
m_config_set_option0(mpctx->mconfig, "keep-open", "no");
|
||||
m_config_set_option0(mpctx->mconfig, "force-window", "no");
|
||||
m_config_set_option0(mpctx->mconfig, "gapless-audio", "yes");
|
||||
m_config_set_option0(mpctx->mconfig, "resume-playback", "no");
|
||||
mp_input_enable_section(mpctx->input, "encode", MP_INPUT_EXCLUSIVE);
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -514,7 +514,7 @@ static int cache_control(stream_t *cache, int cmd, void *arg)
|
||||
if (r != STREAM_ERROR)
|
||||
goto done;
|
||||
|
||||
MP_VERBOSE(s, "[cache] blocking for STREAM_CTRL %d\n", cmd);
|
||||
MP_VERBOSE(s, "blocking for STREAM_CTRL %d\n", cmd);
|
||||
|
||||
s->control = cmd;
|
||||
s->control_arg = arg;
|
||||
|
||||
+8
-2
@@ -396,16 +396,22 @@ stream_t *open_output_stream(const char *filename, struct mpv_global *global)
|
||||
static int stream_reconnect(stream_t *s)
|
||||
{
|
||||
#define MAX_RECONNECT_RETRIES 5
|
||||
#define RECONNECT_SLEEP_MS 1000
|
||||
#define RECONNECT_SLEEP_MAX_MS 500
|
||||
if (!s->streaming)
|
||||
return 0;
|
||||
if (!(s->flags & MP_STREAM_SEEK_FW))
|
||||
return 0;
|
||||
int64_t pos = s->pos;
|
||||
int sleep_ms = 5;
|
||||
for (int retry = 0; retry < MAX_RECONNECT_RETRIES; retry++) {
|
||||
MP_WARN(s, "Connection lost! Attempting to reconnect (%d)...\n", retry + 1);
|
||||
|
||||
if (stream_check_interrupt(retry ? RECONNECT_SLEEP_MS : 0))
|
||||
if (retry) {
|
||||
mp_sleep_us(sleep_ms * 1000);
|
||||
sleep_ms = MPMIN(sleep_ms * 2, RECONNECT_SLEEP_MAX_MS);
|
||||
}
|
||||
|
||||
if (stream_check_interrupt(0))
|
||||
return 0;
|
||||
|
||||
s->eof = 1;
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ void mp_ass_set_style(ASS_Style *style, double res_y,
|
||||
void mp_ass_add_default_styles(ASS_Track *track, struct MPOpts *opts)
|
||||
{
|
||||
if (opts->ass_styles_file && opts->ass_style_override)
|
||||
ass_read_styles(track, opts->ass_styles_file, opts->sub_cp);
|
||||
ass_read_styles(track, opts->ass_styles_file, NULL);
|
||||
|
||||
if (track->n_styles == 0) {
|
||||
if (!track->PlayResY) {
|
||||
|
||||
@@ -52,11 +52,9 @@ struct sub_bitmap {
|
||||
int x, y;
|
||||
int dw, dh;
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t color;
|
||||
} libass;
|
||||
};
|
||||
struct {
|
||||
uint32_t color;
|
||||
} libass;
|
||||
};
|
||||
|
||||
struct sub_bitmaps {
|
||||
|
||||
@@ -31,7 +31,7 @@ will be replaced with TA calls, and the talloc wrapper will be removed.
|
||||
|
||||
Documentation for the talloc API is here:
|
||||
|
||||
http://git.samba.org/?p=samba.git;a=blob;f=lib/talloc/talloc.h;hb=HEAD
|
||||
http://talloc.samba.org/talloc/doc/html/modules.html
|
||||
|
||||
There are some minor differences with mpv's talloc bridge. mpv calls abort()
|
||||
on allocation failures, and the talloc_set_destructor() signature is slightly
|
||||
|
||||
@@ -115,6 +115,8 @@ static const vf_info_t *const filter_list[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static void vf_uninit_filter(vf_instance_t *vf);
|
||||
|
||||
static bool get_desc(struct m_obj_desc *dst, int index)
|
||||
{
|
||||
if (index >= MP_ARRAY_SIZE(filter_list) - 1)
|
||||
@@ -270,6 +272,17 @@ static vf_instance_t *vf_open_filter(struct vf_chain *c, const char *name,
|
||||
return vf_open(c, name, args);
|
||||
}
|
||||
|
||||
void vf_remove_filter(struct vf_chain *c, struct vf_instance *vf)
|
||||
{
|
||||
assert(vf != c->first && vf != c->last); // these are sentinels
|
||||
struct vf_instance *prev = c->first;
|
||||
while (prev && prev->next != vf)
|
||||
prev = prev->next;
|
||||
assert(prev); // not inserted
|
||||
prev->next = vf->next;
|
||||
vf_uninit_filter(vf);
|
||||
}
|
||||
|
||||
struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name,
|
||||
char **args)
|
||||
{
|
||||
@@ -439,6 +452,7 @@ static void update_formats(struct vf_chain *c, struct vf_instance *vf,
|
||||
MP_INFO(c, "Using conversion filter.\n");
|
||||
struct vf_instance *conv = vf_open(c, "scale", NULL);
|
||||
if (conv) {
|
||||
conv->autoinserted = true;
|
||||
conv->next = vf->next;
|
||||
vf->next = conv;
|
||||
update_formats(c, conv, vf->last_outfmts);
|
||||
@@ -492,6 +506,12 @@ int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params)
|
||||
{
|
||||
struct mp_image_params cur = *params;
|
||||
int r = 0;
|
||||
for (struct vf_instance *vf = c->first; vf; ) {
|
||||
struct vf_instance *next = vf->next;
|
||||
if (vf->autoinserted)
|
||||
vf_remove_filter(c, vf);
|
||||
vf = next;
|
||||
}
|
||||
c->first->fmt_in = *params;
|
||||
uint8_t unused[IMGFMT_END - IMGFMT_START];
|
||||
update_formats(c, c->first, unused);
|
||||
|
||||
@@ -75,6 +75,7 @@ typedef struct vf_instance {
|
||||
void (*uninit)(struct vf_instance *vf);
|
||||
|
||||
char *label;
|
||||
bool autoinserted;
|
||||
|
||||
struct mp_image_params fmt_in, fmt_out;
|
||||
|
||||
@@ -134,6 +135,7 @@ struct mp_image *vf_output_queued_frame(struct vf_chain *c);
|
||||
void vf_seek_reset(struct vf_chain *c);
|
||||
struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name,
|
||||
char **args);
|
||||
void vf_remove_filter(struct vf_chain *c, struct vf_instance *vf);
|
||||
int vf_append_filter_list(struct vf_chain *c, struct m_obj_settings *list);
|
||||
struct vf_instance *vf_find_by_label(struct vf_chain *c, const char *label);
|
||||
void vf_print_filter_chain(struct vf_chain *c, int msglevel);
|
||||
|
||||
+2
-1
@@ -267,7 +267,8 @@ static int encode_video(struct vo *vo, AVFrame *frame, AVPacket *packet)
|
||||
frame->pts * (double) vc->stream->codec->time_base.num /
|
||||
(double) vc->stream->codec->time_base.den, size);
|
||||
|
||||
encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream);
|
||||
if (got_packet)
|
||||
encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
+50
-74
@@ -50,6 +50,8 @@
|
||||
#include "osdep/timer.h"
|
||||
#include "bitmap_packer.h"
|
||||
|
||||
// Returns x + a, but wrapped around to the range [0, m)
|
||||
// a must be within [-m, m], x within [0, m)
|
||||
#define WRAP_ADD(x, a, m) ((a) < 0 \
|
||||
? ((x)+(a)+(m) < (m) ? (x)+(a)+(m) : (x)+(a)) \
|
||||
: ((x)+(a) < (m) ? (x)+(a) : (x)+(a)-(m)))
|
||||
@@ -76,8 +78,6 @@ struct vdpctx {
|
||||
|
||||
VdpPresentationQueueTarget flip_target;
|
||||
VdpPresentationQueue flip_queue;
|
||||
uint64_t last_vdp_time;
|
||||
uint64_t last_sync_update;
|
||||
|
||||
VdpOutputSurface output_surfaces[MAX_OUTPUT_SURFACES];
|
||||
VdpOutputSurface screenshot_surface;
|
||||
@@ -160,53 +160,6 @@ struct vdpctx {
|
||||
|
||||
static bool status_ok(struct vo *vo);
|
||||
|
||||
static int change_vdptime_sync(struct vo *vo, int64_t *t)
|
||||
{
|
||||
struct vdpctx *vc = vo->priv;
|
||||
struct vdp_functions *vdp = vc->vdp;
|
||||
VdpStatus vdp_st;
|
||||
VdpTime vdp_time;
|
||||
vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time);
|
||||
CHECK_VDP_ERROR(vo, "Error when calling vdp_presentation_queue_get_time");
|
||||
uint64_t t1 = *t;
|
||||
uint64_t t2 = mp_time_us();
|
||||
uint64_t old = vc->last_vdp_time + (t1 - vc->last_sync_update) * 1000ULL;
|
||||
if (vdp_time > old) {
|
||||
if (vdp_time > old + (t2 - t1) * 1000ULL)
|
||||
vdp_time -= (t2 - t1) * 1000ULL;
|
||||
else
|
||||
vdp_time = old;
|
||||
} else if (!vdp_time) {
|
||||
/* Some drivers do not return timestamps. */
|
||||
vdp_time = old;
|
||||
}
|
||||
MP_DBG(vo, "adjusting VdpTime offset by %f µs\n",
|
||||
(int64_t)(vdp_time - old) / 1000.);
|
||||
vc->last_vdp_time = vdp_time;
|
||||
vc->last_sync_update = t1;
|
||||
*t = t2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint64_t sync_vdptime(struct vo *vo)
|
||||
{
|
||||
struct vdpctx *vc = vo->priv;
|
||||
|
||||
uint64_t t = mp_time_us();
|
||||
if (t - vc->last_sync_update > 5000000)
|
||||
change_vdptime_sync(vo, &t);
|
||||
uint64_t now = (t - vc->last_sync_update) * 1000ULL + vc->last_vdp_time;
|
||||
// Make sure nanosecond inaccuracies don't make things inconsistent
|
||||
now = FFMAX(now, vc->recent_vsync_time);
|
||||
return now;
|
||||
}
|
||||
|
||||
static uint64_t convert_to_vdptime(struct vo *vo, uint64_t t)
|
||||
{
|
||||
struct vdpctx *vc = vo->priv;
|
||||
return (t - vc->last_sync_update) * 1000LL + vc->last_vdp_time;
|
||||
}
|
||||
|
||||
static int render_video_to_output_surface(struct vo *vo,
|
||||
VdpOutputSurface output_surface,
|
||||
VdpRect *output_rect,
|
||||
@@ -485,12 +438,6 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo)
|
||||
CHECK_VDP_WARNING(vo, "Error setting colorkey");
|
||||
}
|
||||
|
||||
VdpTime vdp_time;
|
||||
vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time);
|
||||
CHECK_VDP_ERROR(vo, "Error when calling vdp_presentation_queue_get_time");
|
||||
vc->last_vdp_time = vdp_time;
|
||||
vc->last_sync_update = mp_time_us();
|
||||
|
||||
vc->vsync_interval = 1;
|
||||
if (vc->composite_detect && vo_x11_screen_is_composited(vo)) {
|
||||
MP_INFO(vo, "Compositing window manager detected. Assuming timing info "
|
||||
@@ -1019,6 +966,15 @@ static int update_presentation_queue_status(struct vo *vo)
|
||||
&status, &vtime);
|
||||
CHECK_VDP_WARNING(vo, "Error calling "
|
||||
"presentation_queue_query_surface_status");
|
||||
if (mp_msg_test(vo->log, MSGL_TRACE)) {
|
||||
VdpTime current;
|
||||
vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, ¤t);
|
||||
CHECK_VDP_WARNING(vo, "Error when calling "
|
||||
"vdp_presentation_queue_get_time");
|
||||
MP_TRACE(vo, "Vdpau time: %"PRIu64"\n", (uint64_t)current);
|
||||
MP_TRACE(vo, "Surface %d status: %d time: %"PRIu64"\n",
|
||||
(int)surface, (int)status, (uint64_t)vtime);
|
||||
}
|
||||
if (status == VDP_PRESENTATION_QUEUE_STATUS_QUEUED)
|
||||
break;
|
||||
if (vc->vsync_interval > 1) {
|
||||
@@ -1040,12 +996,13 @@ static int update_presentation_queue_status(struct vo *vo)
|
||||
return num_queued;
|
||||
}
|
||||
|
||||
static inline uint64_t prev_vs2(struct vdpctx *vc, uint64_t ts, int shift)
|
||||
// Return the timestamp of the vsync that must have happened before ts.
|
||||
static inline uint64_t prev_vsync(struct vdpctx *vc, uint64_t ts)
|
||||
{
|
||||
uint64_t offset = ts - vc->recent_vsync_time;
|
||||
// Fix negative values for 1<<shift vsyncs before vc->recent_vsync_time
|
||||
offset += (uint64_t)vc->vsync_interval << shift;
|
||||
offset %= vc->vsync_interval;
|
||||
int64_t diff = (int64_t)(ts - vc->recent_vsync_time);
|
||||
int64_t offset = diff % vc->vsync_interval;
|
||||
if (offset < 0)
|
||||
offset += vc->vsync_interval;
|
||||
return ts - offset;
|
||||
}
|
||||
|
||||
@@ -1067,18 +1024,36 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration)
|
||||
if (vc->vsync_interval == 1)
|
||||
duration = -1; // Make sure drop logic is disabled
|
||||
|
||||
/* If the presentation time may not be before our last timestamp sync. */
|
||||
if (pts_us && pts_us < vc->last_sync_update)
|
||||
pts_us = vc->last_sync_update;
|
||||
VdpTime vdp_time = 0;
|
||||
vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time);
|
||||
CHECK_VDP_WARNING(vo, "Error when calling vdp_presentation_queue_get_time");
|
||||
|
||||
uint64_t now = sync_vdptime(vo);
|
||||
uint64_t pts = pts_us ? convert_to_vdptime(vo, pts_us) : now;
|
||||
int64_t rel_pts_ns = (pts_us - mp_time_us()) * 1000;
|
||||
if (!pts_us || rel_pts_ns < 0)
|
||||
rel_pts_ns = 0;
|
||||
|
||||
uint64_t now = vdp_time;
|
||||
uint64_t pts = now + rel_pts_ns;
|
||||
uint64_t ideal_pts = pts;
|
||||
uint64_t npts = duration >= 0 ? pts + duration : UINT64_MAX;
|
||||
|
||||
#define PREV_VS2(ts, shift) prev_vs2(vc, ts, shift)
|
||||
// Only gives accurate results for ts >= vc->recent_vsync_time
|
||||
#define PREV_VSYNC(ts) PREV_VS2(ts, 0)
|
||||
/* This should normally never happen.
|
||||
* - The last queued frame can't have a PTS that goes more than 50ms in the
|
||||
* future. This is guaranteed by the playloop, which currently actually
|
||||
* roughly queues 50ms ahead, plus the flip queue offset. Just to be sure
|
||||
* give some additional room by doubling the time.
|
||||
* - The last vsync can never be in the future.
|
||||
*/
|
||||
int64_t max_pts_ahead = (vo->flip_queue_offset + 0.050) * 2 * 1e9;
|
||||
if (vc->last_queue_time > now + max_pts_ahead ||
|
||||
vc->recent_vsync_time > now)
|
||||
{
|
||||
vc->last_queue_time = 0;
|
||||
vc->recent_vsync_time = 0;
|
||||
MP_WARN(vo, "Inconsistent timing detected.\n");
|
||||
}
|
||||
|
||||
#define PREV_VSYNC(ts) prev_vsync(vc, ts)
|
||||
|
||||
/* We hope to be here at least one vsync before the frame should be shown.
|
||||
* If we are running late then don't drop the frame unless there is
|
||||
@@ -1107,7 +1082,7 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration)
|
||||
*/
|
||||
uint64_t vsync = PREV_VSYNC(pts);
|
||||
if (pts < vsync + vsync_interval / 4
|
||||
&& (vsync - PREV_VS2(vc->last_queue_time, 16)
|
||||
&& (vsync - PREV_VSYNC(vc->last_queue_time)
|
||||
> pts - vc->last_ideal_time + vsync_interval / 2
|
||||
|| vc->dropped_frame && vsync > vc->dropped_time))
|
||||
pts -= vsync_interval / 2;
|
||||
@@ -1122,19 +1097,20 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration)
|
||||
|
||||
int num_flips = update_presentation_queue_status(vo);
|
||||
vsync = vc->recent_vsync_time + num_flips * vc->vsync_interval;
|
||||
now = sync_vdptime(vo);
|
||||
pts = FFMAX(pts, now);
|
||||
pts = FFMAX(pts, vsync + (vsync_interval >> 2));
|
||||
vsync = PREV_VSYNC(pts);
|
||||
if (npts < vsync + vsync_interval)
|
||||
return;
|
||||
pts = vsync + (vsync_interval >> 2);
|
||||
vdp_st =
|
||||
vdp->presentation_queue_display(vc->flip_queue,
|
||||
vc->output_surfaces[vc->surface_num],
|
||||
vo->dwidth, vo->dheight, pts);
|
||||
VdpOutputSurface frame = vc->output_surfaces[vc->surface_num];
|
||||
vdp_st = vdp->presentation_queue_display(vc->flip_queue, frame,
|
||||
vo->dwidth, vo->dheight, pts);
|
||||
CHECK_VDP_WARNING(vo, "Error when calling vdp_presentation_queue_display");
|
||||
|
||||
MP_TRACE(vo, "Queue new surface %d: Vdpau time: %"PRIu64" "
|
||||
"pts: %"PRIu64"\n", (int)frame, now, pts);
|
||||
|
||||
vc->last_queue_time = pts;
|
||||
vc->queue_time[vc->surface_num] = pts;
|
||||
vc->last_ideal_time = ideal_pts;
|
||||
|
||||
@@ -112,43 +112,6 @@ static const struct mp_keymap keymap[] = {
|
||||
|
||||
/** Wayland listeners **/
|
||||
|
||||
static void display_handle_error(void *data,
|
||||
struct wl_display *display,
|
||||
void *object_id,
|
||||
uint32_t code,
|
||||
const char *message)
|
||||
{
|
||||
struct vo_wayland_state *wl = data;
|
||||
const char * error_type_msg = "";
|
||||
|
||||
switch (code) {
|
||||
case WL_DISPLAY_ERROR_INVALID_OBJECT:
|
||||
error_type_msg = "Invalid object";
|
||||
break;
|
||||
case WL_DISPLAY_ERROR_INVALID_METHOD:
|
||||
error_type_msg = "Invalid method";
|
||||
break;
|
||||
case WL_DISPLAY_ERROR_NO_MEMORY:
|
||||
error_type_msg = "No memory";
|
||||
break;
|
||||
}
|
||||
|
||||
MP_ERR(wl, "%s: %s\n", error_type_msg, message);
|
||||
}
|
||||
|
||||
static void display_handle_delete_id(void *data,
|
||||
struct wl_display *display,
|
||||
uint32_t id)
|
||||
{
|
||||
struct vo_wayland_state *wl = data;
|
||||
MP_DBG(wl, "Object %u deleted\n", id);
|
||||
}
|
||||
|
||||
static const struct wl_display_listener display_listener = {
|
||||
display_handle_error,
|
||||
display_handle_delete_id
|
||||
};
|
||||
|
||||
static void ssurface_handle_ping(void *data,
|
||||
struct wl_shell_surface *shell_surface,
|
||||
uint32_t serial)
|
||||
@@ -644,8 +607,6 @@ static bool create_display (struct vo_wayland_state *wl)
|
||||
return false;
|
||||
}
|
||||
|
||||
wl_display_add_listener(wl->display.display, &display_listener, wl);
|
||||
|
||||
wl->display.registry = wl_display_get_registry(wl->display.display);
|
||||
wl_registry_add_listener(wl->display.registry, ®istry_listener, wl);
|
||||
|
||||
@@ -960,7 +921,6 @@ int vo_wayland_control (struct vo *vo, int *events, int request, void *arg)
|
||||
return VO_TRUE;
|
||||
case VOCTRL_FULLSCREEN:
|
||||
vo_wayland_fullscreen(vo);
|
||||
*events |= VO_EVENT_RESIZE;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_ONTOP:
|
||||
vo_wayland_ontop(vo);
|
||||
|
||||
@@ -8,7 +8,20 @@ __all__ = ["check_pthreads", "check_iconv", "check_lua", "check_oss_4front",
|
||||
|
||||
pthreads_program = load_fragment('pthreads.c')
|
||||
|
||||
def check_pthread_flag(ctx, dependency_identifier):
|
||||
checks = [
|
||||
check_cc(fragment = pthreads_program, cflags = '-pthread'),
|
||||
check_cc(fragment = pthreads_program, cflags = '-pthread',
|
||||
linkflags = '-pthread') ]
|
||||
|
||||
for fn in checks:
|
||||
if fn(ctx, dependency_identifier):
|
||||
return True
|
||||
return False
|
||||
|
||||
def check_pthreads(ctx, dependency_identifier):
|
||||
if check_pthread_flag(ctx, dependency_identifier):
|
||||
return True
|
||||
platform_cflags = {
|
||||
'linux': '-D_REENTRANT',
|
||||
'freebsd': '-D_THREAD_SAFE',
|
||||
|
||||
Reference in new issue
Block a user