From: Kostya Shishkov Date: Sat, 6 Jun 2020 07:40:26 +0000 (+0200) Subject: factor out keyframe interval option X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=ee0ca773d99115f67d776735bcad168e1993d2e8;p=nihav.git factor out keyframe interval option --- diff --git a/nihav-commonfmt/src/codecs/cinepakenc.rs b/nihav-commonfmt/src/codecs/cinepakenc.rs index 4271e1a..ce50eee 100644 --- a/nihav-commonfmt/src/codecs/cinepakenc.rs +++ b/nihav-commonfmt/src/codecs/cinepakenc.rs @@ -984,7 +984,7 @@ impl NAEncoder for CinepakEncoder { const ENCODER_OPTS: &[NAOptionDefinition] = &[ NAOptionDefinition { - name: "key_int", description: "Keyframe interval (0 - automatic)", + name: KEYFRAME_OPTION, description: KEYFRAME_OPTION_DESC, opt_type: NAOptionDefinitionType::Int(Some(0), Some(128)) }, NAOptionDefinition { name: "nstrips", description: "Number of strips per frame (0 - automatic)", @@ -1002,7 +1002,7 @@ println!("option {}", option.name); for opt_def in ENCODER_OPTS.iter() { if opt_def.check(option).is_ok() { match option.name { - "key_int" => { + KEYFRAME_OPTION => { if let NAValue::Int(intval) = option.value { self.key_int = intval as u8; } diff --git a/nihav-core/src/options.rs b/nihav-core/src/options.rs index c2f2d4d..846a948 100644 --- a/nihav-core/src/options.rs +++ b/nihav-core/src/options.rs @@ -8,6 +8,11 @@ use std::sync::Arc; use std::fmt; +/// Common name for keyframe interval option. +pub const KEYFRAME_OPTION: &'static str = "key_int"; +/// Common description for keyframe interval option. +pub const KEYFRAME_OPTION_DESC: &'static str = "Keyframe interval (0 - automatic)"; + /// A list specifying option parsing and validating errors. #[derive(Clone,Copy,Debug,PartialEq)] pub enum OptionError {