Skip to main content

spoolframe_types/
media.rs

1//! What a client learns about a media file before it plays it: its length,
2//! what it is (container and picture, to show), and the tracks it can
3//! choose between.
4//!
5//! Audio and subtitle codecs stay on the server, where the playback
6//! planner uses them; a client chooses an audio language, not a codec.
7
8use std::time::Duration;
9
10use serde::{Deserialize, Serialize};
11
12use crate::codec::{Container, HdrFormat, VideoCodec};
13use crate::duration_ms;
14
15/// The tracks of one media file. A track is identified by its position in
16/// its list, which is stable for as long as the file does not change.
17#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
18pub struct MediaTracks {
19    #[serde(with = "duration_ms::option")]
20    pub duration: Option<Duration>,
21    /// The file's container, from the server's own probe of it. `None`
22    /// only where nothing was probed.
23    pub container: Option<Container>,
24    /// The file's average bits per second, every stream counted, for
25    /// "42 Mbit/s": what the container says, else its size over its
26    /// length. `None` where the server knows neither.
27    ///
28    /// This and `VideoTrack::bit_rate` are not `required::option`, though
29    /// every server sends them: the SDK keeps an item's file and tracks
30    /// with a download, and a download kept by an older SDK lacks the
31    /// keys, which read as `None`.
32    pub bit_rate: Option<u64>,
33    /// The main picture; `None` for audio only (music).
34    pub video: Option<VideoTrack>,
35    pub audio: Vec<AudioTrack>,
36    pub subtitles: Vec<SubtitleTrack>,
37}
38
39/// A file's picture as it is stored, for "4K · HEVC · Dolby Vision ·
40/// 10-bit": what the file is, not how it will play.
41#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
42pub struct VideoTrack {
43    pub codec: VideoCodec,
44    /// Pixels. A 2.40:1 4K film is 3840 by 1600: go by the width for
45    /// its class.
46    pub width: u32,
47    pub height: u32,
48    /// Bits per sample: 8, 10 or 12.
49    pub bit_depth: u32,
50    /// The HDR format; `None` is SDR. Dolby Vision over an HDR10 base is
51    /// Dolby Vision. HDR10+ is HDR10 here: its metadata is in the frames,
52    /// which the probe does not read.
53    pub hdr: Option<HdrFormat>,
54    /// The picture's own average bits per second, where the file says:
55    /// MP4 does for each stream, Matroska where its muxer wrote
56    /// statistics tags (mkvmerge does). As [`MediaTracks::bit_rate`].
57    pub bit_rate: Option<u64>,
58}
59
60#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
61pub struct AudioTrack {
62    /// An ISO 639-2 code such as `eng`, when the file says.
63    pub language: Option<String>,
64    pub title: Option<String>,
65    pub channels: Option<u32>,
66    /// The file marks it as the one to play by default.
67    pub default: bool,
68    /// What the track is for, whatever its title says.
69    pub role: AudioRole,
70}
71
72/// What an audio track is for.
73#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
74#[serde(rename_all = "snake_case")]
75pub enum AudioRole {
76    /// The programme's own sound.
77    #[default]
78    Main,
79    /// Narration of what is on screen, for blind and partially sighted
80    /// viewers.
81    AudioDescription,
82    Commentary,
83    /// Anything else (karaoke, music and effects only), and any role this
84    /// build does not know.
85    #[serde(other)]
86    Other,
87}
88
89#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
90pub struct SubtitleTrack {
91    /// An ISO 639-2 code such as `eng`, when the file says.
92    pub language: Option<String>,
93    pub title: Option<String>,
94    /// Only for foreign-language parts of the dialogue; shown even when
95    /// subtitles are off. The same as `role == Forced`.
96    pub forced: bool,
97    pub default: bool,
98    /// From a separate file next to the media, not inside it.
99    pub external: bool,
100    /// What the track is for, whatever its title says.
101    pub role: SubtitleRole,
102    /// How the track is timed: an external text track's sync and
103    /// offset, the same for every user. Only for an external text track
104    /// (SRT, WebVTT, ASS), in an item's tracks; `None` for every other
105    /// track, whose timing is the file's. Read as `None` when left out,
106    /// as a download's tracks kept by an older SDK lack it.
107    #[serde(default)]
108    pub timing: Option<SubtitleTiming>,
109    /// Where a track someone downloaded came from: its source,
110    /// who downloaded it and when, in an item's tracks; `None` for every
111    /// track that was not downloaded. Read as `None` when left out, as
112    /// `timing` is.
113    #[serde(default)]
114    pub download: Option<SubtitleDownload>,
115}
116
117/// A subtitle site the server searches and downloads from. On the wire
118/// it is its [`id`](SubtitleSource::id), a string: a client shows a site
119/// this build does not know as that id.
120#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
121pub enum SubtitleSource {
122    OpenSubtitles,
123    SubDl,
124}
125
126impl SubtitleSource {
127    /// Every site, in the order the server asks them unless the admin
128    /// set another.
129    pub const ALL: [SubtitleSource; 2] = [SubtitleSource::OpenSubtitles, SubtitleSource::SubDl];
130
131    /// Its id: `opensubtitles`, `subdl`.
132    pub fn id(self) -> &'static str {
133        match self {
134            SubtitleSource::OpenSubtitles => "opensubtitles",
135            SubtitleSource::SubDl => "subdl",
136        }
137    }
138
139    /// Its name, to show.
140    pub fn name(self) -> &'static str {
141        match self {
142            SubtitleSource::OpenSubtitles => "OpenSubtitles",
143            SubtitleSource::SubDl => "SubDL",
144        }
145    }
146
147    /// The site `id` names, if one.
148    pub fn of(id: &str) -> Option<SubtitleSource> {
149        SubtitleSource::ALL.into_iter().find(|s| s.id() == id)
150    }
151
152    /// The name of the site `id` names; the id itself for one this build
153    /// does not know.
154    pub fn name_of(id: &str) -> &str {
155        SubtitleSource::of(id).map_or(id, |s| s.name())
156    }
157}
158
159impl std::fmt::Display for SubtitleSource {
160    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
161        f.write_str(self.name())
162    }
163}
164
165/// A subtitle track downloaded from a subtitle site, for everyone
166/// on the server.
167#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
168pub struct SubtitleDownload {
169    /// The download's own id: what `RemoveSubtitleDownload` names.
170    pub id: String,
171    /// The site it came from, by id: `opensubtitles` (OpenSubtitles) or
172    /// `subdl` (SubDL), as [`SubtitleResult::source`].
173    pub source: String,
174    /// The release it was made for, as the site names it.
175    pub release: String,
176    /// Who downloaded it, by display name.
177    pub by: String,
178    /// When, Unix seconds.
179    pub at: i64,
180    /// It was found by the file's hash: made for this very release, so
181    /// it was not synced.
182    pub hash_match: bool,
183    pub origin: SubtitleOrigin,
184    /// Whether the session's user may remove it: the one who downloaded
185    /// it, or an admin.
186    pub can_remove: bool,
187}
188
189/// Who made a subtitle.
190#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
191#[serde(rename_all = "snake_case")]
192pub enum SubtitleOrigin {
193    /// Machine-translated from another language's subtitle.
194    MachineTranslated,
195    /// Made by an AI, from the speech.
196    Ai,
197    /// A person. Also any origin this build does not know. (Last, as
198    /// serde wants of `other`.)
199    #[default]
200    #[serde(other)]
201    Human,
202}
203
204/// One subtitle a search found, to download by its `id`.
205#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
206pub struct SubtitleResult {
207    /// What `DownloadSubtitle` names: the site's id and its file's,
208    /// `opensubtitles:5338574`, `subdl:3172974-3188291`. Opaque to a
209    /// client.
210    pub id: String,
211    /// The site it was found on: `opensubtitles` (OpenSubtitles) or
212    /// `subdl` (SubDL); a client shows another as it is.
213    pub source: String,
214    /// The release it was made for, as its uploader named it.
215    pub release: String,
216    /// Its language, as the site says it: `en`, `pt-BR`.
217    pub language: String,
218    /// `srt`, `ass`, `vtt`, or what the site says.
219    pub format: Option<String>,
220    /// The frame rate it was made for, in thousandths: 23 976.
221    pub fps_milli: Option<u32>,
222    /// How many times it was downloaded on the site; 0 where the site
223    /// does not say (SubDL).
224    pub downloads: u64,
225    /// Its rating on the site, 0 to 100 (tenths of its 0 to 10); `None`
226    /// while unrated.
227    pub rating: Option<u8>,
228    pub hearing_impaired: bool,
229    /// Only the parts in another language than the rest (signs, a
230    /// foreign line): a forced subtitle, not the whole dialogue. False
231    /// where the site does not say (SubDL).
232    pub forced: bool,
233    pub origin: SubtitleOrigin,
234    /// Found by the file's hash: made for this very release, and played
235    /// as it is, not synced.
236    pub hash_match: bool,
237    /// Downloaded before and removed as bad: listed last.
238    pub rejected: bool,
239    /// Downloaded already: a download gives the same track.
240    pub downloaded: bool,
241}
242
243/// What a subtitle search found for an item, best first: hash
244/// matches, then the rest by rating and downloads; machine-translated and
245/// AI-made after people's; rejected ones last. Every site the server
246/// searches is asked at once, and their results are one list.
247#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
248pub struct SubtitleSearch {
249    /// The languages searched.
250    pub languages: Vec<String>,
251    pub results: Vec<SubtitleResult>,
252    /// How each site's search went, in the order the server asks them:
253    /// one that failed or is out of quota leaves the others' results.
254    pub sources: Vec<SubtitleSourceStatus>,
255}
256
257/// How one site's part of a search went.
258#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
259pub struct SubtitleSourceStatus {
260    /// `opensubtitles` or `subdl`, as [`SubtitleResult::source`].
261    pub source: String,
262    /// Flattened: `{"source": "subdl", "state": "found", "found": 12}`.
263    #[serde(flatten)]
264    pub state: SubtitleSourceState,
265}
266
267/// Whether a site answered a search.
268#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
269#[serde(tag = "state", rename_all = "snake_case")]
270pub enum SubtitleSourceState {
271    /// It answered, with `found` of the results.
272    Found { found: u32 },
273    /// Its quota is used up until `resets_at` (Unix seconds), when it
274    /// says.
275    QuotaExhausted { resets_at: Option<i64> },
276    /// It asked to wait this long before the next request.
277    RateLimited { retry_after_ms: u64 },
278    /// It could not be reached or refused the request: `message` says
279    /// why, to show.
280    Failed { message: String },
281    /// One this build does not know.
282    #[serde(other)]
283    Unknown,
284}
285
286/// A subtitle downloaded: the item's new track, at once, and the
287/// downloads left today.
288#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
289pub struct SubtitleDownloaded {
290    /// Its place in the item's `Tracks`' `subtitles`.
291    pub track: u32,
292    pub subtitle: SubtitleTrack,
293    /// The server's account's downloads left today, when the site says.
294    #[serde(deserialize_with = "crate::required::option")]
295    pub account_remaining: Option<u32>,
296    /// The user's own, when the admin set a limit per user.
297    #[serde(deserialize_with = "crate::required::option")]
298    pub user_remaining: Option<u32>,
299}
300
301/// Whose downloads ran out.
302#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
303#[serde(rename_all = "snake_case")]
304pub enum QuotaOf {
305    /// The server's account at the site: no one can download until it
306    /// resets.
307    Account,
308    /// The user's own daily limit on this server.
309    User,
310    /// One this build does not know.
311    #[serde(other)]
312    Unknown,
313}
314
315/// How an external text subtitle is timed: synced to the file or
316/// as it came, and moved by a manual offset on top. Set for everyone who
317/// plays the item.
318#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
319pub struct SubtitleTiming {
320    pub sync: SubtitleSync,
321    /// Added to every cue, ms, on top of the synced or original timing:
322    /// positive shows the text later. What the track is served with
323    /// already has it: a client does not add it again.
324    pub offset_ms: i64,
325    /// Who set the offset last, by display name; `None` while no one has.
326    #[serde(deserialize_with = "crate::required::option")]
327    pub offset_by: Option<String>,
328    /// When, Unix seconds.
329    #[serde(deserialize_with = "crate::required::option")]
330    pub offset_at: Option<i64>,
331}
332
333/// Where a subtitle's sync is.
334#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
335#[serde(tag = "state", rename_all = "snake_case")]
336pub enum SubtitleSync {
337    /// Its own timing, as the file has it: never synced, or put back
338    /// with "Use original timing".
339    Original,
340    /// Being synced, or waiting its turn; it is served as it was until
341    /// the sync is done.
342    Syncing,
343    /// Synced, and served synced.
344    Synced {
345        /// The shift of most of its cues, ms.
346        offset_ms: i64,
347        /// The frame-rate ratio its times were multiplied by, in
348        /// millionths: 1 000 000 for none, 1 042 709 for 23.976 to 25.
349        factor_ppm: u32,
350        /// Where scenes were cut or added: the places its shift changes.
351        splits: u32,
352        /// How well it fell on the file, 0 to 100.
353        score: u8,
354    },
355    /// A sync scored too low to trust: it may be another film's subtitle.
356    /// Served with its original timing.
357    Uncertain { score: u8 },
358    /// The sync could not be made; served as it was.
359    Failed { reason: String },
360    /// A state this build does not know: show the track as it is.
361    #[serde(other)]
362    Unknown,
363}
364
365/// What a subtitle track is for.
366#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
367#[serde(rename_all = "snake_case")]
368pub enum SubtitleRole {
369    /// For deaf and hard-of-hearing viewers: dialogue plus sounds and
370    /// speakers.
371    Sdh,
372    /// Only foreign-language parts and signs.
373    Forced,
374    Commentary,
375    /// All the dialogue. Also any role this build does not know: showing
376    /// it is the safe guess. (Last, as serde wants of `other`.)
377    #[default]
378    #[serde(other)]
379    Full,
380}
381
382#[cfg(test)]
383mod tests {
384    use super::*;
385
386    #[test]
387    fn a_track_s_role_left_out_is_refused() {
388        let audio = AudioTrack {
389            language: None,
390            title: None,
391            channels: None,
392            default: false,
393            role: AudioRole::Commentary,
394        };
395        crate::test_support::assert_each_required(&audio, &["role"]);
396        let subtitle = SubtitleTrack {
397            language: None,
398            title: None,
399            forced: false,
400            default: false,
401            external: false,
402            role: SubtitleRole::Sdh,
403            timing: None,
404            download: None,
405        };
406        crate::test_support::assert_each_required(&subtitle, &["role"]);
407    }
408
409    fn sidecar(timing: Option<SubtitleTiming>) -> SubtitleTrack {
410        SubtitleTrack {
411            language: Some("eng".into()),
412            title: None,
413            forced: false,
414            default: false,
415            external: true,
416            role: SubtitleRole::Full,
417            timing,
418            download: None,
419        }
420    }
421
422    /// PX-02: a downloaded track says so, and where from; any other track
423    /// says `null`, and one kept without the key reads as none.
424    #[test]
425    fn a_track_s_download_is_null_for_one_not_downloaded() {
426        let mut json = serde_json::to_value(sidecar(None)).unwrap();
427        assert!(json["download"].is_null(), "{json}");
428        json.as_object_mut().unwrap().remove("download");
429        assert_eq!(
430            serde_json::from_value::<SubtitleTrack>(json).unwrap(),
431            sidecar(None)
432        );
433        let mut track = sidecar(None);
434        track.download = Some(SubtitleDownload {
435            id: "d1".into(),
436            source: "opensubtitles".into(),
437            release: "Film.2019.1080p".into(),
438            by: "Alice".into(),
439            at: 1_760_000_000,
440            hash_match: false,
441            origin: SubtitleOrigin::MachineTranslated,
442            can_remove: true,
443        });
444        let json = serde_json::to_value(&track).unwrap();
445        assert_eq!(json["download"]["origin"], "machine_translated");
446        assert_eq!(
447            serde_json::from_value::<SubtitleTrack>(json).unwrap(),
448            track
449        );
450    }
451
452    #[test]
453    fn an_origin_or_quota_this_build_does_not_know_still_decodes() {
454        let origin: SubtitleOrigin = serde_json::from_value(serde_json::json!("dubbed")).unwrap();
455        assert_eq!(origin, SubtitleOrigin::Human);
456        let whose: QuotaOf = serde_json::from_value(serde_json::json!("household")).unwrap();
457        assert_eq!(whose, QuotaOf::Unknown);
458    }
459
460    #[test]
461    fn a_source_is_named_by_its_id() {
462        for source in SubtitleSource::ALL {
463            assert_eq!(SubtitleSource::of(source.id()), Some(source));
464        }
465        assert_eq!(SubtitleSource::of("SubDL"), None);
466        assert_eq!(SubtitleSource::name_of("subdl"), "SubDL");
467        assert_eq!(SubtitleSource::name_of("podnapisi"), "podnapisi");
468    }
469
470    /// A result as a server before SubDL sent one, named by
471    /// OpenSubtitles' `file_id` with no `id`, `source` or `forced`, is
472    /// refused, as is a search without `sources`: each is required.
473    #[test]
474    fn a_result_or_a_search_missing_a_field_is_refused() {
475        let result = serde_json::json!({
476            "id": "opensubtitles:7", "source": "opensubtitles", "release": "R",
477            "language": "en", "format": null, "fps_milli": null, "downloads": 1,
478            "rating": null, "hearing_impaired": false, "forced": false,
479            "origin": "human", "hash_match": false, "rejected": false,
480            "downloaded": false,
481        });
482        let read: SubtitleResult = serde_json::from_value(result.clone()).unwrap();
483        assert_eq!(read.id, "opensubtitles:7");
484        for field in ["id", "source", "forced"] {
485            let mut without = result.clone();
486            without.as_object_mut().unwrap().remove(field);
487            let error = serde_json::from_value::<SubtitleResult>(without).unwrap_err();
488            assert!(
489                error
490                    .to_string()
491                    .contains(&format!("missing field `{field}`")),
492                "{field}: {error}"
493            );
494        }
495        let mut before_subdl = result.clone();
496        let fields = before_subdl.as_object_mut().unwrap();
497        fields.remove("id");
498        fields.insert("file_id".into(), 7.into());
499        assert!(serde_json::from_value::<SubtitleResult>(before_subdl).is_err());
500        let search = serde_json::json!({"languages": ["en"], "results": [result]});
501        let error = serde_json::from_value::<SubtitleSearch>(search).unwrap_err();
502        assert!(
503            error.to_string().contains("missing field `sources`"),
504            "{error}"
505        );
506    }
507
508    #[test]
509    fn a_download_s_remaining_counts_left_out_are_refused() {
510        let downloaded = SubtitleDownloaded {
511            track: 3,
512            subtitle: sidecar(None),
513            account_remaining: None,
514            user_remaining: None,
515        };
516        crate::test_support::assert_each_required(
517            &downloaded,
518            &["account_remaining", "user_remaining"],
519        );
520    }
521
522    /// PX-03: a track's timing is `null` when there is none, and one kept
523    /// without the key reads as none; one sent reads back as it was, its
524    /// state by name.
525    #[test]
526    fn a_track_s_timing_is_null_when_there_is_none() {
527        let mut json = serde_json::to_value(sidecar(None)).unwrap();
528        assert!(json["timing"].is_null(), "{json}");
529        json.as_object_mut().unwrap().remove("timing");
530        assert_eq!(
531            serde_json::from_value::<SubtitleTrack>(json).unwrap(),
532            sidecar(None)
533        );
534        let timing = SubtitleTiming {
535            sync: SubtitleSync::Synced {
536                offset_ms: -3_200,
537                factor_ppm: 1_042_709,
538                splits: 1,
539                score: 87,
540            },
541            offset_ms: 1_500,
542            offset_by: Some("Alice".into()),
543            offset_at: Some(1_760_000_000),
544        };
545        let json = serde_json::to_value(sidecar(Some(timing.clone()))).unwrap();
546        assert_eq!(json["timing"]["sync"]["state"], "synced");
547        assert_eq!(
548            serde_json::from_value::<SubtitleTrack>(json).unwrap(),
549            sidecar(Some(timing))
550        );
551    }
552
553    #[test]
554    fn a_sync_state_this_build_does_not_know_is_unknown() {
555        let sync: SubtitleSync =
556            serde_json::from_value(serde_json::json!({ "state": "transcribing" })).unwrap();
557        assert_eq!(sync, SubtitleSync::Unknown);
558    }
559
560    #[test]
561    fn a_timing_s_offset_author_left_out_is_refused() {
562        let timing = SubtitleTiming {
563            sync: SubtitleSync::Original,
564            offset_ms: 0,
565            offset_by: None,
566            offset_at: None,
567        };
568        crate::test_support::assert_each_required(&timing, &["offset_by", "offset_at"]);
569    }
570
571    #[test]
572    fn tracks_round_trip_with_the_duration_in_milliseconds() {
573        let tracks = MediaTracks {
574            duration: Some(Duration::from_millis(6_106_791)),
575            container: Some(Container::Matroska),
576            bit_rate: Some(42_000_000),
577            video: Some(VideoTrack {
578                codec: VideoCodec::Hevc,
579                width: 3840,
580                height: 1600,
581                bit_depth: 10,
582                hdr: Some(HdrFormat::DolbyVision),
583                bit_rate: Some(38_500_000),
584            }),
585            audio: vec![AudioTrack {
586                language: Some("eng".into()),
587                title: None,
588                channels: Some(6),
589                default: true,
590                role: AudioRole::Main,
591            }],
592            subtitles: vec![SubtitleTrack {
593                language: Some("eng".into()),
594                title: Some("Forced".into()),
595                forced: true,
596                default: false,
597                external: true,
598                role: SubtitleRole::Forced,
599                timing: None,
600                download: None,
601            }],
602        };
603        let json = serde_json::to_value(&tracks).unwrap();
604        assert_eq!(json["duration"], 6_106_791);
605        assert_eq!(serde_json::from_value::<MediaTracks>(json).unwrap(), tracks);
606    }
607
608    #[test]
609    fn tracks_from_a_server_without_bit_rates_still_decode() {
610        let tracks = MediaTracks {
611            bit_rate: Some(42_000_000),
612            video: Some(VideoTrack {
613                codec: VideoCodec::Hevc,
614                width: 3840,
615                height: 2160,
616                bit_depth: 10,
617                hdr: None,
618                bit_rate: Some(38_500_000),
619            }),
620            ..MediaTracks::default()
621        };
622        let mut json = serde_json::to_value(&tracks).unwrap();
623        assert_eq!(json["bit_rate"], 42_000_000);
624        json.as_object_mut().unwrap().remove("bit_rate");
625        json["video"].as_object_mut().unwrap().remove("bit_rate");
626        let older: MediaTracks = serde_json::from_value(json).unwrap();
627        assert_eq!(older.bit_rate, None);
628        assert_eq!(older.video.unwrap().bit_rate, None);
629    }
630
631    #[test]
632    fn a_role_from_a_newer_peer_still_decodes() {
633        // A role this build does not know. (A track with no role at all is
634        // refused: `a_track_s_role_left_out_is_refused`.)
635        let audio: AudioRole = serde_json::from_value(serde_json::json!("karaoke")).unwrap();
636        assert_eq!(audio, AudioRole::Other);
637        let subtitle: SubtitleRole = serde_json::from_value(serde_json::json!("lyrics")).unwrap();
638        assert_eq!(subtitle, SubtitleRole::Full);
639    }
640}