Index: applications/editors/josm/plugins/videomapping/.classpath
===================================================================
--- applications/editors/josm/plugins/videomapping/.classpath	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/.classpath	(revision 28924)
@@ -3,15 +3,14 @@
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="test"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-	<classpathentry kind="lib" path="/core/dist/josm-custom.jar"/>
-	<classpathentry kind="lib" path="lib/jna.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="lib" path="lib/log4j.jar"/>
-	<classpathentry kind="lib" path="lib/vlcj-1.1.5.1.jar" sourcepath="C:/Dokumente und Einstellungen/Matthias/Desktop/vlcj/vlcj-1.1.5.1-javadoc.jar">
+	<classpathentry kind="lib" path="lib/vlcj-2.1.0.jar" sourcepath="lib/vlcj-2.1.0-sources.jar">
 		<attributes>
-			<attribute name="javadoc_location" value="jar:file:/D:/Projekte/Studium/BA Arbeit/working/plugins/videomapping/lib/vlcj-1.1.5.1-javadoc.jar!/"/>
+			<attribute name="javadoc_location" value="jar:platform:/resource/VideoMapping/lib/vlcj-2.1.0-javadoc.jar!/"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry combineaccessrules="false" kind="src" path="/core"/>
-	<classpathentry kind="lib" path="lib/platform.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
+	<classpathentry kind="lib" path="lib/jna-3.4.0.jar"/>
+	<classpathentry kind="lib" path="lib/platform-3.4.0.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: applications/editors/josm/plugins/videomapping/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- applications/editors/josm/plugins/videomapping/.settings/org.eclipse.jdt.core.prefs	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/.settings/org.eclipse.jdt.core.prefs	(revision 28924)
@@ -1,8 +1,7 @@
-#Fri Apr 30 14:06:39 CEST 2010
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
@@ -10,3 +9,3 @@
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Index: applications/editors/josm/plugins/videomapping/README
===================================================================
--- applications/editors/josm/plugins/videomapping/README	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/README	(revision 28924)
@@ -5,7 +5,7 @@
 icon: http://www.openclipart.org/detail/16349
 
-VLCj binding (1.1.0f):
+VLCj binding (2.1.0):
 http://code.google.com/p/vlcj/
 
-for use with VLC 1.1.x
-http://download.videolan.org/pub/videolan/testing/vlc-1.1.0-pre4/win32/
+for use with VLC 2.0.x
+http://www.videolan.org/vlc/#download
Index: applications/editors/josm/plugins/videomapping/build.xml
===================================================================
--- applications/editors/josm/plugins/videomapping/build.xml	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/build.xml	(revision 28924)
@@ -42,7 +42,7 @@
     <import file="../build-common.xml"/>
 
-    <property name="vlcj" value="${plugin.lib.dir}/vlcj-1.1.5.1.jar"/>
-    <property name="jna" value="${plugin.lib.dir}/jna.jar"/>
-    <property name="platform" value="${plugin.lib.dir}/platform.jar"/>
+    <property name="vlcj" value="${plugin.lib.dir}/vlcj-2.1.0.jar"/>
+    <property name="jna" value="${plugin.lib.dir}/jna-3.4.0.jar"/>
+    <property name="platform" value="${plugin.lib.dir}/platform-3.4.0.jar"/>
     <property name="log4j" value="${plugin.lib.dir}/log4j.jar"/>
     <!-- classpath -->
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPlugin.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPlugin.java	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPlugin.java	(revision 28924)
@@ -2,12 +2,9 @@
 
 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
+import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
-import static org.openstreetmap.josm.tools.I18n.marktr;
-
-import java.awt.BorderLayout;
-import java.awt.Panel;
+
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
-import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.text.ParseException;
@@ -16,11 +13,7 @@
 import java.util.Date;
 
-import javax.swing.Action;
-import javax.swing.Box;
 import javax.swing.InputVerifier;
-import javax.swing.JButton;
 import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JComponent;
-import javax.swing.JDialog;
 import javax.swing.JFileChooser;
 import javax.swing.JFormattedTextField;
@@ -29,5 +22,4 @@
 import javax.swing.JMenuItem;
 import javax.swing.JOptionPane;
-import javax.swing.JPanel;
 import javax.swing.JRadioButtonMenuItem;
 import javax.swing.SwingUtilities;
@@ -35,17 +27,16 @@
 
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.plugins.*;
+import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
+import org.openstreetmap.josm.gui.layer.GpxLayer;
+import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.plugins.Plugin;
+import org.openstreetmap.josm.plugins.PluginInformation;
 import org.openstreetmap.josm.plugins.videomapping.video.GPSVideoPlayer;
 import org.openstreetmap.josm.plugins.videomapping.video.VideoEngine;
 import org.openstreetmap.josm.tools.Shortcut;
-import org.openstreetmap.josm.actions.JosmAction;
-import org.openstreetmap.josm.gui.MapView;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
-import org.openstreetmap.josm.gui.layer.*;
-
-import uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil;
-
-import com.sun.jna.LastErrorException;
-import com.sun.jna.NativeLibrary;
+
+import uk.co.caprica.vlcj.player.DeinterlaceMode;
 
   /**
@@ -66,5 +57,5 @@
     private final String PROP_JUMPLENGTH="videomapping.jumplength";
     private final String PROP_LOOPLENGTH="videomapping.looplength"; 
-    private String deinterlacer;
+//    private String deinterlacer;
     private boolean autoCenter;
     private Integer jumpLength,loopLength;
@@ -91,5 +82,4 @@
                     importVideoFile();
                 }
-        
         };
         VRemove= new JosmAction(tr("Remove Video"),"videomapping",tr("removes current video from layer"),null,false) {
@@ -98,9 +88,11 @@
             public void actionPerformed(ActionEvent arg0) {
             }
-        };       
+        };
         VStart = new JosmAction(tr("Play/Pause"), "audio-playpause", tr("starts/pauses video playback"),
                 Shortcut.registerShortcut("videomapping:startstop",tr("Video: {0}", tr("Play/Pause")),KeyEvent.VK_NUMPAD5, Shortcut.DIRECT), false, "vm_play_pause",false) {            
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.pause();                
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.pause();
+                }
             }
         };
@@ -108,5 +100,7 @@
                 Shortcut.registerShortcut("videomapping:backward",tr("Video: {0}", tr("Backward")),KeyEvent.VK_NUMPAD4, Shortcut.DIRECT), false, "vm_prev",false) {
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.backward();
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.backward();
+                }
             }
         };
@@ -114,6 +108,7 @@
                 Shortcut.registerShortcut("videomapping:forward",tr("Video: {0}", tr("Forward")),KeyEvent.VK_NUMPAD6, Shortcut.DIRECT), false, "vm_next",false) {
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.forward();
-                            
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.forward();
+                }
             }
         };
@@ -122,6 +117,7 @@
             
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.setSpeed(gpsVideoPlayer.getSpeed()+20);
-                            
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.setSpeed(gpsVideoPlayer.getSpeed()+20);
+                }
             }
         };
@@ -130,6 +126,7 @@
             
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.setSpeed(gpsVideoPlayer.getSpeed()-20);
-                            
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.setSpeed(gpsVideoPlayer.getSpeed()-20);
+                }
             }
         };
@@ -144,5 +141,7 @@
                 Shortcut.registerShortcut("videomapping:loop",tr("Video: {0}", tr("Loop")),KeyEvent.VK_NUMPAD7, Shortcut.DIRECT), false) {            
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.toggleLooping();
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.toggleLooping();
+                }
             }
         };
@@ -151,5 +150,7 @@
         VCenterIcon = new JCheckBoxMenuItem(new JosmAction(tr("Keep centered"), (String)null, tr("follows the video icon automaticly"),null, false,"vm_keepcentered",false) {            
             public void actionPerformed(ActionEvent e) {
-            	videoPositionLayer.setAutoCenter(VCenterIcon.isSelected());
+                if (videoPositionLayer != null) {
+                    videoPositionLayer.setAutoCenter(VCenterIcon.isSelected());
+                }
             }
         });
@@ -157,5 +158,7 @@
         VSubTitles = new JCheckBoxMenuItem(new JosmAction(tr("Subtitles"), (String)null, tr("Show subtitles in video"),null, false,"vm_subtitles",false) {
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.setSubtitles(VSubTitles.isSelected());                            
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.setSubtitles(VSubTitles.isSelected());
+                }
             }
         });
@@ -182,15 +185,21 @@
         VIntNone= new JRadioButtonMenuItem(new JosmAction(tr("none"), (String)null, tr("no deinterlacing"),null, false,"vm_deinterlacer",false) {            
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.setDeinterlacer("none");
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.setDeinterlacer(null);
+                }
             }
         });
         VIntBob= new JRadioButtonMenuItem(new JosmAction("bob", (String)null, tr("deinterlacing using line doubling"),null, false,"vm_bobdeinterlace",false) {
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.setDeinterlacer("bob");
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.setDeinterlacer(DeinterlaceMode.BOB);
+                }
             }
         });
         VIntLinear= new JRadioButtonMenuItem(new JosmAction("linear", (String)null, tr("deinterlacing using linear interpolation"),null, false,"vm_lineardeinterlace",false) {
             public void actionPerformed(ActionEvent e) {
-            	gpsVideoPlayer.setDeinterlacer("linear");
+                if (gpsVideoPlayer != null) {
+                    gpsVideoPlayer.setDeinterlacer(DeinterlaceMode.LINEAR);
+                }
             }
         });
@@ -212,5 +221,4 @@
         VMenu.add(VDeinterlacer);
         VMenu.add(VSubTitles);
-        
     }
 
@@ -218,17 +226,17 @@
 		JFileChooser fc = new JFileChooser(mostRecentFolder);
         fc.setSelectedFile(new File(mostRecentFolder));
-        if(fc.showOpenDialog(Main.main.parent)!=JFileChooser.CANCEL_OPTION)
-        {        	
+        if (fc.showOpenDialog(Main.parent) != JFileChooser.CANCEL_OPTION) {
         	mostRecentFolder=fc.getSelectedFile().getAbsolutePath();
         	saveProperties();
-        	if(videoPositionLayer==null)
-        	{
-        		videoPositionLayer= new VideoPositionLayer(gpsLayer);
+        	if (videoPositionLayer == null && gpsLayer != null) {
+        		videoPositionLayer = new VideoPositionLayer(gpsLayer);
             	gpsVideoPlayer = new GPSVideoPlayer(new SimpleDateFormat("hh:mm:ss") ,videoPositionLayer);
             	gpsVideoPlayer.setJumpLength(jumpLength);
             	gpsVideoPlayer.setLoopLength(loopLength);
             	enableVideoControlMenus(true);
-        	}        	
-        	gpsVideoPlayer.addVideo(fc.getSelectedFile());        	
+        	}
+        	if (gpsVideoPlayer != null) {
+        	    gpsVideoPlayer.addVideo(fc.getSelectedFile());
+        	}
         }		
 	}
@@ -244,8 +252,7 @@
 	}
 	
-	private void setDefaults()
-	{
+	private void setDefaults() {
 		autoCenter=false;
-		deinterlacer="";
+//		deinterlacer="";
 		jumpLength=1000;
 		loopLength=6000;
@@ -276,8 +283,6 @@
     }
 	
-
 	private void showJumpTo()
 	{
-		String s;
     	try {
 	    	JOptionPane d=new JOptionPane(tr("Jump to"), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);	    	
@@ -301,5 +306,5 @@
 	            }
 	        });
-	    	if(d.showConfirmDialog(Main.main.panel,inp, tr("Jump to GPS time"),JOptionPane.OK_CANCEL_OPTION)==JOptionPane.OK_OPTION)
+	    	if (JOptionPane.showConfirmDialog(Main.panel,inp, tr("Jump to GPS time"),JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)
 	    	{
 	    		//add the day to the time
@@ -342,6 +347,3 @@
 		
 	}
-      
-    
-    
   }
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPositionLayer.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPositionLayer.java	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPositionLayer.java	(revision 28924)
@@ -2,4 +2,13 @@
 
 
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -8,17 +17,8 @@
 import java.util.LinkedList;
 import java.util.List;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.io.File;
-
-import javax.swing.*;
-
-import static org.openstreetmap.josm.tools.I18n.*;
+
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
 
 import org.openstreetmap.josm.Main;
@@ -35,7 +35,5 @@
 import org.openstreetmap.josm.gui.layer.GpxLayer;
 import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.plugins.videomapping.video.GPSVideo;
 import org.openstreetmap.josm.plugins.videomapping.video.GPSVideoPlayer;
-import org.openstreetmap.josm.plugins.videomapping.video.Video;
 
 //Basic rendering and GPS layer interaction
@@ -107,5 +105,5 @@
         g.drawString(gpsTimeFormat.format(iconPosition.getTime()),p.x-15,p.y-15);
 	}
-	
+/*	
 	private void paintInterpolatedSegment(Graphics2D g) {
 		g.setColor(Color.CYAN);
@@ -142,5 +140,5 @@
 		return ls;
 	}
-	
+*/	
 	//creates a waypoint for the corresponding time
 	public WayPoint interpolate(Date GPSTime)
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideo.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideo.java	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideo.java	(revision 28924)
@@ -1,6 +1,4 @@
 package org.openstreetmap.josm.plugins.videomapping.video;
-import java.awt.Canvas;
 import java.io.File;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
@@ -11,4 +9,6 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.plugins.videomapping.VideoPositionLayer;
+
+import uk.co.caprica.vlcj.player.MediaPlayerFactory;
 
 // a specific synced video
@@ -24,12 +24,12 @@
 	private VideoPositionLayer videoPositionLayer;
 	
-	public GPSVideo(File filename, String id) {
-		super(filename,id);
+	public GPSVideo(File filename, String id, MediaPlayerFactory mediaPlayerFactory) {
+		super(filename,id,mediaPlayerFactory);
 	}
 	
 	public GPSVideo(Video video)
 	{
-		super(video.filename,video.id);
-		this.player=video.player;
+		super(video.filename, video.id, video.mediaPlayerFactory);
+		this.player = video.player;
 	}
 	
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 28913)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/GPSVideoPlayer.java	(revision 28924)
@@ -1,6 +1,6 @@
 package org.openstreetmap.josm.plugins.videomapping.video;
-import java.awt.BorderLayout;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.awt.Color;
-import java.awt.FlowLayout;
 import java.awt.HeadlessException;
 import java.awt.event.ActionEvent;
@@ -9,23 +9,11 @@
 import java.io.File;
 import java.text.DateFormat;
-import java.util.Calendar;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
 
 import javax.swing.JButton;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JPanel;
 
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.gpx.WayPoint;
-import org.openstreetmap.josm.plugins.videomapping.VideoObserver;
 import org.openstreetmap.josm.plugins.videomapping.VideoPositionLayer;
-
-import static org.openstreetmap.josm.tools.I18n.*;
-import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
 
 //extends video playback, major control has the video player
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/Video.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/Video.java	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/Video.java	(revision 28924)
@@ -9,27 +9,30 @@
 
 import uk.co.caprica.vlcj.player.MediaPlayer;
+import uk.co.caprica.vlcj.player.MediaPlayerFactory;
+import uk.co.caprica.vlcj.player.embedded.videosurface.CanvasVideoSurface;
 
 //basic informations about one single video playback instance
 public class Video {
-	public File filename;
-	public String id; //unique id to make it easy to identify
+	public final File filename;
+	public final String id; //unique id to make it easy to identify
 	public MediaPlayer player;
 	public Canvas canvas;
-	public JPanel panel;	
+	public CanvasVideoSurface videoSurface;
+	public final JPanel panel;
+	public final MediaPlayerFactory mediaPlayerFactory;
 	
-	public Video(File filename, String id) {
-		this.filename=filename;
-		this.id=id;
-		canvas=new Canvas();
-		panel=new JPanel();
-		panel.setLayout(new FlowLayout());
-		panel.add(canvas,BorderLayout.CENTER);
+	public Video(File filename, String id, MediaPlayerFactory mediaPlayerFactory) {
+		this.filename = filename;
+		this.id = id;
+		this.mediaPlayerFactory = mediaPlayerFactory;
+		this.canvas = new Canvas();
+		this.videoSurface = mediaPlayerFactory.newVideoSurface(canvas);
+		this.panel = new JPanel();
+		this.panel.setLayout(new FlowLayout());
+		this.panel.add(videoSurface.canvas(), BorderLayout.CENTER);
 	}
 	
-	public long getCurrentTime()
-	{
+	public long getCurrentTime() {
 		return player.getTime();
 	}
-	
-
 }
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoEngine.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoEngine.java	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoEngine.java	(revision 28924)
@@ -1,30 +1,29 @@
 package org.openstreetmap.josm.plugins.videomapping.video;
 
-import java.awt.Canvas;
-import java.awt.Dimension;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.awt.Window;
-import java.io.File;
 import java.util.LinkedList;
 import java.util.List;
 
-import com.sun.jna.NativeLibrary;
-
-import uk.co.caprica.vlcj.binding.internal.libvlc_media_player_t;
+import uk.co.caprica.vlcj.binding.internal.libvlc_media_t;
+import uk.co.caprica.vlcj.player.DeinterlaceMode;
 import uk.co.caprica.vlcj.player.MediaPlayer;
 import uk.co.caprica.vlcj.player.MediaPlayerEventListener;
 import uk.co.caprica.vlcj.player.MediaPlayerFactory;
-import uk.co.caprica.vlcj.player.VideoMetaData;
 import uk.co.caprica.vlcj.player.embedded.DefaultFullScreenStrategy;
 import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
 import uk.co.caprica.vlcj.player.embedded.FullScreenStrategy;
-import uk.co.caprica.vlcj.runtime.windows.WindowsCanvas;
+import uk.co.caprica.vlcj.runtime.RuntimeUtil;
 import uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil;
 
-import static org.openstreetmap.josm.tools.I18n.*;
+import com.sun.jna.NativeLibrary;
+import com.sun.jna.platform.win32.Advapi32Util;
+import com.sun.jna.platform.win32.WinReg;
 
 //concrete Player library that is able to playback multiple videos
-public class VideoEngine implements MediaPlayerEventListener{
+public class VideoEngine implements MediaPlayerEventListener {
 	private FullScreenStrategy fullScreenStrategy;
-	private MediaPlayerFactory mediaPlayerFactory;
+	public MediaPlayerFactory mediaPlayerFactory;
 	private List<Video> videos;
 	private List<VideosObserver> observers;
@@ -32,12 +31,36 @@
     private final String[] standardMediaOptions = {""};
     private final static String[] deinterlacers = {"bob","linear"};
-    private final float initialCanvasFactor = 0.5f;
+    //private final float initialCanvasFactor = 0.5f;
 	private boolean singleVideoMode; //commands will only affect the last added video
 	private Video lastAddedVideo;
 	
 	//called at plugin start to setup library
-	public static void setupPlayer()
-	{
-		NativeLibrary.addSearchPath("libvlc", WindowsRuntimeUtil.getVlcInstallDir());
+	public static void setupPlayer() {
+	    String vlcInstallDir = null;
+	    
+	    if (RuntimeUtil.isWindows()) {
+	        vlcInstallDir = WindowsRuntimeUtil.getVlcInstallDir();
+	        String arch = System.getProperty("os.arch");
+	        if (vlcInstallDir == null && arch.equals("amd64")) {
+	            try {
+	                vlcInstallDir = Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, 
+	                        WindowsRuntimeUtil.VLC_REGISTRY_KEY.replaceFirst("\\\\", "\\\\Wow6432Node\\\\"), 
+	                        WindowsRuntimeUtil.VLC_INSTALL_DIR_KEY);
+	            } catch (RuntimeException e) {
+	                System.err.println(e.getMessage());
+	            }
+	        }
+	    } else if (RuntimeUtil.isMac()) {
+	        // TODO
+	    } else if (RuntimeUtil.isNix()) {
+            // TODO
+	    }
+	    
+        if (vlcInstallDir != null) {
+            System.out.println("videomapping: found VLC install dir: "+vlcInstallDir);
+            NativeLibrary.addSearchPath("libvlc", vlcInstallDir);
+        } else {
+            System.err.println("videomapping: unable to locate VLC install dir");
+        }
 	}
 	
@@ -47,17 +70,14 @@
 		videos = new LinkedList<Video>();
 		observers = new LinkedList<VideosObserver>();
-		try
-		{
+		try {
 			mediaPlayerFactory = new MediaPlayerFactory(libvlcArgs);
 	        fullScreenStrategy = new DefaultFullScreenStrategy(parent);
-		}
-		catch (NoClassDefFoundError e)
-        {
+		} catch (NoClassDefFoundError e) {
             System.err.println(tr("Unable to find JNA Java library!"));
+        } catch (UnsatisfiedLinkError e) {
+            System.err.println(tr("Unable to find native libvlc library!"));
+        } catch (Throwable t) {
+            System.err.println(t.getMessage());
         }
-        catch (UnsatisfiedLinkError e)
-        {
-            System.err.println(tr("Unable to find native libvlc library!"));
-        }        
 	}
 	
@@ -66,11 +86,10 @@
 		try
 		{
-			EmbeddedMediaPlayer mp;
-			mp = mediaPlayerFactory.newMediaPlayer(fullScreenStrategy);
+			EmbeddedMediaPlayer mp = mediaPlayerFactory.newEmbeddedMediaPlayer(fullScreenStrategy);
 			video.player=mp;
 			mp.setStandardMediaOptions(standardMediaOptions);
 			videos.add(video);
 			lastAddedVideo=video;
-			mp.setVideoSurface(video.canvas);
+			mp.setVideoSurface(video.videoSurface);
 	        mp.addMediaPlayerEventListener(this);
 	        String mediaPath = video.filename.getAbsoluteFile().toString();
@@ -87,5 +106,5 @@
         }
 	}
-	
+	/*
 	private Video getVideo(MediaPlayer mp)
 	{
@@ -95,5 +114,5 @@
 		return null;
 	}
-
+*/
 	public List<Video> getVideos() {		
 		return videos;
@@ -246,5 +265,5 @@
 		
 	
-	public void setDeinterlacer (String deinterlacer)
+	public void setDeinterlacer (DeinterlaceMode deinterlacer)
 	{
 		if (singleVideoMode)
@@ -282,4 +301,5 @@
 			video.player.release();
 			video.player=null;
+			video.videoSurface=null;
 			video.canvas=null;
 		}
@@ -302,9 +322,9 @@
 		
 	}
-
+/*
 	public void buffering(MediaPlayer arg0) {
 		
 	}
-
+*/
 	public void error(MediaPlayer arg0) {
 		
@@ -322,5 +342,5 @@
 		
 	}
-
+/*
 	public void mediaChanged(MediaPlayer arg0) {
 		
@@ -332,5 +352,5 @@
 		notifyObservers(VideoObserversEvents.resizing);		
 	}
-
+*/
 	public void opening(MediaPlayer arg0) {
 		
@@ -386,3 +406,81 @@
 	}
 
+    @Override
+    public void mediaChanged(MediaPlayer mediaPlayer, libvlc_media_t media, String mrl) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void buffering(MediaPlayer mediaPlayer, float newCache) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void videoOutput(MediaPlayer mediaPlayer, int newCount) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void mediaMetaChanged(MediaPlayer mediaPlayer, int metaType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void mediaSubItemAdded(MediaPlayer mediaPlayer, libvlc_media_t subItem) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void mediaDurationChanged(MediaPlayer mediaPlayer, long newDuration) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void mediaParsedChanged(MediaPlayer mediaPlayer, int newStatus) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void mediaFreed(MediaPlayer mediaPlayer) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void mediaStateChanged(MediaPlayer mediaPlayer, int newState) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void newMedia(MediaPlayer mediaPlayer) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void subItemPlayed(MediaPlayer mediaPlayer, int subItemIndex) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void subItemFinished(MediaPlayer mediaPlayer, int subItemIndex) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void endOfSubItems(MediaPlayer mediaPlayer) {
+        // TODO Auto-generated method stub
+        
+    }
+
 }
Index: applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoPlayer.java
===================================================================
--- applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoPlayer.java	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/video/VideoPlayer.java	(revision 28924)
@@ -1,10 +1,7 @@
 package org.openstreetmap.josm.plugins.videomapping.video;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.awt.Adjustable;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.helpers.DateTimeDateFormat;
-
 import java.awt.BorderLayout;
-import java.awt.Canvas;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
@@ -14,25 +11,13 @@
 import java.awt.event.WindowEvent;
 import java.awt.event.WindowListener;
-import java.beans.PropertyChangeListener;
 import java.io.File;
-import java.sql.Time;
 import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Hashtable ;
+import java.util.Hashtable;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Set;
-import java.util.TimeZone;
 import java.util.Timer;
 import java.util.TimerTask;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
-import javax.swing.Action;
+
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
@@ -40,24 +25,11 @@
 import javax.swing.JSlider;
 import javax.swing.JToggleButton;
-import javax.swing.SwingUtilities;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.plugins.videomapping.VideoObserver;
-import static org.openstreetmap.josm.tools.I18n.*;
-
-import uk.co.caprica.vlcj.binding.LibVlc;
-import uk.co.caprica.vlcj.player.MediaPlayer;
-import uk.co.caprica.vlcj.player.MediaPlayerEventAdapter;
-import uk.co.caprica.vlcj.player.MediaPlayerEventListener;
-import uk.co.caprica.vlcj.player.MediaPlayerFactory;
-import uk.co.caprica.vlcj.player.VideoMetaData;
-import uk.co.caprica.vlcj.player.embedded.*;
-import uk.co.caprica.vlcj.runtime.RuntimeUtil;
-import uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil;
+import uk.co.caprica.vlcj.player.DeinterlaceMode;
 
 //basic UI of a videoplayer for multiple videos incl. notifications
-public class VideoPlayer extends JFrame implements WindowListener, VideosObserver, VideoPlayerObserver{
+public class VideoPlayer extends JFrame implements WindowListener, VideosObserver, VideoPlayerObserver {
 	private static final int notificationIntervall = 500;
 	protected JPanel screenPanel,controlsPanel,canvasPanel;
@@ -66,5 +38,5 @@
     private JToggleButton loop,mute;
     private JSlider speed;
-    private DateFormat videoTimeFormat;
+//    private DateFormat videoTimeFormat;
     private VideoEngine videoengine;
     private long jumpLength;
@@ -77,5 +49,5 @@
 	public VideoPlayer(DateFormat videoTimeFormat) throws HeadlessException {
 		super();		
-		this.videoTimeFormat=videoTimeFormat;
+//		this.videoTimeFormat=videoTimeFormat;
 		//setup playback notifications
 		videoengine=new VideoEngine(this);
@@ -94,7 +66,7 @@
 	}
 	
-	public Video addVideo(File Videofile,String id)
-	{
-		Video video = new Video(Videofile,id);		
+	public Video addVideo(File Videofile, String id)
+	{
+		Video video = new Video(Videofile,id,videoengine.mediaPlayerFactory);
 		canvasPanel.add(video.panel);
 		video.canvas.setSize(new Dimension(300, 300)); // will be updated by the video engine itself
@@ -111,5 +83,5 @@
 
 	
-	public void pause(){
+	public void pause() {
 		videoengine.pause();
 		if (videoengine.isNoVideoPlaying())
@@ -143,5 +115,5 @@
 	}
 	
-	public void setDeinterlacer(String deinterlacer)
+	public void setDeinterlacer(DeinterlaceMode deinterlacer)
 	{
 		videoengine.setDeinterlacer(deinterlacer);
Index: applications/editors/josm/plugins/videomapping/test/videotest.java
===================================================================
--- applications/editors/josm/plugins/videomapping/test/videotest.java	(revision 28913)
+++ applications/editors/josm/plugins/videomapping/test/videotest.java	(revision 28924)
@@ -1,23 +1,8 @@
 
-import java.awt.Canvas;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.io.File;
 import java.text.SimpleDateFormat;
 
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JSlider;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
 import org.openstreetmap.josm.plugins.videomapping.video.VideoEngine;
 import org.openstreetmap.josm.plugins.videomapping.video.VideoPlayer;
-
-import uk.co.caprica.vlcj.player.*;
-
 
 //simple app to test videoplayer alone
@@ -31,6 +16,4 @@
     	testplayer.addVideo(new File("C:\\TEMP\\aoe-drachen_dvdscr.avi"),"2");
     	testplayer.enableSingleVideoMode(true);
-        
     }
-
 }
