You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: adds a progress/cancel feature to Context for the c2pa-rs sdk (#1927)
* Progress callback API and cancellation
Progress API: Replace OperationPhase with ProgressPhase (#[repr(u8)]), and ProgressCallback trait with ProgressCallbackFunc (Fn(ProgressPhase, f32) -> bool). Progress is reported as f32 0.0–1.0 instead of u8 0–100.
Cancellation: Add cancel() and is_cancelled() on Context; remove Arc<AtomicBool> cancellation token. Add Error::OperationCancelled.
C FFI: Add c2pa_context_builder_set_progress_callback(builder, user_data, callback) and c2pa_context_cancel(ctx). Remove C2paCancellationToken and related APIs.
Coverage: Add check_progress in builder (save_to_stream), store, and claim so callbacks run during signing, embedding, and verification.
Tests: Add unit tests for progress/cancel in context.rs and integration tests in builder.rs.
Docs: Add docs/pro
* feat: api update
Replaced f32 pct with (u32 step, u32 total) in the callback type
Renamed/replaced phases: Ingredients/Verification/RemoteFetch → Reading, VerifyingManifest, VerifyingSignature, VerifyingIngredient, VerifyingAssetHash, FetchingRemoteManifest (keeping Thumbnail, Hashing, Signing, Embedding)
added builder_sample.rs — Updated to demonstrate the new API with per-phase elapsed timing output and assertions against the new phase names
Added more instrumentation for phases.
* add ProgressPhase::Writing
* Updates progress/cancel documentation and adds unit tests
* Add granular progress callbacks to hashing and verification paths
Introduce hash_stream_by_alg_with_progress (pub(crate)) in hash_utils.rs; make hash_stream_by_alg a thin wrapper. Callbacks fire per HashRange.
Add _with_progress variants to DataHash, BmffHash, and BoxHash for both signing (gen_hash) and verification (verify_stream_hash); public functions become thin wrappers passing None.
Wire progress callbacks through builder.rs, store.rs, and claim.rs using context.check_progress(ProgressPhase::VerifyingAssetHash / Hashing, step, total).
Add FetchingOCSP and FetchingTimestamp phases to ProgressPhase; fire FetchingOCSP per OCSP responder in ocsp/fetch.rs.
* adds progress.rs example
This can work with any file and supports both reading (with one param, and signing/embedding.
* chore: review feedback, fix ordering on cancel
remove changes to builder_sample<
remove test_input.jpg cruft
* Update docs/progress_callbacks.md
0 commit comments