Skip to main content

TextFormat

Enum TextFormat 

Source
#[non_exhaustive]
pub enum TextFormat { Utf8, PangoMarkup, Srt, WebVtt, Ssa, Ttml, Teletext, }
Expand description

Format of a Caps::Text stream. Generalizes “subtitles”: a Text link carries any timed-or-untimed text payload (a subtitle cue, a caption, a transcription, an OCR result, an overlay string), the format naming the on-the-wire syntax. “Subtitle” is not a separate media kind here, just timed Text frames (timing rides on FrameTiming), so one variant serves overlay, captioning, and analytics text alike. A parser converts a structured format (Srt / WebVtt / Ssa / Ttml) to the plain Utf8 cues a renderer or consumer wants, like a codec decode for text.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Utf8

Plain UTF-8 text, no markup. The decoded/common-denominator form a subtitle parser emits and an overlay or sink consumes.

§

PangoMarkup

UTF-8 with Pango inline markup (<b>, <i>, <span>…), the styled text an overlay renderer draws directly (GStreamer pango-markup).

§

Srt

SubRip (.srt): blank-line-separated cues, each an index, a HH:MM:SS,mmm --> HH:MM:SS,mmm time range, then the text lines.

§

WebVtt

WebVTT (.vtt, RFC 8538): a WEBVTT header then start --> end cues with .-millisecond timestamps; the HTML5 / HLS subtitle format.

§

Ssa

SubStation Alpha / Advanced SSA (.ssa / .ass): a sectioned INI-like script with styled Dialogue: events. The fansub / Matroska text format.

§

Ttml

Timed Text Markup Language (W3C TTML / SMPTE-TT / EBU-TT, also DFXP): an XML timed-text document. The broadcast / DASH caption format.

§

Teletext

EBU teletext (ETSI EN 300 706) as a DVB private PES carries it (EN 300 472): a data_identifier byte then fixed-size data units, each one teletext line with a framing code, a hamming 8/4 magazine / packet address, and 40 odd-parity bytes. Not readable text yet: a teletext decoder assembles the addressed page’s rows and emits Self::Utf8 cues, the way a subtitle parser converts Self::Srt.

Trait Implementations§

Source§

impl Clone for TextFormat

Source§

fn clone(&self) -> TextFormat

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TextFormat

Source§

impl Debug for TextFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TextFormat

Source§

impl Hash for TextFormat

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TextFormat

Source§

fn eq(&self, other: &TextFormat) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TextFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ElementBound for T
where T: Send,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.