Commit a8129f5e authored by ludwig's avatar ludwig

increased the Framerate of the player

git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@118 0463f305-d864-43cb-8a47-61cf597d4139
parent c671f1dd
<?xml version="1.0" encoding="UTF-8"?>
<preferences>
<sf.eclipse.odt.core.builder.stores.SourcePaths>
<source-folders/>
</sf.eclipse.odt.core.builder.stores.SourcePaths>
<sf.eclipse.odt.core.builder.stores.BinaryPaths>
<binary-folder>/TTT/bin</binary-folder>
</sf.eclipse.odt.core.builder.stores.BinaryPaths>
<sf.eclipse.odt.core.builder.stores.BuilderConfigurationStore>
<builder-configurations>
<configuration>
<id>CFG-369842239</id>
<name>project builder configuration</name>
<is-project-configuration/>
<compilation-profile>BYTECODE</compilation-profile>
</configuration>
</builder-configurations>
</sf.eclipse.odt.core.builder.stores.BuilderConfigurationStore>
<sf.eclipse.odt.core.builder.stores.ExecutableStore>
<executables/>
</sf.eclipse.odt.core.builder.stores.ExecutableStore>
<sf.eclipse.odt.core.builder.stores.GrammarStore>
<grammars/>
</sf.eclipse.odt.core.builder.stores.GrammarStore>
</preferences>
......@@ -367,17 +367,7 @@ public class Recorder implements MessageConsumer, Closeable {
System.out.println("\nRecorder start.");
System.out.println(" Recording desktop to '" + file.getCanonicalPath() + "'");
// modified by Ziewer - 10.05.2007
//
// WAS
// // TODO: sync start - maybe start after ttt header is written but BEFORE startime is written
// if (audioVideoRecorder != null)
// audioVideoRecorder.startRec(file.getCanonicalPath());
//
// // prepare recording
// writeHeader(file.getCanonicalPath());
// END WAS
// prepare recording
DataOutputStream new_out = writeHeader(file.getCanonicalPath());
......@@ -522,22 +512,7 @@ public class Recorder implements MessageConsumer, Closeable {
// no extensions
out.writeInt(0);
// modified by Ziewer - 10.05.2007
//
// WAS
// // startime
// long starttime = System.currentTimeMillis();
// out.writeLong(starttime);
//
// // offset to adjust timestamps
// offset = (int) (protocol.getStarttime() - starttime);
//
// out.flush();
//
// // make visible for message handler
// this.out = out;
// END WAS
//
out.flush();
return out;
// end of modification by Ziewer - 10.05.2007
......
This diff is collapsed.
......@@ -147,9 +147,10 @@ public class TTT extends JFrame {
System.out.println(ABOUT);
setJMenuBar(createMenu());
desktop = new JDesktopPane();
setContentPane(desktop);
desktop.setVisible(true);
// attempt to close all open files before closing
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
......@@ -326,7 +327,7 @@ public class TTT extends JFrame {
menu.setMnemonic(KeyEvent.VK_T);
menuBar.add(menu);
menuItem = new JMenuItem("present & record");
menuItem = new JMenuItem("Start Recording");
menuItem.setToolTipText("start presenter with recording feature");
menuItem.setIcon(Constants.getIcon("16x16/mix_record.png"));
menuItem.setMnemonic(KeyEvent.VK_R);
......
......@@ -243,11 +243,12 @@ public class AudioVideoPlayer {
// set playback to new time
public void setTime(int time) {
// linear sync of audio preplay
// linear sync of audio preplay
if (recording.desktop_replay_factor_sync)
player.setMediaTime(new Time((long) ((time + replayOffset) / replayRatio) * 1000000l));
else
player.setMediaTime(new Time(time * 1000000l));
}
// playback control
......
......@@ -123,7 +123,7 @@ public class JSAAudioRecorder extends Thread implements IAudioRecorder {
throw new IOException("audio source unavailable");
}
audioInputStream = new AudioInputStream(targetDataLine);
targetType = AudioFileFormat.Type.WAVE;
targetType = AudioFileFormat.Type. WAVE;
}
public void startRecording(File file) {
......
......@@ -180,7 +180,6 @@ public class GraphicsContext extends JComponent implements GraphicInterface, Mes
//MODMSG : changed return type to BufferedImage
public BufferedImage getScreenshotWithoutAnnotations() {
BufferedImage screenshot;
// Create a buffered image using the default color model
screenshot = new BufferedImage(prefs.framebufferWidth, prefs.framebufferHeight, BufferedImage.TYPE_INT_RGB);
......
......@@ -706,7 +706,7 @@ public class Index {
ProgressMonitor progressMonitor = null;
if (!batch && ShowProgressMonitor) {
// show progress
String text = mode == ScriptCreator.THUMBNAILS ? "Computing thumbnails" : "Computing screenshots";
String text = mode == ScriptCreator.THUMBNAILS ? "Computing thumbnails" : "Computing screenshots";
progressMonitor = new ProgressMonitor(TTT.getRootComponent(), text, null, 0, index.size());
progressMonitor.setMillisToDecideToPopup(100);
progressMonitor.setMillisToPopup(100);
......@@ -718,9 +718,10 @@ public class Index {
if(scriptCreator != null)
scriptCreator = new ScriptCreator(recording, mode);
PDFHelper pdfHelper = null;
if ((mode & ScriptCreator.PDF_SCRIPT) != 0) {
// generate PDF helper
// check whether the iText-library is installed or not
if (LibraryChecker.isITextPdfLibraryInstalled()) {
......@@ -746,7 +747,7 @@ public class Index {
// measure time
long t = System.currentTimeMillis();
boolean isCanceled = false;
// compute
if (mode != 0)
for (int i = 0; i < index.size(); i++) {
......@@ -777,6 +778,8 @@ public class Index {
}
// set time of index
IndexEntry indexEntry = index.get(i);
recording.setTime(indexEntry.getTimestamp());
// create screenshot
......@@ -785,6 +788,7 @@ public class Index {
// set thumbnail
if ((mode & ScriptCreator.THUMBNAILS) != 0) {
// faster image scaling
Image thumbnail = ScriptCreator.getScaledInstance(screenshot, recording.prefs.framebufferWidth
/ thumbnail_scale_factor, recording.prefs.framebufferHeight / thumbnail_scale_factor);
......@@ -826,7 +830,6 @@ public class Index {
}
}
}
// close pdf document
if (((mode & ScriptCreator.PDF_SCRIPT) != 0) && pdfHelper != null) {
try {
......
......@@ -115,8 +115,9 @@ public class PlaybackControls extends GradientPanel implements TimeChangedListen
break;
default:
if (event >= 0)
if (event >= 0){
timeSlider.setValue(event, false);
}
else
// index
if (recording.indexViewer != null)
......@@ -124,7 +125,6 @@ public class PlaybackControls extends GradientPanel implements TimeChangedListen
}
}
private VolumeSlider volumeSlider;
// initialize GUI
......
......@@ -38,133 +38,146 @@ import ttt.Constants;
import ttt.record.Recording;
/***********************************************************************************************************************
* using own listener handling, to allow setting a value without releasing an event
* using own listener handling, to allow setting a value without releasing an
* event
**********************************************************************************************************************/
public class TimeSlider extends JSlider {
// own change event including timestamp and adjustment flag
private MyChangeEvent changeEvent = new MyChangeEvent(this);
// label to display time
private JLabel timeLabel;
public TimeSlider(final Recording recording, JLabel timeLabel) {
super(HORIZONTAL, 0, recording.getDuration(), 0);
setBackground(Color.WHITE);
setMajorTickSpacing(10 * 60000);
setMinorTickSpacing(5 * 60000);
setPaintTicks(true);
setToolTipText("Adjust playback time");
// label to display time
this.timeLabel = timeLabel;
// pass event handling to recording
addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(ChangeEvent e) {
recording.sliderStateChanged(e);
}
});
// handle clicking on the slider track to set playback time
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
// only set the timeSlider to the selected value if significantly different from current value
// don't want it being set if the user is only trying to click on the thumb
int newValue = getMaximum() / getWidth() * e.getX();
int difference = newValue - getValue();
if (difference < 0)
difference = -difference;
if (difference > (getMaximum() - getMinimum()) / 100)
setValue((int) newValue);
// set focus back to main compinent
recording.graphicsContext.requestFocusInWindow();
}
});
}
// /////////////////////////////////////////////////////////
// listener handling
// /////////////////////////////////////////////////////////
// use own listener handling to control event firing
private ArrayList<ChangeListener> changedListeners = new ArrayList<ChangeListener>();
// register listener
public void addChangeListener(ChangeListener listener) {
changedListeners.add(listener);
}
// unregister listener
public void removeChangeListener(ChangeListener listener) {
changedListeners.remove(listener);
}
// fire event
// NOTE: cannot override fireStateChanged(), because this will be called by other JSlider methods
private void myFireStateChanged() {
for (int i = 0; i < changedListeners.size(); i++)
changedListeners.get(i).stateChanged(changeEvent);
}
// /////////////////////////////////////////////////////////////////////////
// setting value and firing events
// /////////////////////////////////////////////////////////////////////////
// override set value
public void setValue(int value) {
setValue(value, true);
}
// set value with or without firing an event
synchronized public void setValue(int value, boolean fireEvent) {
// ignore during adjustment
if (!fireEvent && getValueIsAdjusting())
return;
// ignore event caused by clicking on slider or if player paused (causing one msec steps)
switch (getValue() - value) {
case -1:
case 0:
case 1:
return;
}
// update slider and label
super.setValue(value);
if (timeLabel != null)
timeLabel.setText(Constants.getStringFromTime(value, false));
// fire event with given value
if (fireEvent) {
changeEvent.time = value;
myFireStateChanged();
}
}
// adjusting
public void setValueIsAdjusting(boolean adjusting) {
super.setValueIsAdjusting(adjusting);
changeEvent.adjusting = adjusting;
// event is only needed for end of adjustment (causes setting audio time)
if (!adjusting)
myFireStateChanged();
}
// ///////////////////////////////////////////////////////////////////////
// change event class
// ///////////////////////////////////////////////////////////////////////
// change event including timestamp and adjustment flag
public class MyChangeEvent extends ChangeEvent {
public int time;
public boolean adjusting;
public MyChangeEvent(Object object) {
super(object);
}
}
// own change event including timestamp and adjustment flag
private MyChangeEvent changeEvent = new MyChangeEvent(this);
// label to display time
private JLabel timeLabel;
public TimeSlider(final Recording recording, JLabel timeLabel) {
super(HORIZONTAL, 0, recording.getDuration(), 0);
setBackground(Color.WHITE);
setMajorTickSpacing(10 * 60000);
setMinorTickSpacing(5 * 60000);
setPaintTicks(true);
setToolTipText("Adjust playback time");
// label to display time
this.timeLabel = timeLabel;
// pass event handling to recording
addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(ChangeEvent e) {
recording.sliderStateChanged(e);// , recording);
// recording.sliderStateChanged(e);
}
});
// handle clicking on the slider track to set playback time
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
// only set the timeSlider to the selected value if
// significantly different from current value
// don't want it being set if the user is only trying to click
// on the thumb
int newValue = getMaximum() / getWidth() * e.getX();
int difference = newValue - getValue();
if (difference < 0) {
difference = -difference;
}
if (difference > (getMaximum() - getMinimum()) / 100) {
setValue((int) newValue);
}
// set focus back to main compinent
recording.graphicsContext.requestFocusInWindow();
}
});
}
// /////////////////////////////////////////////////////////
// listener handling
// /////////////////////////////////////////////////////////
// use own listener handling to control event firing
private ArrayList<ChangeListener> changedListeners = new ArrayList<ChangeListener>();
// register listener
public void addChangeListener(ChangeListener listener) {
changedListeners.add(listener);
}
// unregister listener
public void removeChangeListener(ChangeListener listener) {
changedListeners.remove(listener);
}
// fire event
// NOTE: cannot override fireStateChanged(), because this will be called by
// other JSlider methods
private void myFireStateChanged() {
for (int i = 0; i < changedListeners.size(); i++)
changedListeners.get(i).stateChanged(changeEvent);
}
// /////////////////////////////////////////////////////////////////////////
// setting value and firing events
// /////////////////////////////////////////////////////////////////////////
// override set value
public void setValue(int value) {
setValue(value, true);
}
// set value with or without firing an event
synchronized public void setValue(int value, boolean fireEvent) {
// ignore during adjustment
if (!fireEvent && getValueIsAdjusting())
return;
// ignore event caused by clicking on slider or if player paused
// (causing one msec steps)
switch (getValue() - value) {
case -1:
case 0:
case 1:
return;
}
// update slider and label
super.setValue(value);
if (timeLabel != null)
timeLabel.setText(Constants.getStringFromTime(value, false));
// fire event with given value
if (fireEvent) {
changeEvent.time = value;
myFireStateChanged();
}
}
// adjusting
public void setValueIsAdjusting(boolean adjusting) {
super.setValueIsAdjusting(adjusting);
changeEvent.adjusting = adjusting;
// event is only needed for end of adjustment (causes setting audio
// time)
if (!adjusting)
myFireStateChanged();
}
// ///////////////////////////////////////////////////////////////////////
// change event class
// ///////////////////////////////////////////////////////////////////////
// change event including timestamp and adjustment flag
public class MyChangeEvent extends ChangeEvent {
public int time;
public boolean adjusting;
public MyChangeEvent(Object object) {
super(object);
}
}
}
......@@ -85,6 +85,7 @@ public class ScriptCreator {
System.out.println("\nERROR: Script generation failed. Could not create directories.\n");
}
}
}
public ScriptCreator(Recording recording, int mode, String ocrPath) throws IOException {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment