chore(i18n): finish translating code comments and scripts to English
CI / Format and clippy (push) Successful in 1m57s
CI / Dependency audit (push) Successful in 13s
CI / Check desktop app (Linux) (push) Successful in 3m54s
CI / Tests (Linux) (push) Failing after 7m25s
Release / Create release (push) Successful in 6s
Release / CLI (linux-aarch64) (push) Successful in 1m48s
Release / CLI (linux-x86_64) (push) Successful in 2m39s
Release / Desktop app (linux-aarch64) (push) Successful in 10m9s
Release / Desktop app (linux-x86_64) (push) Successful in 12m20s
Release / Desktop app (windows) (push) Successful in 7m32s
Release / Build latest.json (push) Successful in 5s
CI / Format and clippy (push) Successful in 1m57s
CI / Dependency audit (push) Successful in 13s
CI / Check desktop app (Linux) (push) Successful in 3m54s
CI / Tests (Linux) (push) Failing after 7m25s
Release / Create release (push) Successful in 6s
Release / CLI (linux-aarch64) (push) Successful in 1m48s
Release / CLI (linux-x86_64) (push) Successful in 2m39s
Release / Desktop app (linux-aarch64) (push) Successful in 10m9s
Release / Desktop app (linux-x86_64) (push) Successful in 12m20s
Release / Desktop app (windows) (push) Successful in 7m32s
Release / Build latest.json (push) Successful in 5s
Completes the English-only standardization for code, comments, scripts and CI templates (UI/CLI-facing strings stay bilingual pt-BR/en, untouched). Covers the remaining crates/, apps/gui/ui/ and apps/gui/src-tauri/ comments, .gitea/ workflow and template comments, .githooks/ hooks, and the scripts/ source comments for the files already renamed in a prior commit (check.sh, generate-logo.py, install-hooks.sh). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
This commit is contained in:
1 parent
da212e6926
commit
6328220c60
129 files changed
+1961
-1834
No files matched your search
@@ -1,4 +1,4 @@
|
||||
//! Reconstrução do moov de MP4 H.264: arquivos sintéticos e, se existir, um vídeo real.
|
||||
//! H.264 MP4 `moov` reconstruction: synthetic B-frame streams and optional real video test.
|
||||
|
||||
use guara_core::mp4rebuild;
|
||||
use guara_core::source::MemSource;
|
||||
@@ -44,7 +44,7 @@ fn hex(s: &str) -> Vec<u8> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Cabeçalho de fatia H.264 conforme o SPS acima (log2_max_frame_num e log2_max_poc_lsb lidos do SPS).
|
||||
/// Builds an H.264 slice header matching `SPS` above (`log2_max_frame_num = 4`, `log2_max_poc_lsb = 4`).
|
||||
fn slice(
|
||||
idr: bool,
|
||||
frame_num: u32,
|
||||
@@ -78,7 +78,7 @@ fn nal(out: &mut Vec<u8>, n: &[u8]) {
|
||||
out.extend_from_slice(n);
|
||||
}
|
||||
|
||||
/// Monta um MP4 sem moov: ftyp, free, mdat. Devolve (arquivo, tamanhos esperados, sincronos, ordem de exibição).
|
||||
/// Builds a headerless MP4 (`ftyp` + `free` + `mdat`). Returns `(bytes, sample_sizes, sync_sample_nums, display_order_pocs)`.
|
||||
fn synthetic(gops: usize) -> (Vec<u8>, Vec<usize>, Vec<bool>) {
|
||||
synthetic_opt(gops, true)
|
||||
}
|
||||
@@ -90,7 +90,7 @@ fn synthetic_opt(gops: usize, inband: bool) -> (Vec<u8>, Vec<usize>, Vec<bool>)
|
||||
let mut mdat = vec![];
|
||||
let mut sizes = vec![];
|
||||
let mut sync = vec![];
|
||||
// GOP: I P B B P B B (ordem de decodificação) com POC de exibição 0 6 2 4 12 8 10 (em unidades de 2)
|
||||
// GOP in decode order: `I P B B P B B` with display POCs `0, 6, 2, 4, 12, 8, 10`
|
||||
let pocs = [0u32, 6, 2, 4, 12, 8, 10];
|
||||
let mut frame_num = 0;
|
||||
for g in 0..gops {
|
||||
@@ -144,7 +144,7 @@ fn assemble(file: &[u8], r: &mp4rebuild::Rebuilt) -> Vec<u8> {
|
||||
fn rebuilds_synthetic_stream_with_b_frames_and_garbage_tail() {
|
||||
let (mut file, sizes, sync) = synthetic(6);
|
||||
let real_len = file.len();
|
||||
// Lixo depois do fim real (outro arquivo no disco) e tamanho do mdat declarado como "até o fim".
|
||||
// Append non-NAL garbage and set `mdat` size to `0` (extends to EOF) to test stream end detection.
|
||||
file.extend((0..20_000u32).map(|i| (i.wrapping_mul(2654435761) >> 11) as u8 | 0x80));
|
||||
let n = file.len() as u32 - 32;
|
||||
file[32..36].copy_from_slice(&n.to_be_bytes());
|
||||
@@ -168,7 +168,7 @@ fn rebuilds_synthetic_stream_with_b_frames_and_garbage_tail() {
|
||||
assert_eq!(s.bytes.len(), sizes[i], "tamanho da amostra {}", i + 1);
|
||||
assert_eq!(s.is_sync, sync[i], "sincronia da amostra {}", i + 1);
|
||||
}
|
||||
// Ordem de exibição: pts = dts + deslocamento deve crescer na ordem do POC.
|
||||
// Composition timestamps (`pts = dts + ctts_offset`) must follow the expected POC display order.
|
||||
let mut pts: Vec<(i64, usize)> = vec![];
|
||||
for i in 0..sizes.len() {
|
||||
let s = mp4.read_sample(track_id, i as u32 + 1).unwrap().unwrap();
|
||||
@@ -193,7 +193,7 @@ fn rebuilds_real_h264_file_like_the_original_index() {
|
||||
return;
|
||||
};
|
||||
let orig = std::fs::read(&path).unwrap();
|
||||
// Corta o moov original.
|
||||
// Strip the original `moov` atom.
|
||||
let mut p = 0usize;
|
||||
let mut cut = orig.len();
|
||||
while p + 8 <= orig.len() {
|
||||
@@ -229,7 +229,7 @@ fn rebuilds_real_h264_file_like_the_original_index() {
|
||||
|
||||
#[test]
|
||||
fn rebuilds_real_video_with_interleaved_audio() {
|
||||
// GUARA_MP4_BIG: vídeo real com áudio; o teste corta o moov e os primeiros 40 MB do mdat bastam.
|
||||
// Optional real-video test (`GUARA_MP4_BIG`): strips `moov` and truncates `mdat` to the first 40 MB.
|
||||
let Ok(path) = std::env::var("GUARA_MP4_BIG") else {
|
||||
return;
|
||||
};
|
||||
@@ -238,7 +238,7 @@ fn rebuilds_real_video_with_interleaved_audio() {
|
||||
let total = f.metadata().unwrap().len();
|
||||
let mut head = vec![0u8; 1 << 20];
|
||||
f.read_exact(&mut head).unwrap();
|
||||
// átomos no começo
|
||||
// locate leading `ftyp` and `mdat` atoms
|
||||
let mut p = 0usize;
|
||||
let (mut ftyp_end, mut mdat_at) = (0usize, None);
|
||||
while p + 8 <= head.len() {
|
||||
@@ -260,7 +260,7 @@ fn rebuilds_real_video_with_interleaved_audio() {
|
||||
eprintln!("SKIP: mdat fora do primeiro MiB (moov no começo é grande)");
|
||||
return;
|
||||
};
|
||||
// Reexecuta com a leitura completa do começo para montar: ftyp + mdat (40 MB).
|
||||
// Re-read the leading `ftyp` + first 40 MB of `mdat` into a truncated test buffer.
|
||||
use std::io::Seek;
|
||||
let mut f = std::fs::File::open(&path).unwrap();
|
||||
f.seek(std::io::SeekFrom::Start(mp as u64)).unwrap();
|
||||
@@ -268,9 +268,9 @@ fn rebuilds_real_video_with_interleaved_audio() {
|
||||
f.read_exact(&mut mdat).unwrap();
|
||||
let mut file = head[..ftyp_end].to_vec();
|
||||
file.extend_from_slice(&mdat);
|
||||
// O tamanho do mdat declarado vai muito além dos 40 MB que temos (arquivo cortado).
|
||||
// The original `mdat` header declares the full multi-hundred-MB length (simulating an interrupted recording).
|
||||
let src = MemSource(file.clone());
|
||||
// Sem SPS/PPS no mdat, é preciso um vídeo de referência da mesma câmera (aqui, o próprio original).
|
||||
// When SPS/PPS are not repeated in `mdat`, extract donor codec parameters from a reference video.
|
||||
let cfg = mp4rebuild::config_from_mp4(&MemSource(head.clone()), 0, head.len() as u64)
|
||||
.expect("avcC do original");
|
||||
assert!(
|
||||
@@ -282,7 +282,7 @@ fn rebuilds_real_video_with_interleaved_audio() {
|
||||
let osize = out.len() as u64;
|
||||
let mut b = mp4::Mp4Reader::read_header(std::io::Cursor::new(out), osize).unwrap();
|
||||
let tb = *b.tracks().keys().next().unwrap();
|
||||
// Original (índice completo) para comparar as primeiras amostras.
|
||||
// Parse the original intact MP4 sample table to verify the first 100 reconstructed frames.
|
||||
let f = std::fs::File::open(&path).unwrap();
|
||||
let mut a = mp4::Mp4Reader::read_header(std::io::BufReader::new(f), total).unwrap();
|
||||
let vid = a
|
||||
@@ -321,7 +321,7 @@ mod common;
|
||||
fn deep_scan_rebuilds_a_video_without_moov_using_a_neighbour_as_reference() {
|
||||
use guara_core::{ScanMode, ScanOptions};
|
||||
common::init();
|
||||
// Arquivo íntegro (com moov) da "mesma câmera" e um segundo que perdeu o moov e não traz SPS/PPS.
|
||||
// Disk image containing an intact donor MP4 (with `moov`) plus a truncated MP4 without inline SPS/PPS.
|
||||
let (good_raw, _, _) = synthetic_opt(8, true);
|
||||
let r =
|
||||
mp4rebuild::rebuild(&MemSource(good_raw.clone()), 0, good_raw.len() as u64, &[]).unwrap();
|
||||
|
||||
Reference in new issue
Block a user