forked from forks/ffprobe-wasm
Add stream metadata tags. (#17)
This commit is contained in:
@@ -18,19 +18,22 @@ onmessage = (e) => {
|
||||
// Remap streams into collection.
|
||||
const s = [];
|
||||
for (let i = 0; i < info.streams.size(); i++) {
|
||||
s.push(info.streams.get(i));
|
||||
const tags = {};
|
||||
for (let j = 0; j < info.streams.get(i).tags.size(); j++) {
|
||||
const t = info.streams.get(i).tags.get(j);
|
||||
tags[t.key] = t.value;
|
||||
}
|
||||
s.push({...info.streams.get(i), ...{ tags}});
|
||||
}
|
||||
|
||||
// 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);
|
||||
const tags = {};
|
||||
for (let j = 0; j < info.chapters.get(i).tags.size(); j++) {
|
||||
const t = info.chapters.get(i).tags.get(j);
|
||||
tags[t.key] = t.value;
|
||||
}
|
||||
c.push({...info.chapters.get(i), ...{tags}});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,42 @@
|
||||
<b-table stacked :items="items"></b-table>
|
||||
|
||||
<h4>Streams</h4>
|
||||
<b-table striped hover :items="info.streams"></b-table>
|
||||
<b-table striped hover :items="info.streams" :fields="stream_fields">
|
||||
<template #cell(show_details)="row">
|
||||
<b-button size="sm" @click="row.toggleDetails" class="mr-2">
|
||||
{{ row.detailsShowing ? 'Hide' : 'Show'}}
|
||||
</b-button>
|
||||
</template>
|
||||
<template #row-details="row">
|
||||
<b-card>
|
||||
<div v-for="(value, key) in row.item.tags" :key="key">
|
||||
<b-row class="mb-2">
|
||||
<b-col sm="3" class="text-sm-right"><b>{{ key }}:</b></b-col>
|
||||
<b-col>{{ value }}</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</b-card>
|
||||
</template>
|
||||
</b-table>
|
||||
|
||||
<div v-show="info.chapters.length > 0">
|
||||
<h4>Chapters</h4>
|
||||
<b-table striped hover :items="info.chapters">
|
||||
<template #cell(tags)="data">
|
||||
<b-table-lite small stacked outlined :items="data.item.tags"></b-table-lite>
|
||||
</template>
|
||||
<b-table striped hover :items="info.chapters" :fields="chapter_fields">
|
||||
<template #cell(show_details)="row">
|
||||
<b-button size="sm" @click="row.toggleDetails" class="mr-2">
|
||||
{{ row.detailsShowing ? 'Hide' : 'Show'}}
|
||||
</b-button>
|
||||
</template>
|
||||
<template #row-details="row">
|
||||
<b-card>
|
||||
<div v-for="(value, key) in row.item.tags" :key="key">
|
||||
<b-row class="mb-2">
|
||||
<b-col sm="3" class="text-sm-right"><b>{{ key }}:</b></b-col>
|
||||
<b-col>{{ value }}</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</b-card>
|
||||
</template>
|
||||
</b-table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,6 +52,28 @@
|
||||
export default {
|
||||
name: 'Overview',
|
||||
props: ['info'],
|
||||
data() {
|
||||
return {
|
||||
stream_fields: [
|
||||
'id',
|
||||
'start_time',
|
||||
'duration',
|
||||
'codec_type',
|
||||
'codec_name',
|
||||
'format',
|
||||
'bit_rate',
|
||||
'profile',
|
||||
'level',
|
||||
'width',
|
||||
'height',
|
||||
'channels',
|
||||
'sample_rate',
|
||||
'frame_size',
|
||||
{ key: 'show_details', label: 'Tags' },
|
||||
],
|
||||
chapter_fields: ['id', 'time_base', 'start', 'end', { key: 'show_details', label: 'Tags' }],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
items() {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user