Skip to main content

SubtitleTrack

Struct SubtitleTrack 

Source
pub struct SubtitleTrack {
    pub index: i32,
    pub url: String,
    pub language: Option<String>,
    pub label: Option<String>,
    pub mime_type: String,
}
Expand description

Represents a subtitle track

๐Ÿ”ด Do not add #[serde(rename_all = "camelCase")] here. This is the one struct in the player that deliberately keeps snake_case on the wire, because the same serialization feeds two consumers that both spell mime_type:

  • the JNI boundary โ€” player/android/mod.rs serializes MediaItem::subtitles with serde_json and hands the string to JellyTauPlayer.loadWithMetadata, whose parser reads url, language, label and optString("mime_type");
  • the IPC boundary โ€” PlayItemRequest::subtitles deserializes this same type from the frontend, and the generated binding (SubtitleTrack in bindings.ts) therefore also declares mime_type.

Renaming would not break the build and would not fail the IPC: Kotlinโ€™s optString would just fall back to its default MIME type for every track, so the failure would be silent. UT-146 asserts the serialized keys.

TRACES: UR-020 | IR-016, JA-008 | UT-146

Fieldsยง

ยงindex: i32

Stream index in the media source

ยงurl: String

Subtitle URL

ยงlanguage: Option<String>

Language code (e.g., โ€œengโ€, โ€œspaโ€)

ยงlabel: Option<String>

Display title

ยงmime_type: String

MIME type (e.g., โ€œtext/vttโ€, โ€œapplication/x-subripโ€). Snake_case on purpose โ€” see the note on the struct.

Trait Implementationsยง

Sourceยง

impl Clone for SubtitleTrack

Sourceยง

fn clone(&self) -> SubtitleTrack

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 Debug for SubtitleTrack

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl<'de> Deserialize<'de> for SubtitleTrack

Sourceยง

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Sourceยง

impl NamedType for SubtitleTrack

Sourceยง

fn sid() -> SpectaID

Sourceยง

fn named_data_type( type_map: &mut TypeCollection, generics: &[DataType], ) -> NamedDataType

this is equivalent to [Type::inline] but returns a [NamedDataType] instead.
Sourceยง

fn definition_named_data_type(type_map: &mut TypeCollection) -> NamedDataType

this is equivalent to [Type::definition] but returns a [NamedDataType] instead.
Sourceยง

impl PartialEq for SubtitleTrack

Sourceยง

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) ยท Sourceยง

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl Serialize for SubtitleTrack

Sourceยง

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Sourceยง

impl Type for SubtitleTrack

Sourceยง

fn inline(type_map: &mut TypeCollection, generics: Generics<'_>) -> DataType

Returns the definition of a type using the provided generics. Read more
Sourceยง

fn reference(type_map: &mut TypeCollection, generics: &[DataType]) -> Reference

Generates a datatype corresponding to a reference to this type, as determined by its category. Getting a reference to a type implies that it should belong in the type map (since it has to be referenced from somewhere), so the output of definition will be put into the type map.
Sourceยง

impl Flatten for SubtitleTrack

Sourceยง

impl StructuralPartialEq for SubtitleTrack

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
ยง

impl<'de, D, R> CommandArg<'de, R> for D
where D: Deserialize<'de>, R: Runtime,

ยง

fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>

Derives an instance of Self from the [CommandItem]. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

ยง

impl<T> FunctionArg for T
where T: Type,

ยง

fn to_datatype(type_map: &mut TypeCollection) -> Option<DataType>

Gets the type of an argument as a [DataType]. Read more
ยง

impl<T> Instrument for T

ยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
ยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

ยง

impl<T> IpcResponse for T
where T: Serialize,

ยง

fn body(self) -> Result<InvokeResponseBody, Error>

Resolve the IPC response body.
ยง

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

ยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
ยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
ยง

impl<T> ScopeObject for T
where T: Send + Sync + Debug + DeserializeOwned + 'static,

ยง

type Error = Error

The error type.
ยง

fn deserialize<R>( _app: &AppHandle<R>, raw: Value, ) -> Result<T, <T as ScopeObject>::Error>
where R: Runtime,

Deserialize the raw scope value.
Sourceยง

impl<T> Serialize for T
where T: Serialize + ?Sized,

Sourceยง

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Sourceยง

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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 = Infallible

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.
ยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

ยง

fn vzip(self) -> V

ยง

impl<T> WithSubscriber for T

ยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
ยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Sourceยง

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

ยง

impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,