Skip to content

Commit

Permalink
Merge branch 'mpv-player:master' into plex-htpc-patches
Browse files Browse the repository at this point in the history
  • Loading branch information
mitzsch authored Oct 3, 2024
2 parents 4c7a141 + 0d7b4d6 commit 383d26d
Show file tree
Hide file tree
Showing 41 changed files with 231 additions and 138 deletions.
1 change: 1 addition & 0 deletions DOCS/interface-changes/nvidia-true-hdr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add `--vf=d3d11vpp=nvidia-true-hdr`
2 changes: 2 additions & 0 deletions DOCS/man/vf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ Available mpv-only filters are:
which algorithm is actually selected. ``none`` always falls back. On
most if not all hardware, this option will probably do nothing, because
a video processor usually supports all modes or none.
``nvidia-true-hdr``
Enable NVIDIA RTX Video HDR processing.

``fingerprint=...``
Compute video frame fingerprints and provide them as metadata. Actually, it
Expand Down
1 change: 0 additions & 1 deletion audio/decode/ad_lavc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "audio/fmt-conversion.h"
#include "common/av_common.h"
#include "common/codecs.h"
#include "common/global.h"
#include "common/msg.h"
#include "demux/packet.h"
#include "demux/stheader.h"
Expand Down
4 changes: 3 additions & 1 deletion audio/out/ao_coreaudio_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,14 @@ int64_t ca_get_device_latency_ns(struct ao *ao, AudioDeviceID device)
}
}

double sample_rate = ao->samplerate;
double sample_rate;
OSStatus err = CA_GET_O(device, kAudioDevicePropertyNominalSampleRate,
&sample_rate);
CHECK_CA_WARN("cannot get device sample rate, falling back to AO sample rate!");
if (err == noErr) {
MP_VERBOSE(ao, "Device sample rate: %f\n", sample_rate);
} else {
sample_rate = ao->samplerate;
}

return MP_TIME_S_TO_NS(latency_frames / sample_rate);
Expand Down
12 changes: 6 additions & 6 deletions ci/build-mingw64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ _ffmpeg () {
[ -d ffmpeg ] || $gitclone https://github.com/FFmpeg/FFmpeg.git ffmpeg
builddir ffmpeg
local args=(
--pkg-config=pkg-config --target-os=mingw32
--pkg-config=pkg-config --target-os=mingw32 --enable-gpl
--enable-cross-compile --cross-prefix=$TARGET- --arch=${TARGET%%-*}
--cc="$CC" --cxx="$CXX" $commonflags
--disable-{doc,programs}
Expand Down Expand Up @@ -219,8 +219,8 @@ _libplacebo () {
_libplacebo_mark=lib/libplacebo.dll.a

_freetype () {
local ver=2.13.2
gettar "https://mirror.netcologne.de/savannah/freetype/freetype-${ver}.tar.xz"
local ver=2.13.3
gettar "https://download.savannah.gnu.org/releases/freetype/freetype-${ver}.tar.xz"
builddir freetype-${ver}
meson setup .. --cross-file "$prefix_dir/crossfile"
makeplusinstall
Expand All @@ -229,7 +229,7 @@ _freetype () {
_freetype_mark=lib/libfreetype.dll.a

_fribidi () {
local ver=1.0.15
local ver=1.0.16
gettar "https://github.com/fribidi/fribidi/releases/download/v${ver}/fribidi-${ver}.tar.xz"
builddir fribidi-${ver}
meson setup .. --cross-file "$prefix_dir/crossfile" \
Expand All @@ -240,7 +240,7 @@ _fribidi () {
_fribidi_mark=lib/libfribidi.dll.a

_harfbuzz () {
local ver=9.0.0
local ver=10.0.1
gettar "https://github.com/harfbuzz/harfbuzz/releases/download/${ver}/harfbuzz-${ver}.tar.xz"
builddir harfbuzz-${ver}
meson setup .. --cross-file "$prefix_dir/crossfile" \
Expand Down Expand Up @@ -320,7 +320,7 @@ if [ "$2" = pack ]; then
pushd artifact/tmp
dlls=(
libgcc_*.dll lib{ssp,stdc++,winpthread}-[0-9]*.dll # compiler runtime
av*.dll sw*.dll lib{ass,freetype,fribidi,harfbuzz,iconv,placebo}-[0-9]*.dll
av*.dll sw*.dll postproc-[0-9]*.dll lib{ass,freetype,fribidi,harfbuzz,iconv,placebo}-[0-9]*.dll
lib{shaderc_shared,spirv-cross-c-shared,dav1d}.dll zlib1.dll
)
if [[ -f vulkan-1.dll ]]; then
Expand Down
5 changes: 4 additions & 1 deletion common/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,10 @@ void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va)
bstr_xappend(root, &root->buffer, log->partial[lev]);
log->partial[lev].len = 0;

bstr_xappend_vasprintf(root, &root->buffer, format, va);
if (bstr_xappend_vasprintf(root, &root->buffer, format, va) < 0) {
bstr_xappend(root, &root->buffer, bstr0("format error: "));
bstr_xappend(root, &root->buffer, bstr0(format));
}

// Remember last status message and restore it to ensure that it is
// always displayed
Expand Down
2 changes: 1 addition & 1 deletion etc/_mpv.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function _mpv_generate_arguments {
_mpv_completion_arguments+="$name"
else
# Find the parent option and use that with this option's name
_mpv_completion_arguments+="${_mpv_completion_arguments[(R)${name%-*}=*]/*=/$name=}"
_mpv_completion_arguments+="${(S)_mpv_completion_arguments[(R)${name%-*}=*]/*=/$name=}"
fi

elif [[ $desc == Print* ]]; then
Expand Down
17 changes: 8 additions & 9 deletions misc/bstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,37 +376,36 @@ void bstr_xappend(void *talloc_ctx, bstr *s, bstr append)
s->start[s->len] = '\0';
}

void bstr_xappend_asprintf(void *talloc_ctx, bstr *s, const char *fmt, ...)
int bstr_xappend_asprintf(void *talloc_ctx, bstr *s, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
bstr_xappend_vasprintf(talloc_ctx, s, fmt, ap);
int ret = bstr_xappend_vasprintf(talloc_ctx, s, fmt, ap);
va_end(ap);
return ret;
}

// Exactly as bstr_xappend(), but with a formatted string.
void bstr_xappend_vasprintf(void *talloc_ctx, bstr *s, const char *fmt,
va_list ap)
int bstr_xappend_vasprintf(void *talloc_ctx, bstr *s, const char *fmt,
va_list ap)
{
int size;
va_list copy;
va_copy(copy, ap);
size_t avail = talloc_get_size(s->start) - s->len;
char *dest = s->start ? s->start + s->len : NULL;
char c;
if (avail < 1)
dest = &c;
size = vsnprintf(dest, MPMAX(avail, 1), fmt, copy);
size = vsnprintf(dest, avail, fmt, copy);
va_end(copy);

if (size < 0)
abort();
return size;

if (avail < 1 || size + 1 > avail) {
resize_append(talloc_ctx, s, size + 1);
vsnprintf(s->start + s->len, size + 1, fmt, ap);
}
s->len += size;
return size;
}

bool bstr_case_startswith(struct bstr s, struct bstr prefix)
Expand Down
4 changes: 2 additions & 2 deletions misc/bstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ static inline struct bstr bstr_getline(struct bstr str, struct bstr *rest)
struct bstr bstr_strip_linebreaks(struct bstr str);

void bstr_xappend(void *talloc_ctx, bstr *s, bstr append);
void bstr_xappend_asprintf(void *talloc_ctx, bstr *s, const char *fmt, ...)
int bstr_xappend_asprintf(void *talloc_ctx, bstr *s, const char *fmt, ...)
PRINTF_ATTRIBUTE(3, 4);
void bstr_xappend_vasprintf(void *talloc_ctx, bstr *s, const char *fmt, va_list va)
int bstr_xappend_vasprintf(void *talloc_ctx, bstr *s, const char *fmt, va_list va)
PRINTF_ATTRIBUTE(3, 0);

// If s starts/ends with prefix, return true and return the rest of the string
Expand Down
13 changes: 13 additions & 0 deletions misc/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

#include <stdint.h>

#include <libavutil/random_seed.h>

#include "osdep/threads.h"
#include "osdep/timer.h"
#include "random.h"

static uint64_t state[4];
Expand All @@ -44,6 +47,16 @@ void mp_rand_seed(uint64_t seed)
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
seed = 42;
#endif

if (seed == 0) {
uint8_t buf[sizeof(seed)];
if (av_random_bytes(buf, sizeof(buf)) < 0) {
seed = mp_raw_time_ns();
} else {
memcpy(&seed, buf, sizeof(seed));
}
}

mp_mutex_lock(&state_mutex);
state[0] = seed;
for (int i = 1; i < 4; i++)
Expand Down
2 changes: 1 addition & 1 deletion misc/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/*
* Initialize the pseudo-random number generator's state with
* the given 64-bit seed.
* the given 64-bit seed. If the seed is 0, it is randomized.
*/
void mp_rand_seed(uint64_t seed);

Expand Down
6 changes: 4 additions & 2 deletions options/m_config_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "libmpv/client.h"

#include "common/common.h"
#include "common/global.h"
#include "common/msg_control.h"
#include "common/msg.h"
#include "m_config_frontend.h"
Expand Down Expand Up @@ -662,10 +661,13 @@ static struct m_config_option *m_config_mogrify_cli_opt(struct m_config *config,
bstr no_name = *name;
if (!co && bstr_eatstart0(&no_name, "no-")) {
co = m_config_get_co(config, no_name);
if (!co)
return NULL;

// Not all choice types have this value - if they don't, then parsing
// them will simply result in an error. Good enough.
if (!co || !(co->opt->type->flags & M_OPT_TYPE_CHOICE))
if (!(co->opt->type->flags & M_OPT_TYPE_CHOICE) &&
!(co->opt->flags & M_OPT_ALLOW_NO))
return NULL;

*name = no_name;
Expand Down
1 change: 0 additions & 1 deletion options/m_config_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <stdint.h>

#include "common/common.h"
#include "common/global.h"
#include "common/msg.h"
#include "common/msg_control.h"
#include "m_config_core.h"
Expand Down
2 changes: 2 additions & 0 deletions options/m_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ char *format_file_size(int64_t size);
#define M_OPT_DEFAULT_NAN (1 << 26)

// type time: string "no" maps to MP_NOPTS_VALUE (if unset, NOPTS is rejected)
// and
// parsing: "--no-opt" is parsed as "--opt=no"
#define M_OPT_ALLOW_NO (1 << 27)

// type channels: disallow "auto" (still accept ""), limit list to at most 1 item.
Expand Down
4 changes: 2 additions & 2 deletions options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ static const m_option_t mp_opts[] = {
{"ab-loop-a", OPT_TIME(ab_loop[0]), .flags = M_OPT_ALLOW_NO},
{"ab-loop-b", OPT_TIME(ab_loop[1]), .flags = M_OPT_ALLOW_NO},
{"ab-loop-count", OPT_CHOICE(ab_loop_count, {"inf", -1}),
M_RANGE(0, INT_MAX)},
M_RANGE(0, INT_MAX), .force_update = true},

{"playlist-start", OPT_CHOICE(playlist_pos, {"auto", -1}, {"no", -1}),
M_RANGE(0, INT_MAX)},
Expand Down Expand Up @@ -821,7 +821,7 @@ static const m_option_t mp_opts[] = {
{"no", 0},
{"inf", -1},
{"yes", -1}),
M_RANGE(0, 10000)},
M_RANGE(0, 10000), .force_update = true},
{"loop", OPT_ALIAS("loop-file")},

{"resume-playback", OPT_BOOL(position_resume)},
Expand Down
1 change: 0 additions & 1 deletion options/parse_commandline.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <stdbool.h>

#include "osdep/io.h"
#include "common/global.h"
#include "common/msg.h"
#include "common/msg_control.h"
#include "m_option.h"
Expand Down
2 changes: 0 additions & 2 deletions osdep/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include "common/common.h"
#include "common/msg.h"
#include "misc/random.h"
#include "threads.h"
#include "timer.h"

Expand All @@ -32,7 +31,6 @@ static mp_once timer_init_once = MP_STATIC_ONCE_INITIALIZER;
static void do_timer_init(void)
{
mp_raw_time_init();
mp_rand_seed(mp_raw_time_ns());
raw_time_offset = mp_raw_time_ns();
assert(raw_time_offset > 0);
}
Expand Down
1 change: 0 additions & 1 deletion player/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "common/global.h"
#include "common/msg.h"
#include "common/msg_control.h"
#include "common/global.h"
#include "input/input.h"
#include "input/cmd.h"
#include "misc/ctype.h"
Expand Down
1 change: 0 additions & 1 deletion player/configfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include "osdep/io.h"

#include "common/global.h"
#include "common/encode.h"
#include "common/msg.h"
#include "misc/ctype.h"
Expand Down
2 changes: 1 addition & 1 deletion player/external_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int test_ext(MPOpts *opts, bstr ext)

static int test_cover_filename(bstr fname, char **cover_files)
{
for (int n = 0; cover_files[n]; n++) {
for (int n = 0; cover_files && cover_files[n]; n++) {
if (bstrcasecmp(bstr0(cover_files[n]), fname) == 0) {
size_t size = n;
while (cover_files[++size]);
Expand Down
1 change: 0 additions & 1 deletion player/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "client.h"
#include "common/msg.h"
#include "common/msg_control.h"
#include "common/global.h"
#include "options/path.h"
#include "options/m_config.h"
#include "options/parse_configfile.h"
Expand Down
2 changes: 2 additions & 0 deletions player/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "mpv_talloc.h"

#include "misc/dispatch.h"
#include "misc/random.h"
#include "misc/thread_pool.h"
#include "osdep/io.h"
#include "osdep/terminal.h"
Expand Down Expand Up @@ -263,6 +264,7 @@ struct MPContext *mp_create(void)
talloc_enable_leak_report();

mp_time_init();
mp_rand_seed(0);

struct MPContext *mpctx = talloc(NULL, MPContext);
*mpctx = (struct MPContext){
Expand Down
1 change: 0 additions & 1 deletion player/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "options/m_property.h"
#include "options/m_config.h"
#include "common/common.h"
#include "common/global.h"
#include "common/encode.h"
#include "common/playlist.h"
#include "input/input.h"
Expand Down
1 change: 0 additions & 1 deletion player/screenshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include <libavcodec/avcodec.h>

#include "common/global.h"
#include "osdep/io.h"

#include "mpv_talloc.h"
Expand Down
1 change: 0 additions & 1 deletion player/sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "common/msg.h"
#include "options/options.h"
#include "common/common.h"
#include "common/global.h"

#include "stream/stream.h"
#include "sub/dec_sub.h"
Expand Down
1 change: 0 additions & 1 deletion stream/stream_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "common/common.h"
#include "common/msg.h"
#include "common/global.h"
#include "stream.h"
#include "options/m_option.h"
#include "options/path.h"
Expand Down
1 change: 0 additions & 1 deletion sub/ass_mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <ass/ass_types.h>

#include "common/common.h"
#include "common/global.h"
#include "common/msg.h"
#include "options/path.h"
#include "ass_mp.h"
Expand Down
1 change: 0 additions & 1 deletion test/repack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <libavutil/pixfmt.h>

#include "common/common.h"
#include "common/global.h"
#include "img_utils.h"
#include "sub/draw_bmp.h"
#include "sub/osd.h"
Expand Down
Loading

0 comments on commit 383d26d

Please sign in to comment.