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.rsserializesMediaItem::subtitleswithserde_jsonand hands the string toJellyTauPlayer.loadWithMetadata, whose parser readsurl,language,labelandoptString("mime_type"); - the IPC boundary โ
PlayItemRequest::subtitlesdeserializes this same type from the frontend, and the generated binding (SubtitleTrackinbindings.ts) therefore also declaresmime_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: i32Stream index in the media source
url: StringSubtitle URL
language: Option<String>Language code (e.g., โengโ, โspaโ)
label: Option<String>Display title
mime_type: StringMIME 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
impl Clone for SubtitleTrack
Sourceยงfn clone(&self) -> SubtitleTrack
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceยงimpl Debug for SubtitleTrack
impl Debug for SubtitleTrack
Sourceยงimpl<'de> Deserialize<'de> for SubtitleTrack
impl<'de> Deserialize<'de> for SubtitleTrack
Sourceยงfn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
impl NamedType for SubtitleTrack
fn sid() -> SpectaID
Sourceยงfn named_data_type(
type_map: &mut TypeCollection,
generics: &[DataType],
) -> NamedDataType
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
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
impl PartialEq for SubtitleTrack
Sourceยงfn eq(&self, other: &SubtitleTrack) -> bool
fn eq(&self, other: &SubtitleTrack) -> bool
Tests for
self and other values to be equal, and is used by ==.Sourceยงimpl Serialize for SubtitleTrack
impl Serialize for SubtitleTrack
Sourceยงimpl Type for SubtitleTrack
impl Type for SubtitleTrack
Sourceยงfn inline(type_map: &mut TypeCollection, generics: Generics<'_>) -> DataType
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
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.impl Flatten for SubtitleTrack
impl StructuralPartialEq for SubtitleTrack
Auto Trait Implementationsยง
impl Freeze for SubtitleTrack
impl RefUnwindSafe for SubtitleTrack
impl Send for SubtitleTrack
impl Sync for SubtitleTrack
impl Unpin for SubtitleTrack
impl UnsafeUnpin for SubtitleTrack
impl UnwindSafe for SubtitleTrack
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงimpl<'de, D, R> CommandArg<'de, R> for Dwhere
D: Deserialize<'de>,
R: Runtime,
impl<'de, D, R> CommandArg<'de, R> for Dwhere
D: Deserialize<'de>,
R: Runtime,
ยงfn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>
fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>
ยงimpl<T> FunctionArg for Twhere
T: Type,
impl<T> FunctionArg for Twhere
T: Type,
ยงfn to_datatype(type_map: &mut TypeCollection) -> Option<DataType>
fn to_datatype(type_map: &mut TypeCollection) -> Option<DataType>
Gets the type of an argument as a [
DataType]. Read more