示例#1
0
  /** Returns the number of the longest track. */
  public int getLongestTrack() {
    int maxTitle = 0;
    long maxLength = 0;

    for (int ix = 0; ix < info.getTitles().size(); ix++) {
      DvdTitle title = info.getTitle(ix);
      if (title.getTotalTimeMs() > maxLength) {
        maxTitle = ix;
        maxLength = title.getTotalTimeMs();
      }
    }

    return maxTitle + 1;
  }
示例#2
0
  /** Gets a description of all {@link Track} of the DVD. */
  public Track[] getTracks() {
    Track[] result = new Track[info.getTitles().size()];

    for (int ix = 0; ix < result.length; ix++) {
      DvdTitle title = info.getTitle(ix);
      DvdTitleSet vts = title.getTitleSet();

      Track track = new Track();
      track.setTrack(title.getTitle());
      track.setAngles(title.getAngles());
      track.setChapters(title.getChapters());
      track.setDimension(new Dimension(vts.getWidth(), vts.getHeight()));

      long lengthSec = title.getTotalTimeMs() / 1000L;
      track.setLength(String.format("%d:%02d", (int) (lengthSec / 60), (int) (lengthSec % 60)));
      track.setAspect(AspectRatio.valueOf(vts.getAspect().name()));

      result[ix] = track;
    }

    return result;
  }