Ejemplo n.º 1
0
  public void showExportVideoDialog() {
    List<String> channels = channelListPanel.getSelectedChannels();

    // remove non-data channels
    for (int i = channels.size() - 1; i >= 0; i--) {
      Channel channel = RBNBController.getInstance().getChannel(channels.get(i));
      String mime = channel.getMetadata("mime");
      if (!mime.equals("image/jpeg")) {
        channels.remove(i);
      }
    }

    // don't bring up the dialog if there are no channels specified
    if (channels.isEmpty()) {
      JOptionPane.showMessageDialog(
          null, "There are no video channels selected.", "Error", JOptionPane.ERROR_MESSAGE);
      return;
    }

    new ExportVideoDialog(frame, rbnb, channels);
  }
Ejemplo n.º 2
0
  /**
   * Get the metadata channel tree for the given <code>path</code>. This will populate the channel
   * map with channel objects derived from the metadata. This will recursively make requests for
   * child servers and plugins up to the maximum request depth of {@value #MAX_REQUEST_DEPTH}.
   *
   * @param sink sink the sink connection to the RBNB server
   * @param path the path for the desired metadata
   * @param channels the map to populate with channel objects
   * @param depth the depth of the request
   * @return the metadata channel tree for the given path
   * @throws SAPIException if a server error occurs
   * @see #MAX_REQUEST_DEPTH
   */
  private ChannelTree getChannelTree(
      Sink sink, String path, Map<String, Channel> channels, int depth) throws SAPIException {
    depth++;

    ChannelTree ctree = ChannelTree.EMPTY_TREE;

    ChannelMap markerChannelMap = new ChannelMap();

    ChannelMap cmap = new ChannelMap();

    if (path == null) {
      path = "";
      cmap.Add("...");
    } else {
      cmap.Add(path + "/...");
    }

    sink.RequestRegistration(cmap);

    cmap = sink.Fetch(FETCH_TIMEOUT, cmap);

    if (cmap.GetIfFetchTimedOut()) {
      log.error("Failed to get metadata.  Fetch timed out.");
      return ctree;
    }

    ctree = ChannelTree.createFromChannelMap(cmap);

    // store user metadata in channel objects
    String[] channelList = cmap.GetChannelList();
    for (int i = 0; i < channelList.length; i++) {
      int channelIndex = cmap.GetIndex(channelList[i]);
      if (channelIndex != -1) {
        ChannelTree.Node node = ctree.findNode(channelList[i]);
        String userMetadata = cmap.GetUserInfo(channelIndex);
        Channel channel = new RBNBChannel(node, userMetadata);
        channels.put(channelList[i], channel);

        // look for marker channels
        String mimeType = channel.getMetadata("mime");
        if (mimeType != null && mimeType.compareToIgnoreCase(EventMarker.MIME_TYPE) == 0) {
          markerChannelMap.Add(node.getFullName());
        }
      }
    }

    Iterator<?> it = ctree.iterator();
    while (it.hasNext()) {
      ChannelTree.Node node = (ChannelTree.Node) it.next();
      NodeTypeEnum type = node.getType();

      // look for child servers or plugins and get their channels
      if ((type == ChannelTree.SERVER || type == ChannelTree.PLUGIN)
          && !path.startsWith(node.getFullName())
          && depth < MAX_REQUEST_DEPTH) {
        ChannelTree childChannelTree = getChannelTree(sink, node.getFullName(), channels, depth);
        ctree = childChannelTree.merge(ctree);
      }
    }

    if (markerChannelMap.NumberOfChannels() > 0) {
      double markersDuration = System.currentTimeMillis() / 1000d;

      // request from start of marker channels to now
      sink.Request(markerChannelMap, 0, markersDuration, "absolute");

      markerChannelMap = sink.Fetch(FETCH_TIMEOUT, markerChannelMap);
      if (!markerChannelMap.GetIfFetchTimedOut()) {
        // notify marker listeners
        fireMarkersUpdated(markerChannelMap);
      } else {
        log.error("Failed to get event markers. Fetched timed out.");
      }
    }

    return ctree;
  }