Skip to main content

GsiBlock

Struct GsiBlock 

Source
pub struct GsiBlock { /* private fields */ }
Expand description

General Subtitle Information (GSI) block, the first 1024 bytes of an STL file.

Implementations§

Source§

impl GsiBlock

Source

pub fn code_page_number(&self) -> &CodePageNumber

Code Page Number (CPN), the code page of the text in the GSI block.

Source

pub fn disk_format_code(&self) -> &DiskFormatCode

Disk Format Code (DFC), the frame rate of the time codes.

Source

pub fn display_standard_code(&self) -> &DisplayStandardCode

Display Standard Code (DSC).

Source

pub fn character_code_table(&self) -> &CharacterCodeTable

Character Code Table (CCT) of the Text Fields in the TTI blocks.

Source

pub fn language( &self, ) -> Result<Option<LanguageCode>, InvalidFieldValue<String>>

Language Code (LC), validated as two hexadecimal digits 00h-7Fh, the range of the codes in Appendix 3. A validated code may still be unassigned, see LanguageCode::name. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
// The test file uses 2Fh, which is reserved for national assignment
let language = stl.gsi.language().unwrap().unwrap();
assert_eq!(0x2F, language.0);
assert_eq!(None, language.name());
Source

pub fn original_programme_title(&self) -> Option<&str>

Original Programme Title (OPT), without the trailing space padding. None if blank.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Some("TEST"), stl.gsi.original_programme_title());
Source

pub fn original_episode_title(&self) -> Option<&str>

Original Episode Title (OET), without the trailing space padding. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Some("TEST EPISODE"), stl.gsi.original_episode_title());
Source

pub fn translated_programme_title(&self) -> Option<&str>

Translated Programme Title (TPT), without the trailing space padding. None if blank.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Some("TEST"), stl.gsi.translated_programme_title());
Source

pub fn translated_episode_title(&self) -> Option<&str>

Translated Episode Title (TET), without the trailing space padding. None if blank.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Some("EPISODE DE TEST"), stl.gsi.translated_episode_title());
Source

pub fn translators_name(&self) -> Option<&str>

Translator’s Name (TN), without the trailing space padding. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Some("C. Lebeaupin"), stl.gsi.translators_name());
Source

pub fn translators_contact_details(&self) -> Option<&str>

Translator’s Contact Details (TCD), without the trailing space padding. None if blank.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(None, stl.gsi.translators_contact_details());
Source

pub fn subtitle_list_reference_code(&self) -> Option<&str>

Subtitle List Reference Code (SLR), without the trailing space padding. None if blank.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(None, stl.gsi.subtitle_list_reference_code());
Source

pub fn creation_date(&self) -> Result<Option<Date>, InvalidFieldValue<String>>

Creation Date (CD), validated as an existing date in the format YYMMDD. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
use ebustl_parser::Date;

let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
let date = Date { year: 2013, month: 10, day: 10 };
assert_eq!(Ok(Some(date)), stl.gsi.creation_date());
Source

pub fn revision_date(&self) -> Result<Option<Date>, InvalidFieldValue<String>>

Revision Date (RD), validated as an existing date in the format YYMMDD. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
use ebustl_parser::Date;

let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
let date = Date { year: 2013, month: 10, day: 17 };
assert_eq!(Ok(Some(date)), stl.gsi.revision_date());
Source

pub fn revision_number(&self) -> Result<Option<u8>, InvalidFieldValue<String>>

Revision Number (RN), validated as 0-99, ignoring space padding. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
// Blank in the test file
assert_eq!(Ok(None), stl.gsi.revision_number());
Source

pub fn total_number_of_text_and_timing_blocks(&self) -> u32

Total Number of TTI Blocks (TNB), including extension blocks.

Source

pub fn total_number_of_subtitles(&self) -> u32

Total Number of Subtitles (TNS).

Source

pub fn total_number_of_subtitle_groups(&self) -> u16

Total Number of Subtitle Groups (TNG).

Source

pub fn max_number_of_chars_in_row(&self) -> u16

Maximum Number of Displayable Characters in any text row (MNC).

Source

pub fn max_number_of_rows(&self) -> u16

Maximum Number of Displayable Rows (MNR).

Source

pub fn time_code_status(&self) -> &TimeCodeStatus

Time Code: Status (TCS), whether the time codes in the GSI and TTI blocks are intended for use.

Source

pub fn time_code_start_of_programme( &self, ) -> Result<Option<Time>, InvalidFieldValue<String>>

Time Code: Start-of-Programme (TCP), validated as HHMMSSFF with minutes and seconds 0-59 and frames according to the Disk Format Code. Hours may exceed 23, e.g. for a programme that continues past midnight. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
use ebustl_parser::Time;

let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
let time = Time { hours: 10, minutes: 0, seconds: 0, frames: 0 };
assert_eq!(Ok(Some(time)), stl.gsi.time_code_start_of_programme());
Source

pub fn time_code_first_in_cue( &self, ) -> Result<Option<Time>, InvalidFieldValue<String>>

Time Code: First In-Cue (TCF), validated as HHMMSSFF with minutes and seconds 0-59 and frames according to the Disk Format Code. Hours may exceed 23, e.g. for a programme that continues past midnight. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
use ebustl_parser::Time;

let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
let time = Time { hours: 10, minutes: 0, seconds: 0, frames: 0 };
assert_eq!(Ok(Some(time)), stl.gsi.time_code_first_in_cue());
Source

pub fn total_number_of_disks(&self) -> u8

Total Number of Disks (TND) in the set holding the subtitle list.

Source

pub fn disk_sequence_number(&self) -> u8

Disk Sequence Number (DSN) of this disk in the set, starting at 1.

Source

pub fn country_of_origin( &self, ) -> Result<Option<&str>, InvalidFieldValue<String>>

Country of Origin (CO), validated as three upper case letters (ISO 3166 alpha-3). None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Ok(Some("FRA")), stl.gsi.country_of_origin());
Source

pub fn publisher(&self) -> Option<&str>

Publisher (PUB), without the trailing space padding. None if blank.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Some("TESTSUB"), stl.gsi.publisher());
Source

pub fn editors_name(&self) -> Option<&str>

Editor’s Name (EN), without the trailing space padding. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(Some("TESTSUB 1.0.1"), stl.gsi.editors_name());
Source

pub fn editors_contact_details(&self) -> Option<&str>

Editor’s Contact Details (ECD), without the trailing space padding. None if blank.

On error, InvalidFieldValue::value gives the value as stored in the file.

§Example
let stl = ebustl_parser::parse_stl_from_file("stls/test.stl").unwrap();
assert_eq!(None, stl.gsi.editors_contact_details());
Source

pub fn user_defined_area(&self) -> &str

User-Defined Area (UDA), decoded with the code page of the GSI block.

Source§

impl GsiBlock

Source

pub fn new() -> GsiBlock

Creates a GSI block for a teletext subtitle list.

The defaults are code page 850, 25 frames per second, Level-1 teletext, the Latin character code table, today as creation and revision date and time codes intended for use.

Trait Implementations§

Source§

impl Debug for GsiBlock

Source§

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

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

impl Default for GsiBlock

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for GsiBlock

Source§

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

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

impl Eq for GsiBlock

Source§

impl PartialEq for GsiBlock

Source§

fn eq(&self, other: &Self) -> 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 GsiBlock

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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, !>

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.