Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for cimbar.js, cimbar_send #75

Merged
merged 4 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: emscripten/emsdk:latest
image: emscripten/emsdk:3.1.39
Copy link
Owner Author

@sz3 sz3 Jun 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Staying on latest isn't just tempting fate: it's already changed/broken in the past month.

options: -v ${{ github.workspace }}:/usr/src/app
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion package-wasm.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
#docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it emscripten/emsdk:latest
#docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it emscripten/emsdk:3.1.39

cd /usr/src/app

Expand Down
18 changes: 12 additions & 6 deletions src/lib/cimbar_js/cimbar_js.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* This code is subject to the terms of the Mozilla Public License, v.2.0. http://mozilla.org/MPL/2.0/. */
#include "cimbar_js.h"

#include "cimb_translator/Config.h"
#include "encoder/SimpleEncoder.h"
#include "gui/window_glfw.h"
#include "util/byte_istream.h"
Expand All @@ -18,9 +19,9 @@ namespace {
uint8_t _encodeId = 0;

// settings
unsigned _ecc = 30;
unsigned _colorBits = 2;
int _compressionLevel = 6;
unsigned _ecc = cimbar::Config::ecc_bytes();
unsigned _colorBits = cimbar::Config::color_bits();
int _compressionLevel = cimbar::Config::compression_level();
}

extern "C" {
Expand All @@ -30,6 +31,11 @@ int initialize_GL(int width, int height)
if (_window)
return 1;

// must be divisible by 4???
if (width % 4 != 0)
width += (4 - width % 4);
if (height % 4 != 0)
height += (4 - height % 4);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll admit I don't understand this at all. Some opengl nonsense, I think.

std::cerr << "initializing " << width << " by " << height << " window";

_window = std::make_shared<cimbar::window_glfw>(width, height, "Cimbar Encoder");
Expand Down Expand Up @@ -105,11 +111,11 @@ int configure(unsigned color_bits, unsigned ecc, int compression)
{
// defaults
if (color_bits > 3)
color_bits = 2;
color_bits = cimbar::Config::color_bits();
if (ecc < 0 or ecc >= 150)
ecc = 30;
ecc = cimbar::Config::ecc_bytes();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honor config defaults.

if (compression < 0 or compression > 22)
compression = 6;
compression = cimbar::Config::compression_level();

// check if we need to refresh the stream
bool refresh = (color_bits != _colorBits or ecc != _ecc or compression != _compressionLevel);
Expand Down
2 changes: 1 addition & 1 deletion web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ return {

setColorBits : function(color_bits)
{
Module._configure(color_bits, 30, 6);
Module._configure(color_bits, 255, 255);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use config defaults.


var nav = document.getElementById("nav-container");
if (color_bits == 2) {
Expand Down