Skip to content

Commit

Permalink
docs: 优化注释
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohappy committed Jan 22, 2025
1 parent ace2c55 commit 4fadd59
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ libmedia 支持多线程,但需要页面可以使用 SharedArrayBuffer,你
| G.711 A-law ||||||
| G.711 μ-law ||||||

> x265 wasm 编码器比较特殊,无法在非多线程环境下运行
### 相关文章

Expand Down
2 changes: 2 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ Codecs are compiled into separate wasm modules, the decoders are in the ```dist/
| G.711 A-law ||||||
| G.711 μ-law ||||||

> X265 wasm encoder is special and cannot run in a non-multi-threaded environment
### License

libmedia uses the LGPL open source license. You need to comply with the license requirements. For details, see [LGPL](https://github.com/zhaohappy/libmedia/blob/master/COPYING.LGPLv3)
Expand Down
2 changes: 2 additions & 0 deletions site/docs/guide/wasm.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ Codecs are compiled into separate wasm modules, the decoders are in the ```dist/
| G.711 A-law ||||||
| G.711 μ-law ||||||

> X265 wasm encoder is special and cannot run in a non-multi-threaded environment
## Usage

The decoder is in the project's ```dist/decode``` directory, and the encoder is in the project's ```dist/encode``` directory. The wasm module does not publish an npm package, so it is recommended that you host the wasm file on your own cdn. You can also use some public cdns to access files hosted on github. The following takes ```cdn.jsdelivr.net``` as an example.
Expand Down
2 changes: 2 additions & 0 deletions site/docs/guide/wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ order: 6
| G.711 A-law ||||||
| G.711 μ-law ||||||

> x265 wasm 编码器比较特殊,无法在非多线程环境下运行
## 使用

解码器在项目的 ```dist/decode``` 目录下,编码器在项目的 ```dist/encode``` 目录下。wasm 模块并没有发布 npm 包,建议自己将 wasm 文件托管到自己的 cdn 上。你也可以使用一些公共 cdn 来访问 github 上托管的文件。下面以 ```cdn.jsdelivr.net``` 举例。
Expand Down
26 changes: 20 additions & 6 deletions src/avtranscoder/AVTranscoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ export interface TaskOptions {
webtransport?: WebTransportOptions

/**
* 是否启动 WebCodecs 解码
* 是否启用 WebCodecs 解码
*/
enableWebCodecs?: boolean

/**
* 是否启动硬件解码
* 是否启用硬件解码
*/
enableHardware?: boolean
}
Expand Down Expand Up @@ -205,20 +205,32 @@ export interface TaskOptions {
keyFrameInterval?: number

/**
* 是否启动 WebCodecs 编码
* 是否启用 WebCodecs 编码
*/
enableWebCodecs?: boolean

/**
* 是否启动硬件编码
* 是否启用硬件编码
*/
enableHardware?: boolean

/**
* 配置编码器 profile
*/
profile?: number
/**
* 配置编码器 level
*/
level?: number
/**
* 配置最大 b 帧长度(默认 4)
* 只有 wasm 的 h264/h265 编码器支持
*/
delay?: number
/**
* 编码器的参数设置
* 编码器的参数设置 wasm 编码器生效
*
* 详情参考 ffmpeg 的编码器 options 配置
*/
encoderOptions?: Data
}
Expand Down Expand Up @@ -247,7 +259,9 @@ export interface TaskOptions {
* 输出采样格式
*/
sampleFmt?: keyof (typeof SampleFmtString2SampleFormat)

/**
* 配置编码器 profile
*/
profile?: number
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/avtranscoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,7 @@
enableWebCodecs: enableWebcodecComponent.enableWebCodecs,
enableHardware: enableHardwareComponent.enableHardwareAcceleration,
encoderOptions: {
preset: 'fast',
'cpu-used': 5
preset: 'fast'
}
}
}
Expand Down

0 comments on commit 4fadd59

Please sign in to comment.