X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fdetect.rs;h=17b1411df7810fb8be38a9e4a37346206e178d32;hb=9895bd7b1732a96f0b3f61bf7c95ba342bd08b1e;hp=0b606419b0c91f86b495482e56d0332e39d4de25;hpb=5641dccfbf2a70d589cf094a0d4ed5a10f919f00;p=nihav.git diff --git a/nihav-core/src/detect.rs b/nihav-core/src/detect.rs index 0b60641..17b1411 100644 --- a/nihav-core/src/detect.rs +++ b/nihav-core/src/detect.rs @@ -134,7 +134,7 @@ impl<'a> CC<'a> { match *self { CC::Or (ref a, ref b) => { a.eval(src) || b.eval(src) }, CC::Eq(ref arg) => { arg.eq(src) }, - CC::In(ref a, ref b) => { a.le(src) && b.ge(src) }, + CC::In(ref a, ref b) => { a.ge(src) && b.le(src) }, CC::Lt(ref arg) => { arg.lt(src) }, CC::Le(ref arg) => { arg.le(src) }, CC::Gt(ref arg) => { arg.gt(src) }, @@ -193,6 +193,29 @@ const DETECTORS: &[DetectConditions] = &[ extensions: ".ivr", conditions: &[CheckItem{offs: 0, cond: &CC::Or(&CC::Str(b".R1M"), &CC::Str(b".REC"))}], }, + DetectConditions { + demux_name: "bink", + extensions: ".bik,.bk2", + conditions: &[CheckItem{offs: 0, cond: &CC::Or(&CC::In(Arg::U32BE(0x32494B62), // BIKb + Arg::U32BE(0x32494B7B)), // BIKz + &CC::In(Arg::U32BE(0x4B423261), // KB2a + Arg::U32BE(0x4B42327B)))}], // KB2z + }, + DetectConditions { + demux_name: "smacker", + extensions: ".smk", + conditions: &[CheckItem{offs: 0, cond: &CC::Or(&CC::Str(b"SMK2"), &CC::Str(b"SMK4"))}], + }, + DetectConditions { + demux_name: "bmv", + extensions: ".bmv", + conditions: &[], + }, + DetectConditions { + demux_name: "vmd", + extensions: ".vmd", + conditions: &[], + }, ]; pub fn detect_format(name: &str, src: &mut ByteReader) -> Option<(&'static str, DetectionScore)> { @@ -226,9 +249,9 @@ pub fn detect_format(name: &str, src: &mut ByteReader) -> Option<(&'static str, if score == DetectionScore::MagicMatches { return Some((detector.demux_name, score)); } - if let None = result { + if result.is_none() && score != DetectionScore::No { result = Some((detector.demux_name, score)); - } else { + } else if result.is_some() { let (_, oldsc) = result.unwrap(); if oldsc.less(score) { result = Some((detector.demux_name, score));