code: public double getRatio() {
  
      // get ratio from media format definition
      if (this.ratio > 0) {
        return this.ratio;
      }
  
      // get ratio from media format definition calculated from ratio sample/display values
      if (this.ratioWidth > 0 && this.ratioHeight > 0) {
        return this.ratioWidth / this.ratioHeight;
      }
  
      // otherwise calculate ratio
      if (isFixedDimension() && this.width > 0 && this.height > 0) {
        return (double)this.width / (double)this.height;
      }
  
      return 0d;
    }
docs: Returns the ratio defined in the media format definition.
  If no ratio is defined an the media format has a fixed with/height it is calculated automatically.
  Otherwise 0 is returned.
  @return Ratio