Пример #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
  /**
   * Example tool that can be used for testing and debugging purposes.
   *
   * <p>Debug log level is activated automatically.
   */
  public static void main(String[] args) {
    System.setProperty(LsdvdLogger.DEBUG_PROPERTY_NAME, "true");

    if (args.length < 1) {
      System.err.println("Usage: IfoReader [<dvd-mountpoint> ...]");
      System.exit(1);
    }

    for (String file : args) {
      try {
        IfoReader reader = new IfoReader(new File(file));
        reader.getTitles().forEach(System.out::println);
        System.out.println();
      } catch (IOException ex) {
        ex.printStackTrace();
      }
    }
  }
Пример #3
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;
  }