GIF: parse terminator
This commit is contained in:
parent
e0a2a3287b
commit
40c7091386
|
@ -43,6 +43,8 @@ const types = [
|
||||||
"unknownExtensionBlock",
|
"unknownExtensionBlock",
|
||||||
"unknownExtensionBlockLabel",
|
"unknownExtensionBlockLabel",
|
||||||
"unknownExtensionBlockData",
|
"unknownExtensionBlockData",
|
||||||
|
|
||||||
|
"gifTerminator",
|
||||||
].reduce((result, id) => {
|
].reduce((result, id) => {
|
||||||
result[id] = id;
|
result[id] = id;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -298,6 +298,15 @@ const NODE_UI_FNS = {
|
||||||
title: "Unknown Extension Block Data",
|
title: "Unknown Extension Block Data",
|
||||||
description: p("TODO"),
|
description: p("TODO"),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
// Terminator
|
||||||
|
|
||||||
|
[GifNodeType.gifTerminator]: () => ({
|
||||||
|
title: "GIF Terminator",
|
||||||
|
description: p(
|
||||||
|
"The terminator is a one-byte block indicating the end of our GIF. We're done!",
|
||||||
|
),
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -315,6 +315,10 @@ export default (bytes) => {
|
||||||
readerFn = readExtensionBlock;
|
readerFn = readExtensionBlock;
|
||||||
break;
|
break;
|
||||||
case BLOCK_TYPE_TRAILER:
|
case BLOCK_TYPE_TRAILER:
|
||||||
|
children.push({
|
||||||
|
type: GifNodeType.gifTerminator,
|
||||||
|
bytes: bytes.subarray(offset, offset + 1),
|
||||||
|
});
|
||||||
break readingBlocks;
|
break readingBlocks;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown GIF block type: ${blockType}`);
|
throw new Error(`Unknown GIF block type: ${blockType}`);
|
||||||
|
|
Loading…
Reference in New Issue