diff --git a/src/main/java/org/harctoolbox/irp/Decoder.java b/src/main/java/org/harctoolbox/irp/Decoder.java index 18e01d86..be2b4a22 100644 --- a/src/main/java/org/harctoolbox/irp/Decoder.java +++ b/src/main/java/org/harctoolbox/irp/Decoder.java @@ -263,6 +263,18 @@ public AbstractDecodesCollection decodeLoose(IrSigna return decodeIrSignal(irSignal, decoderParams); } + public AbstractDecodesCollection decodeIrSignalWithFallback(IrSignal irSignal, DecoderParameters decoderParams) { + SimpleDecodesSet decodes = decodeIrSignal(irSignal, decoderParams); + if (!decodes.isEmpty()) + return decodes; + + if (decoderParams.ignoreLeadingGarbage || (!decoderParams.strict && (irSignal.introOnly() || irSignal.repeatOnly()))) { + ModulatedIrSequence sequence = irSignal.toModulatedIrSequence(); + return decode(sequence, decoderParams); + } + return decodes; // empty + } + public static final class DecoderParameters { private boolean strict;