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.
This commit is contained in:
Trek H 2020-01-20 21:00:24 +10:30
parent feae838b3f
commit e278397aa3
1 changed files with 6 additions and 6 deletions

View File

@ -1,12 +1,9 @@
/*
NAME
lex-mjpeg.js
AUTHOR
Trek Hopton <trek@ausocean.org>
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).