From e278397aa3481e9f6266fab88bf21e93f6cab4f9 Mon Sep 17 00:00:00 2001 From: Trek H Date: Mon, 20 Jan 2020 21:00:24 +1030 Subject: [PATCH] mjpeg-player: append to lexer The mjpeg lexer can now have data appended to it as many times as needed instead of having the data passed at construction. --- cmd/mjpeg-player/lex-mjpeg.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/mjpeg-player/lex-mjpeg.js b/cmd/mjpeg-player/lex-mjpeg.js index 4d5be7e9..222fa945 100644 --- a/cmd/mjpeg-player/lex-mjpeg.js +++ b/cmd/mjpeg-player/lex-mjpeg.js @@ -1,12 +1,9 @@ /* -NAME - lex-mjpeg.js - AUTHOR Trek Hopton LICENSE - This file is Copyright (C) 2019 the Australian Ocean Lab (AusOcean) + This file is Copyright (C) 2020 the Australian Ocean Lab (AusOcean) It is free software: you can redistribute it and/or modify them under the terms of the GNU General Public License as published by the @@ -24,11 +21,14 @@ LICENSE // MJPEGLexer lexes a byte array containing MJPEG into individual JPEGs. class MJPEGLexer { - constructor(src) { - this.src = src; + constructor() { this.off = 0; } + append(data) { + this.src = new Uint8Array(data); + } + // read returns the next single frame. read() { // Check if the src can contain at least the start and end flags (4B).