]> git.sesse.net Git - vlc/commitdiff
Java Bindings synched with lastest version.
authorFilippo Carone <littlejohn@videolan.org>
Wed, 2 Aug 2006 14:11:17 +0000 (14:11 +0000)
committerFilippo Carone <littlejohn@videolan.org>
Wed, 2 Aug 2006 14:11:17 +0000 (14:11 +0000)
26 files changed:
bindings/java/Makefile.am
bindings/java/VLCExample.java
bindings/java/org/videolan/jvlc/Audio.java [new file with mode: 0644]
bindings/java/org/videolan/jvlc/Input.java [new file with mode: 0644]
bindings/java/org/videolan/jvlc/InputIntf.java
bindings/java/org/videolan/jvlc/JVLC.java
bindings/java/org/videolan/jvlc/JVLCCanvas.java
bindings/java/org/videolan/jvlc/Playlist.java
bindings/java/org/videolan/jvlc/PlaylistIntf.java
bindings/java/org/videolan/jvlc/Status.java [deleted file]
bindings/java/org/videolan/jvlc/VLM.java [new file with mode: 0644]
bindings/java/org/videolan/jvlc/VLMIntf.java
bindings/java/org/videolan/jvlc/Video.java [new file with mode: 0644]
bindings/java/org/videolan/jvlc/VideoIntf.java
bindings/java/src/Makefile.am [new file with mode: 0644]
bindings/java/src/audio-jni.cc [new file with mode: 0644]
bindings/java/src/core-jni.cc [new file with mode: 0644]
bindings/java/src/graphics-jni.cc [moved from bindings/java/vlc-graphics-jni.cc with 98% similarity]
bindings/java/src/input-jni.cc [new file with mode: 0644]
bindings/java/src/playlist-jni.cc [new file with mode: 0644]
bindings/java/src/utils.cc [new file with mode: 0644]
bindings/java/src/utils.h [new file with mode: 0644]
bindings/java/src/video-jni.cc [new file with mode: 0644]
bindings/java/src/vlm-jni.cc [new file with mode: 0644]
bindings/java/vlc-libvlc-jni.cc [deleted file]
configure.ac

index 076c68ea69dfcebc10f385c3a12ef13c2b09da86..7df98ca57221002123621c0095f134b098ef1dda 100644 (file)
@@ -4,47 +4,42 @@
 
 if BUILD_JAVA
 
-OBJECTS = org/videolan/jvlc/VLCException.class org/videolan/jvlc/Playlist.class org/videolan/jvlc/AudioIntf.class org/videolan/jvlc/InputIntf.class org/videolan/jvlc/PlaylistIntf.class org/videolan/jvlc/VideoIntf.class org/videolan/jvlc/JLibVLC.class org/videolan/jvlc/JVLC.class org/videolan/jvlc/JVLCCanvas.class org/videolan/jvlc/JVLCPanel.class org/videolan/jvlc/VLMIntf.class org/videolan/jvlc/GenericVideoWidget.class
+OBJECTS = org/videolan/jvlc/VLCException.class org/videolan/jvlc/Playlist.class org/videolan/jvlc/AudioIntf.class org/videolan/jvlc/Audio.class org/videolan/jvlc/InputIntf.class org/videolan/jvlc/Input.class org/videolan/jvlc/PlaylistIntf.class org/videolan/jvlc/VideoIntf.class org/videolan/jvlc/Video.class org/videolan/jvlc/JLibVLC.class org/videolan/jvlc/JVLC.class org/videolan/jvlc/JVLCCanvas.class org/videolan/jvlc/JVLCPanel.class org/videolan/jvlc/VLMIntf.class org/videolan/jvlc/VLM.class  org/videolan/jvlc/GenericVideoWidget.class
+
+COBJECTS = src/utils.o src/video-jni.o src/audio-jni.o src/input-jni.o src/playlist-jni.o src/vlm-jni.o src/core-jni.o src/graphics-jni.o
 
 # Include some JAVA stuff
 PROCESSOR_FAMILY = `uname -m | sed -e 's/^i.86/i386/' | sed -e 's/^x86_64/amd64/'`
+
 if HAVE_WIN32
 JINCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/win32
 LIBJINCLUDES = -L${JAVA_HOME}/lib -ljawt
-#JAVAC = javac
 JCH = javah
-#CXX = g++ -Wall -mno-cygwin -g
-#LDFLAGS = -mno-cygwin `vlc-config --libs external pic` -Wl,--kill-at
 JAVACXXFLAGS = `top_builddir=../.. ../../vlc-config --cflags pic` -I../../ -I ../../include $(JINCLUDES)
 JAVALDFLAGS = -mno-cygwin -L../../src -lvlc `top_builddir=../.. ../../vlc-config --libs builtin vlc pic` -Wl,--kill-at
 else
 JINCLUDES = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
 LIBJINCLUDES = -L$(JAVA_HOME)/jre/lib/$(PROCESSOR_FAMILY) -ljawt
-#JAVAC = gcj -Wall -g -C 
 JCH = gcjh -jni
-SWT_PATH = /usr/share/java
-# Compile flags
 JAVACXXFLAGS = `top_builddir=../.. ../../vlc-config --cflags pic` -I../../ -I ../../include $(JINCLUDES)
 JAVALDFLAGS = -L../../src -lvlc `top_builddir=../.. ../../vlc-config --libs builtin vlc pic`
 endif
 
+export JINCLUDES
+
 # Build targets
 all: libjvlc.so VlcClient VLCExample
 
 if HAVE_WIN32
-libjvlc.so: vlc-libvlc-jni.o vlc-graphics-jni.o
-       $(CXX) -shared vlc-libvlc-jni.o vlc-graphics-jni.o $(LIBJINCLUDES) $(LDFLAGS) $(JAVALDFLAGS) -o jvlc.dll
+libjvlc.so: $(OBJECTS)
+       $(MAKE) -C src
+       $(CXX) -shared $(COBJECTS) $(LIBJINCLUDES) $(LDFLAGS) $(JAVALDFLAGS) -o jvlc.dll
 else
-libjvlc.so: vlc-libvlc-jni.o vlc-graphics-jni.o
-       $(CXX) -shared vlc-libvlc-jni.o vlc-graphics-jni.o $(LIBJINCLUDES) $(LDFLAGS) $(JAVALDFLAGS) -o libjvlc.so
+libjvlc.so: $(OBJECTS)         
+       $(MAKE) -C src
+       $(CXX) -shared $(COBJECTS) $(LIBJINCLUDES) $(LDFLAGS) $(JAVALDFLAGS) -o libjvlc.so
 endif
 
-vlc-graphics-jni.o: VlcClient
-       $(CXX) -c vlc-graphics-jni.cc $(CXXFLAGS) $(JAVACXXFLAGS)
-
-vlc-libvlc-jni.o: VlcClient
-       $(CXX) -c vlc-libvlc-jni.cc $(CXXFLAGS) $(JAVACXXFLAGS)
-
 VlcClient: $(OBJECTS)
        $(JAVAC) VlcClient.java
 
@@ -54,14 +49,15 @@ VLCExample: $(OBJECTS)
 if HAVE_WIN32
 %.class: %.java
        $(JAVAC)  $?
-       $(JCH) org.videolan.jvlc.$(*F)
+       $(JCH) org.videolan.jvlc.$(*F) -o includes/$(*F).h
 else
 %.class: %.java
        $(JAVAC) $?
-       $(JCH) org/videolan/jvlc/$(*F)
+       $(JCH) org/videolan/jvlc/$(*F) -o includes/$(*F).h
 endif
 
 clean:
        rm -f *.class *~ org/videolan/jvlc/*.class org_videolan*.h *.so *.o *.dll
+       $(MAKE) -C src clean-local
 
 endif
index 973322964e44f3cf2aa4ee27d5f0df5bfa6b38d2..c45aa2fae5c3567362a14f9c4e5fbc78f5b678b1 100644 (file)
@@ -32,9 +32,9 @@ public class VLCExample
 
         if (videoInput) {
                try {
-                       System.out.print(jvlc.getVideoWidth());
+                       System.out.print(jvlc.video.getWidth());
                        System.out.print("x");
-                       System.out.println(jvlc.getVideoHeight());
+                       System.out.println(jvlc.video.getHeight());
                } catch (VLCException e) {
                        e.printStackTrace();
                }
@@ -43,32 +43,32 @@ public class VLCExample
         {
                if (videoInput) {
                        System.out.print("Fullscreen... ");             
-                       jvlc.setFullscreen(true);
+                       jvlc.video.setFullscreen(true);
                        Thread.sleep(3000);
                        System.out.println("real size.");
-                       jvlc.setFullscreen(false);
+                       jvlc.video.setFullscreen(false);
                System.out.print("Taking snapshot... ");
-               jvlc.getSnapshot( System.getProperty( "user.dir" ) + "/snap.png");
+               jvlc.video.getSnapshot( System.getProperty( "user.dir" ) + "/snap.png");
                System.out.println("taken. (see " + System.getProperty( "user.dir" ) + "/snap.png )");
                }
             System.out.print("Muting...");
-            jvlc.setMute(true);
+            jvlc.audio.setMute(true);
             Thread.sleep(3000);
             System.out.println("unmuting.");
-            jvlc.setMute(false);
+            jvlc.audio.setMute(false);
             Thread.sleep(3000);
-            System.out.println("Volume is: " + jvlc.getVolume());
+            System.out.println("Volume is: " + jvlc.audio.getVolume());
             System.out.print("Setting volume to 150... ");
-            jvlc.setVolume(150);
+            jvlc.audio.setVolume(150);
             System.out.println("done");
             Thread.sleep(3000);
             System.out.println("INPUT INFORMATION");
             System.out.println("-----------------");
-            System.out.println("Total length   (ms) :\t" + jvlc.getInputLength());
-            System.out.println("Input time     (ms) :\t" + jvlc.getInputTime());
-            System.out.println("Input position [0-1]:\t" + jvlc.getInputPosition());
+            System.out.println("Total length   (ms) :\t" + jvlc.input.getLength());
+            System.out.println("Input time     (ms) :\t" + jvlc.input.getTime());
+            System.out.println("Input position [0-1]:\t" + jvlc.input.getPosition());
             if (videoInput)
-               System.out.println("Input FPS          :\t" + jvlc.getInputFPS());
+               System.out.println("Input FPS          :\t" + jvlc.input.getFPS());
            
             
         }
diff --git a/bindings/java/org/videolan/jvlc/Audio.java b/bindings/java/org/videolan/jvlc/Audio.java
new file mode 100644 (file)
index 0000000..a0c53a6
--- /dev/null
@@ -0,0 +1,42 @@
+package org.videolan.jvlc;
+
+public class Audio implements AudioIntf {
+    
+       private long libvlcInstance;
+
+       private native boolean  _getMute();
+    private native void                _setMute( boolean value );
+    private native void                _toggleMute();
+    private native int         _getVolume();
+    private native void                _setVolume( int volume );
+    
+    public Audio( long instance ) {
+       this.libvlcInstance = instance;
+    }
+    
+    public boolean getMute() throws VLCException {
+        return _getMute();
+    }
+
+    public void setMute(boolean value) throws VLCException {
+        _setMute( value );
+        
+    }
+    
+    public void toggleMute() throws VLCException {
+       _toggleMute();
+    }
+
+    public int getVolume() throws VLCException {
+        return _getVolume();        
+    }
+
+    public void setVolume(int volume) throws VLCException {
+        _setVolume( volume );
+        
+    }
+    
+       public long getInstance() {
+               return libvlcInstance;
+       }
+}
diff --git a/bindings/java/org/videolan/jvlc/Input.java b/bindings/java/org/videolan/jvlc/Input.java
new file mode 100644 (file)
index 0000000..4131679
--- /dev/null
@@ -0,0 +1,61 @@
+package org.videolan.jvlc;
+
+public class Input implements InputIntf {
+       
+    private long libvlcInstance;
+
+       /*
+     *  Input native methods
+     */
+    private native long     _getLength();
+    private native float    _getPosition();
+    private native long     _getTime();
+    private native float       _getFPS();
+    private native void                _setTime(long value);
+    private native void                _setPosition(float value);
+    private native boolean  _isPlaying();
+    private native boolean  _hasVout();
+
+    
+    public Input( long instance ) {
+       this.libvlcInstance = instance;
+    }
+
+       public long getLength() throws VLCException {
+        return _getLength();        
+    }
+
+    public long getTime() throws VLCException {
+        return _getTime();
+    }
+
+    public float getPosition() throws VLCException {
+        return _getPosition();
+        
+    }
+
+    public void setTime(long time) throws VLCException {
+       _setTime(time);
+    }
+
+    public void setPosition(float position) throws VLCException {
+       _setPosition(position);
+    }
+
+    public double getFPS() throws VLCException {
+        return _getFPS();
+    }
+    
+    public boolean isPlaying() throws VLCException {
+        return _isPlaying();
+    }
+
+    public boolean hasVout() throws VLCException {
+        return _hasVout();
+    }
+    
+       public long getInstance() {
+               return libvlcInstance;
+       }
+
+}
index 5be174746aab50b96ad75f06584dfe25ddf24aad..7477a63a23ecff7ca419ac975ec73fcfbc03c044 100644 (file)
@@ -39,31 +39,49 @@ public interface InputIntf {
      * @return The total length of the current file playing in millis.
      * @throws VLCException
      */
-    long getInputLength() throws VLCException;
+    long getLength() throws VLCException;
 
     /**
      * @return The current position in millis within the playing item.
      * @throws VLCException
      */
-    long getInputTime() throws VLCException;
+    long getTime() throws VLCException;
     
     /**
      * @return The position in %.
      * @throws VLCException
      */
-    float getInputPosition() throws VLCException;
+    float getPosition() throws VLCException;
     
     /**
-     * Not implemented
+     * Moves current input to position specified in a float [0-1].
+     * @param value The position, from 0 to 1, to move the input to.
      * @throws VLCException
      */
-    void setInputTime() throws VLCException;
+    void setPosition( float value ) throws VLCException;
+    
+    /**
+     * Moves current input to time specified in value
+     * @param value The time in milliseconds to move the input to.
+     * @throws VLCException
+     */
+    void setTime(long value) throws VLCException;
     
     
     /**
      * @return If the playing item is a video file, returns the FPS, otherwise 0.
      * @throws VLCException
      */
-    double getInputFPS() throws VLCException;
+    double getFPS() throws VLCException;
+    
+    
+    /**
+     * @return True if the current input is really playing
+     */
+    boolean isPlaying() throws VLCException;
     
+    /**
+     * @return True if the current input has spawned a video output window
+     */
+    boolean hasVout() throws VLCException;
 }
index 294994c260f9e26a98150ca064d6045fe4e02e2a..ef73d688c479e200cd5e119d7f31fa6a430de5da 100644 (file)
@@ -30,7 +30,8 @@
 
 package org.videolan.jvlc;
 
-public class JVLC implements JLibVLC, Runnable {
+
+public class JVLC implements Runnable {
     
     static {
         System.loadLibrary("jvlc" );
@@ -39,9 +40,13 @@ public class JVLC implements JLibVLC, Runnable {
     /**
      * These are set as final since they live along the jvlc object
      */
-    private final long _instance;
-    public  final Playlist playlist;
-
+    private final long         _instance;
+    
+    public  final Playlist     playlist;
+    public     final Video             video;
+    public     final Audio             audio;
+    public     final Input             input;
+    public     final VLM               vlm;
     
     private boolean beingDestroyed = false;
 
@@ -57,14 +62,23 @@ public class JVLC implements JLibVLC, Runnable {
         String[] args = new String[1];
         args[0] = "";
         
-        _instance = createInstance(args);
-        playlist = new Playlist( _instance );
+        _instance      = createInstance( args );
+        playlist       = new Playlist  ( _instance );
+        video          = new Video             ( _instance );
+        audio          = new Audio             ( _instance );
+        input          = new Input             ( _instance );
+        vlm                    = new VLM               ( _instance );
         new Thread(this).start();
     }
     
     public JVLC(String[] args) {
-        _instance = createInstance( args );
-        playlist = new Playlist( _instance );
+        _instance      = createInstance( args );
+        playlist       = new Playlist  ( _instance );
+        video          = new Video             ( _instance );
+        audio          = new Audio             ( _instance );
+        input          = new Input             ( _instance );
+        vlm                    = new VLM               ( _instance );
+        
         new Thread(this).start();
     }
     
@@ -82,123 +96,9 @@ public class JVLC implements JLibVLC, Runnable {
        /*
      * Core methods
      */
-    private native long createInstance();
     private native long createInstance( String[] args );
     private native void _destroy();   
-    /*
-     *         Audio native methods
-     */
-    private native boolean     _getMute();
-    private native void                _setMute( boolean value );
-    private native void                _toggleMute();
-    private native int         _getVolume();
-    private native void                _setVolume( int volume );
-
-    /*
-     *  Input native methods
-     */
-    private native long     _getInputLength();
-    private native float    _getInputPosition();
-    private native long     _getInputTime();
-    private native float       _getInputFPS();
-
-    
-    /*
-     * Video native methods
-     */
-    private native void     _toggleFullscreen();
-    private native void     _setFullscreen( boolean value);
-    private native boolean  _getFullscreen();
-    private native int      _getVideoHeight();
-    private native int      _getVideoWidth();
-    private native void                _getSnapshot(String filename);
-
-    /*
-     * VLM native methods
-     */
-    private native void _addBroadcast(String mediaName, String meditInputMRL, String mediaOutputMRL ,
-                               String[] additionalOptions, boolean enableBroadcast, boolean isPlayableInLoop);
-    private native void _deleteMedia   (String mediaName);
-    private native void _setEnabled            (String mediaName,      boolean newStatus);
-    private native void _setOutput             (String mediaName,      String mediaOutputMRL);
-    private native void _setInput              (String mediaName,      String mediaInputMRL);
-    private native void _setLoop               (String mediaName,      boolean isPlayableInLoop);
-    private native void _changeMedia   (String newMediaName, String inputMRL, String outputMRL , String[] additionalOptions, boolean enableNewBroadcast, boolean isPlayableInLoop);
-
-    /*
-     * Native methods wrappers
-     */
-       
-    
-    public boolean getMute() throws VLCException {
-        return _getMute();
-    }
-
-    public void setMute(boolean value) throws VLCException {
-        _setMute( value );
-        
-    }
-    
-    public void toggleMute() throws VLCException {
-       _toggleMute();
-    }
-
-    public int getVolume() throws VLCException {
-        return _getVolume();        
-    }
-
-    public void setVolume(int volume) throws VLCException {
-        _setVolume( volume );
-        
-    }
-
-    public void toggleFullscreen() throws VLCException {
-        _toggleFullscreen();
-        
-    }
-
-    public void setFullscreen( boolean value ) throws VLCException {
-        _setFullscreen( value );
-        
-    }
 
-    public boolean getFullscreen() throws VLCException {
-       return _getFullscreen();        
-    }
-
-    public int getVideoHeight() throws VLCException {
-        return _getVideoHeight();
-    }
-    
-
-    public int getVideoWidth() throws VLCException {
-        return _getVideoWidth();        
-    }
-
-    
-    public long getInputLength() throws VLCException {
-        return _getInputLength();        
-    }
-
-    public long getInputTime() throws VLCException {
-        return _getInputTime();
-    }
-
-    public float getInputPosition() throws VLCException {
-        return _getInputPosition();
-        
-    }
-
-    public void setInputTime() throws VLCException {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public double getInputFPS() throws VLCException {
-        return _getInputFPS();
-    }
-    
     public long getInstance() throws VLCException {
         return _instance;
     }
@@ -211,42 +111,7 @@ public class JVLC implements JLibVLC, Runnable {
        }
     
 
-       public void getSnapshot(String filename) throws VLCException {
-               _getSnapshot(filename);
-       }
-
-
-    public void addBroadcast( String name, String input, String output, String[] options, boolean enabled, boolean loop )
-       throws VLCException {
-       _addBroadcast(name, input, output, options, enabled, loop);
-    }
-    
-    public void deleteMedia( String name ) throws VLCException {
-       _deleteMedia(name);
-    }
-    
-    public void setEnabled( String name, boolean enabled ) throws VLCException {
-       _setEnabled(name, enabled);
-    }
-    
-    public void setOutput( String name, String output ) throws VLCException {
-       _setOutput(name, output);
-    }
-    
-    public void setInput( String name, String input ) throws VLCException {
-       _setInput(name, input);
-    }
-    
-    public void setLoop( String name, boolean loop ) throws VLCException {
-       _setLoop(name, loop);
-    }
-    
-    public void changeMedia( String name, String input, String output, String[] options, boolean enabled, boolean loop )
-       throws VLCException {
-       _changeMedia(name, input, output, options, enabled, loop);
-    }
 
-       
        /**
         * Checks if the input is playing.
         * @return True if there is a playing input.
@@ -273,14 +138,14 @@ public class JVLC implements JLibVLC, Runnable {
                while (! beingDestroyed) {
                        try {
                                while (playlist.isRunning()) {
-                                       if (playlist.inputIsPlaying()) {
+                                       if (input.isPlaying()) {
                                                inputPlaying = true;
                                        }
                                        else {
                                                inputPlaying = false;
                                    }
                                            
-                                       if (playlist.inputHasVout()) {
+                                       if (input.hasVout()) {
                                                inputVout = true;
                                    }
                                        else {
@@ -302,6 +167,5 @@ public class JVLC implements JLibVLC, Runnable {
                        } // try
                } // while ! being destroyed
        } // run
-
 }
 
index f7f376eb64439a632b7c41b6b150a1f2d1b934a7..848a96d72c29773149d3f338ade2a08c4d8aa15f 100644 (file)
@@ -45,6 +45,11 @@ public class JVLCCanvas extends Canvas {
         setSize(200, 200);
     }
     
+    public JVLCCanvas(String[] args) {
+       jvlc = new JVLC(args);
+       setSize(200, 200);
+    }
+    
     /**
      * @param width The initial canvas width
      * @param height The initial canvas height
@@ -53,6 +58,11 @@ public class JVLCCanvas extends Canvas {
         jvlc = new JVLC();
         setSize(width, height);
     }
+    
+    public JVLCCanvas(String[] args, int width, int height) {
+        jvlc = new JVLC(args);
+        setSize(width, height);
+    }
 
     public JVLCCanvas(JVLC jvlc) {
         this.jvlc = jvlc;
index e59f17aa0d81a22dcb47a38d4fe9c50d3c87cb96..0d007efbe742e6ddd790506d298f778c29fefe99 100644 (file)
@@ -50,8 +50,6 @@ public class Playlist implements PlaylistIntf {
     native private int _itemsCount();
     native private int _isRunning();
     
-    native private boolean _inputIsPlaying();
-       native private boolean _inputHasVout();
 
 
     public synchronized void play(int id, String[] options) throws VLCException {
@@ -113,13 +111,4 @@ public class Playlist implements PlaylistIntf {
     public long getInstance() throws VLCException {
         return libvlcInstance;
     }
-    
-    public synchronized boolean inputIsPlaying() throws VLCException {
-        return _inputIsPlaying();
-    }
-
-    public synchronized boolean inputHasVout() throws VLCException {
-        return _inputHasVout();
-    }
-    
 }
index 9bb7141e3dc9c724d5df34b2629da2d614d3574e..cd45cb8b4f46fee68b58e6b943614cc8fc0148fc 100644 (file)
@@ -61,11 +61,6 @@ public interface PlaylistIntf {
      */
     int itemsCount() throws VLCException;
     
-    /**
-     * @return True if the current input is really playing
-     */
-    boolean inputIsPlaying() throws VLCException;
-    
     /**
      * Move to next item
      */
@@ -94,8 +89,5 @@ public interface PlaylistIntf {
      */
     void addExtended();
     
-    /**
-     * @return True if the current input has spawned a video output window
-     */
-    boolean inputHasVout() throws VLCException;
+
 }
diff --git a/bindings/java/org/videolan/jvlc/Status.java b/bindings/java/org/videolan/jvlc/Status.java
deleted file mode 100644 (file)
index 06563a1..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * Status.java: VLC status thread 
- *****************************************************************************
- *
- * Copyright (C) 1998-2006 the VideoLAN team
- * 
- * Author: Filippo Carone <filippo@carone.org>
- *
- * Created on 5-jun-2006
- *
- * $Id $
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- * 
- */
-
-package org.videolan.jvlc;
-
-/**
- * In this thread we check the playlist status and the input status to see if:
- * - the playlist is running
- * - the input is playing
- * - if the input has a vout child
- *
- */
-public class Status implements Runnable {
-
-       final JVLC jvlc;
-       public boolean inputPlaying;
-       public boolean inputVout;
-    private long resolution = 50;
-       
-       public Status(JVLC jvlc) {
-               if (jvlc == null)
-                       throw new RuntimeException("No jvlc instance.. I die");
-               if (jvlc.playlist == null) 
-            throw new RuntimeException("No playlist instance.. I die");
-               this.jvlc = jvlc;
-               new Thread(this).start();
-       }
-       
-       public void run() {
-               while (true) {
-                       while (jvlc.playlist.isRunning()) {
-                               if (jvlc.playlist.inputIsPlaying()) {
-                                       inputPlaying = true;
-                }
-                               else {
-                                       inputPlaying = false;
-                }
-                     
-                               if (jvlc.playlist.inputHasVout()) {
-                                       inputVout = true;
-                }
-                               else {
-                                       inputVout = false;
-                }
-                               try {
-                                       Thread.sleep(resolution);
-                               } catch (InterruptedException e) {
-                                       e.printStackTrace();
-                               } 
-                       } 
-            inputPlaying = false;
-            inputVout = false;
-                       try {
-                               Thread.sleep(resolution);
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
-                       }
-               }
-       }
-
-}
diff --git a/bindings/java/org/videolan/jvlc/VLM.java b/bindings/java/org/videolan/jvlc/VLM.java
new file mode 100644 (file)
index 0000000..e16fd6a
--- /dev/null
@@ -0,0 +1,74 @@
+package org.videolan.jvlc;
+
+public class VLM implements VLMIntf {
+
+       private long libvlcInstance;
+
+       private native void _addBroadcast(String mediaName, String meditInputMRL,
+                       String mediaOutputMRL, String[] additionalOptions,
+                       boolean enableBroadcast, boolean isPlayableInLoop);
+
+       private native void _deleteMedia(String mediaName);
+       private native void _setEnabled(String mediaName, boolean newStatus);
+       private native void _setOutput(String mediaName, String mediaOutputMRL);
+       private native void _setInput(String mediaName, String mediaInputMRL);
+       private native void _setLoop(String mediaName, boolean isPlayableInLoop);
+       private native void _changeMedia(String newMediaName, String inputMRL,
+                       String outputMRL, String[] additionalOptions,
+                       boolean enableNewBroadcast, boolean isPlayableInLoop);
+       private native void _playMedia(String mediaName);
+       private native void _stopMedia(String mediaName);
+       private native void _pauseMedia(String mediaName);
+
+    public VLM( long instance ) {
+       this.libvlcInstance = instance;
+    }
+       
+       public void addBroadcast(String name, String input, String output,
+                       String[] options, boolean enabled, boolean loop)
+                       throws VLCException {
+               _addBroadcast(name, input, output, options, enabled, loop);
+       }
+
+       public void deleteMedia(String name) throws VLCException {
+               _deleteMedia(name);
+       }
+
+       public void setEnabled(String name, boolean enabled) throws VLCException {
+               _setEnabled(name, enabled);
+       }
+
+       public void setOutput(String name, String output) throws VLCException {
+               _setOutput(name, output);
+       }
+
+       public void setInput(String name, String input) throws VLCException {
+               _setInput(name, input);
+       }
+
+       public void setLoop(String name, boolean loop) throws VLCException {
+               _setLoop(name, loop);
+       }
+
+       public void changeMedia(String name, String input, String output,
+                       String[] options, boolean enabled, boolean loop)
+                       throws VLCException {
+               _changeMedia(name, input, output, options, enabled, loop);
+       }
+
+       public void playMedia(String name) throws VLCException {
+               _playMedia(name);
+       }
+
+       public void stopMedia(String name) throws VLCException {
+               _stopMedia(name);
+       }
+
+       public void pauseMedia(String name) throws VLCException {
+               _pauseMedia(name);
+       }
+       
+       public long getInstance() {
+               return libvlcInstance;
+       }
+}
index 4fc41d24ee73e9f93343c411abfcd9dfe85f11f7..f909a1be41a0a37588ab3db9c0581da2f0e606ab 100644 (file)
@@ -32,12 +32,12 @@ public interface VLMIntf {
 
        /**
         * Add a broadcast, with one input
-        * @param mediaName the name of the new broadcast
-        * @param medInputMRL the input MRL
-        * @param mediaOutputURL the output MRL (the parameter to the "sout" variable)
-        * @param additionalOptions additional options
-        * @param enableBroadcast boolean for enabling the new broadcast
-        * @param isPlayableInLoop Should this broadcast be played in loop ?
+        * @param name the name of the new broadcast
+        * @param input the input MRL
+        * @param output the output MRL (the parameter to the "sout" variable)
+        * @param options additional options
+        * @param enabled boolean for enabling the new broadcast
+        * @param loop Should this broadcast be played in loop ?
         */
     void addBroadcast( String name, String input, String output, String[] options, boolean enabled, boolean loop )
        throws VLCException;
@@ -71,7 +71,7 @@ public interface VLMIntf {
     void setInput( String name, String input ) throws VLCException;
     
     /**
-     * Set output for a media
+     * Set loop mode for a media
      * @param name the media to work on
      * @param loop the new status
      */
@@ -89,4 +89,22 @@ public interface VLMIntf {
      */    
     void changeMedia( String name, String input, String output, String[] options, boolean enabled, boolean loop )
        throws VLCException;
+    /**
+     * Plays a media
+     * @param name of the broadcast to play
+     */
+    void playMedia(String name) throws VLCException;
+
+    /**
+     * Stops a media
+     * @param name of the broadcast to stop
+     */
+    void stopMedia(String name) throws VLCException;
+
+    /**
+     * Pauses a media
+     * @param name name of the broadcast to pause
+     */    
+    void pauseMedia(String name) throws VLCException;
+
 }
diff --git a/bindings/java/org/videolan/jvlc/Video.java b/bindings/java/org/videolan/jvlc/Video.java
new file mode 100644 (file)
index 0000000..88c1059
--- /dev/null
@@ -0,0 +1,113 @@
+/**
+ * 
+ */
+package org.videolan.jvlc;
+
+import java.awt.Component;
+import java.awt.Dimension;
+
+public final class Video implements VideoIntf {
+       
+       private long libvlcInstance;
+       
+       public Video( long libvlcInstance) {
+               this.libvlcInstance = libvlcInstance;
+               
+       }
+
+       /*
+     * Video native methods
+     */
+    private native void                        _toggleFullscreen();
+    private native void                        _setFullscreen( boolean value);
+    private native boolean             _getFullscreen();
+    private native int                 _getHeight();
+    private native int                 _getWidth();
+    private native void                        _getSnapshot(String filename);
+    private native void                        _destroyVideo();
+    private native void                        _reparent(Component component);
+    private native void                        _setSize(int width, int height);
+       
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#destroyVideo()
+        */
+       public void destroyVideo() throws VLCException {
+               _destroyVideo();
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#getFullscreen()
+        */
+       public boolean getFullscreen() throws VLCException {
+               return _getFullscreen();
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#getSnapshot(java.lang.String)
+        */
+       public void getSnapshot(String filepath) throws VLCException {
+               _getSnapshot( filepath );
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#getVideoHeight()
+        */
+       public int getHeight() throws VLCException {
+               return _getHeight();
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#getVideoWidth()
+        */
+       public int getWidth() throws VLCException {
+               return _getWidth();
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#reparentVideo(java.awt.Component)
+        */
+       public void reparent(Component c) throws VLCException {
+               _reparent(c);
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#resizeVideo(int, int)
+        */
+       public void setSize(int width, int height) throws VLCException {
+               _setSize( width, height );
+
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#setFullscreen(boolean)
+        */
+       public void setFullscreen(boolean fullscreen) throws VLCException {
+               _setFullscreen( fullscreen );
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#toggleFullscreen()
+        */
+       public void toggleFullscreen() throws VLCException {
+               _toggleFullscreen();
+       }
+       
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#getSize()
+        */
+       public Dimension getSize() throws VLCException {
+               return new Dimension (getWidth(), getHeight());
+       }
+
+       /* (non-Javadoc)
+        * @see org.videolan.jvlc.VideoIntf#setSize(java.awt.Dimension)
+        */
+       public void setSize(Dimension d) throws VLCException {
+               setSize(d.width, d.height);
+       }
+
+       public long getInstance() {
+               return libvlcInstance;
+       }
+       
+}
index 2b7c56909d1c5e228ccbe293131a12f41211069d..cecd4acb21b25b01785471f10189c68532f57dc5 100644 (file)
@@ -29,6 +29,9 @@
 
 package org.videolan.jvlc;
 
+import java.awt.Component;
+import java.awt.Dimension;
+
 
 public interface VideoIntf {
     /**
@@ -62,10 +65,50 @@ public interface VideoIntf {
     /**
      * @return The current video window height
      */
-    int                getVideoHeight() throws VLCException;
+    int                getHeight() throws VLCException;
 
     /**
      * @return The current video window width
      */
-    int                getVideoWidth() throws VLCException;    
+    int                getWidth() throws VLCException;
+    
+    /**
+     * Get the size of the video output window as a Dimension object.
+     * @return The video size in a Dimension object.
+     * @throws VLCException
+     */
+    Dimension  getSize() throws VLCException;
+    
+    /**
+     * Destroys video output, but the item continues to play.
+     * @throws VLCException
+     */
+    void destroyVideo() throws VLCException;
+    
+    /**
+     * Moves video output from the current Canvas to another. This funtion
+     * doens't resize the video output to the new canvas size. See resizeVideo().
+     * @param c
+     * @throws VLCException
+     */
+    void reparent(Component c) throws VLCException;
+    
+    /**
+     * Resizes video output to width and height. This operation could be necessary
+     * after reparenting. See reparentVideo().
+     * @param width The new video output width
+     * @param height The new video output height
+     * @throws VLCException
+     */
+    void setSize(int width, int height) throws VLCException;
+    
+    /**
+     * Resizes video output to width and height. This operation could be necessary
+     * after reparenting. See reparentVideo().
+        *
+     * @param d The new size of video
+     * @throws VLCException
+     */
+    void setSize(Dimension d) throws VLCException;
+    
 }
diff --git a/bindings/java/src/Makefile.am b/bindings/java/src/Makefile.am
new file mode 100644 (file)
index 0000000..0d47720
--- /dev/null
@@ -0,0 +1,17 @@
+if BUILD_JAVA
+
+COBJECTS = utils.o video-jni.o audio-jni.o input-jni.o playlist-jni.o vlm-jni.o core-jni.o graphics-jni.o
+JAVACXXFLAGS = `top_builddir=../../.. ../../../vlc-config --cflags pic` -I../../ -I ../../include $(JINCLUDES) -c
+
+
+all: $(COBJECTS)
+
+%.o: %.cc
+       $(CXX) $? $(CXXFLAGS) $(JAVACXXFLAGS) -o $(*F).o
+
+.PHONY: clean-local
+
+clean-local:
+       rm -f *.o *~
+
+endif
diff --git a/bindings/java/src/audio-jni.cc b/bindings/java/src/audio-jni.cc
new file mode 100644 (file)
index 0000000..6d90b92
--- /dev/null
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * audio-jni.cc: JNI native audio functions for VLC Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2006 the VideoLAN team
+ *
+ * Authors: Filippo Carone <filippo@carone.org>
+ *
+ *
+ * $Id $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/* These are a must*/
+#include <jni.h>
+
+#include <vlc/libvlc.h>
+
+/* JVLC internal imports, generated by gcjh */
+#include "../includes/Audio.h"
+#include "utils.h"
+
+JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Audio__1getMute (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+    jboolean res;
+
+    res = (jboolean) libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
+
+    CHECK_EXCEPTION;
+
+    return res;
+    
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setMute (JNIEnv *env, jobject _this, jboolean value) 
+{
+    INIT_FUNCTION;
+
+    libvlc_audio_set_mute( ( libvlc_instance_t * ) instance, value, exception );
+
+    CHECK_EXCEPTION;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1toggleMute (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+
+    libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
+    
+    CHECK_EXCEPTION;
+}
+
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Audio__1getVolume (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION;
+    jint res = 0;
+
+    res = libvlc_audio_get_volume( ( libvlc_instance_t * ) instance, exception );
+
+    CHECK_EXCEPTION;
+
+    return res;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1setVolume (JNIEnv *env, jobject _this, jint volume)
+{
+    INIT_FUNCTION;
+
+    libvlc_audio_set_volume( ( libvlc_instance_t * ) instance, volume, exception );
+
+    CHECK_EXCEPTION;
+}
+
diff --git a/bindings/java/src/core-jni.cc b/bindings/java/src/core-jni.cc
new file mode 100644 (file)
index 0000000..b932ce3
--- /dev/null
@@ -0,0 +1,101 @@
+/*****************************************************************************
+ * vlc-libvlc-jni.cc: JNI interface for vlc Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2006 the VideoLAN team
+ *
+ * Authors: Filippo Carone <filippo@carone.org>
+ *          Philippe Morin <phmorin@free.fr>
+ *
+ * $Id: core-jni.cc 156 2006-08-01 09:23:01Z littlejohn $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/* These are a must*/
+#include <jni.h>
+#include <vlc/libvlc.h>
+
+#include <stdio.h>  // for printf
+#include <stdlib.h> // for calloc
+#include <string.h> // for strcmp
+#include <unistd.h> // for usleep
+
+/* JVLC internal imports, generated by gcjh */
+#include "../includes/JVLC.h"
+
+#include <jawt.h>
+#include <jawt_md.h>
+
+#include <X11/Xlib.h> // for Xlibs graphics functions
+
+#include "utils.h"
+
+
+jlong getClassInstance (JNIEnv *env, jobject _this);
+
+JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC_createInstance (JNIEnv *env, jobject _this, jobjectArray args) {
+
+    long res;
+    int argc;
+    const char **argv;
+
+    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
+
+    libvlc_exception_init( exception );
+  
+    argc = (int) env->GetArrayLength((jarray) args) + 1;
+    argv = (const char **) malloc(argc * sizeof(char*));
+
+    argv[0] = "vlc";
+    
+    
+    for (int i = 0; i < argc - 1; i++) {
+        argv[i+1] = env->GetStringUTFChars((jstring) env->GetObjectArrayElement(args, i),
+                                         0
+        );
+       //printf("param: %s\n", argv[i + 1]);
+    }
+
+    res = (long) libvlc_new(argc, (char**) argv, exception );
+
+    free( exception );
+    free( argv );
+
+    return res;
+
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1destroy (JNIEnv *env, jobject _this) 
+{
+    long instance;
+    
+    instance = getClassInstance( env, _this );
+
+    libvlc_destroy( (libvlc_instance_t *) instance);
+
+    return;
+}
+
+
+/*
+ * Utility functions
+ */
+jlong getClassInstance (JNIEnv *env, jobject _this) {
+    /* get the id field of object */
+    jclass    cls   = env->GetObjectClass(_this);
+    jmethodID mid   = env->GetMethodID(cls, "getInstance", "()J");
+    jlong     field = env->CallLongMethod(_this, mid);
+    return field;
+}
similarity index 98%
rename from bindings/java/vlc-graphics-jni.cc
rename to bindings/java/src/graphics-jni.cc
index 2a5fa0d9a0e860f0065b6379839ddbaf4545be0b..417d5fbc922950f0745747a7fbd6fffa1b4e8383 100644 (file)
@@ -33,7 +33,7 @@
 #include <stdio.h>    // for printf
 
 /* JVLC internal imports, generated by gcjh */
-#include "org_videolan_jvlc_JVLCCanvas.h"
+#include "../includes/JVLCCanvas.h"
 
 /*
  * This will only work on X11 at the moment
diff --git a/bindings/java/src/input-jni.cc b/bindings/java/src/input-jni.cc
new file mode 100644 (file)
index 0000000..068c0f9
--- /dev/null
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * input-jni.cc: JNI native input functions for VLC Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2006 the VideoLAN team
+ *
+ * Authors: Filippo Carone <filippo@carone.org>
+ *
+ *
+ * $Id $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#include <jni.h>
+
+#include <vlc/libvlc.h>
+
+/* JVLC internal imports, generated by gcjh */
+#include "../includes/Input.h"
+#include "utils.h"
+
+JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_Input__1getLength (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION ;
+    vlc_int64_t res = 0;
+
+    GET_INPUT_THREAD ;
+
+    res = libvlc_input_get_length( input, exception );
+    CHECK_EXCEPTION_FREE;
+
+    return res;
+}
+
+JNIEXPORT jfloat JNICALL Java_org_videolan_jvlc_Input__1getPosition (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+    jfloat res;
+    
+    GET_INPUT_THREAD ;
+
+    res = libvlc_input_get_position( input, exception );
+    CHECK_EXCEPTION_FREE;
+
+    return res;
+}
+
+JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_Input__1getTime (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+    vlc_int64_t res = 0;
+
+    GET_INPUT_THREAD ;
+
+    res = libvlc_input_get_time( input, exception );
+    CHECK_EXCEPTION_FREE ;
+
+    return res;
+}
+
+JNIEXPORT jfloat JNICALL Java_org_videolan_jvlc_Input__1getFPS (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+    float res;
+
+    GET_INPUT_THREAD ;
+
+    res = libvlc_input_get_fps( input, exception );
+    CHECK_EXCEPTION_FREE ;
+
+    return res;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Input__1setTime (JNIEnv *env, jobject _this, jlong time) 
+{
+    INIT_FUNCTION;
+
+    GET_INPUT_THREAD ;
+
+    libvlc_input_set_time( input, time, exception );
+    CHECK_EXCEPTION_FREE;
+        
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Input__1setPosition (JNIEnv *env, jobject _this, jfloat position )
+{
+    INIT_FUNCTION;
+
+    GET_INPUT_THREAD ;
+
+    libvlc_input_set_position( input, position, exception );
+    CHECK_EXCEPTION_FREE;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Input__1isPlaying (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION ;
+    vlc_bool_t res = 0;
+    
+    GET_INPUT_THREAD ;
+    
+    res = libvlc_input_will_play( input, exception );
+    CHECK_EXCEPTION_FREE ;
+    
+    return res;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Input__1hasVout (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION ;
+    vlc_bool_t res = 0;
+    
+    GET_INPUT_THREAD ;
+    
+    res = libvlc_input_has_vout( input, exception );
+    CHECK_EXCEPTION_FREE ;
+    
+    return res;
+}
+
diff --git a/bindings/java/src/playlist-jni.cc b/bindings/java/src/playlist-jni.cc
new file mode 100644 (file)
index 0000000..064d005
--- /dev/null
@@ -0,0 +1,178 @@
+/*****************************************************************************
+ * playlist-jni.cc: JNI native playlist functions for VLC Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2006 the VideoLAN team
+ *
+ * Authors: Filippo Carone <filippo@carone.org>
+ *
+ *
+ * $Id $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/* These are a must*/
+#include <jni.h>
+#include <vlc/libvlc.h>
+
+/* JVLC internal imports, generated by gcjh */
+#include "../includes/Playlist.h"
+
+#include "utils.h"
+
+
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1playlist_1add (JNIEnv *env, jobject _this, jstring uri, jstring name,  jobjectArray options) {
+
+    INIT_FUNCTION ;
+    
+    int res = 0;
+    int i_options = 0;
+    const char** ppsz_options = NULL;
+    const char* psz_uri  = env->GetStringUTFChars( uri, 0 );
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+
+    if ( options != NULL ) {
+        i_options = ( int ) env->GetArrayLength( ( jarray ) options ) + 1;
+        ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
+        sprintf( ( char * ) ppsz_options[0], "%s", "jvlc" );
+
+        for (int i = 0; i < i_options - 1; i++) {
+            ppsz_options[ i+1 ] =
+                env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
+        }
+        res = libvlc_playlist_add_extended( ( libvlc_instance_t * ) instance, psz_uri, psz_name, i_options, ppsz_options, exception );
+       
+        CHECK_EXCEPTION_FREE;
+        
+    } else {
+        res = libvlc_playlist_add( ( libvlc_instance_t * ) instance, psz_uri, psz_name, exception );
+        
+        CHECK_EXCEPTION_FREE;
+    }
+    
+    if (psz_uri != NULL) {
+        env->ReleaseStringUTFChars( uri, psz_uri );
+    }
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }
+
+    return res;
+}
+
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1play (JNIEnv *env, jobject _this, jint id, jobjectArray options)
+{
+
+    INIT_FUNCTION;
+    
+    int i_options = 0;
+    const char** ppsz_options = NULL;
+
+    if ( options != NULL ) {
+       i_options = ( int ) env->GetArrayLength( ( jarray ) options );
+       ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
+       for ( int i = 0; i < i_options - 1; i++ ) {
+           ppsz_options[ i ] = 
+               env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
+       }
+    }
+
+    libvlc_playlist_play( ( libvlc_instance_t * ) instance, id, i_options, ( char **  ) ppsz_options, exception );
+
+    CHECK_EXCEPTION_FREE;
+}
+
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1pause (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+
+    libvlc_playlist_pause( ( libvlc_instance_t* ) instance, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1stop (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+
+    libvlc_playlist_stop( ( libvlc_instance_t* ) instance, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1next (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+    
+    libvlc_playlist_next( ( libvlc_instance_t* ) instance, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1prev (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+    
+    libvlc_playlist_prev( (libvlc_instance_t*) instance, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1clear (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+
+    libvlc_playlist_clear( (libvlc_instance_t*) instance, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1deleteItem (JNIEnv *env, jobject _this, jint itemID)
+{
+    INIT_FUNCTION ;
+
+    libvlc_playlist_delete_item( ( libvlc_instance_t * ) instance, itemID, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1itemsCount (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+    int res = 0;
+
+    res = libvlc_playlist_items_count( (libvlc_instance_t*) instance, exception );
+
+    CHECK_EXCEPTION_FREE ;
+
+    return res;
+
+}
+
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1isRunning (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+    int res = 0;
+
+    res = libvlc_playlist_isplaying( (libvlc_instance_t*) instance, exception );
+
+    CHECK_EXCEPTION_FREE ;
+
+    return res;
+}
diff --git a/bindings/java/src/utils.cc b/bindings/java/src/utils.cc
new file mode 100644 (file)
index 0000000..e20bd80
--- /dev/null
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * utils.cc: Utility functions for VLC Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2006 the VideoLAN team
+ *
+ * Authors: Filippo Carone <filippo@carone.org>
+ *
+ *
+ * $Id $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/* These are a must*/
+#include <jni.h>
+
+#include "utils.h"
+
+JAWT awt;
+JAWT_DrawingSurfaceInfo* dsi;
+
+void handle_vlc_exception( JNIEnv* env, libvlc_exception_t* exception ) {
+  jclass newExcCls;
+
+  // raise a Java exception
+  newExcCls = env->FindClass("org/videolan/jvlc/VLCException");
+  if (newExcCls == 0) { /* Unable to find the new exception class, give up. */
+      return;
+  }
+  env->ThrowNew(newExcCls, libvlc_exception_get_message(exception));
+       
+}
+
+jlong getInstance (JNIEnv *env, jobject _this) {
+    /* get the id field of object */
+    jclass    cls   = env->GetObjectClass(_this);
+    jmethodID mid   = env->GetMethodID(cls, "getInstance", "()J");
+    jlong     field = env->CallLongMethod(_this, mid);
+    return field;
+}
diff --git a/bindings/java/src/utils.h b/bindings/java/src/utils.h
new file mode 100644 (file)
index 0000000..371f9af
--- /dev/null
@@ -0,0 +1,35 @@
+/* These are a must*/
+#include <jni.h>
+#include <jawt.h>
+#include <jawt_md.h>
+
+#include <vlc/libvlc.h>
+#include <stdlib.h> // for free
+
+void handle_vlc_exception( JNIEnv*, libvlc_exception_t* );
+jlong getInstance ( JNIEnv* , jobject );
+
+#define CHECK_EXCEPTION_FREE \
+    if ( libvlc_exception_raised( exception )) \
+    { \
+        handle_vlc_exception( env, exception ); \
+    } \
+    free( exception );
+
+#define CHECK_EXCEPTION \
+    if ( libvlc_exception_raised( exception )) \
+    { \
+        handle_vlc_exception( env, exception ); \
+    }
+
+
+#define INIT_FUNCTION \
+    long instance; \
+    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t )); \
+    libvlc_exception_init( exception ); \
+    instance = getInstance( env, _this );
+
+#define GET_INPUT_THREAD \
+    libvlc_input_t *input; \
+    input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception ); \
+    CHECK_EXCEPTION ;
diff --git a/bindings/java/src/video-jni.cc b/bindings/java/src/video-jni.cc
new file mode 100644 (file)
index 0000000..1229bba
--- /dev/null
@@ -0,0 +1,233 @@
+/*****************************************************************************
+ * video-jni.cc: JNI native video functions for VLC Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2006 the VideoLAN team
+ *
+ * Authors: Filippo Carone <filippo@carone.org>
+ *
+ *
+ * $Id $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/* These are a must*/
+#include <jni.h>
+
+#include <vlc/libvlc.h>
+
+/* JVLC internal imports, generated by gcjh */
+#include "../includes/Video.h"
+
+#include "utils.h"
+#include <stdio.h>
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1toggleFullscreen (JNIEnv *env, jobject _this)
+{
+    INIT_FUNCTION ;
+
+    GET_INPUT_THREAD ;
+    
+    libvlc_toggle_fullscreen( input, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1setFullscreen (JNIEnv *env, jobject _this, jboolean value) 
+{
+    INIT_FUNCTION ;
+
+    GET_INPUT_THREAD ;
+
+    libvlc_set_fullscreen( input, value, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Video__1getFullscreen (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+    int res = 0;
+
+    GET_INPUT_THREAD ;
+
+    res = libvlc_get_fullscreen( input, exception );
+
+    CHECK_EXCEPTION_FREE ;
+    
+    return res;
+}
+
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Video__1getHeight (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+    int res = 0;
+
+    GET_INPUT_THREAD ;
+
+    res = libvlc_video_get_height( input, exception );
+
+    CHECK_EXCEPTION_FREE ;
+
+    return res;
+}
+
+JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Video__1getWidth (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION;
+    int res = 0;
+
+    GET_INPUT_THREAD ;
+
+    res = libvlc_video_get_width( input, exception );
+
+    CHECK_EXCEPTION_FREE ;
+
+    return res;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1getSnapshot (JNIEnv *env, jobject _this, jstring filepath) 
+{
+    INIT_FUNCTION;
+    
+    const char* psz_filepath  = env->GetStringUTFChars( filepath, 0 );
+
+    GET_INPUT_THREAD ;
+
+    libvlc_video_take_snapshot( input, (char *) psz_filepath, exception );
+
+    CHECK_EXCEPTION_FREE ;
+    
+    if (psz_filepath != NULL) {
+        env->ReleaseStringUTFChars( filepath, psz_filepath );
+    }
+    
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1destroyVideo (JNIEnv *env, jobject _this) 
+{
+    INIT_FUNCTION ;
+     
+    GET_INPUT_THREAD ;
+
+    libvlc_video_destroy( input, exception );
+
+    CHECK_EXCEPTION_FREE;
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, jobject _this, jobject canvas) 
+{
+    INIT_FUNCTION ;
+    
+    GET_INPUT_THREAD ;
+
+    JAWT awt;
+    JAWT_DrawingSurface* ds;
+    JAWT_DrawingSurfaceInfo* dsi;
+#ifdef WIN32
+    JAWT_Win32DrawingSurfaceInfo* dsi_win;
+#else
+    JAWT_X11DrawingSurfaceInfo* dsi_x11;
+    GC gc;  
+#endif    
+    jint lock;
+    
+    vlc_value_t value;
+
+    /* Get the AWT */
+    awt.version = JAWT_VERSION_1_3;
+    if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
+        printf("AWT Not found\n");
+        return;
+    }
+
+    /* Get the drawing surface */
+    ds = awt.GetDrawingSurface(env, canvas);
+    if (ds == NULL) {
+        printf("NULL drawing surface\n");
+        return;
+    }
+
+    /* Lock the drawing surface */
+    lock = ds->Lock(ds);
+    if((lock & JAWT_LOCK_ERROR) != 0) {
+        printf("Error locking surface\n");
+        awt.FreeDrawingSurface(ds);
+        return;
+    }
+
+    /* Get the drawing surface info */
+    dsi = ds->GetDrawingSurfaceInfo(ds);
+    if (dsi == NULL) {
+        printf("Error getting surface info\n");
+        ds->Unlock(ds);
+        awt.FreeDrawingSurface(ds);
+        return;
+    }
+
+    
+#ifdef WIN32
+    /* Get the platform-specific drawing info */
+    dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
+
+    libvlc_video_reparent( input, dsi_win->hwnd, exception );
+
+    CHECK_EXCEPTION_FREE ;
+    
+    /* Now paint */
+    value.i_int = reinterpret_cast<int>(dsi_win->hwnd); 
+    VLC_VariableSet( 1, "drawable", value );
+
+#else // UNIX
+    /* Get the platform-specific drawing info */
+
+    dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
+
+    /* Now paint */
+    gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0);
+    XSetBackground(dsi_x11->display, gc, 0);
+
+    /* and reparent */
+    libvlc_video_reparent( input, dsi_x11->drawable, exception );
+
+    CHECK_EXCEPTION_FREE ;
+
+    /* also update the drawable variable value */
+    value.i_int = dsi_x11->drawable;
+    VLC_VariableSet( 0, "drawable", value );
+    
+    XFreeGC(dsi_x11->display, gc);
+
+#endif
+  /* Free the drawing surface info */
+  ds->FreeDrawingSurfaceInfo(dsi);
+
+  /* Unlock the drawing surface */
+  ds->Unlock(ds);
+
+  /* Free the drawing surface */
+  awt.FreeDrawingSurface(ds);
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1setSize__II (JNIEnv *env, jobject _this, jint width, jint height) 
+{
+    INIT_FUNCTION ;
+
+    GET_INPUT_THREAD ;
+    
+    libvlc_video_resize( input, width, height, exception );
+
+    CHECK_EXCEPTION_FREE ;
+}
diff --git a/bindings/java/src/vlm-jni.cc b/bindings/java/src/vlm-jni.cc
new file mode 100644 (file)
index 0000000..c43db60
--- /dev/null
@@ -0,0 +1,219 @@
+/*****************************************************************************
+ * vlm-jni.cc: JNI native VLM functions for VLC Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2006 the VideoLAN team
+ *
+ * Authors: Philippe Morin <phmorin@free.fr>
+ *
+ *
+ * $Id $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#include <jni.h>
+
+#include <vlc/libvlc.h>
+
+/* JVLC internal imports, generated by gcjh */
+#include "../includes/VLM.h"
+#include "utils.h"
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1addBroadcast (JNIEnv *env, jobject _this, jstring name, jstring inputmrl, jstring outputmrl, jobjectArray options, jboolean enable, jboolean loop) 
+{
+    INIT_FUNCTION;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );  
+    const char* psz_inputmrl = env->GetStringUTFChars( inputmrl, 0 );    
+    const char* psz_outputmrl = env->GetStringUTFChars( outputmrl, 0 );        
+    int i_options = 0;
+    const char** ppsz_options = NULL;
+    
+    if ( options != NULL ) {
+        i_options = ( int ) env->GetArrayLength( ( jarray ) options );
+        ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
+        
+        for ( int i = 0; i < i_options - 1; i++ ) {
+            ppsz_options[ i ] = 
+                env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
+        }
+    }
+
+    libvlc_vlm_add_broadcast( (libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_inputmrl, (char*)psz_outputmrl ,
+                              i_options, (char**)ppsz_options, enable, loop, exception );
+
+    CHECK_EXCEPTION_FREE ;
+
+    
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }    
+    if (psz_inputmrl != NULL) {
+        env->ReleaseStringUTFChars( inputmrl, psz_inputmrl );
+    }    
+    if (psz_outputmrl != NULL) {
+        env->ReleaseStringUTFChars( outputmrl, psz_outputmrl );
+    }
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1deleteMedia (JNIEnv *env, jobject _this, jstring name) 
+{
+    INIT_FUNCTION ;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+
+    libvlc_vlm_del_media( (libvlc_instance_t *) instance, (char*)psz_name, exception);    
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }    
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1setEnabled (JNIEnv *env, jobject _this, jstring name, jboolean newStatus) 
+{
+    INIT_FUNCTION ;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+
+    libvlc_vlm_set_enabled( (libvlc_instance_t *) instance, (char*)psz_name, newStatus, exception);
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }        
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1setOutput (JNIEnv *env, jobject _this, jstring name, jstring mrl) 
+{
+    INIT_FUNCTION;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+    const char* psz_mrl = env->GetStringUTFChars( mrl, 0 );    
+
+    libvlc_vlm_set_output((libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_mrl, exception);
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }    
+
+    if (psz_mrl != NULL) {
+        env->ReleaseStringUTFChars( mrl, psz_mrl );
+    }    
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1setInput (JNIEnv *env, jobject _this, jstring name, jstring mrl) 
+{
+    INIT_FUNCTION;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+    const char* psz_mrl = env->GetStringUTFChars( mrl, 0 );    
+
+    libvlc_vlm_set_input((libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_mrl, exception);
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }    
+    if (psz_mrl != NULL) {
+        env->ReleaseStringUTFChars( mrl, psz_mrl );
+    }    
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1setLoop (JNIEnv *env, jobject _this, jstring name, jboolean newStatus) 
+{
+    INIT_FUNCTION;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+
+    libvlc_vlm_set_loop((libvlc_instance_t *) instance, (char*)psz_name, newStatus, exception);
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }    
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1changeMedia (JNIEnv *env, jobject _this, jstring name, jstring inputmrl, jstring outputmrl, jobjectArray options, jboolean enablenewbroadcast, jboolean broadcast) 
+{
+    INIT_FUNCTION;
+    int i_options = 0;
+    const char** ppsz_options = NULL;
+    const char* psz_name      = env->GetStringUTFChars( name, 0 );
+    const char* psz_inputmrl  = env->GetStringUTFChars( inputmrl, 0 );    
+    const char* psz_outputmrl = env->GetStringUTFChars( outputmrl, 0 );        
+
+    if ( options != NULL ) {
+        i_options = ( int ) env->GetArrayLength( ( jarray ) options );
+        ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
+        
+        for ( int i = 0; i < i_options - 1; i++ ) {
+            ppsz_options[ i ] = 
+                env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
+        }
+    }
+
+    libvlc_vlm_change_media( (libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_inputmrl, (char*)psz_outputmrl ,
+                              i_options, (char**)ppsz_options, enablenewbroadcast, broadcast, exception );
+    CHECK_EXCEPTION_FREE ;
+    
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }    
+    
+    if (psz_inputmrl != NULL) {
+       env->ReleaseStringUTFChars( name, psz_inputmrl );
+    }    
+   
+    if (psz_outputmrl != NULL) {
+        env->ReleaseStringUTFChars( name, psz_outputmrl );
+    }
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1playMedia (JNIEnv *env, jobject _this, jstring name) 
+{
+    INIT_FUNCTION;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+
+    libvlc_vlm_play_media( (libvlc_instance_t *) instance, (char*)psz_name, exception );
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1stopMedia (JNIEnv *env, jobject _this, jstring name) 
+{
+    INIT_FUNCTION;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+
+
+    libvlc_vlm_stop_media( (libvlc_instance_t *) instance, (char*)psz_name, exception );
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }
+}
+
+JNIEXPORT void JNICALL Java_org_videolan_jvlc_VLM__1pauseMedia (JNIEnv *env, jobject _this, jstring name) 
+{
+    INIT_FUNCTION;
+    const char* psz_name = env->GetStringUTFChars( name, 0 );
+   
+    libvlc_vlm_pause_media( (libvlc_instance_t *) instance, (char*)psz_name, exception );
+    CHECK_EXCEPTION_FREE ;
+
+    if (psz_name != NULL) {
+        env->ReleaseStringUTFChars( name, psz_name );
+    }    
+}
+
diff --git a/bindings/java/vlc-libvlc-jni.cc b/bindings/java/vlc-libvlc-jni.cc
deleted file mode 100644 (file)
index 58c0cea..0000000
+++ /dev/null
@@ -1,1018 +0,0 @@
-/*****************************************************************************
- * vlc-libvlc-jni.cc: JNI interface for vlc Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *          Philippe Morin <phmorin@free.fr>
- *
- * $Id: vlc-libvlc-jni.cc 140 2006-07-26 13:47:20Z littlejohn $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
- *****************************************************************************/
-
-/* These are a must*/
-#include <jni.h>
-#include <vlc/libvlc.h>
-
-#include <stdio.h>  // for printf
-#include <stdlib.h> // for calloc
-#include <string.h> // for strcmp
-#include <unistd.h> // for usleep
-
-/* JVLC internal imports, generated by gcjh */
-#include "org_videolan_jvlc_JVLC.h"
-#include "org_videolan_jvlc_Playlist.h"
-
-jlong getClassInstance (JNIEnv *env, jobject _this);
-jlong getPlaylistInstance (JNIEnv *env, jobject _this);
-
-void handle_vlc_exception( JNIEnv* env, libvlc_exception_t* exception ) {
-  jclass newExcCls;
-
-  // raise a Java exception
-  newExcCls = env->FindClass("org/videolan/jvlc/VLCException");
-  if (newExcCls == 0) { /* Unable to find the new exception class, give up. */
-      return;
-  }
-  env->ThrowNew(newExcCls, libvlc_exception_get_message(exception));
-       
-}
-
-
-JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC_createInstance___3Ljava_lang_String_2 (JNIEnv *env, jobject _this, jobjectArray args) {
-
-    long res;
-    int argc;
-    const char **argv;
-
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-
-    libvlc_exception_init( exception );
-  
-    argc = (int) env->GetArrayLength((jarray) args) + 1;
-    argv = (const char **) malloc(argc * sizeof(char*));
-
-    argv[0] = "vlc";
-    
-    
-    for (int i = 0; i < argc - 1; i++) {
-        argv[i+1] = env->GetStringUTFChars((jstring) env->GetObjectArrayElement(args, i),
-                                         0
-        );
-       //printf("param: %s\n", argv[i + 1]);
-    }
-
-    res = (long) libvlc_new(argc, (char**) argv, exception );
-
-    free( exception );
-    free( argv );
-
-    return res;
-
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1destroy (JNIEnv *env, jobject _this) 
-{
-    long instance;
-    
-    instance = getClassInstance( env, _this );
-
-    libvlc_destroy( (libvlc_instance_t *) instance);
-
-    return;
-}
-
-
-
-
-/*
- * Audio native functions
- */
-
-JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_JVLC__1getMute (JNIEnv *env, jobject _this) 
-{
-    // res is the final result
-    jboolean res;
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-   
-    res = (jboolean) libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-
-    return res;
-    
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1setMute (JNIEnv *env, jobject _this, jboolean value) 
-{
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_audio_set_mute( ( libvlc_instance_t * ) instance, value, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1toggleMute (JNIEnv *env, jobject _this) 
-{
-
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    ///\TODO: NO, this is not what we want.
-    libvlc_audio_get_mute( ( libvlc_instance_t * ) instance, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-}
-
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_JVLC__1getVolume (JNIEnv *env, jobject _this)
-
-    
-{
-    jint res = 0;
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    res = libvlc_audio_get_volume( ( libvlc_instance_t * ) instance, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-
-    return res;
-}
-
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_JVLC__1getVolume (JNIEnv *env, jobject);
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1setVolume (JNIEnv *env, jobject _this, jint volume) 
-{
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_audio_set_volume( ( libvlc_instance_t * ) instance, volume, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-}
-
-
-
-/*
- * Video native functions
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1toggleFullscreen (JNIEnv *env, jobject _this) 
-{
-    long instance = 0;
-    libvlc_input_t *input;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception );
-
-    
-    libvlc_toggle_fullscreen( input, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1setFullscreen (JNIEnv *env, jobject _this, jboolean value)
-{
-    long instance = 0;
-    libvlc_input_t *input;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception );
-    libvlc_set_fullscreen( input, value, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-}
-
-JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_JVLC__1getFullscreen (JNIEnv *env, jobject _this)
-{
-    int res = 0;
-    libvlc_input_t *input;
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-    input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception );
-
-    res = libvlc_get_fullscreen( input, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-
-    return res;
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1getSnapshot (JNIEnv *env, jobject _this, jstring filepath) 
-{
-    const char* psz_filepath  = env->GetStringUTFChars( filepath, 0 );
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-    long instance = 0;
-    libvlc_input_t *input;
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception );
-
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    libvlc_video_take_snapshot( input, (char *) psz_filepath, exception );
-
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    
-    if (psz_filepath != NULL) {
-        env->ReleaseStringUTFChars( filepath, psz_filepath );
-    }
-
-}
-
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_JVLC__1getVideoHeight (JNIEnv *env, jobject _this)
-{
-    int res = 0;
-    libvlc_input_t *input;
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-    input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception );
-
-    res = libvlc_video_get_height( input, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-
-    return res;
-}
-
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_JVLC__1getVideoWidth (JNIEnv *env, jobject _this)
-{
-    int res = 0;
-    libvlc_input_t *input;
-    long instance = 0;
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-    input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception );
-
-    res = libvlc_video_get_width( input, exception );
-    
-    if ( libvlc_exception_raised( exception )) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-
-    return res;
-}
-
-/*
- * Playlist native functions
- */
-
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1playlist_1add (JNIEnv *env, jobject _this, jstring uri, jstring name,  jobjectArray options) {
-    long instance = 0;
-    int res = 0;
-    int i_options = 0;
-    const char** ppsz_options = NULL;
-    const char* psz_uri  = env->GetStringUTFChars( uri, 0 );
-    const char* psz_name = env->GetStringUTFChars( name, 0 );
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    if ( options != NULL ) {
-       i_options = ( int ) env->GetArrayLength( ( jarray ) options ) + 1;
-       ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
-       sprintf( ( char * ) ppsz_options[0], "%s", "jvlc" );
-
-       for (int i = 0; i < i_options - 1; i++) {
-           ppsz_options[ i+1 ] =
-               env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
-       }
-        res = libvlc_playlist_add_extended( ( libvlc_instance_t * ) instance, psz_uri, psz_name, i_options, ppsz_options, exception );
-        
-        if ( libvlc_exception_raised ( exception ) ) 
-        {
-            handle_vlc_exception( env, exception );
-        }            
-    } else {
-        res = libvlc_playlist_add( ( libvlc_instance_t * ) instance, psz_uri, psz_name, exception );
-        if ( libvlc_exception_raised ( exception ) ) 
-        {
-            handle_vlc_exception( env, exception );
-        }            
-    }
-    /// \todo check exceptions
-
-    /* free resources */
-    free(exception);
-    if (psz_uri != NULL) {
-        env->ReleaseStringUTFChars( uri, psz_uri );
-    }
-
-    if (psz_name != NULL) {
-        env->ReleaseStringUTFChars( name, psz_name );
-    }
-
-    return res;
-}
-
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1play (JNIEnv *env, jobject _this, jint id, jobjectArray options) {
-
-    int i_options = 0;
-    const char** ppsz_options = NULL;
-
-    libvlc_instance_t *p_instance = ( libvlc_instance_t * ) getPlaylistInstance( env, _this );
-    
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    if ( options != NULL ) {
-       i_options = ( int ) env->GetArrayLength( ( jarray ) options );
-       ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
-       for ( int i = 0; i < i_options - 1; i++ ) {
-           ppsz_options[ i ] = 
-               env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
-       }
-    }
-
-    libvlc_playlist_play( p_instance, id, i_options, ( char **  ) ppsz_options, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-    
-    free( exception );
-    return;
-}
-
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1pause (JNIEnv *env, jobject _this) {
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-  
-    libvlc_playlist_pause( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return;
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1stop (JNIEnv *env, jobject _this) {
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    libvlc_playlist_stop( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return;
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1next (JNIEnv *env, jobject _this) {
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    libvlc_playlist_next( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-    
-    free( exception );
-    return;
-
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1prev (JNIEnv *env, jobject _this) {
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    libvlc_playlist_prev( (libvlc_instance_t*) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return;
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1clear (JNIEnv *env, jobject _this) {
-    long instance = 0;
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    libvlc_playlist_clear( (libvlc_instance_t*) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return;
-}
-
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1deleteItem (JNIEnv *env, jobject _this, jint itemID) {
-    long instance = 0;
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_playlist_delete_item( ( libvlc_instance_t * ) instance, itemID, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return;
-}
-
-
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1itemsCount (JNIEnv *env, jobject _this) {
-    long instance = 0;
-    int res = 0;
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    res = libvlc_playlist_items_count( (libvlc_instance_t*) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return res;
-
-}
-
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1isRunning (JNIEnv *env, jobject _this) {
-    long instance = 0;
-    int res = 0;
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    res = libvlc_playlist_isplaying( (libvlc_instance_t*) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return res;
-
-}
-
-JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Playlist__1inputIsPlaying (JNIEnv *env, jobject _this) 
-{
-    vlc_bool_t res = 0;
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-    libvlc_input_t *input;
-    
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    
-    input = libvlc_playlist_get_input( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-    
-    res = libvlc_input_will_play( input, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    free( exception );
-    return res;    
-}
-
-JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Playlist__1inputHasVout (JNIEnv *env, jobject _this) 
-{
-    vlc_bool_t res = 0;
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-    libvlc_input_t *input;
-    
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    
-    input = libvlc_playlist_get_input( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }            
-
-    res = libvlc_input_has_vout( input, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-    return res;    
-}
-
-/*
- * Input handling functions
- */
-
-JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC__1getInputLength (JNIEnv *env, jobject _this) 
-{
-    vlc_int64_t res = 0;
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-    libvlc_input_t *input;
-    
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    
-    input = libvlc_playlist_get_input( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-    
-    res = libvlc_input_get_length( input, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-    return res;    
-}
-
-JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC__1getInputTime (JNIEnv *env, jobject _this) 
-{
-    vlc_int64_t res = 0;
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-    libvlc_input_t *input;
-    
-    libvlc_exception_init( exception );
-    instance = getPlaylistInstance( env, _this );
-    
-    input = libvlc_playlist_get_input( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    
-    res = libvlc_input_get_time( input, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-    return res;    
-}
-
-JNIEXPORT jfloat JNICALL Java_org_videolan_jvlc_JVLC__1getInputPosition (JNIEnv *env, jobject _this) 
-{
-    float res;
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-    libvlc_input_t *input;
-    
-    libvlc_exception_init( exception );
-    
-    instance = getPlaylistInstance( env, _this );
-    
-    input = libvlc_playlist_get_input( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    res = libvlc_input_get_position( input, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-    
-    return res;
-    
-}
-
-JNIEXPORT jfloat JNICALL Java_org_videolan_jvlc_JVLC__1getInputFPS (JNIEnv *env, jobject _this) 
-{
-    float res;
-    long instance = 0;
-    libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
-    libvlc_input_t *input;
-    
-    libvlc_exception_init( exception );
-    
-    instance = getPlaylistInstance( env, _this );
-    
-    input = libvlc_playlist_get_input( ( libvlc_instance_t* ) instance, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    res = libvlc_input_get_fps( input, exception );
-    if ( libvlc_exception_raised ( exception ) ) 
-    {
-        handle_vlc_exception( env, exception );
-    }
-
-    free( exception );
-    
-    return res;
-}
-
-
-/*
- *  VLM native functions
- */
-
-/*
- * Class:     org_videolan_jvlc_JVLC
- * Method:    _addBroadcast
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;ZZ)V
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1addBroadcast(JNIEnv *env, jobject _this, jstring name,jstring inputmrl, jstring outputmrl, jobjectArray options, jboolean enable, jboolean loop) {
-  const char* psz_name = env->GetStringUTFChars( name, 0 );    
-  const char* psz_inputmrl = env->GetStringUTFChars( inputmrl, 0 );    
-  const char* psz_outputmrl = env->GetStringUTFChars( outputmrl, 0 );        
-  long instance = 0;
-  libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-  int i_options = 0;
-  const char** ppsz_options = NULL;
-
-  if ( options != NULL ) {
-       i_options = ( int ) env->GetArrayLength( ( jarray ) options );
-       ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
-
-       for ( int i = 0; i < i_options - 1; i++ ) {
-           ppsz_options[ i ] = 
-               env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
-       }
-    }
-
-
-  libvlc_exception_init( exception );
-  
-  instance = getPlaylistInstance( env, _this );  
-
-  libvlc_vlm_add_broadcast( (libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_inputmrl, (char*)psz_outputmrl ,
-                               i_options, (char**)ppsz_options, enable, loop, exception );
-
-
-   if (psz_name != NULL) {
-       env->ReleaseStringUTFChars( name, psz_name );
-   }    
-   if (psz_inputmrl != NULL) {
-       env->ReleaseStringUTFChars( inputmrl, psz_inputmrl );
-   }    
-   if (psz_outputmrl != NULL) {
-       env->ReleaseStringUTFChars( outputmrl, psz_outputmrl );
-   }
-   
-   handle_vlc_exception(env,exception);
-
-   free(exception);
-}
-
-/*
- * Class:     org_videolan_jvlc_JVLC
- * Method:    _deleteMedia
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1deleteMedia(JNIEnv *env, jobject _this, jstring name) {
-    long instance = 0;
-    const char* psz_name = env->GetStringUTFChars( name, 0 );
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_vlm_del_media( (libvlc_instance_t *) instance, (char*)psz_name, exception);    
-    handle_vlc_exception(env,exception);
-    /* free resources */
-    free(exception);
-
-    if (psz_name != NULL) {
-        env->ReleaseStringUTFChars( name, psz_name );
-    }    
-}
-
-/*
- * Class:     org_videolan_jvlc_JVLC
- * Method:    _setEnabled
- * Signature: (Ljava/lang/String;Z)V
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1setEnabled(JNIEnv *env, jobject _this, jstring name, jboolean newStatus) {
-    long instance = 0;
-    const char* psz_name = env->GetStringUTFChars( name, 0 );
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_vlm_set_enabled( (libvlc_instance_t *) instance, (char*)psz_name, newStatus, exception);
-
-    handle_vlc_exception(env,exception);
-    /* free resources */
-    free(exception);
-
-    if (psz_name != NULL) {
-        env->ReleaseStringUTFChars( name, psz_name );
-    }        
-}
-
-/*
- * Class:     org_videolan_jvlc_JVLC
- * Method:    _setOutput
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1setOutput(JNIEnv *env, jobject _this, jstring name, jstring mrl) {
-   long instance = 0;
-    const char* psz_name = env->GetStringUTFChars( name, 0 );
-    const char* psz_mrl = env->GetStringUTFChars( mrl, 0 );    
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_vlm_set_output((libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_mrl, exception);
-
-    handle_vlc_exception(env,exception);
-    /* free resources */
-    free(exception);
-
-    if (psz_name != NULL) {
-        env->ReleaseStringUTFChars( name, psz_name );
-    }    
-    if (psz_mrl != NULL) {
-        env->ReleaseStringUTFChars( mrl, psz_mrl );
-    }    
-}
-
-/*
- * Class:     org_videolan_jvlc_JVLC
- * Method:    _setInput
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1setInput(JNIEnv *env, jobject _this, jstring name, jstring mrl) {
-   long instance = 0;
-    const char* psz_name = env->GetStringUTFChars( name, 0 );
-    const char* psz_mrl = env->GetStringUTFChars( mrl, 0 );    
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_vlm_set_input((libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_mrl, exception);
-    
-    handle_vlc_exception(env,exception);
-    /* free resources */
-    free(exception);
-
-    if (psz_name != NULL) {
-        env->ReleaseStringUTFChars( name, psz_name );
-    }    
-    if (psz_mrl != NULL) {
-        env->ReleaseStringUTFChars( mrl, psz_mrl );
-    }    
-}
-
-/*
- * Class:     org_videolan_jvlc_JVLC
- * Method:    _setLoop
- * Signature: (Ljava/lang/String;Z)V
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1setLoop(JNIEnv *env, jobject _this, jstring name, jboolean newStatus) {
-   long instance = 0;
-    const char* psz_name = env->GetStringUTFChars( name, 0 );
-    libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-    libvlc_exception_init( exception );
-
-    instance = getPlaylistInstance( env, _this );
-
-    libvlc_vlm_set_loop((libvlc_instance_t *) instance, (char*)psz_name, newStatus, exception);
-
-    handle_vlc_exception(env,exception);
-    /* free resources */
-    free(exception);
-
-    if (psz_name != NULL) {
-        env->ReleaseStringUTFChars( name, psz_name );
-    }    
-}
-
-/*
- * Class:     org_videolan_jvlc_JVLC
- * Method:    _changeMedia
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;ZZ)V
- */
-JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1changeMedia(JNIEnv *env, jobject _this, jstring name, jstring inputmrl, jstring outputmrl, jobjectArray options, jboolean enablenewbroadcast, jboolean broadcast) {
-   int i_options = 0;
-   const char** ppsz_options = NULL;
-   long instance = 0;
-   if ( options != NULL ) {
-       i_options = ( int ) env->GetArrayLength( ( jarray ) options );
-       ppsz_options = ( const char ** ) malloc( i_options * sizeof( char* ) );
-
-       for ( int i = 0; i < i_options - 1; i++ ) {
-           ppsz_options[ i ] = 
-               env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
-       }
-    }
-
-   const char* psz_name = env->GetStringUTFChars( name, 0 );
-   const char* psz_inputmrl = env->GetStringUTFChars( inputmrl, 0 );    
-   const char* psz_outputmrl = env->GetStringUTFChars( outputmrl, 0 );        
-   libvlc_exception_t *exception = (libvlc_exception_t *) malloc( sizeof( libvlc_exception_t ));
-
-   libvlc_exception_init( exception );
-
-   instance = getPlaylistInstance( env, _this );
-
-   libvlc_vlm_change_media( (libvlc_instance_t *) instance, (char*)psz_name, (char*)psz_inputmrl, (char*)psz_outputmrl ,
-                              i_options, (char**)ppsz_options, enablenewbroadcast, broadcast, exception );
-
-   handle_vlc_exception(env,exception);
-
-   if (psz_name != NULL) {
-        env->ReleaseStringUTFChars( name, psz_name );
-   }    
-
-   if (psz_inputmrl != NULL) {
-        env->ReleaseStringUTFChars( name, psz_inputmrl );
-   }    
-
-   if (psz_outputmrl != NULL) {
-        env->ReleaseStringUTFChars( name, psz_outputmrl );
-   }    
-   
-}
-
-
-
-/*
- * Utility functions
- */
-jlong getClassInstance (JNIEnv *env, jobject _this) {
-    /* get the id field of object */
-    jclass    cls   = env->GetObjectClass(_this);
-    jmethodID mid   = env->GetMethodID(cls, "getInstance", "()J");
-    jlong     field = env->CallLongMethod(_this, mid);
-    return field;
-}
-
-jlong getPlaylistInstance (JNIEnv *env, jobject _this) {
-    /* get the instance field of object */
-    jclass    cls   = env->GetObjectClass(_this);
-    jmethodID mid   = env->GetMethodID(cls, "getInstance", "()J");
-    jlong     field = env->CallLongMethod(_this, mid);
-    return field;
-}
index cbfc6b576791e9714001fe15a100b5a9dc514f41..59c7577b1ed4e68797b26a5192fd796bbdc6082b 100644 (file)
@@ -5494,6 +5494,7 @@ AC_CONFIG_FILES([
   activex/axvlc.inf
   bindings/Makefile
   bindings/java/Makefile
+  bindings/java/src/Makefile
   bindings/mediacontrol-python/Makefile
   doc/Makefile
   intl/Makefile