+/// Frame skipping mode for decoders.
+#[derive(Clone,Copy,PartialEq,Debug)]
+pub enum FrameSkipMode {
+ /// Decode all frames.
+ None,
+ /// Decode all key frames.
+ KeyframesOnly,
+ /// Decode only intra frames.
+ IntraOnly,
+}
+
+impl Default for FrameSkipMode {
+ fn default() -> Self {
+ FrameSkipMode::None
+ }
+}
+
+impl FromStr for FrameSkipMode {
+ type Err = DecoderError;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ match s {
+ FRAME_SKIP_OPTION_VAL_NONE => Ok(FrameSkipMode::None),
+ FRAME_SKIP_OPTION_VAL_KEYFRAME => Ok(FrameSkipMode::KeyframesOnly),
+ FRAME_SKIP_OPTION_VAL_INTRA => Ok(FrameSkipMode::IntraOnly),
+ _ => Err(DecoderError::InvalidData),
+ }
+ }
+}
+
+impl ToString for FrameSkipMode {
+ fn to_string(&self) -> String {
+ match *self {
+ FrameSkipMode::None => FRAME_SKIP_OPTION_VAL_NONE.to_string(),
+ FrameSkipMode::KeyframesOnly => FRAME_SKIP_OPTION_VAL_KEYFRAME.to_string(),
+ FrameSkipMode::IntraOnly => FRAME_SKIP_OPTION_VAL_INTRA.to_string(),
+ }
+ }
+}
+