- fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] }
- fn set_options(&mut self, _options: &[NAOption]) { }
- fn query_option_value(&self, _name: &str) -> Option<NAValue> { None }
+ fn get_supported_options(&self) -> &[NAOptionDefinition] { ENCODER_OPTS }
+ fn set_options(&mut self, options: &[NAOption]) {
+ for option in options.iter() {
+println!("option {}", option.name);
+ for opt_def in ENCODER_OPTS.iter() {
+ if opt_def.check(option).is_ok() {
+ match option.name {
+ "key_int" => {
+ if let NAValue::Int(intval) = option.value {
+ self.key_int = intval as u8;
+ }
+ },
+ "nstrips" => {
+ if let NAValue::Int(intval) = option.value {
+ self.nstrips = intval as usize;
+ }
+ },
+ "quant_mode" => {
+ if let NAValue::String(ref str) = option.value {
+ match str.as_str() {
+ "elbg" => self.qmode = QuantMode::ELBG,
+ "hybrid" => self.qmode = QuantMode::Hybrid,
+ "mediancut" => self.qmode = QuantMode::MedianCut,
+ _ => {},
+ };
+ }
+ },
+ _ => {},
+ };
+ }
+ }
+ }
+ }
+ fn query_option_value(&self, name: &str) -> Option<NAValue> {
+ match name {
+ "key_int" => Some(NAValue::Int(i64::from(self.key_int))),
+ "nstrips" => Some(NAValue::Int(self.nstrips as i64)),
+ "quant_mode" => Some(NAValue::String(self.qmode.to_string())),
+ _ => None,
+ }
+ }