Changeset 1190


Ignore:
Timestamp:
07/25/06 15:17:14 (14 years ago)
Author:
curtis
Message:

Add API to toggle default usage of legacy QT reader.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/QTReader.java

    r1134 r1190  
    213213  private LegacyQTReader legacy; 
    214214 
     215  /** Flag indicating whether to use legacy reader by default. */ 
     216  private boolean useLegacy; 
     217 
    215218  /** Amount to subtract from each offset. */ 
    216219  private int scale; 
     
    222225  private boolean interlaced; 
    223226 
    224   /** Flag indicating whether or not the resource and data fork are separated.*/ 
     227  /** Flag indicating whether the resource and data fork are separated. */ 
    225228  private boolean spork; 
    226  
    227229 
    228230  // -- Constructor -- 
     
    231233  public QTReader() { super("QuickTime", "mov"); } 
    232234 
     235  // -- QTReader API methods -- 
     236 
     237  /** Sets whether to use the legacy reader (QTJava) by default. */ 
     238  public void setLegacy(boolean legacy) { useLegacy = legacy; } 
    233239 
    234240  // -- FormatReader API methods -- 
     
    304310    } 
    305311 
    306     if (!codec.equals("raw ") && !codec.equals("rle ") && 
     312    boolean doLegacy = useLegacy; 
     313    if (!doLegacy && !codec.equals("raw ") && !codec.equals("rle ") && 
    307314      !codec.equals("jpeg") && !codec.equals("mjpb")) 
    308315    { 
     
    311318          codec + "); using QTJava reader"); 
    312319      } 
     320      doLegacy = true; 
     321    } 
     322    if (doLegacy) { 
    313323      if (legacy == null) legacy = new LegacyQTReader(); 
    314324      return legacy.openBytes(id, no); 
     
    419429      throw new FormatException("Invalid image number: " + no); 
    420430    } 
    421     if (!codec.equals("raw ") && !codec.equals("rle ") && 
     431    boolean doLegacy = useLegacy; 
     432    if (!doLegacy && !codec.equals("raw ") && !codec.equals("rle ") && 
    422433      !codec.equals("jpeg") && !codec.equals("mjpb")) 
    423434    { 
     
    426437          codec + "); using QTJava reader"); 
    427438      } 
     439      doLegacy = true; 
     440    } 
     441    if (doLegacy) { 
    428442      if (legacy == null) legacy = new LegacyQTReader(); 
    429443      return legacy.openImage(id, no); 
     
    615629    } 
    616630  } 
    617  
    618631 
    619632  // -- Helper methods -- 
Note: See TracChangeset for help on using the changeset viewer.