forked from forks/ffprobe-wasm
feature: add support for displaying chapters (#15)
* feat: add initial code for reading chapters * feat: add more fields for supporting chapters and chapter tags.
This commit is contained in:
@@ -21,6 +21,19 @@ onmessage = (e) => {
|
||||
s.push(info.streams.get(i));
|
||||
}
|
||||
|
||||
// Remap chapters into collection.
|
||||
const c = [];
|
||||
for (let i = 0; i < info.chapters.size(); i++) {
|
||||
const t = info.chapters.get(i).tags.get(0);
|
||||
|
||||
// Remap tags too.
|
||||
const tags = [];
|
||||
const obj = {};
|
||||
obj[t.key] = t.value;
|
||||
tags.push(obj);
|
||||
c.push({...info.chapters.get(i), ...{tags}});
|
||||
}
|
||||
|
||||
const versions = {
|
||||
libavutil: Module.avutil_version(),
|
||||
libavcodec: Module.avcodec_version(),
|
||||
@@ -31,6 +44,7 @@ onmessage = (e) => {
|
||||
data = {
|
||||
...info,
|
||||
streams: s,
|
||||
chapters: c,
|
||||
versions,
|
||||
}
|
||||
postMessage(data);
|
||||
|
||||
Reference in New Issue
Block a user