Browse Source

Make remote accept screenshot blobs

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 3 years ago
parent
commit
d04a1f8731
3 changed files with 29 additions and 3 deletions
  1. +4
    -2
      Makefile
  2. +1
    -1
      dpf
  3. +24
    -0
      src/CardinalPlugin.cpp

+ 4
- 2
Makefile View File

@@ -106,6 +106,8 @@ endif
# --------------------------------------------------------------
# MOD builds

EXTRA_MOD_FLAGS = -I../include/single-precision -fsingle-precision-constant

ifeq ($(WITH_LTO),true)
EXTRA_MOD_FLAGS += -ffat-lto-objects
endif
@@ -119,9 +121,9 @@ MOD_ENVIRONMENT = \
LD=${1}/host/usr/bin/${2}-ld \
PKG_CONFIG=${1}/host/usr/bin/pkg-config \
STRIP=${1}/host/usr/bin/${2}-strip \
CFLAGS="-I${1}/staging/usr/include -fsingle-precision-constant $(EXTRA_MOD_FLAGS)" \
CFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS)" \
CPPFLAGS= \
CXXFLAGS="-I${1}/staging/usr/include -I../include/single-precision -fsingle-precision-constant $(EXTRA_MOD_FLAGS) -Wno-attributes" \
CXXFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS) -Wno-attributes" \
LDFLAGS="-L${1}/staging/usr/lib $(EXTRA_MOD_FLAGS)" \
EXE_WRAPPER="qemu-${3}-static -L ${1}/target" \
HEADLESS=true \


+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 65440847faef769cfcb07a94009642341820dd63
Subproject commit 3106d9a311c33a677e14828348657d21343c569d

+ 24
- 0
src/CardinalPlugin.cpp View File

@@ -196,6 +196,7 @@ struct Initializer
lo_server_add_method(oscServer, "/hello", "", osc_hello_handler, this);
lo_server_add_method(oscServer, "/load", "b", osc_load_handler, this);
lo_server_add_method(oscServer, "/screenshot", "b", osc_screenshot_handler, this);
lo_server_add_method(oscServer, nullptr, nullptr, osc_fallback_handler, nullptr);
startThread();
@@ -302,6 +303,29 @@ struct Initializer
LO_TT_IMMEDIATE, "/resp", "ss", "load", ok ? "ok" : "fail");
return 0;
}
static int osc_screenshot_handler(const char*, const char* types, lo_arg** argv, int argc, const lo_message m, void* const self)
{
d_stdout("osc_screenshot_handler()");
DISTRHO_SAFE_ASSERT_RETURN(argc == 1, 0);
DISTRHO_SAFE_ASSERT_RETURN(types != nullptr && types[0] == 'b', 0);
const int32_t size = argv[0]->blob.size;
DISTRHO_SAFE_ASSERT_RETURN(size > 4, 0);
const uint8_t* const blob = (uint8_t*)(&argv[0]->blob.data);
DISTRHO_SAFE_ASSERT_RETURN(blob != nullptr, 0);
bool ok = false;
if (CardinalBasePlugin* const plugin = static_cast<Initializer*>(self)->oscPlugin)
ok = plugin->updateStateValue("screenshot", String::asBase64(blob, size).buffer());
const lo_address source = lo_message_get_source(m);
lo_send_from(source, static_cast<Initializer*>(self)->oscServer,
LO_TT_IMMEDIATE, "/resp", "ss", "screenshot", ok ? "ok" : "fail");
return 0;
}
#endif
};


Loading…
Cancel
Save