mirror of https://bitbucket.org/ausocean/av.git
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:
parent
feae838b3f
commit
e278397aa3
|
@ -1,12 +1,9 @@
|
||||||
/*
|
/*
|
||||||
NAME
|
|
||||||
lex-mjpeg.js
|
|
||||||
|
|
||||||
AUTHOR
|
AUTHOR
|
||||||
Trek Hopton <trek@ausocean.org>
|
Trek Hopton <trek@ausocean.org>
|
||||||
|
|
||||||
LICENSE
|
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
|
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
|
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.
|
// MJPEGLexer lexes a byte array containing MJPEG into individual JPEGs.
|
||||||
class MJPEGLexer {
|
class MJPEGLexer {
|
||||||
constructor(src) {
|
constructor() {
|
||||||
this.src = src;
|
|
||||||
this.off = 0;
|
this.off = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
append(data) {
|
||||||
|
this.src = new Uint8Array(data);
|
||||||
|
}
|
||||||
|
|
||||||
// read returns the next single frame.
|
// read returns the next single frame.
|
||||||
read() {
|
read() {
|
||||||
// Check if the src can contain at least the start and end flags (4B).
|
// Check if the src can contain at least the start and end flags (4B).
|
||||||
|
|
Loading…
Reference in New Issue