Skip to content

Commit 9ad6574

Browse files
committed
Merge branch 'release/2024.3.0'
2 parents 12c91b7 + ef73b04 commit 9ad6574

File tree

12 files changed

+944
-699
lines changed

12 files changed

+944
-699
lines changed

CHANGES.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@
1111

1212
## develop
1313

14+
## 2024.3.0
15+
16+
- [CHANGE] `Encode::encode()``writer: &mut W` ではなく `writer: W` を引数に取るように変更する
17+
- @sile
18+
- [CHANGE] `Decode::decode()``reader: &mut R` ではなく `reader: R` を引数に取るように変更する
19+
- @sile
20+
- [ADD] デコード時にペイロードデータを保持しない `IgnoredBox` を追加する
21+
- @sile
22+
- [ADD] `SampleTableAccessor::get_sample_by_timestamp()` を追加する
23+
- @sile
24+
- [ADD] `SampleAccessor::timestamp()` を追加する
25+
- @sile
26+
- [ADD] `SampleAccessor::sync_sample()` を追加する
27+
- @sile
28+
- [CHANGE] `SampleTableAccessor::new()` で stco ボックスと stsc ボックスの不整合をチェックするようにする
29+
- @sile
30+
- [UPDATE] `SampleTableAccessor` が borrowed / owned の両方に対応できるようにする
31+
- @sile
32+
- [UPDATE] 共通関数でエラーが発生した場合のファイル名・行番号表示を改善する
33+
- 今までは共通関数のエラー位置が `Error` に含まれていたが、それでは情報量が少ないので、その一つ上の呼び出し元の位置を使うように変更した
34+
- @sile
35+
1436
## 2024.2.0
1537

1638
- [ADD] WebCodecs を使ってローカルで MP4 ファイルを変換するサンプルを追加する

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "shiguredo_mp4"
3-
version = "2024.2.0"
3+
version = "2024.3.0"
44
edition = "2021"
55
authors = ["Shiguredo Inc."]
66
license = "Apache-2.0"

examples/dump_wasm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl BoxInfo {
2828
pub fn dump(bytes: *const u8, bytes_len: i32) -> *mut Vec<u8> {
2929
let bytes = unsafe { std::slice::from_raw_parts(bytes, bytes_len as usize) };
3030

31-
let json = Mp4File::<RootBox>::decode(&mut &bytes[..])
31+
let json = Mp4File::<RootBox>::decode(bytes)
3232
.map_err(|e| e.to_string())
3333
.and_then(|mp4| {
3434
let infos = mp4.iter().map(BoxInfo::new).collect::<Vec<_>>();

examples/transcode_wasm/index.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,11 @@ <h1>MP4 Transcode</h1>
2727
<li>H.265 で変換する場合には Safari TP か H.265 機能を有効にした Chrome Canary を使う必要があります</li>
2828
</ul>
2929
<li>`edts` などのトラックの再生位置調整用のボックスは考慮していないため、変換後にリップシンクがズレる可能性があります</li>
30-
<li>入力および出力 MP4 は全てメモリ上で保持して処理されるため、GB 単位のファイルではメモリが足りなくなる可能性があります</li>
30+
<li>入力および出力 MP4 は全てメモリ上で保持して処理されるため、数百 MB 単位のファイルでは WebAssembly 内のメモリ(最大 4 GB)が足りなくなる可能性があります</li>
3131
<li>出力 MP4 では、再生に必須ではないメタデータ(作成日時など)には固定値が使用されます</li>
3232
</ul>
3333
</small>
3434

35-
<h3>入力 MP4 ファイル</h3>
36-
<b><font color="red">ファイルを選択すると変換が開始されます。</font></b>
37-
<br />
38-
変換が完了したら<b>出力 MP4 ファイル</b>のリンクが有効になります。
39-
<br /><br />
40-
<input id="input" type="file" accept="video/mp4" onclick="event.target.value = ''" onchange="startTranscode()" />
41-
<br />
42-
43-
<h3>出力 MP4 ファイル</h3>
44-
<a id="output" href="" download="output.mp4" class="disabled-link">ダウンロードリンク</a>
45-
<br />
46-
4735
<h3>変換設定</h3>
4836
コーデック:
4937
<select id="codec">
@@ -71,6 +59,18 @@ <h3>変換設定</h3>
7159
</select>
7260
<br />
7361

62+
<h3>入力 MP4 ファイル</h3>
63+
<b><font color="red">ファイルを選択すると変換が開始されます。</font></b>
64+
<br />
65+
変換が完了したら<b>出力 MP4 ファイル</b>のリンクが有効になります。
66+
<br /><br />
67+
<input id="input" type="file" accept="video/mp4" onclick="event.target.value = ''" onchange="startTranscode()" />
68+
<br />
69+
70+
<h3>出力 MP4 ファイル</h3>
71+
<a id="output" href="" download="output.mp4" class="disabled-link">ダウンロードリンク</a>
72+
<br />
73+
7474
<h3>変換ログ</h3>
7575
<textarea id="log" cols="90" rows="30" style="font-family:monospace, serif;"></textarea>
7676

examples/transcode_wasm/src/mp4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ pub struct InputMp4 {
227227

228228
impl InputMp4 {
229229
pub fn parse(mp4_file_bytes: &[u8]) -> orfail::Result<Self> {
230-
let mp4_file = Mp4File::decode(&mut &mp4_file_bytes[..]).or_fail()?;
230+
let mp4_file = Mp4File::decode(mp4_file_bytes).or_fail()?;
231231
let moov_box = mp4_file
232232
.boxes
233233
.iter()

examples/transcode_wasm/transcode.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ let frameFormat = "RGBA";
2727
},
2828
async createVideoDecoder(resultFuture, configWasmJson) {
2929
const config = wasmJsonToValue(configWasmJson);
30+
const originalDescription = config.description;
3031
config.description = new Uint8Array(config.description);
3132

3233
const coderId = nextCoderId;
@@ -68,6 +69,7 @@ let frameFormat = "RGBA";
6869
};
6970

7071
if (!(await VideoDecoder.isConfigSupported(config)).supported) {
72+
config.description = originalDescription;
7173
let result = {"Err": {"message": "unsupported decoder config: " + JSON.stringify(config)}};
7274
wasmFunctions.notifyCreateVideoDecoderResult(
7375
transcoder, resultFuture, valueToWasmJson(result));

0 commit comments

Comments
 (0)