Skip to content

Commit

Permalink
movie.size added
Browse files Browse the repository at this point in the history
  • Loading branch information
foomoon committed Dec 23, 2023
1 parent 612d9f9 commit d87946c
Show file tree
Hide file tree
Showing 20 changed files with 192 additions and 146 deletions.
1 change: 1 addition & 0 deletions dist/lib/movie.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export declare class Movie {
fps: number;
};
toOctet(): Uint8Array;
size(isCompressed?: boolean): number;
}
15 changes: 15 additions & 0 deletions dist/lib/movie.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ export class Movie {
// this.frameData = output;
return output; //.buffer;
}
size(isCompressed = false) {
let nBytes = 0;
// for each frame, determine number of leds
this.frameData.forEach((frame) => {
let leds = frame.leds;
if (isCompressed) {
leds = frame.leds.filter((led) => {
return led.red != 0 && led.green != 0 && led.blue != 0;
});
}
let numNonBlackLeds = leds.length;
nBytes += numNonBlackLeds * 3;
});
return nBytes;
}
}
function generateUUID() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/classes/AuthenticationToken.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">AuthenticationToken</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L682">lib/light.ts:682</a></li></ul></aside>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L682">lib/light.ts:682</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand Down Expand Up @@ -63,24 +63,24 @@ <h5><span class="tsd-kind-parameter">res</span>: <span class="tsd-signature-type
</div></li></ul></div>
<h4 class="tsd-returns-title">Returns <a href="AuthenticationToken.html" class="tsd-signature-type tsd-kind-class">AuthenticationToken</a></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L693">lib/light.ts:693</a></li></ul></aside></li></ul></section></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L693">lib/light.ts:693</a></li></ul></aside></li></ul></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Properties</h2>
<section class="tsd-panel tsd-member"><a id="challengeResponse" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>challenge<wbr/>Response</span><a href="#challengeResponse" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">challenge<wbr/>Response</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L685">lib/light.ts:685</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L685">lib/light.ts:685</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="expiry" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>expiry</span><a href="#expiry" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">expiry</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type ">Date</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L684">lib/light.ts:684</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L684">lib/light.ts:684</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="token" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>token</span><a href="#token" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L683">lib/light.ts:683</a></li></ul></aside></section></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L683">lib/light.ts:683</a></li></ul></aside></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Methods</h2>
<section class="tsd-panel tsd-member"><a id="getChallengeResponse" class="tsd-anchor"></a>
Expand All @@ -92,7 +92,7 @@ <h3 class="tsd-anchor-link"><span>get<wbr/>Challenge<wbr/>Response</span><a href
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>Challenge response generated by the XLED instance</p>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L720">lib/light.ts:720</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L720">lib/light.ts:720</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member"><a id="getToken" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>get<wbr/>Token</span><a href="#getToken" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures">
Expand All @@ -102,7 +102,7 @@ <h3 class="tsd-anchor-link"><span>get<wbr/>Token</span><a href="#getToken" aria-
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>Token as string</p>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L704">lib/light.ts:704</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L704">lib/light.ts:704</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member"><a id="getTokenDecoded" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>get<wbr/>Token<wbr/>Decoded</span><a href="#getTokenDecoded" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures">
Expand All @@ -112,7 +112,7 @@ <h3 class="tsd-anchor-link"><span>get<wbr/>Token<wbr/>Decoded</span><a href="#ge
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Buffer</span></h4><p>Token as buffer, for UDP use</p>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/light.ts#L712">lib/light.ts:712</a></li></ul></aside></li></ul></section></section></div>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/light.ts#L712">lib/light.ts:712</a></li></ul></aside></li></ul></section></section></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
10 changes: 5 additions & 5 deletions docs/classes/Frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><a href="OneColorFrame.html" class="tsd-signature-type tsd-kind-class">OneColorFrame</a></li></ul></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/frame.ts#L10">lib/frame.ts:10</a></li></ul></aside>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/frame.ts#L10">lib/frame.ts:10</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand Down Expand Up @@ -63,14 +63,14 @@ <h5><span class="tsd-kind-parameter">leds</span>: <a href="Led.html" class="tsd-
</div></li></ul></div>
<h4 class="tsd-returns-title">Returns <a href="Frame.html" class="tsd-signature-type tsd-kind-class">Frame</a></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/frame.ts#L19">lib/frame.ts:19</a></li></ul></aside></li></ul></section></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/frame.ts#L19">lib/frame.ts:19</a></li></ul></aside></li></ul></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Properties</h2>
<section class="tsd-panel tsd-member"><a id="leds" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>leds</span><a href="#leds" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">leds</span><span class="tsd-signature-symbol">:</span> <a href="Led.html" class="tsd-signature-type tsd-kind-class">Led</a><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/frame.ts#L11">lib/frame.ts:11</a></li></ul></aside></section></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/frame.ts#L11">lib/frame.ts:11</a></li></ul></aside></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Methods</h2>
<section class="tsd-panel tsd-member"><a id="getNLeds" class="tsd-anchor"></a>
Expand All @@ -82,7 +82,7 @@ <h3 class="tsd-anchor-link"><span>getNLeds</span><a href="#getNLeds" aria-label=
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/frame.ts#L44">lib/frame.ts:44</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/frame.ts#L44">lib/frame.ts:44</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member"><a id="toOctet" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>to<wbr/>Octet</span><a href="#toOctet" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures">
Expand All @@ -92,7 +92,7 @@ <h3 class="tsd-anchor-link"><span>to<wbr/>Octet</span><a href="#toOctet" aria-la
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Uint8Array</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/91b0b3b/src/lib/frame.ts#L28">lib/frame.ts:28</a></li></ul></aside></li></ul></section></section></div>
<li>Defined in <a href="https://github.com/foomoon/xled-js/blob/612d9f9/src/lib/frame.ts#L28">lib/frame.ts:28</a></li></ul></aside></li></ul></section></section></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
Loading

0 comments on commit d87946c

Please sign in to comment.