Skip to main content

Crate c2pa_vtt

Crate c2pa_vtt 

Source
Expand description

C2PA manifest embedding and hard binding for WebVTT subtitle and caption files.

WebVTT is a structured text format, so a C2PA Manifest Store is associated with it using the fixed ASCII armour delimiters (-----BEGIN C2PA MANIFEST----- / -----END C2PA MANIFEST-----) inside a single-line NOTE comment placed immediately after the WEBVTT signature, as specified by the C2PA structured text embedding section. Placement after the signature (rather than at the start of the file) is what makes this WebVTT-specific: the WEBVTT line is a reserved header that must come first.

WEBVTT

NOTE -----BEGIN C2PA MANIFEST----- https://example.com/m.c2pa -----END C2PA MANIFEST-----

00:00:00.000 --> 00:00:05.000
Hello world

§Scope relative to c2pa-structured-text

c2pa-structured-text implements the general structured text embedding method and lists WebVTT as one comment style. This crate is the canonical WebVTT implementation: the general method’s “prepend a comment line” rule would place the block before the WEBVTT signature and produce an invalid file, and the hard binding needs WebVTT-aware placement. c2pa-structured-text documents the WebVTT delimiter but defers correct placement and hard binding here.

§Hard binding

See binding for the byte-exact c2pa.hash.data data hash and the single exclusion range covering the manifest block.

§Validation

See bridge for extracting the manifest store and delegating signature/trust/assertion validation to the official C2PA SDK.

§Features

Re-exports§

pub use binding::data_hash_exclusion;
pub use binding::Exclusion;
pub use binding::HashAlg;
pub use bridge::extract_manifest_source;
pub use bridge::ManifestSource;
pub use binding::compute_data_hash;
pub use binding::verify_data_hash;

Modules§

binding
Hard binding for WebVTT: the c2pa.hash.data data hash.
bridge
Validation bridge to the official C2PA SDK (c2pa-rs).

Structs§

ExtractionResult
A located manifest NOTE block.

Enums§

Error
Errors returned when embedding, extracting, or hard-binding a manifest.
ManifestRef
A manifest to associate with a WebVTT file.

Functions§

embed_manifest
Embed a manifest reference as a single-line NOTE block placed immediately after the WEBVTT signature line, separated from adjacent blocks by blank lines as WebVTT requires.
extract_manifest
Locate the C2PA manifest NOTE block in a WebVTT file.
remove_manifest
Remove the manifest NOTE block from a WebVTT file, returning the file with that block’s byte range spliced out.