예제 #1
0
  @Override
  public ArrayList<Class<? extends Player>> getProfiles() {
    ArrayList<Class<? extends Player>> a = new ArrayList<>();
    if (type == AUDIO) {
      PMS r = PMS.get();
      for (String engine : configuration.getEnginesAsList(r.getRegistry())) {
        switch (engine) {
          case MPlayerWebAudio.ID:
            a.add(MPlayerWebAudio.class);
            break;
          case VideoLanAudioStreaming.ID:
            a.add(VideoLanAudioStreaming.class);
            break;
        }
      }
    } else {
      PMS r = PMS.get();
      for (String engine : configuration.getEnginesAsList(r.getRegistry())) {
        switch (engine) {
          case FFmpegWebVideo.ID:
            a.add(FFmpegWebVideo.class);
            break;
          case MEncoderWebVideo.ID:
            a.add(MEncoderWebVideo.class);
            break;
          case VideoLanVideoStreaming.ID:
            a.add(VideoLanVideoStreaming.class);
            break;
          case MPlayerWebVideoDump.ID:
            a.add(MPlayerWebVideoDump.class);
            break;
        }
      }
    }

    return a;
  }
  public void addEngines() {
    ArrayList<Player> disPlayers = new ArrayList<Player>();
    ArrayList<Player> ordPlayers = new ArrayList<Player>();
    PMS r = PMS.get();

    for (String id : configuration.getEnginesAsList(r.getRegistry())) {
      // boolean matched = false;
      for (Player p : PlayerFactory.getAllPlayers()) {
        if (p.id().equals(id)) {
          ordPlayers.add(p);
          // matched = true;
        }
      }
    }

    for (Player p : PlayerFactory.getAllPlayers()) {
      if (!ordPlayers.contains(p)) {
        ordPlayers.add(p);
        disPlayers.add(p);
      }
    }

    for (Player p : ordPlayers) {
      TreeNodeSettings en = new TreeNodeSettings(p.name(), p, null);
      if (disPlayers.contains(p)) {
        en.setEnable(false);
      }
      JComponent jc = en.getConfigPanel();
      if (jc == null) {
        jc = buildEmpty();
      }
      jc.addComponentListener(
          new ComponentAdapter() {
            @Override
            public void componentShown(ComponentEvent e) {
              handleCardComponentChange(e.getComponent());
            }
          });
      tabbedPane.add(en.id(), jc);
      parent[p.purpose()].add(en);
    }

    for (int i = 0; i < tree.getRowCount(); i++) {
      tree.expandRow(i);
    }

    tree.setSelectionRow(0);
  }