Skip to content

Commit

Permalink
fix: add ucla checks for millis_separator
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia committed Aug 28, 2024
1 parent 90f9f0a commit f2bbcdb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
20 changes: 20 additions & 0 deletions src/rust/lib_ccxr/src/common/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,3 +639,23 @@ impl Default for Options {
}
}
}

impl Options {
pub fn millis_separator(&self) -> char {
if self.ucla {
'.'
} else {
self.date_format.millis_separator()
}
}
}

impl EncoderConfig {
pub fn millis_separator(&self) -> char {
if self.ucla {
'.'
} else {
self.date_format.millis_separator()
}
}
}
6 changes: 3 additions & 3 deletions src/rust/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl FromRust<Options> for ccx_s_options {
self.settings_dtvcc = options.settings_dtvcc.to_ctype();
self.is_608_enabled = options.is_608_enabled as _;
self.is_708_enabled = options.is_708_enabled as _;
self.millis_separator = options.date_format.millis_separator() as _;
self.millis_separator = options.millis_separator() as _;
self.binary_concat = options.binary_concat as _;
self.use_gop_as_pts = if let Some(usegops) = options.use_gop_as_pts {
if usegops {
Expand Down Expand Up @@ -257,7 +257,7 @@ impl CType2<ccx_s_teletext_config, &Options> for TeletextConfig {
encoding: value.enc_cfg.encoding.to_ctype() as _,
nofontcolor: self.nofontcolor.into(),
nohtmlescape: self.nohtmlescape.into(),
millis_separator: self.date_format.millis_separator() as _,
millis_separator: value.millis_separator() as _,
latrusmap: self.latrusmap.into(),
};
config.set_verbose(self.verbose.into());
Expand Down Expand Up @@ -571,7 +571,7 @@ impl CType<encoder_cfg> for EncoderConfig {
ucla: self.ucla as _,
encoding: self.encoding as _,
date_format: self.date_format.to_ctype(),
millis_separator: self.date_format.millis_separator() as _,
millis_separator: self.millis_separator() as _,
autodash: self.autodash as _,
trim_subs: self.trim_subs as _,
sentence_cap: self.sentence_cap as _,
Expand Down
10 changes: 6 additions & 4 deletions src/rust/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,11 +1222,9 @@ impl OptionsExt for Options {
tlt_config.page = Cell::new(TeletextPageNumber::from(tlt_config.user_page));
}

let mut millis_separator = ',';
// Red Hen/ UCLA Specific stuff
if args.ucla {
self.ucla = true;
millis_separator = '.';
self.enc_cfg.no_bom = true;

if !self.transcript_settings.is_final {
Expand Down Expand Up @@ -1291,11 +1289,15 @@ impl OptionsExt for Options {
}

if args.sects {
self.date_format = TimestampFormat::Seconds { millis_separator };
self.date_format = TimestampFormat::Seconds {
millis_separator: ',',
};
}

if args.datets {
self.date_format = TimestampFormat::Date { millis_separator };
self.date_format = TimestampFormat::Date {
millis_separator: ',',
};
}

if args.teletext {
Expand Down

0 comments on commit f2bbcdb

Please sign in to comment.