Index: /applications/editors/josm/plugins/videomapping/.classpath
===================================================================
--- /applications/editors/josm/plugins/videomapping/.classpath	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/.classpath	(revision 21631)
@@ -5,9 +5,11 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
-	<classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/vlcj-1.1f.jar">
+	<classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/jna.jar"/>
+	<classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/vlcj-1.1h.jar">
 		<attributes>
-			<attribute name="javadoc_location" value="jar:file:/C:/Dokumente und Einstellungen/g/Eigene Dateien/Workspace/vlcj/vlcj-1.1f-javadoc.jar!/"/>
+			<attribute name="javadoc_location" value="jar:file:/D:/Projekte/Studium/GeoProjekt/working/vlcj/vlcj-1.1h-javadoc.jar!/"/>
 		</attributes>
 	</classpathentry>
+	<classpathentry kind="lib" path="D:/Projekte/Studium/GeoProjekt/working/VideoMapping/lib/log4j.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java
===================================================================
--- /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/GpsPlayer.java	(revision 21631)
@@ -19,4 +19,6 @@
 	private WayPoint prev,curr,next;
 	private WayPoint start;
+	private Timer t;
+	private TimerTask ani; //for moving trough the list
 	
 
@@ -36,4 +38,5 @@
 		super();
 		this.ls = l;
+		//set start position
 		start=ls.get(0);
 		prev=null;
@@ -42,4 +45,5 @@
 	}
 	
+	// one secure step forward
 	public void next() {		
 		if(ls.indexOf(curr)+1<ls.size())
@@ -54,4 +58,5 @@
 	}
 	
+	//one secure step backward
 	public void prev()
 	{
@@ -65,4 +70,5 @@
 	}
 	
+	//select the given waypoint as center
 	public void jump(WayPoint p)
 	{
@@ -83,13 +89,14 @@
 	}
 	
-	public void jump(int t)
-	{
-		if ((ls.indexOf(curr)+t>0)&&(ls.indexOf(curr)<ls.size()))
-		{
-			jump(ls.get(ls.indexOf(curr)+t)); //FIXME here is a bug
+	//select the k-th waypoint
+	public void jump(int k)
+	{
+		if ((ls.indexOf(curr)+k>0)&&(ls.indexOf(curr)<ls.size()))
+		{
+			jump(ls.get(ls.indexOf(curr)+k)); //FIXME here is a bug
 		}		
 	}
 	
-	//gets only points on the line of the GPS track between waypoints nearby the point m
+	//gets only points on the line of the GPS track (between waypoints) nearby the point m
 	private Point getInterpolated(Point m)
 	{
@@ -145,4 +152,5 @@
 	}
 	
+	//returns a point on the p% of the current selected segment
 	private Point getInterpolated(float percent)
 	{
@@ -150,5 +158,5 @@
 		int dX,dY;
 		Point p;
-		Point leftP,rightP,highP,lowP;
+		Point leftP,rightP;
 		Point c = Main.map.mapView.getPoint(getCurr().getEastNorth());
 		Point p1 = Main.map.mapView.getPoint(getCurr().getEastNorth());
@@ -157,6 +165,4 @@
 		leftP=getLeftPoint(p1, p2);
 		rightP=getRightPoint(p1,p2);
-		highP=getHighPoint(p1, p2);
-		lowP=getLowPoint(p1, p2);
 		//we will never go over the segment
 		percent=percent/100;
@@ -200,5 +206,5 @@
 		old=old+inc;
 		Date t = new Date(old);
-		w.time = t.getTime()/1000; //TODO need better way to set time
+		w.time = t.getTime()/1000; //TODO need better way to set time and sync it
 		SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss:S");
 		/*System.out.print(length+"px ");
@@ -211,4 +217,5 @@
 	}
 
+	//returns a point and time for the current segment
 	private WayPoint getInterpolatedWaypoint(float percentage)
 	{
@@ -218,4 +225,5 @@
 	}
 	
+	//returns n points on the current segment
 	public List<WayPoint> getInterpolatedLine(int interval)
 	{
@@ -281,4 +289,5 @@
 	}
 
+	//returns time in ms relatie to startpoint
 	public long getRelativeTime()
 	{
@@ -286,8 +295,36 @@
 	}
 
-	//jumps to a speciffic time
+	//jumps to a specific time
 	public void jump(long relTime) {
-		jump(relTime/1000);		//TODO ugly quick hack	
-		
+		int pos = (int) (relTime/1000);//TODO ugly quick hack	
+		jump(pos);		
+		
+	}
+	
+	//toggles walking along the track
+	public void play()
+	{
+		if (t==null)
+		{
+			//start
+			t= new Timer();
+			ani=new TimerTask() {			
+				@Override
+				//some cheap animation stuff
+				public void run() {				
+					next();
+					Main.map.mapView.repaint();
+				}
+			};
+			t.schedule(ani,1000,1000);			
+		}
+		else
+		{
+			//stop
+			ani.cancel();
+			ani=null;
+			t.cancel();
+			t=null;					
+		}
 	}
 	
Index: /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java
===================================================================
--- /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/PositionLayer.java	(revision 21631)
@@ -44,26 +44,28 @@
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
 import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.plugins.videomapping.video.GPSVideoPlayer;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Shortcut;
 
-public class PositionLayer extends Layer implements MouseListener,MouseMotionListener, KeyListener {
+//Basic rendering and GPS layer interaction
+public class PositionLayer extends Layer implements MouseListener,MouseMotionListener {
 	private List<WayPoint> ls;
-	public GpsPlayer l;
-	private Collection<WayPoint> selected;
-	private Timer t;
-	private TimerTask ani;
+	public GpsPlayer player;
 	private boolean dragIcon=false; //do we move the icon by hand?
 	private WayPoint iconPosition;
 	private Point mouse;
 	private ImageIcon icon;
-	private SimpleDateFormat df;
+	private SimpleDateFormat mins;
+	private SimpleDateFormat ms;
+	private GPSVideoPlayer gps;
 		
 	public PositionLayer(String name, final List<WayPoint> ls) {
 		super(name);
 		this.ls=ls;
-		l= new GpsPlayer(ls);
-		selected = new ArrayList<WayPoint>();
+		player= new GpsPlayer(ls);
+
 		icon=ImageProvider.get("videomapping.png");
-		df = new SimpleDateFormat("hh:mm:ss:S");
+		mins = new SimpleDateFormat("hh:mm:ss:S");
+		ms= new SimpleDateFormat("mm:ss");
 		Main.map.mapView.addMouseListener(this);
 		Main.map.mapView.addMouseMotionListener(this);							
@@ -79,5 +81,4 @@
 	@Override
 	public Object getInfoComponent() {
-		// TODO Auto-generated method stub
 		return null;
 	}
@@ -115,5 +116,5 @@
 	
 	@Override
-	//Draw the current position
+	//Draw the current position, infos, waypoints
 	public void paint(Graphics2D g, MapView map, Bounds bound) {
 		Point p;
@@ -126,25 +127,18 @@
 			g.drawOval(p.x - 2, p.y - 2, 4, 4);
 			}
-		g.setColor(Color.RED);
-		//draw selected GPS points
-		for(WayPoint n:selected)
-		{
-			p = Main.map.mapView.getPoint(n.getEastNorth());
-			g.drawOval(p.x - 2, p.y - 2, 4, 4);
-		}
 		//draw surrounding points
 		g.setColor(Color.YELLOW);
-		if(l.getPrev()!=null)
-		{
-			p = Main.map.mapView.getPoint(l.getPrev().getEastNorth());
+		if(player.getPrev()!=null)
+		{
+			p = Main.map.mapView.getPoint(player.getPrev().getEastNorth());
 			g.drawOval(p.x - 2, p.y - 2, 4, 4);
-			Point p2 = Main.map.mapView.getPoint(l.getCurr().getEastNorth());
+			Point p2 = Main.map.mapView.getPoint(player.getCurr().getEastNorth());
 			g.drawLine(p.x, p.y, p2.x, p2.y);
 		}
-		if(l.getNext()!=null)
-		{
-			p = Main.map.mapView.getPoint(l.getNext().getEastNorth());
+		if(player.getNext()!=null)
+		{
+			p = Main.map.mapView.getPoint(player.getNext().getEastNorth());
 			g.drawOval(p.x - 2, p.y - 2, 4, 4);
-			Point p2 = Main.map.mapView.getPoint(l.getCurr().getEastNorth());
+			Point p2 = Main.map.mapView.getPoint(player.getCurr().getEastNorth());
 			g.drawLine(p.x, p.y, p2.x, p2.y);
 		}
@@ -152,5 +146,5 @@
 		g.setColor(Color.CYAN);
 		g.setBackground(Color.CYAN);
-		LinkedList<WayPoint> ipo=(LinkedList<WayPoint>) l.getInterpolatedLine(5);
+		LinkedList<WayPoint> ipo=(LinkedList<WayPoint>) player.getInterpolatedLine(5);
 		for (WayPoint wp : ipo) {
 			p=Main.map.mapView.getPoint(wp.getEastNorth());
@@ -166,32 +160,15 @@
 				p=Main.map.mapView.getPoint(iconPosition.getEastNorth());
 				icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);				
-				g.drawString(df.format(iconPosition.getTime()),p.x,p.y);
+				g.drawString(mins.format(iconPosition.getTime()),p.x-10,p.y-10);
 			}
 		}
 		else
 		{
-			if (l.getCurr()!=null){
-			p=Main.map.mapView.getPoint(l.getCurr().getEastNorth());
-			icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);
-			SimpleDateFormat ms=new SimpleDateFormat("mm:ss");
-			g.drawString(ms.format(l.getRelativeTime()),p.x,p.y);
-			}
-		}
-	}
-	
-	private void markNearestWayPoints(Point mouse) {
-		final int MAX=10; 
-		Point p;		
-		Rectangle rect = new Rectangle(mouse.x-MAX/2,mouse.y-MAX/2,MAX,MAX);
-		//iterate through all possible notes
-		for(WayPoint n : ls)
-		{
-			p = Main.map.mapView.getPoint(n.getEastNorth());
-			if (rect.contains(p))
-			{				
-				selected.add(n);
-			}
-			
-		}	
+			if (player.getCurr()!=null){
+			p=Main.map.mapView.getPoint(player.getCurr().getEastNorth());
+			icon.paintIcon(null, g, p.x-icon.getIconWidth()/2, p.y-icon.getIconHeight()/2);			
+			g.drawString(ms.format(player.getRelativeTime()),p.x-10,p.y-10);
+			}
+		}
 	}
 	
@@ -215,11 +192,18 @@
 	}
 	
+	//upper left corner like rectangle
+	private Rectangle getIconRect()
+	{
+		Point p = Main.map.mapView.getPoint(player.getCurr().getEastNorth());
+		return new Rectangle(p.x-icon.getIconWidth()/2,p.y-icon.getIconHeight()/2,icon.getIconWidth(),icon.getIconHeight());
+	}
+
+
 	@Override
 	public void visitBoundingBox(BoundingXYVisitor arg0) {
-		// TODO dunno what to do here
-
-	}
-
-	//mark selected points
+		// TODO don't know what to do here
+
+	}
+
 	public void mouseClicked(MouseEvent e) {		
 	}
@@ -231,8 +215,9 @@
 	}
 
+	//init drag&drop
 	public void mousePressed(MouseEvent e) {
 		if(e.getButton() == MouseEvent.BUTTON1) {
 			//is it on the cam icon?
-			if (l.getCurr()!=null)
+			if (player.getCurr()!=null)
 			{
 				if (getIconRect().contains(e.getPoint()))
@@ -246,8 +231,8 @@
 		
 	}
-
-	public void mouseReleased(MouseEvent e) {
-		
-		//only on leftclicks of our layer
+	
+	//
+	public void mouseReleased(MouseEvent e) {		
+		//only leftclicks on our layer
 		if(e.getButton() == MouseEvent.BUTTON1) {
 			if(dragIcon)
@@ -257,10 +242,10 @@
 			else
 			{
-				//JOptionPane.showMessageDialog(Main.parent,"test");
-				markNearestWayPoints(e.getPoint());
+				//simple click
 				WayPoint wp = getNearestWayPoint(e.getPoint());
 				if(wp!=null)
 				{
-					l.jump(wp);			
+					player.jump(wp);
+					if(gps!=null) gps.notifyGPSClick();
 				}
 			}
@@ -270,5 +255,5 @@
 	}
 	
-	
+	//slide and restrict during movement
 	public void mouseDragged(MouseEvent e) {		
 		if(dragIcon)
@@ -276,5 +261,5 @@
 			mouse=e.getPoint();
 			//restrict to GPS track
-			iconPosition=l.getInterpolatedWaypoint(mouse);
+			iconPosition=player.getInterpolatedWaypoint(mouse);
 
 			Main.map.mapView.repaint();
@@ -282,13 +267,7 @@
 	}
 
-	private Rectangle getIconRect()
-	{
-		Point p = Main.map.mapView.getPoint(l.getCurr().getEastNorth());
-		return new Rectangle(p.x-icon.getIconWidth()/2,p.y-icon.getIconHeight()/2,icon.getIconWidth(),icon.getIconHeight());
-	}
-	
+	//visualize drag&drop
 	public void mouseMoved(MouseEvent e) {		
-		
-		if (l.getCurr()!=null)
+		if (player.getCurr()!=null)
 		{						
 			if (getIconRect().contains(e.getPoint()))
@@ -304,78 +283,7 @@
 	}
 
-	public void keyPressed(KeyEvent e) {
-		int i;
-		System.out.println(e.getKeyCode());
-		switch(e.getKeyCode())
-		{
-			case KeyEvent.VK_RIGHT:
-				{
-					l.jump(1);
-				};break;
-			case KeyEvent.VK_LEFT:
-			{
-				l.jump(-1);
-
-			};break;
-			case KeyEvent.VK_SPACE:
-			{
-				ani.cancel();
-			}
-		}
-		
-	}
-
-	public void keyReleased(KeyEvent e) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void keyTyped(KeyEvent e) {
-		// TODO Auto-generated method stub
-		
-	}
-	
-	public void pause()
-	{
-		if (t==null)
-		{
-			//start
-			t= new Timer();
-			TimerTask ani=new TimerTask() {			
-				@Override
-				//some cheap animation stuff
-				public void run() {				
-					l.next();
-					Main.map.mapView.repaint();
-				}
-			};
-			t.schedule(ani,500,500);
-			//and video
-			
-		}
-		else
-		{
-			//stop
-			t.cancel();
-			t=null;					
-		}
-	}
-
-
-	public void backward() {
-		if(l!=null)l.prev();
-		Main.map.mapView.repaint();
-	}
-	
-	public void forward() {
-		if(l!=null)l.next();
-		Main.map.mapView.repaint();
-	}
-
-
-	public void loop() {
-		// TODO Auto-generated method stub
-		
-	}
-
+	public void setGPSPlayer(GPSVideoPlayer player) {
+		this.gps = player;
+		
+	}
 }
Index: /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java
===================================================================
--- /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoMappingPlugin.java	(revision 21631)
@@ -37,4 +37,6 @@
  * This Plugin allows you to link a video against a GPS track and playback both synchronously 
  */
+
+//Here we manage properties and start the other classes
 public class VideoMappingPlugin extends Plugin implements LayerChangeListener{
 	  private JMenu VMenu;
@@ -42,6 +44,6 @@
 	  private List<WayPoint> ls;
 	  private JosmAction VAdd,VStart,Vbackward,Vforward,Vloop;
-	  private GPSVideoPlayer video;
-	private PositionLayer layer;
+	  private GPSVideoPlayer player;
+	  private PositionLayer layer;
 	  
 
@@ -97,8 +99,9 @@
 			public void actionPerformed(ActionEvent arg0) {
 				copyGPSLayer();
+				enableControlMenus(true);
 				layer = new PositionLayer("test",ls);
-				Main.main.addLayer(layer);
-				enableControlMenus(true);
-				video = new GPSVideoPlayer(new File("C:\\temp\\test.mpg"), layer.l);
+				Main.main.addLayer(layer);				
+				player = new GPSVideoPlayer(new File("C:\\temp\\test.mpg"), layer.player);
+				layer.setGPSPlayer(player);
 			}
 		};
@@ -107,8 +110,9 @@
 			
 			public void actionPerformed(ActionEvent e) {								
-				video.play();				
-				video.jump(605000);
-				layer.l.jump(9*60+20);
-				layer.pause();
+				//video.play();				
+				//video.jump(605000);
+				//layer.l.jump(9*60+20);
+				//layer.pause();
+				player.play((9*60+20)*1000);
 			}
 		};
@@ -117,5 +121,5 @@
 			
 			public void actionPerformed(ActionEvent e) {
-				layer.backward();
+				//layer.backward();
 							
 			}
@@ -125,5 +129,5 @@
 			
 			public void actionPerformed(ActionEvent e) {
-				layer.forward();
+				//layer.forward();
 							
 			}
@@ -133,5 +137,5 @@
 			
 			public void actionPerformed(ActionEvent e) {
-				layer.loop();
+				//layer.loop();
 							
 			}
@@ -147,5 +151,5 @@
 	
 	
-	//we can only move on our layer
+	//we can only work on our own layer
 	private void enableControlMenus(boolean enabled)
 	{
Index: /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoFile.java
===================================================================
--- /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoFile.java	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoFile.java	(revision 21631)
@@ -4,5 +4,5 @@
 // a specific synced video
 public class GPSVideoFile extends File{
-	public long offset;
+	public long offset; //time difference in ms between GPS and Video track
 	
 	public GPSVideoFile(File f, long offset) {
Index: /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java
===================================================================
--- /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java	(revision 21631)
@@ -1,32 +1,106 @@
 package org.openstreetmap.josm.plugins.videomapping.video;
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.io.File;
 import java.util.Timer;
 import java.util.TimerTask;
 
+import javax.swing.JButton;
+
+import org.openstreetmap.josm.command.AddCommand;
+import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.plugins.videomapping.GpsPlayer;
 
-
-public class GPSVideoPlayer extends SimpleVideoPlayer{
+//combines video and GPS playback
+public class GPSVideoPlayer{
 	Timer t;
 	TimerTask syncGPSTrack;
-	private GpsPlayer pl;
+	private GpsPlayer gps;
+	private SimpleVideoPlayer video;
+	private JButton syncBtn;
 	private GPSVideoFile file;
+	private boolean synced=false; //do we playback the players together?
+	
 
 	public GPSVideoPlayer(File f, final GpsPlayer pl) {
 		super();
-		this.pl = pl;
-		this.file = new GPSVideoFile(f, (long)0);//10,05
-		setFile(file.getAbsoluteFile());
-		t = new Timer();
-		syncGPSTrack= new TimerTask() {
-			
-			@Override
-			public void run() {
-				pl.next();
-				//pl.jump(file.offset+)
-				
+		this.gps = pl;
+		//test sync
+		video = new SimpleVideoPlayer();
+		/*
+		long gpsT=(9*60+20)*1000;
+		long videoT=10*60*1000+5*1000;
+		setFile(new GPSVideoFile(f, gpsT-videoT)); */
+		setFile(new GPSVideoFile(f, 0L));
+		//extend GUI
+		syncBtn= new JButton("sync");
+		syncBtn.setBackground(Color.RED);
+		syncBtn.addActionListener(new ActionListener() {
+			//do a sync
+			public void actionPerformed(ActionEvent e) {
+				long diff=gps.getRelativeTime()-video.getTime();
+				file= new GPSVideoFile(file, diff);
+				syncBtn.setBackground(Color.GREEN);
+				synced=true;
+				gps.play();
 			}
-		};
-		//t.schedule(syncGPSTrack, 1000, 1000);
+		});
+		setSyncMode(true);
+		video.addComponent(syncBtn);
+		t = new Timer();		
 	}
+	
+	public void setSyncMode(boolean b)
+	{
+		if(b)
+		{
+			syncBtn.setVisible(true);
+		}
+		else
+		{
+			syncBtn.setVisible(false);
+		}
+	}
+	
+		
+	public void setFile(GPSVideoFile f)
+	{
+		
+		file=f;
+		video.setFile(f.getAbsoluteFile());
+		video.play();
+	}
+	
+	public void play(long gpsstart)
+	{
+		jumpToGPSTime(gpsstart);
+		gps.jump(gpsstart);
+		gps.play();
+	}
+	
+	//jumps in video to the corresponding linked time
+	public void jumpToGPSTime(long gpsT)
+	{
+		video.jump(getVideoTime(gpsT));
+	}
+	
+	//calc synced timecode from video
+	private long getVideoTime(long GPStime)
+	{
+		return GPStime-file.offset;
+	}
+	
+	//calc corresponding GPS time
+	private long getGPSTime(long videoTime)
+	{
+		return videoTime+file.offset;
+	}
+
+	//when we clicked on the layer, here we update the video position
+	public void notifyGPSClick() {
+		if(synced) jumpToGPSTime(gps.getRelativeTime());
+		
+	}
+	
 }
Index: /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/SimpleVideoPlayer.java
===================================================================
--- /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/SimpleVideoPlayer.java	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/SimpleVideoPlayer.java	(revision 21631)
@@ -22,4 +22,5 @@
 import javax.swing.Action;
 import javax.swing.JButton;
+import javax.swing.JComponent;
 import javax.swing.JFrame;
 import javax.swing.JPanel;
@@ -79,5 +80,5 @@
 		    df = new SimpleDateFormat("hh:mm:ss:S");
 		    scr=new Canvas();
-		    timeline = new JSlider(0,100,0);
+		    timeline = new JSlider(0,100,0); //TODO better setup for ticks
 		    play= new JButton("play");
 		    back= new JButton("<");
@@ -99,5 +100,5 @@
 			//set updater
 			ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
-			executorService.scheduleAtFixedRate(new Syncer(this), 0L, 500L, TimeUnit.MILLISECONDS);
+			executorService.scheduleAtFixedRate(new Syncer(this), 0L, 1000L, TimeUnit.MILLISECONDS);
 		    //setDefaultCloseOperation(EXIT_ON_CLOSE);
 			addWindowListener(this);
@@ -209,26 +210,23 @@
 
 	public void finished(MediaPlayer arg0) {
-		// TODO Auto-generated method stub
-		
+			
 	}
 
 	public void lengthChanged(MediaPlayer arg0, long arg1) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void metaDataAvailable(MediaPlayer arg0, VideoMetaData arg1) {
-		// TODO Auto-generated method stub
-		
+
+	}
+
+	public void metaDataAvailable(MediaPlayer arg0, VideoMetaData data) {
+		scr.setSize(data.getVideoDimension());
+		pack();
+
 	}
 
 	public void paused(MediaPlayer arg0) {
-		// TODO Auto-generated method stub
-		
+
 	}
 
 	public void playing(MediaPlayer arg0) {
-		// TODO Auto-generated method stub
-		
+
 	}
 
@@ -238,23 +236,15 @@
 
 	public void stopped(MediaPlayer arg0) {
-		// TODO Auto-generated method stub
-		
+				
 	}
 
 	public void timeChanged(MediaPlayer arg0, long arg1) {
-		// TODO Auto-generated method stub
-		
-	}
-	
-
-	public void windowActivated(WindowEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void windowClosed(WindowEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
+
+	}
+	
+
+	public void windowActivated(WindowEvent arg0) {	}
+
+	public void windowClosed(WindowEvent arg0) {	}
 
 	//we have to unload and disconnect to the VLC engine
@@ -266,32 +256,17 @@
       }
 
-	public void windowDeactivated(WindowEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void windowDeiconified(WindowEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void windowIconified(WindowEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void windowOpened(WindowEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}	
+	public void windowDeactivated(WindowEvent arg0) {	}
+
+	public void windowDeiconified(WindowEvent arg0) {	}
+
+	public void windowIconified(WindowEvent arg0) {	}
+
+	public void windowOpened(WindowEvent arg0) {	}	
 	
 	public void setFile(File f)
 	{
 		String mediaPath = f.getAbsoluteFile().toString();
-		mp.playMedia(mediaPath, mediaOptions);
-		jump(8000);
-		jump(0);
-		mp.stop();
-		pack();
+		mp.playMedia(mediaPath, mediaOptions);		
+		pack();	
 	}
 	
@@ -330,4 +305,11 @@
 	}
 	
+	//allow externals to extend the ui
+	public void addComponent(JComponent c)
+	{
+		controlsPanel.add(c);
+		pack();
+	}
+	
 
 }
Index: /applications/editors/josm/plugins/videomapping/test/videotest.java
===================================================================
--- /applications/editors/josm/plugins/videomapping/test/videotest.java	(revision 21630)
+++ /applications/editors/josm/plugins/videomapping/test/videotest.java	(revision 21631)
@@ -2,6 +2,9 @@
 import java.awt.Canvas;
 import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.io.File;
 
+import javax.swing.JButton;
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
@@ -22,8 +25,15 @@
 	 */
 	public static void main(String[] args) {
-		SimpleVideoPlayer sVP = new SimpleVideoPlayer();
-		sVP.setFile(new File("C:\\TEMP\\test.mpg"));		
-		sVP.play();
-		sVP.jump(605000);
+		final SimpleVideoPlayer sVP = new SimpleVideoPlayer();
+		sVP.setFile(new File("C:\\TEMP\\test.mpg"));
+		sVP.play(); //FIXME We have a bug so we get out of sync if we jump before the video is up (and this we CAN'T DETECT!!!)
+		JButton b = new JButton("jump");
+		b.addActionListener(new ActionListener() {
+			
+			public void actionPerformed(ActionEvent e) {
+				sVP.jump(610000);				
+			}
+		});
+		sVP.add(b);
 
 	}
