Fix api docs

This commit is contained in:
Jerome Wu 2023-07-26 22:24:38 +08:00
parent ef6c5d2156
commit 096f5b2358
6 changed files with 103 additions and 82 deletions

View File

@ -1,3 +1,4 @@
import MuiThemeProvider from "@site/src/components/common/MuiThemeProvider";
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
@ -11,38 +12,40 @@ import Paper from '@mui/material/Paper';
As 0.12+ is not backward compatible with 0.11.x, below is a quick mapping
table to transform 0.11.x to 0.12+
<TableContainer>
<Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell align="center">0.11.x</TableCell>
<TableCell align="center">0.12+</TableCell>
<TableCell align="center">Note</TableCell>
</TableRow>
</TableHead>
<TableBody>
{[
{"0.11.x": "import { createFFmpeg } from '@ffmpeg/ffmpeg'", "0.12+": "import { FFmpeg } from '@ffmpeg/ffmpeg'", note: ""},
{"0.11.x": "createFFmpeg()", "0.12+": "new FFmpeg()", note: "argumens of createFFmpeg() is moved to ffmpeg.load()"},
{"0.11.x": "await ffmpeg.load()", "0.12+": "await ffmpeg.load()", note: ""},
{"0.11.x": "await ffmpeg.run(...args)", "0.12+": "await ffmpeg.exec([...args])", note: ""},
{"0.11.x": "ffmpeg.FS.writeFile()", "0.12+": "await ffmpeg.writeFile()", note: ""},
{"0.11.x": "ffmpeg.FS.readFile()", "0.12+": "await ffmpeg.readFile()", note: ""},
{"0.11.x": "ffmpeg.exit()", "0.12+": "await ffmpeg.terminate()", note: ""},
{"0.11.x": "ffmpeg.setLogger()", "0.12+": "ffmpeg.on(\"log\", () => {})", note: ""},
{"0.11.x": "ffmpeg.setProgress()", "0.12+": "ffmpeg.on(\"progress\", () => {})", note: ""},
{"0.11.x": "import { fetchFile } from '@ffmpeg/ffmpeg'", "0.12+": "import { fetchFile } from '@ffmpeg/util'", note: ""},
].map((row) => (
<TableRow
key={row['0.11.x']}
>
<TableCell component="th" scope="row">
{row['0.11.x']}
</TableCell>
<TableCell align="left">{row['0.12+']}</TableCell>
<TableCell align="left">{row.note}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
<MuiThemeProvider>
<TableContainer>
<Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell align="center">0.11.x</TableCell>
<TableCell align="center">0.12+</TableCell>
<TableCell align="center">Note</TableCell>
</TableRow>
</TableHead>
<TableBody>
{[
{"0.11.x": "import { createFFmpeg } from '@ffmpeg/ffmpeg'", "0.12+": "import { FFmpeg } from '@ffmpeg/ffmpeg'", note: ""},
{"0.11.x": "createFFmpeg()", "0.12+": "new FFmpeg()", note: "argumens of createFFmpeg() is moved to ffmpeg.load()"},
{"0.11.x": "await ffmpeg.load()", "0.12+": "await ffmpeg.load()", note: ""},
{"0.11.x": "await ffmpeg.run(...args)", "0.12+": "await ffmpeg.exec([...args])", note: ""},
{"0.11.x": "ffmpeg.FS.writeFile()", "0.12+": "await ffmpeg.writeFile()", note: ""},
{"0.11.x": "ffmpeg.FS.readFile()", "0.12+": "await ffmpeg.readFile()", note: ""},
{"0.11.x": "ffmpeg.exit()", "0.12+": "await ffmpeg.terminate()", note: ""},
{"0.11.x": "ffmpeg.setLogger()", "0.12+": "ffmpeg.on(\"log\", () => {})", note: ""},
{"0.11.x": "ffmpeg.setProgress()", "0.12+": "ffmpeg.on(\"progress\", () => {})", note: ""},
{"0.11.x": "import { fetchFile } from '@ffmpeg/ffmpeg'", "0.12+": "import { fetchFile } from '@ffmpeg/util'", note: ""},
].map((row) => (
<TableRow
key={row['0.11.x']}
>
<TableCell component="th" scope="row">
{row['0.11.x']}
</TableCell>
<TableCell align="left">{row['0.12+']}</TableCell>
<TableCell align="left">{row.note}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</MuiThemeProvider>

View File

@ -1,3 +1,4 @@
import MuiThemeProvider from "@site/src/components/common/MuiThemeProvider";
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
@ -49,44 +50,46 @@ be spawned by `ffmpeg-core` inside `ffmpeg.worker`
ffmpeg.wasm is built with toolchains / libraries:
<TableContainer>
<Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell align="center">Name</TableCell>
<TableCell align="center">Version</TableCell>
<TableCell align="center">Note</TableCell>
</TableRow>
</TableHead>
<TableBody>
{[
{name: "Emscripten", version: "3.1.40", note: ""},
{name: "FFmpeg", version: "n5.1.3", note: ""},
{name: "x264", version: "0.164.x", note: ""},
{name: "x265", version: "3.4", note: ""},
{name: "libvpx", version: "v1.9.0", note: ""},
{name: "lame", version: "3.100", note: ""},
{name: "ogg", version: "v1.3.4", note: ""},
{name: "theora", version: "v1.1.1", note: ""},
{name: "opus", version: "v1.3.1", note: ""},
{name: "vorbis", version: "v1.3.3", note: ""},
{name: "zlib", version: "v1.2.11", note: ""},
{name: "libwebp", version: "v1.1.0", note: ""},
{name: "freetype2", version: "v2.10.4", note: ""},
{name: "fribidi", version: "v1.0.9", note: ""},
{name: "harfbuzz", version: "5.2.0", note: ""},
{name: "libass", version: "0.15.0", note: ""},
].map((row) => (
<TableRow
key={row.name}
>
<TableCell component="th" scope="row">
{row.name}
</TableCell>
<TableCell align="center">{row.version}</TableCell>
<TableCell align="center">{row.note}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
<MuiThemeProvider>
<TableContainer>
<Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell align="center">Name</TableCell>
<TableCell align="center">Version</TableCell>
<TableCell align="center">Note</TableCell>
</TableRow>
</TableHead>
<TableBody>
{[
{name: "Emscripten", version: "3.1.40", note: ""},
{name: "FFmpeg", version: "n5.1.3", note: ""},
{name: "x264", version: "0.164.x", note: ""},
{name: "x265", version: "3.4", note: ""},
{name: "libvpx", version: "v1.9.0", note: ""},
{name: "lame", version: "3.100", note: ""},
{name: "ogg", version: "v1.3.4", note: ""},
{name: "theora", version: "v1.1.1", note: ""},
{name: "opus", version: "v1.3.1", note: ""},
{name: "vorbis", version: "v1.3.3", note: ""},
{name: "zlib", version: "v1.2.11", note: ""},
{name: "libwebp", version: "v1.1.0", note: ""},
{name: "freetype2", version: "v2.10.4", note: ""},
{name: "fribidi", version: "v1.0.9", note: ""},
{name: "harfbuzz", version: "5.2.0", note: ""},
{name: "libass", version: "0.15.0", note: ""},
].map((row) => (
<TableRow
key={row.name}
>
<TableCell component="th" scope="row">
{row.name}
</TableCell>
<TableCell align="left">{row.version}</TableCell>
<TableCell align="left">{row.note}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</MuiThemeProvider>

View File

@ -135,10 +135,27 @@ const config = {
[
"docusaurus-plugin-typedoc",
{
id: "ffmpeg",
entryPoints: ["../../packages/ffmpeg/src/index.ts"],
tsconfig: "../../packages/ffmpeg/tsconfig.json",
readme: "none",
out: "api/ffmpeg",
sidebar: {
indexLabel: "@ffmpeg/ffmpeg",
fullNames: true,
},
},
],
[
"docusaurus-plugin-typedoc",
{
id: "util",
entryPoints: ["../../packages/util/src/index.ts"],
tsconfig: "../../packages/util/tsconfig.json",
readme: "none",
out: "api/util",
sidebar: {
indexLabel: "@ffmpeg/util",
fullNames: true,
},
},

View File

@ -29,7 +29,7 @@ const sidebars = {
{
type: "category",
label: "API",
items: ["api/classes/FFmpeg"],
items: ["api/ffmpeg/index", "api/util/index"],
},
{
type: "category",

View File

@ -109,9 +109,6 @@ export class FFmpeg {
* })
* ```
*
* @remarks
* log includes output to stdout and stderr.
*
* @example
* ```ts
* ffmpeg.on("progress", ({ progress, time }) => {
@ -120,7 +117,8 @@ export class FFmpeg {
* ```
*
* @remarks
* The progress events are accurate only when the length of
* - log includes output to stdout and stderr.
* - The progress events are accurate only when the length of
* input and output video/audio file are the same.
*
* @category FFmpeg

View File

@ -5,7 +5,7 @@ import {
import { HeaderContentLength } from "./const.js";
import { ProgressCallback } from "./types.js";
export const readFromBlobOrFile = (blob: Blob | File): Promise<Uint8Array> =>
const readFromBlobOrFile = (blob: Blob | File): Promise<Uint8Array> =>
new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.onload = () => {