summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer/common.h3
-rw-r--r--src/buffer/video.c2
-rw-r--r--src/cache/handlers/http.c2
-rw-r--r--src/codec/codecs.c16
-rw-r--r--src/codec/codecs.h3
-rw-r--r--src/codec/ffmpeg/decoder.c9
-rw-r--r--src/codec/ffmpeg/meson.build4
-rw-r--r--src/fruits/cmc/ui/widgets/now_playing.c21
-rw-r--r--src/fruits/cmsrv/cmsrv.c76
-rw-r--r--src/fruits/cmv/cmv.c22
-rwxr-xr-xsrc/fruits/cmv/create_icon.sh4
-rw-r--r--src/fruits/cmv/meson.build10
-rw-r--r--src/liana/common.h4
-rw-r--r--src/liana/handlers/codec_server.c4
-rw-r--r--src/liana/list.h12
-rw-r--r--src/liana/vcr.c2
-rw-r--r--src/libsink/desktop.c14
-rw-r--r--src/portal/py/modules/__init__.py8
-rw-r--r--src/portal/py/modules/instagram.py4
-rw-r--r--src/render/meson.build8
-rw-r--r--src/render/renderer_libplacebo.c130
-rw-r--r--src/render/renderer_libplacebo.h2
-rw-r--r--src/render/renderer_momo.c6
-rw-r--r--src/render/shaders/osd.h22
-rw-r--r--src/render/shaders/osd_binds.h575
-rw-r--r--src/render/shaders/osd_header.h28
-rw-r--r--src/screen/screen.c250
-rw-r--r--src/screen/screen.h22
-rw-r--r--src/screen/view.c3
-rw-r--r--src/screen/view.h1
-rw-r--r--src/server/server.c7
-rw-r--r--src/server/server.h2
-rw-r--r--src/util/color_palette.c3
-rw-r--r--src/util/color_palette.h1
34 files changed, 740 insertions, 540 deletions
diff --git a/src/buffer/common.h b/src/buffer/common.h
index 701969f..aaf53ea 100644
--- a/src/buffer/common.h
+++ b/src/buffer/common.h
@@ -5,7 +5,8 @@
#include <al/random.h>
#define ROLL_FOR_BUFFER_ERROR(buf) do { \
if (al_random_int(0, 254) == 72) { \
- al_atomic_store(u32)(&(buf)->flow, FLUSHED_ERROR, AL_ATOMIC_RELAXED); \
+ log_warn("Random buffer error proc."); \
+ atomic_store(u32)(&(buf)->flow, FLUSHED_ERROR, AL_ATOMIC_RELAXED); \
} \
} while (0)
#endif
diff --git a/src/buffer/video.c b/src/buffer/video.c
index f7d5e98..19d7aa7 100644
--- a/src/buffer/video.c
+++ b/src/buffer/video.c
@@ -178,7 +178,7 @@ void camu_video_buffer_push(struct camu_video_buffer *buf, struct camu_codec_fra
if (flow != FLOWING) {
// A static buffer will be FLUSHED after any push().
if (buf->is_static) {
- log_warn("Unexpected duplicate frame received.");
+ log_error("Unexpected duplicate frame received.");
}
camu_codec_frame_discard(frame);
return;
diff --git a/src/cache/handlers/http.c b/src/cache/handlers/http.c
index 4fe82e2..ed366fa 100644
--- a/src/cache/handlers/http.c
+++ b/src/cache/handlers/http.c
@@ -1,5 +1,5 @@
#define AL_LOG_SECTION "cache_http"
-#define AL_LOG_ENABLE_TRACE
+//#define AL_LOG_ENABLE_TRACE
#include <al/log.h>
#include <nnwt/common.h>
diff --git a/src/codec/codecs.c b/src/codec/codecs.c
index a373daf..de0a785 100644
--- a/src/codec/codecs.c
+++ b/src/codec/codecs.c
@@ -18,7 +18,8 @@
struct camu_codec_info codec_information[] = {
#ifdef CAMU_HAVE_WUFFS
{
- .name = al_str_c("wuffs"),
+ .id = al_str_c("wuffs"),
+ .name = al_str_c("Wuffs"),
.supported = (s32[]){ CAMU_CODEC_PNG, CAMU_CODEC_NONE },
#ifdef LIANA_SERVER
.create_demuxer = camu_wuffs_demuxer_create,
@@ -30,7 +31,12 @@ struct camu_codec_info codec_information[] = {
#endif
#ifdef CAMU_HAVE_STB_IMAGE
{
+ .id = al_str_c("stbi"),
+#ifdef CAMU_STBI_USE_WUFFS
+ .name = al_str_c("Wuffs (via stb_image API)"),
+#else
.name = al_str_c("stb_image"),
+#endif
.supported = (s32[]){ CAMU_CODEC_PNG, CAMU_CODEC_JPEG, CAMU_CODEC_NONE },
#ifdef LIANA_SERVER
.create_demuxer = camu_stbi_demuxer_create,
@@ -42,6 +48,7 @@ struct camu_codec_info codec_information[] = {
#endif
#ifdef CAMU_HAVE_SPNG
{
+ .id = al_str_c("spng"),
.name = al_str_c("spng"),
.supported = (s32[]){ CAMU_CODEC_PNG, CAMU_CODEC_NONE },
#ifdef LIANA_SERVER
@@ -54,6 +61,7 @@ struct camu_codec_info codec_information[] = {
#endif
#ifdef CAMU_HAVE_FFMPEG
{
+ .id = al_str_c("ff"),
.name = al_str_c("FFmpeg"),
.supported = (s32[]){ CAMU_CODEC_FALLBACK },
#ifdef LIANA_SERVER
@@ -81,13 +89,13 @@ struct camu_codec_info *camu_codec_info_by_type(s32 type)
return NULL;
}
-struct camu_codec_info *camu_codec_info_by_name(str *name)
+struct camu_codec_info *camu_codec_info_by_id(str *id)
{
- if (al_str_eq(name, &al_str_c("pcm_s16le"))) {
+ if (al_str_eq(id, &al_str_c("pcm_s16le"))) {
return (struct camu_codec_info *)0xcdda;
}
for (u32 i = 0; i < ARRAY_SIZE(codec_information); i++) {
- if (al_str_eq(&codec_information[i].name, name)) {
+ if (al_str_eq(&codec_information[i].id, id)) {
return &codec_information[i];
}
}
diff --git a/src/codec/codecs.h b/src/codec/codecs.h
index d383eec..e61ee42 100644
--- a/src/codec/codecs.h
+++ b/src/codec/codecs.h
@@ -3,6 +3,7 @@
#include <al/str.h>
struct camu_codec_info {
+ str id;
str name;
s32 *supported;
struct camu_demuxer *(*create_demuxer)(void);
@@ -12,4 +13,4 @@ struct camu_codec_info {
extern struct camu_codec_info codec_information[];
struct camu_codec_info *camu_codec_info_by_type(s32 type);
-struct camu_codec_info *camu_codec_info_by_name(str *name);
+struct camu_codec_info *camu_codec_info_by_id(str *id);
diff --git a/src/codec/ffmpeg/decoder.c b/src/codec/ffmpeg/decoder.c
index d24677a..95fb0bf 100644
--- a/src/codec/ffmpeg/decoder.c
+++ b/src/codec/ffmpeg/decoder.c
@@ -81,7 +81,7 @@ static s32 init_hwframe_context(struct camu_ff_decoder *av, AVCodecContext *cont
static bool fallback_to_sw_codec(struct camu_ff_decoder *av, const AVCodec *codec)
{
- log_warn("Attempting software decoding fallback...");
+ log_warn("Falling back to software decoding.");
// Remake AVCodecContext as a software decoder.
AVCodecParameters *codecpar = av->codecpar;
av->errored_hw_context = av->codec_context;
@@ -96,7 +96,7 @@ static bool fallback_to_sw_codec(struct camu_ff_decoder *av, const AVCodec *code
return false;
}
log_codec_name(codec, NULL);
- log_info("Using software fallback with %i threads for decoder.", av->thread_count);
+ log_debug("Using software fallback with %i threads for decoder.", av->thread_count);
return true;
}
@@ -248,8 +248,7 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
}
#ifdef CAMU_FF_DECODER_HWACCEL
av->sw_codec = codec;
- // @TODO: How do you correctly probe avcodec_get_hw_config() if find_decoder()
- // always returns libdav1d first?
+ // @TODO: How to correctly probe avcodec_get_hw_config() if find_decoder() always returns libdav1d first?
if (al_strscmp(codec->name, "libdav1d") == 0) {
if (!(codec = avcodec_find_decoder_by_name("av1"))) {
codec = av->sw_codec;
@@ -333,7 +332,7 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
// - https://ffmpeg.org/ffmpeg-codecs.html#Codec-Options
av->codec_context->thread_type = FF_THREAD_FRAME;
av->codec_context->thread_count = av->thread_count;
- log_info("Using %i threads for decoder.", av->thread_count);
+ log_debug("Using %i threads for decoder.", av->thread_count);
#ifdef CAMU_FF_DECODER_HWACCEL
}
#endif
diff --git a/src/codec/ffmpeg/meson.build b/src/codec/ffmpeg/meson.build
index 1691c29..401c93a 100644
--- a/src/codec/ffmpeg/meson.build
+++ b/src/codec/ffmpeg/meson.build
@@ -64,13 +64,13 @@ if not ffmpeg_force_fallback
ffmpeg_args += ['-DCAMU_TRY_HWACCEL']
endif
elif ffmpeg_version_option == 'system'
- error('System FFmpeg requested but not found. Add \'--force-fallback-for=ffmpeg\' or \'-Dcodec-ffmpeg-version=[8,7,6,...]\'.')
+ error('System FFmpeg requested but not found. Add \'--force-fallback-for=ffmpeg\' or \'-Dcodec-ffmpeg-version=[9,8,7,...]\'.')
endif
endif
# Fallback if requested or necessary.
if ffmpeg_force_fallback or not libavutil.found()
if ffmpeg_version_option == 'system'
- ffmpeg_version_option = '8' # Default to current latest.
+ ffmpeg_version_option = '9' # Default to current latest.
endif
subproject('ffmpeg' + ffmpeg_version_option) # Override libav dependencies.
endif
diff --git a/src/fruits/cmc/ui/widgets/now_playing.c b/src/fruits/cmc/ui/widgets/now_playing.c
index 56405b3..1a4303d 100644
--- a/src/fruits/cmc/ui/widgets/now_playing.c
+++ b/src/fruits/cmc/ui/widgets/now_playing.c
@@ -162,23 +162,28 @@ void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *e
ncplane_putstr_yx(np->n, 1, x1 + 2, timestr);
if (entry) {
- u32 rslash = al_str_rfind(&entry->brief, '/');
str part;
+ u32 rslash = al_str_rfind(&entry->brief, '/');
if (rslash != AL_STR_NO_POS) {
part = al_str_substr(&entry->brief, rslash + 1, entry->brief.length);
} else {
part = entry->brief;
}
- char *c_str = al_str_to_c_str(&part);
+ // x1 = Position of right side "|".
+ // x2 = First character of entry brief.
s32 x2 = 6 + width1;
- // @TODO: Can mid be negative.
s32 mid = x1 - x2;
- ncplane_putnstr_yx(np->n, 1, x2, MIN(al_strlen(c_str), (size_t)mid), c_str);
- if (part.length >= mid) {
- ncplane_putnstr_yx(np->n, 1, x2 + mid - 1, 1, ".");
- ncplane_putnstr_yx(np->n, 1, x2 + mid - 2, 1, ".");
+ if (mid >= 1) {
+ char *c_str = al_str_to_c_str(&part);
+ ncplane_putnstr_yx(np->n, 1, x2, MIN(al_strlen(c_str), (size_t)mid), c_str);
+ if (part.length >= (u32)mid) {
+ ncplane_putnstr_yx(np->n, 1, x2 + mid - 1, 1, ".");
+ if (mid >= 2) {
+ ncplane_putnstr_yx(np->n, 1, x2 + mid - 2, 1, ".");
+ }
+ }
+ al_free(c_str);
}
- al_free(c_str);
bool visual_cached = false;
struct cmc_now_playing_visual *visual;
diff --git a/src/fruits/cmsrv/cmsrv.c b/src/fruits/cmsrv/cmsrv.c
index b0793d1..452254b 100644
--- a/src/fruits/cmsrv/cmsrv.c
+++ b/src/fruits/cmsrv/cmsrv.c
@@ -30,6 +30,7 @@ struct cmsrv {
struct nn_line_processor cli;
} local;
#endif
+ bool use_ui;
#ifdef CMSRV_USE_UI
struct cmsrv_ui ui;
struct nn_poll input_poll;
@@ -43,14 +44,27 @@ static void close_cmsrv(struct cmsrv *s)
nn_line_processor_stop(&s->local.cli);
#endif
#ifdef CMSRV_USE_UI
- nn_poll_stop(&s->input_poll);
- nn_timer_stop(&s->render_timer);
+ if (s->use_ui) {
+ nn_poll_stop(&s->input_poll);
+ nn_timer_stop(&s->render_timer);
+ }
#endif
camu_server_close(&s->server);
nn_signal_stop(&s->quit_signal);
}
#ifdef CMSRV_LOCAL_SOCKET
+static inline void try_parse_arg_from_line(str *line, u32 offset, s32 *n)
+{
+ str arg = al_str_substr(line, offset, line->length);
+ bool error;
+ s64 i = al_str_to_long(&arg, 10, &error);
+ if (!error) {
+ if (*n < 0) i = -i;
+ *n = CLAMP(i, (s64)INT32_MIN, (s64)INT32_MAX);
+ }
+}
+
static u8 server_line_callback(void *userdata, str *line)
{
struct cmsrv *s = (struct cmsrv *)userdata;
@@ -60,19 +74,13 @@ static u8 server_line_callback(void *userdata, str *line)
} else if (al_str_cmp(line, &al_str_c(";NEXT"), 0, 5) == 0) {
s32 n = 1;
if (line->length > 6) {
- str arg = al_str_substr(line, 6, line->length);
- bool error;
- s64 i = al_str_to_long(&arg, 10, &error);
- if (!error) n = CLAMP(i, (s64)INT32_MIN, (s64)INT32_MAX);
+ try_parse_arg_from_line(line, 6, &n);
}
lia_list_skip(list, LIANA_SEQUENCE_ANY, n);
} else if (al_str_cmp(line, &al_str_c(";PREV"), 0, 5) == 0) {
s32 n = -1;
if (line->length > 6) {
- str arg = al_str_substr(line, 6, line->length);
- bool error;
- s64 i = -al_str_to_long(&arg, 10, &error);
- if (!error) n = CLAMP(i, (s64)INT32_MIN, (s64)INT32_MAX);
+ try_parse_arg_from_line(line, 6, &n);
}
lia_list_skip(list, LIANA_SEQUENCE_ANY, n);
} else if (al_str_cmp(line, &al_str_c(";SEEK"), 0, 5) == 0) {
@@ -93,8 +101,18 @@ static u8 server_line_callback(void *userdata, str *line)
lia_list_reverse(list);
} else if (al_str_eq(line, &al_str_c(";CLEAR"))) {
lia_list_clear(list);
+ } else if (al_str_cmp(line, &al_str_c(";START_AT"), 0, 9) == 0) {
+ if (line->length > 6) {
+ s32 n = 0;
+ try_parse_arg_from_line(line, 10, &n);
+ if (n > 0) {
+ camu_server_local_start_at(&s->server, n);
+ }
+ }
} else if (al_str_eq(line, &al_str_c(";DISCONNECT"))) {
lia_server_force_disconnect_nodes(&s->server.data.server);
+ } else if (al_str_eq(line, &al_str_c(";QUIT"))) {
+ close_cmsrv(s);
} else {
struct nn_packet *packet = nn_packet_create();
nn_packet_write_str(packet, line);
@@ -156,10 +174,17 @@ static void quit_signal_callback(void *userdata)
static struct cmsrv s = { 0 };
+static bool sigint_force = false;
static void sigint_handler(s32 signum)
{
(void)signum;
- nn_signal_send(&s.quit_signal);
+ if (sigint_force) {
+ exit(128 + SIGINT);
+ } else {
+ nn_signal_send(&s.quit_signal);
+ log_warn("Attempting graceful exit. ^C again to force exit.");
+ sigint_force = true;
+ }
}
#ifdef NAUNET_ON_WINDOWS
@@ -172,11 +197,16 @@ s32 main(s32 argc, char *argv[])
return EXIT_FAILURE;
}
+ s.use_ui = false;
#ifdef CMSRV_USE_UI
- if (!cmsrv_ui_init(&s.ui, &s.server)) {
- return EXIT_FAILURE;
+ char *CMSRV_UI = getenv("CMSRV_UI");
+ if (CMSRV_UI) s.use_ui = al_strscmp(CMSRV_UI, "1") == 0;
+ if (s.use_ui) {
+ if (!cmsrv_ui_init(&s.ui, &s.server)) {
+ return EXIT_FAILURE;
+ }
+ al_set_print(log_callback, &s);
}
- al_set_print(log_callback, &s);
#endif
#ifdef CAMU_HAVE_FFMPEG
@@ -194,7 +224,7 @@ s32 main(s32 argc, char *argv[])
if (CMSRV_IP) addr = al_str_cr(CMSRV_IP);
log_info("Serving from %.*s.", al_str_x(&addr));
- camu_server_init(&s.server, &s.loop);
+ camu_server_init(&s.server, &s.loop, false);
if (!camu_server_listen(&s.server, NNWT_SOCKET_TCP, &addr, CAMU_PORT)) {
return EXIT_FAILURE;
}
@@ -212,12 +242,14 @@ s32 main(s32 argc, char *argv[])
#endif
#ifdef CMSRV_USE_UI
- nn_poll_init(&s.input_poll, input_poll_callback, &s);
- nn_poll_set(&s.input_poll, cmsrv_ui_get_input_fd(&s.ui), NNWT_POLL_READ);
- nn_poll_start(&s.input_poll, &s.loop);
- nn_timer_init(&s.render_timer, &s.loop, render_timer_callback, &s);
- nn_timer_set_repeat(&s.render_timer, NNWT_TS_FROM_USEC(100000));
- nn_timer_again(&s.render_timer);
+ if (s.use_ui) {
+ nn_poll_init(&s.input_poll, input_poll_callback, &s);
+ nn_poll_set(&s.input_poll, cmsrv_ui_get_input_fd(&s.ui), NNWT_POLL_READ);
+ nn_poll_start(&s.input_poll, &s.loop);
+ nn_timer_init(&s.render_timer, &s.loop, render_timer_callback, &s);
+ nn_timer_set_repeat(&s.render_timer, NNWT_TS_FROM_USEC(100000));
+ nn_timer_again(&s.render_timer);
+ }
#endif
nn_event_loop_run(&s.loop);
@@ -226,7 +258,7 @@ s32 main(s32 argc, char *argv[])
nn_socket_close(&s.local.sock);
#endif
#ifdef CMSRV_USE_UI
- cmsrv_ui_close(&s.ui);
+ if (s.use_ui) cmsrv_ui_close(&s.ui);
#endif
camu_server_free(&s.server);
nn_event_loop_destroy(&s.loop);
diff --git a/src/fruits/cmv/cmv.c b/src/fruits/cmv/cmv.c
index 74e3555..333588e 100644
--- a/src/fruits/cmv/cmv.c
+++ b/src/fruits/cmv/cmv.c
@@ -18,7 +18,7 @@
#include "icon.h"
#endif
-#ifndef NAUNET_ON_WINDOWS
+#if !defined NAUNET_ON_WINDOWS && !defined NAUNET_ON_ANDROID
// https://unix.stackexchange.com/a/16884
#define PID_MAX_STR 7 // 0x400000 (2^22).
static str CMV_UNIX_PATH = al_str_c("/tmp/cmv_sock_");
@@ -45,6 +45,7 @@ static void exit_callback(void *userdata, struct camu_desktop *desktop)
static nn_thread_result NNWT_THREADCALL event_loop_thread(void *userdata)
{
+ nn_thread_set_priority(NNWT_THREAD_SCHED_FIFO, 40);
struct cmv *c = (struct cmv *)userdata;
nn_thread_set_name("event_loop");
nn_event_loop_run(&c->loop);
@@ -174,9 +175,16 @@ s32 window_system_main(u32 argc, str *argv, void *extra)
prefs->language.audio = CAMU_LANG_JAPANESE;
prefs->language.subtitles = CAMU_LANG_ENGLISH;
+#ifdef CAMU_DIRECT_MODE
+#ifdef CAMU_SINK_ONLY
+#error "Sink-only and DIRECT_MODE are incompatible"
+#endif
+ if (!local) al_assert("Cannot connect to a server in DIRECT_MODE" && false);
+#endif
+
#ifndef CAMU_SINK_ONLY
if (local) {
- camu_server_init(&c.server, &c.loop);
+ camu_server_init(&c.server, &c.loop, local);
#ifdef CAMU_DIRECT_MODE
camu_server_bind_direct(&c.server);
#else
@@ -212,8 +220,8 @@ s32 window_system_main(u32 argc, str *argv, void *extra)
c.desktop.userdata = &c;
}
char *SINK_FORCE_LOCAL = getenv("SINK_FORCE_LOCAL");
- if (SINK_FORCE_LOCAL && al_strscmp(SINK_FORCE_LOCAL, "1") == 0) {
- c.desktop.sink.local = true;
+ if (SINK_FORCE_LOCAL) {
+ c.desktop.sink.local = al_strscmp(SINK_FORCE_LOCAL, "1") == 0;
} else {
c.desktop.sink.local = local;
}
@@ -232,9 +240,9 @@ s32 window_system_main(u32 argc, str *argv, void *extra)
nn_packet_free(packet);
}
if (extra) {
- u32 start_index = *(u32 *)extra;
+ s32 start_index = *(s32 *)extra;
if (start_index != 0) {
- camu_server_local_set_index(&c.server, start_index);
+ camu_server_local_start_at(&c.server, start_index);
}
}
}
@@ -306,7 +314,7 @@ s32 main(s32 argc, char *argv[])
for (s32 i = 0; i < argc; i++) {
str arg;
#ifdef NAUNET_ON_WINDOWS
- if (!al_str_from_wstr(&arg, &al_wstr_cr(argv[i]))) { // This is so broken.
+ if (!al_str_from_wstr(&arg, &al_wstr_cr(argv[i]))) {
log_error("Failed to convert argument #%i from a wide string.", i);
continue;
}
diff --git a/src/fruits/cmv/create_icon.sh b/src/fruits/cmv/create_icon.sh
new file mode 100755
index 0000000..08aa8eb
--- /dev/null
+++ b/src/fruits/cmv/create_icon.sh
@@ -0,0 +1,4 @@
+#! /usr/bin/env sh
+for size in {16,32,64,128}; do
+ magick sink.png -resize $sizex$size -set filename:f "%[t]-%[w]x%[h]" "%[filename:f].png"
+done
diff --git a/src/fruits/cmv/meson.build b/src/fruits/cmv/meson.build
index 301fa58..a9eda61 100644
--- a/src/fruits/cmv/meson.build
+++ b/src/fruits/cmv/meson.build
@@ -21,10 +21,20 @@ elif is_windows
windows = import('windows')
cmv_src += [windows.compile_resources('icon.rc')]
if not is_msvc
+ cmv_args += ['-mwindows', '-municode']
cmv_link_args += ['-mwindows', '-municode', '-static', '-static-libgcc', '-static-libstdc++']
endif
endif
+install_data(join_paths(meson.source_root(), 'package/sink.desktop'), install_tag: 'xdg',
+ install_dir: join_paths(get_option('datadir'), 'applications'))
+
+foreach size: ['16x16', '32x32', '64x64', '128x128', '256x256']
+ icon_dir = join_paths(get_option('datadir'), 'icons', 'hicolor', size, 'apps')
+ install_data('sink-' + size + '.png', install_tag: 'xdg',
+ install_dir: icon_dir, rename: 'sink.png')
+endforeach
+
if is_android
cmv_args += ['-DAPPLICATION_NAME="CTV"']
shared_library('ctv', cmv_src, dependencies: cmv_deps, c_args: cmv_args, link_args: cmv_link_args)
diff --git a/src/liana/common.h b/src/liana/common.h
index ec6d50a..7776218 100644
--- a/src/liana/common.h
+++ b/src/liana/common.h
@@ -1,3 +1,7 @@
#pragma once
#define LIANA_TIMESTAMP_INVALID ((u64)-1)
+
+#define LIANA_BASE_DELAY ((u64)1600000) // 1600ms
+#define LIANA_BASE_PING ((u64)600000) // 600ms
+#define LIANA_PAUSE_DELAY LIANA_BASE_PING
diff --git a/src/liana/handlers/codec_server.c b/src/liana/handlers/codec_server.c
index 31fbef8..ddba182 100644
--- a/src/liana/handlers/codec_server.c
+++ b/src/liana/handlers/codec_server.c
@@ -20,7 +20,7 @@ static bool codec_server_init(struct lia_server_handler *handler, struct cch_han
log_warn("No codec for this format.");
return false;
}
- log_info("Selected demuxer: %.*s.", al_str_x(&codec->codec_info->name));
+ log_debug("Selected demuxer: %.*s.", al_str_x(&codec->codec_info->name));
codec->demux = codec->codec_info->create_demuxer();
if (!codec->demux->init(codec->demux, handle)) {
return false;
@@ -55,7 +55,7 @@ static void codec_server_write_info(struct lia_server_handler *handler, struct n
nn_packet_write_u32(packet, codec->demux->streams.count);
struct camu_codec_stream *stream;
al_array_foreach_ptr(codec->demux->streams, i, stream) {
- nn_packet_write_str(packet, &codec->codec_info->name);
+ nn_packet_write_str(packet, &codec->codec_info->id);
nn_packet_write_u8(packet, stream->mode);
nn_packet_write_u8(packet, stream->type);
nn_packet_write_u64(packet, stream->duration);
diff --git a/src/liana/list.h b/src/liana/list.h
index 32715bd..580198f 100644
--- a/src/liana/list.h
+++ b/src/liana/list.h
@@ -8,20 +8,8 @@
#define LIANA_SEQUENCE_ANY -1
-#define LIANA_BASE_DELAY ((u64)2000000) // 2000ms
-#define LIANA_BASE_PING ((u64)500000) // 500ms
-#define LIANA_PAUSE_DELAY LIANA_BASE_PING
-#define LIANA_DELAY_IGNORE ((u64)0)
-
-#define LIANA_BUFFER_AHEAD 2
-
//#define LIANA_LIST_SCUFFED_LOOP
-// @TODO:
-// To handle an entry being queued right before a skip, keep a global
-// "max time until all sinks buffered" and used that instead of LIANA_PAUSE_DELAY (if greater).
-// Factor in LIANA_BASE_PING.
-
enum {
LIANA_SINK_SET = 0,
LIANA_SINK_UNSET,
diff --git a/src/liana/vcr.c b/src/liana/vcr.c
index 3a61e32..3b4866c 100644
--- a/src/liana/vcr.c
+++ b/src/liana/vcr.c
@@ -314,7 +314,7 @@ static void cork_if_buffered(struct lia_vcr *vcr, u64 buffer)
if (vcr->expand == VCR_EXPAND_UNTOUCHED) {
vcr->mark.buffered = buffer * VCR_BUFFER_GROW_FACTOR;
vcr->expand = VCR_EXPAND_GROWN;
- log_info("Expanded buffer to size %.2fMB.", vcr->mark.buffered / (f32)MB(1));
+ log_debug("Expanded buffer to size %.2fMB.", vcr->mark.buffered / (f32)MB(1));
return;
}
if (!vcr->corked) {
diff --git a/src/libsink/desktop.c b/src/libsink/desktop.c
index 2707f34..427a6f4 100644
--- a/src/libsink/desktop.c
+++ b/src/libsink/desktop.c
@@ -66,11 +66,11 @@ static u8 sink_callback(void *userdata, u8 op, u8 type, void *opaque)
case CAMU_SINK_START:
switch (type) {
case CAMU_SINK_AUDIO:
- log_info("Starting audio.");
+ log_debug("Starting audio.");
camu_mixer_resume(mixer);
break;
case CAMU_SINK_VIDEO:
- log_info("Starting video.");
+ log_debug("Starting video.");
camu_screen_set_state(scr, CAMU_SCREEN_PLAYING);
camu_screen_wake(scr);
break;
@@ -79,11 +79,11 @@ static u8 sink_callback(void *userdata, u8 op, u8 type, void *opaque)
case CAMU_SINK_STOP:
switch (type) {
case CAMU_SINK_AUDIO:
- log_info("Stopping audio.");
+ log_debug("Stopping audio.");
camu_mixer_pause(mixer);
break;
case CAMU_SINK_VIDEO:
- log_info("Stopping video.");
+ log_debug("Stopping video.");
camu_screen_set_state(scr, CAMU_SCREEN_PAUSED);
break;
}
@@ -187,6 +187,12 @@ static void screen_callback(void *userdata, u8 op, void *opaque)
case CAMU_SCREEN_RESEEK:
camu_sink_reseek(&c->sink);
break;
+ case CAMU_SCREEN_AUDIO_TRACK:
+ camu_sink_adjust_audio_track(&c->sink, *(s32 *)opaque);
+ break;
+ case CAMU_SCREEN_SUBTITLE_TRACK:
+ camu_sink_adjust_subtitle_track(&c->sink, *(s32 *)opaque);
+ break;
case CAMU_SCREEN_SHUFFLE:
camu_sink_shuffle(&c->sink);
break;
diff --git a/src/portal/py/modules/__init__.py b/src/portal/py/modules/__init__.py
index 480ff3c..f63ed56 100644
--- a/src/portal/py/modules/__init__.py
+++ b/src/portal/py/modules/__init__.py
@@ -5,9 +5,9 @@ from modules.youtube import YoutubeModule
#from modules.twitter import TwitterModule
#from modules.pixiv_app import PixivAppModule
#from modules.pixiv_web import PixivWebModule
-from modules.fanbox import FanboxModule
+#from modules.fanbox import FanboxModule
#from modules.instagram import InstagramModule
-from modules.patreon import PatreonModule
+#kfrom modules.patreon import PatreonModule
ALL_MODULES = {
'youtube': (YoutubeModule(), []),
@@ -15,9 +15,9 @@ ALL_MODULES = {
# 'twitter': (TwitterModule(config.TWITTER_COOKIES_PATH), []),
# 'pixiv_web': (PixivWebModule(config.PIXIV_SESSID, config.PIXIV_USERID), []),
# 'pixiv_app': (PixivAppModule(config.PIXIV_REFRESH_TOKEN), []),
- 'fanbox': (FanboxModule(config.FANBOX_SESSID, config.FANBOX_CF_CLEARANCE), []),
+# 'fanbox': (FanboxModule(config.FANBOX_SESSID, config.FANBOX_CF_CLEARANCE), []),
# 'instagram': (InstagramModule(
# config.INSTAGRAM_USER_AGENT, config.INSTAGRAM_SETTINGS_PATH,
# config.INSTAGRAM_SESSION_ID), []),
- 'patreon': (PatreonModule(config.PATREON_SESSION_ID, config.PATREON_UUID, config.PATREON_USER_ID), [])
+# 'patreon': (PatreonModule(config.PATREON_SESSION_ID, config.PATREON_UUID, config.PATREON_USER_ID), [])
}
diff --git a/src/portal/py/modules/instagram.py b/src/portal/py/modules/instagram.py
index 7d71f9f..fbf75d3 100644
--- a/src/portal/py/modules/instagram.py
+++ b/src/portal/py/modules/instagram.py
@@ -74,8 +74,8 @@ class InstagramSearch(Search):
kwargs['views'] = m.play_count
media[str(0)] = Video(url=Url(str(m.video_url)), thumbnail_url=Url(str(m.thumbnail_url)))
elif m.media_type == 1: # Photo
- candidates = sorted(m.image_versions2['candidates'], key=lambda x: x['width'], reverse=True)
- media[str(0)] = Image(url=Url(candidates[0]['url']), thumbnail_url=Url(candidates[1]['url']))
+ candidates = sorted(m.image_versions2.candidates, key=lambda x: x.width, reverse=True)
+ media[str(0)] = Image(url=Url(candidates[0].url), thumbnail_url=Url(candidates[1].url))
kwargs['media'] = media
post = Post(**kwargs)
self.module.add_to_map(unique_id, post)
diff --git a/src/render/meson.build b/src/render/meson.build
index ee0017a..3cbca4c 100644
--- a/src/render/meson.build
+++ b/src/render/meson.build
@@ -56,9 +56,8 @@ elif get_option('renderer') == 'libplacebo'
shaderc_opts.add_cmake_defines({ 'SPIRV_COLOR_TERMINAL': false })
shaderc_opts.add_cmake_defines({ 'ENABLE_EXCEPTIONS_ON_MSVC': false })
shaderc_proj = cmake.subproject('shaderc', options: shaderc_opts)
- shaderc = shaderc_proj.dependency('shaderc')
- meson.override_dependency('shaderc', declare_dependency(dependencies: shaderc, version: '2026.2'))
- render_deps += [
+ shaderc_deps = [
+ shaderc_proj.dependency('shaderc'),
shaderc_proj.dependency('shaderc_util'),
shaderc_proj.dependency('MachineIndependent'),
shaderc_proj.dependency('OSDependent'),
@@ -68,8 +67,9 @@ elif get_option('renderer') == 'libplacebo'
shaderc_proj.dependency('SPIRV-Tools-static')
]
if spirv_optimizer
- render_deps += [shaderc_proj.dependency('SPIRV-Tools-opt')]
+ shaderc_deps += [shaderc_proj.dependency('SPIRV-Tools-opt')]
endif
+ meson.override_dependency('shaderc', declare_dependency(dependencies: shaderc_deps, version: '2026.3'))
endif
libplacebo_opts += ['shaderc=enabled', 'glslang=disabled']
else
diff --git a/src/render/renderer_libplacebo.c b/src/render/renderer_libplacebo.c
index 8c28162..c0a413a 100644
--- a/src/render/renderer_libplacebo.c
+++ b/src/render/renderer_libplacebo.c
@@ -117,7 +117,7 @@ static void log_callback(void *userdata, enum pl_log_level level, const char *me
// will be shot anyway so allow it.
log_info(message);
} else {
- log_info(message);
+ log_debug(message);
}
}
@@ -166,9 +166,11 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid
struct camu_renderer_lp *lr = (struct camu_renderer_lp *)renderer;
#ifndef CRT_BACKGROUND
- clear_color[0] = ((global_color_palette.colors[0] >> 16) & 0xff) / 255.f;
- clear_color[1] = ((global_color_palette.colors[0] >> 8) & 0xff) / 255.f;
- clear_color[2] = ((global_color_palette.colors[0]) & 0xff) / 255.f;
+ if (global_color_palette.supplied) {
+ clear_color[0] = ((global_color_palette.colors[CAMU_COLOR_BACKGROUND] >> 16) & 0xff) / 255.f;
+ clear_color[1] = ((global_color_palette.colors[CAMU_COLOR_BACKGROUND] >> 8) & 0xff) / 255.f;
+ clear_color[2] = (global_color_palette.colors[CAMU_COLOR_BACKGROUND] & 0xff) / 255.f;
+ }
#endif
lr->logger = pl_log_create(PL_API_VER, pl_log_params(
@@ -319,7 +321,7 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid
al_memset(&lr->params, 0, sizeof(struct pl_render_params));
lr->params = default_params;
- lr->params.deband_params = NULL;
+ //lr->params.deband_params = NULL;
//lr->params.frame_mixer = NULL;
// Clear manually so we can draw multiple images per frame.
@@ -331,26 +333,28 @@ static bool renderer_lp_create_renderer(struct camu_renderer *renderer, u32 *wid
lr->params.correct_subpixel_offsets = true;
lr->osd.vars[0].var = pl_var_uvec2("screen");
- lr->osd.vars[1].var = pl_var_uint("scale");
- lr->osd.vars[2].var = pl_var_float("time");
- lr->osd.vars[3].var = pl_var_uint("show_osd");
- lr->osd.vars[4].var = pl_var_uint("connecting");
- lr->osd.vars[5].var = pl_var_uint("paused");
- lr->osd.vars[6].var = pl_var_uint("bar_mode");
- lr->osd.vars[7].var = pl_var_float("bar");
- lr->osd.vars[8].var = pl_var_float("dbar");
- lr->osd.vars[9].var = pl_var_float("bbar");
- lr->osd.vars[10].var = pl_var_uint("show_hour");
- lr->osd.vars[11].var = pl_var_uint("negative");
+ lr->osd.vars[1].var = pl_var_vec4("tcolor");
+ lr->osd.vars[2].var = pl_var_vec4("bcolor");
+ lr->osd.vars[3].var = pl_var_uint("scale");
+ lr->osd.vars[4].var = pl_var_float("time");
+ lr->osd.vars[5].var = pl_var_uint("show_osd");
+ lr->osd.vars[6].var = pl_var_uint("connecting");
+ lr->osd.vars[7].var = pl_var_uint("paused");
+ lr->osd.vars[8].var = pl_var_uint("bar_mode");
+ lr->osd.vars[9].var = pl_var_float("bar");
+ lr->osd.vars[10].var = pl_var_float("dbar");
+ lr->osd.vars[11].var = pl_var_float("bbar");
+ lr->osd.vars[12].var = pl_var_uint("show_hour");
+ lr->osd.vars[13].var = pl_var_uint("negative");
static const char num_names[9][6] = {
"num1", "num2", "num3", "num4",
"num5", "num6", "num7", "num8",
"num9"
};
for (u32 i = 0; i < 9; i++) {
- lr->osd.vars[12 + i].var = pl_var_uint(num_names[i]);
+ lr->osd.vars[14 + i].var = pl_var_uint(num_names[i]);
}
- for (u32 i = 0; i < 21; i++) {
+ for (u32 i = 0; i < 23; i++) {
lr->osd.vars[i].dynamic = true;
}
@@ -491,7 +495,7 @@ static inline intptr_t float_64_hash(f64 value)
static inline bool render_osd(struct camu_renderer_lp *lr, struct camu_screen *scr)
{
f64 duration = scr->osd.duration / 1000000.0;
- f32 bar, dbar, bbar;
+ static f32 bar, dbar, bbar;
f32 progress = ((duration != 0) ? scr->osd.pts / duration : 0.f);
if (scr->osd.bar_mode != CAMU_OSD_BAR_VOLUME) {
dbar = progress;
@@ -504,68 +508,84 @@ static inline bool render_osd(struct camu_renderer_lp *lr, struct camu_screen *s
lr->osd.screen_size[0] = scr->width;
lr->osd.screen_size[1] = scr->height;
lr->osd.vars[0].data = lr->osd.screen_size;
- u32 scale = 1;
- lr->osd.vars[1].data = &scale;
+ static float tcolor[4] = { 0.89f, 0.87f, 0.87f, 1.f };
+ if (global_color_palette.supplied) {
+ tcolor[0] = ((global_color_palette.colors[CAMU_COLOR_FOREGROUND] >> 16) & 0xff) / 255.f;
+ tcolor[1] = ((global_color_palette.colors[CAMU_COLOR_FOREGROUND] >> 8) & 0xff) / 255.f;
+ tcolor[2] = (global_color_palette.colors[CAMU_COLOR_FOREGROUND] & 0xff) / 255.f;
+ }
+ lr->osd.vars[1].data = tcolor;
+ static float bcolor[4] = { 0.04f, 0.04f, 0.04f, 0.575f };
+ if (global_color_palette.supplied) {
+ bcolor[0] = ((global_color_palette.colors[CAMU_COLOR_BACKGROUND] >> 16) & 0xff) / 255.f;
+ bcolor[1] = ((global_color_palette.colors[CAMU_COLOR_BACKGROUND] >> 8) & 0xff) / 255.f;
+ bcolor[2] = (global_color_palette.colors[CAMU_COLOR_BACKGROUND] & 0xff) / 255.f;
+ }
+ lr->osd.vars[2].data = bcolor;
+ static u32 scale = 1;
+ lr->osd.vars[3].data = &scale;
f64 tick = nn_get_tick();
if (lr->osd.tick_time == -1.0) lr->osd.tick_time = tick;
lr->osd.time = (f32)(tick - lr->osd.tick_time);
- lr->osd.vars[2].data = &lr->osd.time;
- lr->osd.vars[3].data = &scr->osd.show;
- lr->osd.vars[4].data = &scr->osd.connecting;
- lr->osd.vars[5].data = &scr->osd.paused;
- lr->osd.vars[6].data = &scr->osd.bar_mode;
- lr->osd.vars[7].data = &bar;
- lr->osd.vars[8].data = &dbar;
- lr->osd.vars[9].data = &bbar;
- u32 hours1, minutes1, seconds1, hundredths;
- u32 show_hour;
+ lr->osd.vars[4].data = &lr->osd.time;
+ lr->osd.vars[5].data = &scr->osd.show;
+ lr->osd.vars[6].data = &scr->osd.connecting;
+ lr->osd.vars[7].data = &scr->osd.paused;
+ lr->osd.vars[8].data = &scr->osd.bar_mode;
+ lr->osd.vars[9].data = &bar;
+ lr->osd.vars[10].data = &dbar;
+ lr->osd.vars[11].data = &bbar;
+ static u32 hours1, minutes1, seconds1, hundredths;
+ static u32 show_hour;
show_hour = camu_split_time(scr->osd.duration, &hours1, &minutes1, &seconds1, &hundredths);
ROUND_SECONDS(hours1, minutes1, seconds1, hundredths);
- lr->osd.vars[10].data = &show_hour;
- u32 negative;
+ lr->osd.vars[12].data = &show_hour;
+ static u32 negative;
negative = scr->osd.pts < 0.0f;
- lr->osd.vars[11].data = &negative;
- lr->osd.vars[15].data = &hours1;
- lr->osd.vars[16].data = &minutes1;
- lr->osd.vars[17].data = &seconds1;
- u32 hours2, minutes2, seconds2;
- camu_split_time(fabs(scr->osd.pts) * 1000000u, &hours2, &minutes2, &seconds2, &hundredths);
+ lr->osd.vars[13].data = &negative;
+ lr->osd.vars[17].data = &hours1;
+ lr->osd.vars[18].data = &minutes1;
+ lr->osd.vars[19].data = &seconds1;
+ static u32 hours2, minutes2, seconds2;
+ u64 time = fabs(scr->osd.pts) * 1000000u;
+ time = MIN(time, scr->osd.duration);
+ camu_split_time(time, &hours2, &minutes2, &seconds2, &hundredths);
// The trade-off of rounding PTS is that if we do, second 0 will be shown for only half a second.
// If we don't, more noticeably, PTS will never equal duration if duration rounds up.
// There's also the option of not rounding either.
ROUND_SECONDS(hours2, minutes2, seconds2, hundredths);
- lr->osd.vars[12].data = &hours2;
- lr->osd.vars[13].data = &minutes2;
- lr->osd.vars[14].data = &seconds2;
- u32 zero = 0;
- lr->osd.vars[18].data = &zero;
- lr->osd.vars[19].data = &zero;
+ lr->osd.vars[14].data = &hours2;
+ lr->osd.vars[15].data = &minutes2;
+ lr->osd.vars[16].data = &seconds2;
+ static u32 zero = 0;
lr->osd.vars[20].data = &zero;
+ lr->osd.vars[21].data = &zero;
+ lr->osd.vars[22].data = &zero;
if (scr->osd.bar_mode == CAMU_OSD_BAR_SEEK) {
- u32 hours3, minutes3, seconds3;
+ static u32 hours3, minutes3, seconds3;
camu_split_time(fabs(duration * bar) * 1000000u, &hours3, &minutes3, &seconds3, &hundredths);
ROUND_SECONDS(hours3, minutes3, seconds3, hundredths);
- lr->osd.vars[18].data = &hours3;
- lr->osd.vars[19].data = &minutes3;
- lr->osd.vars[20].data = &seconds3;
+ lr->osd.vars[20].data = &hours3;
+ lr->osd.vars[21].data = &minutes3;
+ lr->osd.vars[22].data = &seconds3;
} else {
f64 whole = floor(bar);
f64 frac = (bar - whole) * 100.0;
- u32 num1, num2;
+ static u32 num1, num2;
num1 = (u32)whole;
num2 = (u32)round(frac);
- lr->osd.vars[19].data = &num1;
- lr->osd.vars[20].data = &num2;
+ lr->osd.vars[21].data = &num1;
+ lr->osd.vars[22].data = &num2;
}
lr->osd.sh = pl_dispatch_begin(lr->dispatch);
pl_shader_custom(lr->osd.sh, &(struct pl_custom_shader){
.description = "osd",
.prelude = lr->osd.prelude,
- .header = scr->osd.show_binds ? lr->osd.binds : lr->osd.header,
+ .header = scr->osd.alt ? lr->osd.binds : lr->osd.header,
.body = "color = (show_osd == 0u) ? vec4(0.) : draw_osd();",
.output = PL_SHADER_SIG_COLOR,
- .num_variables = 21,
+ .num_variables = 23,
.variables = lr->osd.vars
});
@@ -703,7 +723,7 @@ static bool renderer_lp_render(struct camu_renderer *renderer, struct camu_scree
target->rotation = mix.frames[0]->rotation - video->view.rotation;
//lr->params.color_map_params = pl_color_map_params(.inverse_tone_mapping = true);
/*
- if () {
+ if (1) {
target->color = pl_color_space_srgb;
target->color.hdr.max_luma = PL_COLOR_SDR_WHITE - 50.f;
target->color.hdr.min_luma = (PL_COLOR_SDR_WHITE - 50.f) / PL_COLOR_SDR_CONTRAST;
diff --git a/src/render/renderer_libplacebo.h b/src/render/renderer_libplacebo.h
index a8a5001..dba71bb 100644
--- a/src/render/renderer_libplacebo.h
+++ b/src/render/renderer_libplacebo.h
@@ -51,7 +51,7 @@ struct camu_renderer_lp {
pl_shader sh;
u32 screen_size[2];
f32 time;
- struct pl_shader_var vars[21];
+ struct pl_shader_var vars[23];
f32 vertices[24];
struct pl_vertex_attrib attribs[2];
f64 tick_time;
diff --git a/src/render/renderer_momo.c b/src/render/renderer_momo.c
index 02ccaee..2372213 100644
--- a/src/render/renderer_momo.c
+++ b/src/render/renderer_momo.c
@@ -21,7 +21,11 @@ static void renderer_momo_set(struct camu_renderer *renderer, u8 option, u8 valu
}
static bool renderer_momo_create_renderer(struct camu_renderer *renderer, u32 *width, u32 *height,
-#if defined STELA_API_OPENGL
+#if defined STELA_API_VULKAN
+#error "MOMO cannot support Vulkan"
+#elif defined STELA_API_DX11
+ HWND win32_window,
+#elif defined STELA_API_OPENGL
#ifdef STELA_USE_EGL
EGLDisplay display,
EGLContext context,
diff --git a/src/render/shaders/osd.h b/src/render/shaders/osd.h
index 1109a50..8a5fd6c 100644
--- a/src/render/shaders/osd.h
+++ b/src/render/shaders/osd.h
@@ -5,32 +5,32 @@ static char osd_shader[] = \
" if (connecting != 0u) {\n"
" float t = mod(time,1.8);\n"
" for (int i = 0; i < 3; i++) {\n"
-" col += char(ch_per,uv)*float(t >= float(i)*0.6);\n"
+" col += ch(ch_per,uv)*float(t >= float(i)*0.6);\n"
" }\n"
" } else if (paused != 0u) {\n"
-" col = char(ch_p,uv)+char(ch_a,uv)+char(ch_u,uv)+char(ch_s,uv)+char(ch_e,uv)+char(ch_d,uv);\n"
+" col = ch(ch_p,uv)+ch(ch_a,uv)+ch(ch_u,uv)+ch(ch_s,uv)+ch(ch_e,uv)+ch(ch_d,uv);\n"
" }\n"
" pp = pos2;\n"
" if (negative != 0u) {\n"
-" col += char(ch_dsh,uv);\n"
+" col += ch(ch_dsh,uv);\n"
" }\n"
" if (show_hour != 0u) {\n"
-" col += integer(num1,uv)+char(ch_col,uv);\n"
+" col += integer(num1,uv)+ch(ch_col,uv);\n"
" }\n"
-" col += integer(num2,uv)+char(ch_col,uv)+integer(num3,uv)+char(ch_lsl,uv);\n"
+" col += integer(num2,uv)+ch(ch_col,uv)+integer(num3,uv)+ch(ch_lsl,uv);\n"
" if (show_hour != 0u) {\n"
-" col += integer(num4,uv)+char(ch_col,uv);\n"
+" col += integer(num4,uv)+ch(ch_col,uv);\n"
" }\n"
-" col += integer(num5,uv)+char(ch_col,uv)+integer(num6,uv);\n"
+" col += integer(num5,uv)+ch(ch_col,uv)+integer(num6,uv);\n"
" return col;\n"
"}\n"
"float text_over(vec2 uv, vec2 pos3) {\n"
" float col = 0.;\n"
" pp = pos3;\n"
" if (show_hour != 0u && bar_mode == 1u) {\n"
-" col = integer(num7,uv)+char(ch_col,uv);\n"
+" col = integer(num7,uv)+ch(ch_col,uv);\n"
" }\n"
-" col += integer(num8,uv)+((bar_mode == 2u) ? char(ch_per,uv) : char(ch_col,uv))+integer(num9,uv);\n"
+" col += integer(num8,uv)+((bar_mode == 2u) ? ch(ch_per,uv) : ch(ch_col,uv))+integer(num9,uv);\n"
" return col;\n"
"}\n"
"vec4 draw_osd() {\n"
@@ -45,7 +45,7 @@ static char osd_shader[] = \
" pos2.x -= STRW(0.5) * float(negative);\n"
" float ov = fract(bar);\n"
" ov = (-1.+(bar-ov)+float(c.x < ov))/1.5;\n"
-" vec4 color = mix(bcolor,mix(tcolor,vec4(0.7,0.45,0.,1.),ov),float(c.x < bar));\n"
+" vec4 color = mix(bcolor,mix(tcolor-0.075,vec4(0.7,0.45,0.,1.),ov),float(c.x < bar));\n"
" float alpha = (c.x >= bar) ? 0.7 : 1.;\n"
" color = mix(color,vec4(tcolor.xyz,alpha)+float(bar > dbar)*0.15,float(c.x < dbar));\n"
" color = mix(color,vec4(tcolor.xyz,alpha-0.1)+float(bar > bbar)*0.15,float(c.x < bbar)*0.5);\n"
@@ -62,7 +62,7 @@ static char osd_shader[] = \
" uv = c*ss;\n"
" float width2 = (show_hour != 0u && bar_mode == 1u) ? 8. : 5.;\n"
" vec2 pos3 = floor(vec2(ss.x/2.-STRW(width2)/2.,11.));\n"
-" float box = in_box(uv,pos3-vec2(2.,2.),pos3+vec2(STRW(width2)+1.,STRH(1.)+3.));\n"
+" float box = in_box(uv,pos3-vec2(4.,2.),pos3+vec2(STRW(width2)+3.,STRH(1.)+3.));\n"
" color.xyz = mix(color.xyz,bcolor.xyz,box);\n"
" color.w = color.w+(bcolor.w*box);\n"
" pixel = text_over(uv,pos3);\n"
diff --git a/src/render/shaders/osd_binds.h b/src/render/shaders/osd_binds.h
index 5d6806a..0f5ff19 100644
--- a/src/render/shaders/osd_binds.h
+++ b/src/render/shaders/osd_binds.h
@@ -2,298 +2,363 @@ static char osd_binds_shader[] = \
"float text(vec2 uv, vec2 pos) {\n"
" float col = 0.;\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_L,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_f,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_lsl,uv);\n"
-" col += char(ch_R,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_g,uv);\n"
-" col += char(ch_h,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_col,uv);\n"
-" spaces(1)\n"
-" col += char(ch_N,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_x,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_lsl,uv);\n"
-" col += char(ch_P,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_v,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_o,uv);\n"
-" col += char(ch_u,uv);\n"
-" col += char(ch_s,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_lpa,uv);\n"
-" col += char(ch_C,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_col,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_crs,uv);\n"
-" col += char(ch_lsl,uv);\n"
-" col += char(ch_dsh,uv);\n"
-" col += char(ch_1,uv);\n"
-" col += char(ch_0,uv);\n"
-" col += char(ch_s,uv);\n"
-" col += char(ch_rpa,uv);\n"
+" col += ch(ch_L,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_f,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_R,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_g,uv);\n"
+" col += ch(ch_h,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_N,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_x,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_P,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_v,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_lpa,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_crs,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_dsh,uv);\n"
+" col += ch(ch_1,uv);\n"
+" col += ch(ch_0,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_rpa,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_p,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_c,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_p,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_c,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(6)\n"
-" col += char(ch_P,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_u,uv);\n"
-" col += char(ch_s,uv);\n"
-" col += char(ch_e,uv);\n"
+" col += ch(ch_P,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_e,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_M,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_M,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_M,uv);\n"
-" col += char(ch_u,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_lpa,uv);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_h,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_f,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_col,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_1,uv);\n"
-" col += char(ch_0,uv);\n"
-" col += char(ch_0,uv);\n"
-" col += char(ch_pct,uv);\n"
-" col += char(ch_rpa,uv);\n"
+" col += ch(ch_M,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_lpa,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_h,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_f,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_1,uv);\n"
+" col += ch(ch_0,uv);\n"
+" col += ch(ch_0,uv);\n"
+" col += ch(ch_pct,uv);\n"
+" col += ch(ch_rpa,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_T,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_b,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_T,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_b,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(8)\n"
-" col += char(ch_T,uv);\n"
-" col += char(ch_o,uv);\n"
-" col += char(ch_g,uv);\n"
-" col += char(ch_g,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_O,uv);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_D,uv);\n"
+" col += ch(ch_T,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_g,uv);\n"
+" col += ch(ch_g,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_O,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_D,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_C,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(7)\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_h,uv);\n"
-" col += char(ch_o,uv);\n"
-" col += char(ch_w,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_O,uv);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_D,uv);\n"
-" col += char(ch_lsl,uv);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_k,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_lpa,uv);\n"
-" col += char(ch_C,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_c,uv);\n"
-" col += char(ch_k,uv);\n"
-" col += char(ch_rpa,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_h,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_w,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_O,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_D,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_k,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_lpa,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_c,uv);\n"
+" col += ch(ch_k,uv);\n"
+" col += ch(ch_rpa,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_T,uv);\n"
-" col += char(ch_o,uv);\n"
-" col += char(ch_g,uv);\n"
-" col += char(ch_g,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_u,uv);\n"
-" col += char(ch_b,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_s,uv);\n"
+" col += ch(ch_T,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_g,uv);\n"
+" col += ch(ch_g,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_b,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_s,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_E,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_U,uv);\n"
+" col += ch(ch_p,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_D,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_w,uv);\n"
+" col += ch(ch_n,uv);\n"
+" col += ch(ch_col,uv);\n"
+" spaces(4)\n"
+" col += ch(ch_T,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_c,uv);\n"
+" col += ch(ch_k,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_lpa,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_A,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_d,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_com,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_h,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_f,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_b,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_rpa,uv);\n"
+" pos.y -= STRH(1.2);\n"
+" pp = vec2(pos.x,pos.y);\n"
+" col += ch(ch_E,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_R,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_s,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_k,uv);\n"
+" col += ch(ch_R,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_k,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_crs,uv);\n"
-" col += char(ch_lsl,uv);\n"
-" col += char(ch_dsh,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_crs,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_dsh,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(8)\n"
-" col += char(ch_Z,uv);\n"
-" col += char(ch_o,uv);\n"
-" col += char(ch_o,uv);\n"
-" col += char(ch_m,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_I,uv);\n"
-" col += char(ch_n,uv);\n"
-" col += char(ch_lsl,uv);\n"
-" col += char(ch_O,uv);\n"
-" col += char(ch_u,uv);\n"
-" col += char(ch_t,uv);\n"
+" col += ch(ch_Z,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_m,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_I,uv);\n"
+" col += ch(ch_n,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_O,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_t,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_N,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_N,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_D,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_s,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_b,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_c,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_n,uv);\n"
-" col += char(ch_g,uv);\n"
+" col += ch(ch_D,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_b,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_c,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_n,uv);\n"
+" col += ch(ch_g,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_C,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_T,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_n,uv);\n"
-" col += char(ch_s,uv);\n"
-" col += char(ch_p,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_n,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_B,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_c,uv);\n"
-" col += char(ch_k,uv);\n"
-" col += char(ch_g,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_o,uv);\n"
-" col += char(ch_u,uv);\n"
-" col += char(ch_n,uv);\n"
-" col += char(ch_d,uv);\n"
+" col += ch(ch_T,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_n,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_p,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_n,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_W,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_n,uv);\n"
+" col += ch(ch_d,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_w,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_V,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_V,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_V,uv);\n"
-" col += char(ch_R,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_lpa,uv);\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_h,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_f,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_col,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_3,uv);\n"
-" col += char(ch_6,uv);\n"
-" col += char(ch_0,uv);\n"
-" col += char(ch_dgr,uv);\n"
-" col += char(ch_com,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_C,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_l,uv);\n"
-" col += char(ch_col,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_C,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_n,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_r,uv);\n"
-" col += char(ch_rpa,uv);\n"
+" col += ch(ch_V,uv);\n"
+" col += ch(ch_R,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_lpa,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_n,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_com,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_h,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_f,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_3,uv);\n"
+" col += ch(ch_6,uv);\n"
+" col += ch(ch_0,uv);\n"
+" col += ch(ch_dgr,uv);\n"
+" col += ch(ch_rpa,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_B,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_B,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_S,uv);\n"
-" col += char(ch_w,uv);\n"
-" col += char(ch_a,uv);\n"
-" col += char(ch_p,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_E,uv);\n"
-" col += char(ch_y,uv);\n"
-" col += char(ch_e,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_w,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_p,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_E,uv);\n"
+" col += ch(ch_y,uv);\n"
+" col += ch(ch_e,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_R,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_R,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_R,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_s,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_t,uv);\n"
-" col += char(ch_spc,uv);\n"
-" col += char(ch_V,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_e,uv);\n"
-" col += char(ch_w,uv);\n"
+" col += ch(ch_R,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_s,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_V,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_w,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_lpa,uv);\n"
+" col += ch(ch_C,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_r,uv);\n"
+" col += ch(ch_l,uv);\n"
+" col += ch(ch_lsl,uv);\n"
+" col += ch(ch_S,uv);\n"
+" col += ch(ch_h,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_f,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_col,uv);\n"
+" col += ch(ch_spc,uv);\n"
+" col += ch(ch_R,uv);\n"
+" col += ch(ch_o,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_a,uv);\n"
+" col += ch(ch_t,uv);\n"
+" col += ch(ch_e,uv);\n"
+" col += ch(ch_rpa,uv);\n"
" pos.y -= STRH(1.2);\n"
" pp = vec2(pos.x,pos.y);\n"
-" col += char(ch_Q,uv);\n"
-" col += char(ch_col,uv);\n"
+" col += ch(ch_Q,uv);\n"
+" col += ch(ch_col,uv);\n"
" spaces(10)\n"
-" col += char(ch_Q,uv);\n"
-" col += char(ch_u,uv);\n"
-" col += char(ch_i,uv);\n"
-" col += char(ch_t,uv);\n"
+" col += ch(ch_Q,uv);\n"
+" col += ch(ch_u,uv);\n"
+" col += ch(ch_i,uv);\n"
+" col += ch(ch_t,uv);\n"
" return col;\n"
"}\n"
"vec4 draw_osd() {\n"
@@ -301,9 +366,9 @@ static char osd_binds_shader[] = \
" vec2 ss = sf/2.;\n"
" vec2 c = vec2(coord.x,1.-coord.y);\n"
" vec2 uv = c*ss;\n"
-" vec2 pos = floor(vec2(ss.x/2.-STRW(43.)/2.,(ss.y/2.)+STRH(1.2*10.)));\n"
+" vec2 pos = floor(vec2(ss.x/2.-STRW(49.)/2.,(ss.y/1.25)));\n"
" float pixel = text(uv, pos);\n"
-" float box = in_box(uv,pos-vec2(8.,STRH(1.2*13.)+8.),pos+vec2(STRW(43.)+8.,STRH(1.2)+8.));\n"
+" float box = in_box(uv,pos-vec2(8.,STRH(1.2*14.)+8.),pos+vec2(STRW(49.)+8.,STRH(1.2)+8.));\n"
" vec4 color = bcolor*box;\n"
" color = mix(color,tcolor,pixel);\n"
" color -= pixel*float(mod(c.y*sf.y,3.) < 1.)*0.5;\n"
diff --git a/src/render/shaders/osd_header.h b/src/render/shaders/osd_header.h
index 5ba6491..fad6921 100644
--- a/src/render/shaders/osd_header.h
+++ b/src/render/shaders/osd_header.h
@@ -95,11 +95,9 @@ static char osd_header_shader[] = \
"#define ch_rpa uvec4(0x00E030,0x30180C,0x183030,0xE00000)\n"
"#define ch_tid uvec4(0x0073DA,0xCE0000,0x000000,0x000000)\n"
"#define ch_lar uvec4(0x000000,0x10386C,0xC6C6FE,0x000000)\n"
-"#define spaces(n) for (int i = 0; i < n; i++) { col += char(ch_spc,uv); }\n"
+"#define spaces(n) for (int i = 0; i < n; i++) { col += ch(ch_spc,uv); }\n"
"#define STRW(c) (c*8.)\n"
"#define STRH(c) (c*12.)\n"
-"const vec4 tcolor = vec4(0.78,0.76,0.76,1.);\n"
-"const vec4 bcolor = vec4(0.1,0.1,0.1,0.65);\n"
"vec2 pp = vec2(0.);\n"
"float in_box(vec2 v, vec2 bl, vec2 tr) {\n"
" vec2 s = step(bl,v)-step(tr,v);\n"
@@ -117,30 +115,30 @@ static char osd_header_shader[] = \
" return in_box(uv,vec2(0.),vec2(8.,12.))*float(bv.x+bv.y+bv.z+bv.w);\n"
#endif
"}\n"
-"float char(uvec4 ch, vec2 uv) {\n"
+"float ch(uvec4 ch, vec2 uv) {\n"
" float px = sprite(ch,floor(uv-pp));\n"
" pp += vec2(8.,0.);\n"
" return px;\n"
"}\n"
"uvec4 digit(uint d) {\n"
" switch (d) {\n"
-" case 0: return ch_0;\n"
-" case 1: return ch_1;\n"
-" case 2: return ch_2;\n"
-" case 3: return ch_3;\n"
-" case 4: return ch_4;\n"
-" case 5: return ch_5;\n"
-" case 6: return ch_6;\n"
-" case 7: return ch_7;\n"
-" case 8: return ch_8;\n"
-" case 9:\n"
+" case 0u: return ch_0;\n"
+" case 1u: return ch_1;\n"
+" case 2u: return ch_2;\n"
+" case 3u: return ch_3;\n"
+" case 4u: return ch_4;\n"
+" case 5u: return ch_5;\n"
+" case 6u: return ch_6;\n"
+" case 7u: return ch_7;\n"
+" case 8u: return ch_8;\n"
+" case 9u:\n"
" default: return ch_9;\n"
" }\n"
"}\n"
"float integer(uint number, vec2 uv) {\n"
" float r = 0.;\n"
" for (int i = 1; i >= 0; i--) {\n"
-" r += char(digit(uint(mod(float(number)/max(1.,float(i)*10.),10.))),uv);\n"
+" r += ch(digit(uint(mod(float(number)/max(1.,float(i)*10.),10.))),uv);\n"
" }\n"
" return r;\n"
"}\n";
diff --git a/src/screen/screen.c b/src/screen/screen.c
index 29868d3..841fe0a 100644
--- a/src/screen/screen.c
+++ b/src/screen/screen.c
@@ -37,8 +37,10 @@ static void render_callback(void *userdata)
{
struct camu_screen *scr = (struct camu_screen *)userdata;
bool force;
- if (scr->renderer && camu_screen_tick(scr, &force)) {
- scr->renderer->render(scr->renderer, scr, force);
+ if (camu_screen_tick(scr, &force)) {
+ if (scr->renderer) {
+ scr->renderer->render(scr->renderer, scr, force);
+ }
}
}
@@ -276,7 +278,7 @@ static bool mouse_button_callback(void *userdata, u8 state, u8 button)
bool want_crosshair = MOUSE_MOD(scr) && scr->fullscreen;
scr->window->set_cursor(scr->window, want_crosshair ? STELA_CURSOR_CROSSHAIR : DEFAULT_CURSOR(scr));
if (LAST_CLICK_WITHIN(200000)) {
- if (MOD1(scr)) {
+ if (MOD1(scr) || (scr->osd.show && scr->last_pointer_y >= scr->height - OSD_BAR_HEIGHT)) {
seek_to_percent_at_pointer(scr, scr->last_pointer_x);
} else {
s32 n = (scr->last_pointer_x >= scr->width / 2.0) ? 1 : -1;
@@ -351,10 +353,7 @@ static bool key_callback(void *userdata, u8 state, u16 button)
case STELA_KEY_Q:
scr->window->close(scr->window);
scr->callback(scr->userdata, CAMU_SCREEN_CLOSE, NULL);
- break;
- case STELA_KEY_SLASH:
- scr->osd.show_binds = !scr->osd.show_binds;
- break;
+ return true;
case STELA_KEY_RIGHT:
if (MOD1(scr)) {
if (MOD2(scr)) {
@@ -389,33 +388,58 @@ static bool key_callback(void *userdata, u8 state, u16 button)
scr->callback(scr->userdata, CAMU_SCREEN_SKIP, &n);
break;
}
- case STELA_KEY_LEFT_CONTROL:
- case STELA_KEY_RIGHT_CONTROL:
- if (scr->osd.shown_for & CAMU_OSD_VOLUME) {
- scr->osd.shown_for &= ~CAMU_OSD_VOLUME;
- scr->osd.shown_for |= CAMU_OSD_SEEK;
- } else if (!scr->osd.show) {
+ case STELA_KEY_SPACE:
+ scr->callback(scr->userdata, CAMU_SCREEN_TOGGLE_PAUSE, NULL);
+ break;
+ case STELA_KEY_M: {
+ f32 volume = MOD2(scr) ? 1.f : -1.f;
+ scr->callback(scr->userdata, CAMU_SCREEN_SET_VOLUME, &volume);
+ scr->osd.bar_mode = CAMU_OSD_BAR_VOLUME;
+ scr->osd.bar = volume;
+ if (!scr->osd.show) {
+ scr->osd.flash = CAMU_OSD_FLASH_FOR(0.75);
scr->osd.show = true;
- scr->osd.shown_for |= CAMU_OSD_SEEK;
- }
- if (scr->osd.duration > 0 && scr->last_pointer_y >= scr->height - OSD_BAR_HEIGHT) {
- scr->osd.bar_mode = CAMU_OSD_BAR_SEEK;
}
break;
- case STELA_KEY_TAB:
- if (!(scr->osd.shown_for & CAMU_OSD_SEEK)) {
- if (scr->osd.flash >= 0.0) {
- scr->osd.flash = 0.0;
+ }
+ case STELA_KEY_SLASH:
+ if (scr->osd.show) {
+ if (scr->osd.alt == CAMU_OSD_ALT_BINDS) {
+ if (scr->osd.shown_for & CAMU_OSD_TOGGLED) {
+ scr->osd.shown_for &= ~CAMU_OSD_ALT_TOGGLED;
+ } else {
+ scr->osd.show = false;
+ scr->osd.shown_for = 0;
+ atomic_add(u32)(&scr->force_refresh, 1, AL_ATOMIC_RELAXED);
+ }
+ scr->osd.alt = 0;
} else {
- scr->osd.show = !scr->osd.show;
- scr->osd.shown_for = 0;
- atomic_add(u32)(&scr->force_refresh, 1, AL_ATOMIC_RELAXED);
+ scr->osd.alt = CAMU_OSD_ALT_BINDS;
}
- return true;
+ } else {
+ scr->osd.show = true;
+ scr->osd.shown_for |= CAMU_OSD_ALT_TOGGLED;
+ scr->osd.alt = CAMU_OSD_ALT_BINDS;
+ }
+ return true;
+ case STELA_KEY_TAB:
+ if (scr->osd.show) {
+ scr->osd.show = false;
+ scr->osd.shown_for = 0;
+ scr->osd.alt = 0;
+ atomic_add(u32)(&scr->force_refresh, 1, AL_ATOMIC_RELAXED);
+ } else {
+ scr->osd.show = true;
+ scr->osd.shown_for |= CAMU_OSD_TOGGLED;
+ }
+ return true;
+ case STELA_KEY_LEFT_CONTROL:
+ case STELA_KEY_RIGHT_CONTROL:
+ scr->osd.show = true;
+ scr->osd.shown_for |= CAMU_OSD_KEY_HELD;
+ if (scr->osd.duration > 0 && scr->last_pointer_y >= scr->height - OSD_BAR_HEIGHT) {
+ scr->osd.bar_mode = CAMU_OSD_BAR_SEEK;
}
- break;
- case STELA_KEY_SPACE:
- scr->callback(scr->userdata, CAMU_SCREEN_TOGGLE_PAUSE, NULL);
break;
case STELA_KEY_S:
if (MOD1(scr)) {
@@ -428,81 +452,27 @@ static bool key_callback(void *userdata, u8 state, u16 button)
#endif
}
break;
- case STELA_KEY_E:
- scr->callback(scr->userdata, CAMU_SCREEN_RESEEK, NULL);
- break;
- case STELA_KEY_M: {
- f32 volume = MOD2(scr) ? 1.f : -1.f;
- scr->callback(scr->userdata, CAMU_SCREEN_SET_VOLUME, &volume);
- scr->osd.bar_mode = CAMU_OSD_BAR_VOLUME;
- scr->osd.bar = volume;
- scr->osd.flash = CAMU_OSD_FLASH_FOR(0.75);
- if (!scr->osd.show) {
- scr->osd.show = true;
- scr->osd.shown_for |= CAMU_OSD_VOLUME;
+ case STELA_KEY_UP: {
+ s32 n = -1;
+ if (MOD1(scr)) {
+ scr->callback(scr->userdata, CAMU_SCREEN_AUDIO_TRACK, &n);
+ } else if (MOD2(scr)) {
+ scr->callback(scr->userdata, CAMU_SCREEN_SUBTITLE_TRACK, &n);
}
break;
}
- case STELA_KEY_0:
- scr->callback(scr->userdata, CAMU_SCREEN_PRINT, NULL);
- break;
-#ifdef CAMU_SCREEN_DEBUG_KEY
- case STELA_KEY_P:
- scr->callback(scr->userdata, CAMU_SCREEN_DEBUG, NULL);
- break;
-#endif
- case STELA_KEY_R: {
- struct camu_view *view = get_view_from_mouse_pos(scr);
- if (view) {
- if (MOD2(scr)) {
- switch (view->rotation) {
- case CAMU_VIEW_ROTATION_0:
- case CAMU_VIEW_ROTATION_360:
- view->rotation = CAMU_VIEW_ROTATION_90;
- break;
- case CAMU_VIEW_ROTATION_270:
- view->rotation = CAMU_VIEW_ROTATION_0;
- break;
- case CAMU_VIEW_ROTATION_180:
- view->rotation = CAMU_VIEW_ROTATION_270;
- break;
- case CAMU_VIEW_ROTATION_90:
- view->rotation = CAMU_VIEW_ROTATION_180;
- break;
- }
- } else if (MOD1(scr)) {
- switch (view->rotation) {
- case CAMU_VIEW_ROTATION_0:
- case CAMU_VIEW_ROTATION_360:
- view->rotation = CAMU_VIEW_ROTATION_270;
- break;
- case CAMU_VIEW_ROTATION_270:
- view->rotation = CAMU_VIEW_ROTATION_180;
- break;
- case CAMU_VIEW_ROTATION_180:
- view->rotation = CAMU_VIEW_ROTATION_90;
- break;
- case CAMU_VIEW_ROTATION_90:
- view->rotation = CAMU_VIEW_ROTATION_0;
- break;
- }
- } else if (scr->vr_emulation) {
- view->fov = AL_TO_RADIANS(CAMU_DEFAULT_FOV);
- } else {
- view->mode = CAMU_DEFAULT_VIEW;
- }
- camu_view_calculate(view, scr->width, scr->height);
- return true;
+ case STELA_KEY_DOWN: {
+ s32 n = 1;
+ if (MOD1(scr)) {
+ scr->callback(scr->userdata, CAMU_SCREEN_AUDIO_TRACK, &n);
+ } else if (MOD2(scr)) {
+ scr->callback(scr->userdata, CAMU_SCREEN_SUBTITLE_TRACK, &n);
}
break;
}
- case STELA_KEY_T: {
- struct camu_view *view = get_view_from_mouse_pos(scr);
- if (view) {
- scr->window->resize(scr->window, ceil(view->width * view->zoom), ceil(view->height * view->zoom));
- }
+ case STELA_KEY_E:
+ scr->callback(scr->userdata, CAMU_SCREEN_RESEEK, NULL);
break;
- }
case STELA_KEY_EQUAL: {
struct camu_view *view = get_view_from_mouse_pos(scr);
if (view) {
@@ -578,6 +548,69 @@ static bool key_callback(void *userdata, u8 state, u16 button)
}
break;
}
+ case STELA_KEY_R: {
+ struct camu_view *view = get_view_from_mouse_pos(scr);
+ if (view) {
+ if (MOD2(scr)) {
+ switch (view->rotation) {
+ case CAMU_VIEW_ROTATION_0:
+ case CAMU_VIEW_ROTATION_360:
+ view->rotation = CAMU_VIEW_ROTATION_90;
+ break;
+ case CAMU_VIEW_ROTATION_270:
+ view->rotation = CAMU_VIEW_ROTATION_0;
+ break;
+ case CAMU_VIEW_ROTATION_180:
+ view->rotation = CAMU_VIEW_ROTATION_270;
+ break;
+ case CAMU_VIEW_ROTATION_90:
+ view->rotation = CAMU_VIEW_ROTATION_180;
+ break;
+ }
+ } else if (MOD1(scr)) {
+ switch (view->rotation) {
+ case CAMU_VIEW_ROTATION_0:
+ case CAMU_VIEW_ROTATION_360:
+ view->rotation = CAMU_VIEW_ROTATION_270;
+ break;
+ case CAMU_VIEW_ROTATION_270:
+ view->rotation = CAMU_VIEW_ROTATION_180;
+ break;
+ case CAMU_VIEW_ROTATION_180:
+ view->rotation = CAMU_VIEW_ROTATION_90;
+ break;
+ case CAMU_VIEW_ROTATION_90:
+ view->rotation = CAMU_VIEW_ROTATION_0;
+ break;
+ }
+ } else {
+ if (scr->vr_emulation) {
+ view->fov = AL_TO_RADIANS(CAMU_DEFAULT_FOV);
+ } else {
+ view->mode = CAMU_DEFAULT_VIEW;
+ }
+ view->rotation = view->default_rotation;
+ }
+ camu_view_calculate(view, scr->width, scr->height);
+ return true;
+ }
+ break;
+ }
+ case STELA_KEY_T: {
+ struct camu_view *view = get_view_from_mouse_pos(scr);
+ if (view) {
+ scr->window->resize(scr->window, ceil(view->width * view->zoom), ceil(view->height * view->zoom));
+ }
+ break;
+ }
+ case STELA_KEY_0:
+ scr->callback(scr->userdata, CAMU_SCREEN_PRINT, NULL);
+ break;
+#ifdef CAMU_SCREEN_DEBUG_KEY
+ case STELA_KEY_P:
+ scr->callback(scr->userdata, CAMU_SCREEN_DEBUG, NULL);
+ break;
+#endif
default:
break;
}
@@ -586,8 +619,8 @@ static bool key_callback(void *userdata, u8 state, u16 button)
switch (button) {
case STELA_KEY_LEFT_CONTROL:
case STELA_KEY_RIGHT_CONTROL:
- if (scr->osd.shown_for & CAMU_OSD_SEEK) {
- scr->osd.shown_for &= ~CAMU_OSD_SEEK;
+ scr->osd.shown_for &= ~CAMU_OSD_KEY_HELD;
+ if (scr->osd.shown_for == 0) {
scr->osd.show = false;
atomic_add(u32)(&scr->force_refresh, 1, AL_ATOMIC_RELAXED);
}
@@ -681,9 +714,9 @@ bool camu_screen_init(struct camu_screen *scr)
scr->last_seek_ts = 0;
#endif
scr->touch_mode = false;
- scr->osd.show_binds = false;
- scr->osd.bar = -1.0;
+ scr->osd.show = false;
scr->osd.flash = -1.0;
+ scr->osd.bar = -1.0;
scr->vr_emulation = CAMU_VR_DISABLED;
scr->vr_left_eye = false;
scr->vr_calibrate_x = 0.5;
@@ -954,17 +987,14 @@ bool camu_screen_tick(struct camu_screen *scr, bool *force)
}
bool was_paused = scr->osd.paused;
scr->callback(scr->userdata, CAMU_SCREEN_STATUS, &scr->osd);
- if (!MOD1(scr)) {
- if (scr->osd.flash >= 0.0) {
- if (nn_get_tick() >= scr->osd.flash) {
- scr->osd.flash = -1.0;
- scr->osd.shown_for = 0;
+ if (scr->osd.flash >= 0.0) {
+ if (nn_get_tick() >= scr->osd.flash) {
+ scr->osd.flash = -1.0;
+ if (scr->osd.shown_for == 0) {
scr->osd.show = false;
- scr->osd.bar_mode = CAMU_OSD_BAR_PROGRESS;
*force = true;
- } else {
- scr->osd.show = true;
}
+ scr->osd.bar_mode = CAMU_OSD_BAR_PROGRESS;
}
}
if (scr->osd.bar_mode == CAMU_OSD_BAR_SEEK) {
@@ -977,7 +1007,9 @@ bool camu_screen_tick(struct camu_screen *scr, bool *force)
scr->osd.shown_for |= CAMU_OSD_PAUSE;
} else if (scr->osd.shown_for & CAMU_OSD_PAUSE) {
scr->osd.shown_for &= ~CAMU_OSD_PAUSE;
- scr->osd.show = false;
+ if (scr->osd.shown_for == 0) {
+ scr->osd.show = false;
+ }
}
*force = true;
}
diff --git a/src/screen/screen.h b/src/screen/screen.h
index c3dcd7d..0be414f 100644
--- a/src/screen/screen.h
+++ b/src/screen/screen.h
@@ -17,7 +17,7 @@
// Interpret click and drag as seeking. Mainly a seek performance test.
//#define CAMU_SCREEN_DRAG_SEEK
-#define CAMU_SCREEN_WIDTH 700
+#define CAMU_SCREEN_WIDTH 840
#define CAMU_SCREEN_HEIGHT 700
enum {
@@ -45,6 +45,8 @@ enum {
CAMU_SCREEN_PERCENT_SEEK, // f64
CAMU_SCREEN_RELATIVE_SEEK, // f64
CAMU_SCREEN_RESEEK,
+ CAMU_SCREEN_AUDIO_TRACK, // s32
+ CAMU_SCREEN_SUBTITLE_TRACK, // s32
CAMU_SCREEN_SHUFFLE,
CAMU_SCREEN_STATUS,
CAMU_SCREEN_PRINT,
@@ -60,10 +62,16 @@ struct camu_screen_video {
};
enum {
- CAMU_OSD_PAUSE = 1,
- CAMU_OSD_SEEK = 1 << 1,
- CAMU_OSD_VOLUME = 1 << 2,
- CAMU_OSD_EMPTY = 1 << 3
+ CAMU_OSD_CONNECTING = 1,
+ CAMU_OSD_PAUSE = 1 << 1,
+ CAMU_OSD_EMPTY = 1 << 2,
+ CAMU_OSD_TOGGLED = 1 << 3,
+ CAMU_OSD_ALT_TOGGLED = 1 << 4,
+ CAMU_OSD_KEY_HELD = 1 << 5
+};
+
+enum {
+ CAMU_OSD_ALT_BINDS = 1
};
enum {
@@ -76,13 +84,13 @@ enum {
struct camu_osd {
u32 show;
+ u8 alt;
u8 shown_for;
- bool show_binds;
+ f64 flash;
u32 connecting;
u32 paused;
u32 bar_mode;
f64 bar;
- f64 flash;
f64 pts;
u64 duration;
};
diff --git a/src/screen/view.c b/src/screen/view.c
index fadc81c..07b2c71 100644
--- a/src/screen/view.c
+++ b/src/screen/view.c
@@ -22,7 +22,8 @@
void camu_view_init(struct camu_view *view, u32 width, u32 height, u8 rotation)
{
view->mode = CAMU_DEFAULT_VIEW;
- view->rotation = rotation;
+ view->default_rotation = rotation;
+ view->rotation = view->default_rotation;
view->width = width;
view->height = height;
view->zindex = 0;
diff --git a/src/screen/view.h b/src/screen/view.h
index ae6a357..c1a0ed7 100644
--- a/src/screen/view.h
+++ b/src/screen/view.h
@@ -29,6 +29,7 @@ enum {
struct camu_view {
u8 mode;
+ u8 default_rotation;
u8 rotation;
u32 width;
u32 height;
diff --git a/src/server/server.c b/src/server/server.c
index 7781c05..513e22e 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -225,7 +225,7 @@ void handle_toggle_sink(struct camu_server *server, str *name, struct camu_serve
// One list_pump() call at a single point should be equivalent to any amount in succession.
// There are two things to consider while within list_pump().
-// 1. An entry that was pending may be freed, making entry->list an invalid statement.
+// 1. An entry that was pending may be freed, making entry->list invalid.
// 2. resource->pending may be edited (added to).
// So, we create an array of every list that needs to be pumped and operate on that.
static void process_pending(struct camu_resource *resource)
@@ -922,6 +922,7 @@ bool camu_server_listen(struct camu_server *server, u8 type, str *addr, u16 port
void camu_server_bind_direct(struct camu_server *server)
{
+ al_str_from(&server->addr, "[direct]");
nn_multiplex_direct_init(multiplex_callback, server);
}
@@ -1025,7 +1026,7 @@ void camu_server_local_add(struct camu_server *server, struct nn_packet *packet)
handle_add_command(server, al_array_last(server->lists), packet);
}
-void camu_server_local_set_index(struct camu_server *server, u32 index)
+void camu_server_local_start_at(struct camu_server *server, s32 index)
{
- lia_list_skipto(al_array_last(server->lists), LIANA_SEQUENCE_ANY, index);
+ lia_list_start_at(al_array_last(server->lists), index);
}
diff --git a/src/server/server.h b/src/server/server.h
index 6552413..3112679 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -57,4 +57,4 @@ void camu_server_free(struct camu_server *server);
// Local compat.
void camu_server_local_add(struct camu_server *server, struct nn_packet *packet);
-void camu_server_local_set_index(struct camu_server *server, u32 index);
+void camu_server_local_start_at(struct camu_server *server, s32 index);
diff --git a/src/util/color_palette.c b/src/util/color_palette.c
index f12d1f8..ca14c55 100644
--- a/src/util/color_palette.c
+++ b/src/util/color_palette.c
@@ -36,6 +36,7 @@ static char *normal_colors[16] = {
bool camu_colors_maybe_init(str *path)
{
+ al_memset(&global_color_palette, 0, sizeof(global_color_palette));
#ifdef NAUNET_HAS_JSON
struct nn_file file;
if (!nn_file_exists(path) || !nn_file_open(&file, path, NNWT_FILE_READONLY)) {
@@ -110,6 +111,8 @@ bool camu_colors_maybe_init(str *path)
out:
json_decref(root);
+ global_color_palette.supplied = parsed;
+
return parsed;
#else
(void)path;
diff --git a/src/util/color_palette.h b/src/util/color_palette.h
index b0cc9f4..5943147 100644
--- a/src/util/color_palette.h
+++ b/src/util/color_palette.h
@@ -28,6 +28,7 @@ enum {
#define CAMU_COLOR_PALETTE_COUNT 18
struct camu_color_palette {
+ bool supplied;
u32 colors[CAMU_COLOR_PALETTE_COUNT];
};