This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var glRef = {}; | |
function loadImage(src) { | |
return new Promise((resolve, reject) => { | |
const img = new Image(); | |
img.onload = () => { | |
resolve(img); | |
}; | |
img.src = src; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const W = 640; // video frame width | |
const H = 360; // video frame height | |
const pixelData = await imageLoader("./seaside.png"); // get the pixel data of the backgroung image in RGBA format | |
const buffer = new Uint8Array(W * H * 1.5); // byte buffer for the incoming frame in YUV 422 format | |
const bufferRGB = new Uint8Array(W * H * 4); // byte buffer for the result frame in RGBA format | |
const transformer = new TransformStream({ | |
async transform(videoFrame, controller) { | |
const copyResult = await videoFrame.copyTo(buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function yuv2canvas(yuv, width, height, canvas) { | |
/* | |
canvas.width = width; | |
canvas.height = height; | |
*/ | |
context = canvas.getContext("2d"); | |
output = context.createImageData(width, height); | |
outputData = output.data; | |
yOffset = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WIDTH = 176 | |
const HEIGHT = 144 | |
const progRGB = yuv420ProgPlanarToRgb(base64ToArrayBuffer(yuv420ProgPlanarImage()), WIDTH, HEIGHT) | |
const canvas = document.createElement("canvas") | |
document.body.appendChild(canvas) | |
const ctx = canvas.getContext("2d") | |
const imageData = ctx.createImageData(WIDTH, HEIGHT) | |
putRGBToRGBA(imageData.data, progRGB, WIDTH, HEIGHT) | |
ctx.putImageData(imageData, 0, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PeerTube Apache configuration version 24.6.29 (for PeerTube version 5.x only) | |
SSLSessionCache "shmcb:/usr/local/apache/logs/ssl_gcache_data(512000)" | |
SSLSessionCacheTimeout 87400 | |
SSLStaplingCache shmcb:logs/stapling-cache(150000) | |
# Please check your Apache installation features the following modules via 'apachectl -M': | |
# STANDARD HTTP MODULES: core_module, proxy_module, proxy_http2_module, proxy_wstunnel_module, proxy_http_module, headers_module, remoteip_module, ssl_module, filter_module, reqtimeout_module | |
# THIRD PARTY MODULES: None. | |
# check https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=modern&openssl=1.1.1d&hsts=false&ocsp=false&guideline=5.6 for hardening security |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var udp = require('dgram'); | |
// --------------------creating a udp server -------------------- | |
// creating a udp server | |
var server = udp.createSocket('udp4'); | |
// emits when any error occurs | |
server.on('error',function(error){ | |
console.log('Error: ' + error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@fliptopbox | |
LZW Compression/Decompression for Strings | |
Implementation of LZW algorithms from: | |
http://rosettacode.org/wiki/LZW_compression#JavaScript | |
Usage: | |
var a = 'a very very long string to be squashed'; | |
var b = a.compress(); // 'a veryāăąlong striċ to bečquashed' |