public HideableMediaFrame(String name, int width, int height) { super(name); label.setPreferredSize(new Dimension(width, height)); getContentPane().add(label); this.width = width; this.height = height; pack(); }
viewer.update(nextFrame);
player.viewer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); player.setVisible(true);
public synchronized void showVideoFrame(long timestamp) { if (timestamp >= currentlyShowingRobottimestamp && timestamp < upcomingRobottimestamp) { return; } long videoTimestamp = getVideoTimestamp(timestamp); if (currentlyShowingIndex + 1 < robotTimestamps.length) { upcomingRobottimestamp = robotTimestamps[currentlyShowingIndex + 1]; } else { upcomingRobottimestamp = currentlyShowingRobottimestamp; } try { demuxer.seekToPTS(videoTimestamp); YUVPicture nextFrame = demuxer.getNextFrame(); viewer.update(nextFrame); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public VideoDataPlayer(Camera camera, File dataDirectory, boolean hasTimeBase) throws IOException { this.name = camera.getNameAsString(); this.interlaced = camera.getInterlaced(); this.hasTimebase = hasTimeBase; if (!hasTimebase) { System.err.println("Video data is using timestamps instead of frame numbers. Falling back to seeking based on timestamp."); } videoFile = new File(dataDirectory, camera.getVideoFileAsString()); if (!videoFile.exists()) { throw new IOException("Cannot find video: " + videoFile); } File timestampFile = new File(dataDirectory, camera.getTimestampFileAsString()); parseTimestampData(timestampFile); demuxer = new MP4VideoDemuxer(videoFile); viewer = new HideableMediaFrame(camera.getNameAsString(), demuxer.getWidth(), demuxer.getHeight()); }
public VideoDataPlayer(String name, File dataDirectory, LogProperties logProperties) throws IOException { this.name = name; this.interlaced = logProperties.getInterlaced(name); this.hasTimebase = logProperties.hasTimebase(); if (!hasTimebase) { System.err.println("Video data is using timestamps instead of frame numbers. Falling back to seeking based on timestamp."); } videoFile = new File(dataDirectory, logProperties.getVideoFile(name)); if (!videoFile.exists()) { throw new IOException("Cannot find video: " + videoFile); } File timestampFile = new File(dataDirectory, logProperties.getTimestampFile(name)); parseTimestampData(timestampFile); demuxer = new MP4VideoDemuxer(videoFile); viewer = new HideableMediaFrame(name, demuxer.getWidth(), demuxer.getHeight()); }
@Override public void run() { img = converter.toBufferedImage(nextFrame, img); nextFrame.delete(); ImageIcon icon = new ImageIcon(img); label.setIcon(icon); if (img.getWidth() != width || img.getHeight() != height) { width = img.getWidth(); height = img.getHeight(); label.setPreferredSize(new Dimension(width, height)); pack(); } } });
@Override public void run() { img = converter.toBufferedImage(nextFrame, img); nextFrame.delete(); ImageIcon icon = new ImageIcon(img); label.setIcon(icon); if (img.getWidth() != width || img.getHeight() != height) { width = img.getWidth(); height = img.getHeight(); label.setPreferredSize(new Dimension(width, height)); pack(); } } });
public void setVisible(boolean visible) { viewer.setVisible(visible); }
public HideableMediaFrame(String name, int width, int height) { super(name); label.setPreferredSize(new Dimension(width, height)); getContentPane().add(label); this.width = width; this.height = height; pack(); }
public void setVisible(boolean visible) { viewer.setVisible(visible); }