]> git.sesse.net Git - vlc/commitdiff
Java bindings updated to latest jvlc version.
authorFilippo Carone <littlejohn@videolan.org>
Sat, 6 May 2006 10:04:34 +0000 (10:04 +0000)
committerFilippo Carone <littlejohn@videolan.org>
Sat, 6 May 2006 10:04:34 +0000 (10:04 +0000)
SWT components removed until we are able to configure and check for swt-*.jar
presence.

15 files changed:
bindings/java/FAQ [new file with mode: 0644]
bindings/java/Makefile.am
bindings/java/SWTUglyPlayer.java [deleted file]
bindings/java/org/videolan/jvlc/AudioIntf.java
bindings/java/org/videolan/jvlc/InputIntf.java
bindings/java/org/videolan/jvlc/JLibVLC.java
bindings/java/org/videolan/jvlc/JVLC.java
bindings/java/org/videolan/jvlc/JVLCCanvas.java
bindings/java/org/videolan/jvlc/JVLCPanel.java
bindings/java/org/videolan/jvlc/Playlist.java
bindings/java/org/videolan/jvlc/PlaylistIntf.java
bindings/java/org/videolan/jvlc/SWTVideoWidget.java [deleted file]
bindings/java/org/videolan/jvlc/VLMIntf.java
bindings/java/org/videolan/jvlc/VideoIntf.java
bindings/java/vlc-libvlc-jni.cc

diff --git a/bindings/java/FAQ b/bindings/java/FAQ
new file mode 100644 (file)
index 0000000..cc3cb63
--- /dev/null
@@ -0,0 +1,36 @@
+= Frequently Asked Questions =
+
+== 1. Is it possible to use JVLC in a Java Applet? ==
+
+Yes and No.
+Yes because it's a Java program and even if it contains 
+native code, it is still possible to deploy the applet (take a look at 
+[http://www.raditha.com/java/jni/ this] article).
+No because native code for the Windows and MacOS platforms still needs
+to be written.
+
+== 2. Is it possible to use JVLC in Windows (or MacOS)? ==
+
+It's not possible at the moment. JVLC is composed of two parts, a Java
+multiplatform part and a C++ native code part. The native code has only
+been tested on GNU/Linux platforms, but I'm looking forward to porting
+it to Win32 and Darwin platforms.
+
+== 3. What features of Videolan are available to JVLC? ==
+
+JVLC contains all the features available in Videolan. In fact, JVLC uses
+Videolan core as its core, so JVLC is capable of everything Videolan can
+do.
+
+== 4. Why shouldn't I use JMF (Java Media Framework) for multimedia
+ applications? ==
+
+Well, JVLC and Videolan are free (as in freedom) software, so you can extend
+and adapt them to your needs, while JMF is free as in beer. Furthermore JVLC
+is really straightforward and simple to use.
+
+== 5. How can I help you with this application? ==
+
+Try the software and report any errors or bugs you find to me. This application
+needs porting to MS/Windows and MacOS, if you are able to implement the JNI for
+these platform you may contribute the code.
\ No newline at end of file
index 6142c3e837f7744394eb5868c4a17d86e739b353..1f351f5b40fef11edc836bae276b546d2585c696 100644 (file)
@@ -4,7 +4,7 @@
 
 if BUILD_JAVA
 
-OBJECTS = org/videolan/jvlc/JVLCCanvas.class org/videolan/jvlc/JVLCPanel.class org/videolan/jvlc/AudioIntf.class org/videolan/jvlc/InputIntf.class org/videolan/jvlc/PlaylistIntf.class org/videolan/jvlc/VideoIntf.class org/videolan/jvlc/VLMIntf.class org/videolan/jvlc/Playlist.class org/videolan/jvlc/JLibVLC.class org/videolan/jvlc/JVLC.class org/videolan/jvlc/SWTVideoWidget.class
+OBJECTS = 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/Playlist.class 
 
 JNIHEADERS = org_videolan_jvlc_JVLC.h org_videolan_jvlc_JVLCCanvas.h org_videolan_jvlc_JVLCPanel.h
 
@@ -16,7 +16,7 @@ SWT_PATH = /usr/share/java
 
 
 # Binaries
-JCC = gcj -g -I${SWT_PATH}/swt-gtk.jar
+JCC = gcj -g
 JCH = gcjh -jni
 
 # Compile flags
diff --git a/bindings/java/SWTUglyPlayer.java b/bindings/java/SWTUglyPlayer.java
deleted file mode 100644 (file)
index 8fa6ad9..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*****************************************************************************
- * JVLC.java: global class for vlc Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
- *
- * $Id$
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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.
- *****************************************************************************/
-
-import java.awt.Dialog;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Text;
-
-import org.videolan.jvlc.*;
-
-
-public class SWTUglyPlayer {
-
-       private Shell sShell = null;  //  @jve:decl-index=0:visual-constraint="230,12"
-       private Canvas canvas = null;
-       private SWTVideoWidget vlc = null;
-       private Button button = null;
-       private Text text = null;
-       private Button button1 = null;
-       private Button button2 = null;
-       private Display display = new Display(); 
-       /**
-        * This method initializes sShell
-        */
-       private void createSShell() {
-               sShell = new Shell(display);
-               sShell.setText("Shell");
-               createCanvas();
-               sShell.setSize(new org.eclipse.swt.graphics.Point(339,303));
-               button = new Button(sShell, SWT.NONE);
-               button.setText("Play");
-               button.setSize(new org.eclipse.swt.graphics.Point(70,30));
-               button.setLocation(new org.eclipse.swt.graphics.Point(26,185));
-               button.addMouseListener(new org.eclipse.swt.events.MouseAdapter() {
-                       public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
-                               vlc.getJVLC().playlist.add(text.getText(), text.getText());
-                               vlc.getJVLC().playlist.play(-1, null);
-                       }
-               });
-               text = new Text(sShell, SWT.BORDER);
-               text.setBounds(new org.eclipse.swt.graphics.Rectangle(26,222,200,25));
-               text.setText("~/a.avi");
-               button1 = new Button(sShell, SWT.NONE);
-               button1.setLocation(new org.eclipse.swt.graphics.Point(120,186));
-               button1.setText("Pause");
-               button1.setSize(new org.eclipse.swt.graphics.Point(70,30));
-               button1.addMouseListener(new org.eclipse.swt.events.MouseAdapter() {
-                       public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
-                               vlc.getJVLC().playlist.pause();
-                       }
-               });
-               button2 = new Button(sShell, SWT.NONE);
-               button2.setText("Stop");
-               button2.setSize(new org.eclipse.swt.graphics.Point(70,30));
-               button2.setLocation(new org.eclipse.swt.graphics.Point(221,188));
-               button2.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
-                       public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
-                               vlc.getJVLC().playlist.stop();
-                       }
-               });
-       }
-
-       /**
-        * This method initializes canvas       
-        *
-        */
-       private void createCanvas() {
-               canvas = new Canvas(sShell, SWT.EMBEDDED);
-               canvas.setBounds(new org.eclipse.swt.graphics.Rectangle(22,15,248,145));
-               vlc = new SWTVideoWidget( canvas );
-       }
-
-       public Canvas getCanvas() {
-               return canvas;
-       }
-       
-       public SWTUglyPlayer( ) {
-               createSShell();
-               sShell.open();
-               while( !sShell.isDisposed())
-           {
-             if(!display.readAndDispatch()) 
-             display.sleep();
-           }
-               display.dispose();
-       }
-       
-       static public void main( String[] args ) {
-               SWTUglyPlayer swt = new SWTUglyPlayer();
-       }
-
-}
index 67cdb8617472523a485744aa5e40ac19a1fc6d40..438538805c3d44b8b903efea62017ce955b3eed7 100644 (file)
@@ -1,32 +1,38 @@
 /*****************************************************************************
  * AudioIntf.java: Audio methods interface
  *****************************************************************************
+ *
  * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
  *
+ * Created on 28-feb-2006
+ * 
  * $Id$
+ * 
  *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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
+ * 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;
 
 public interface AudioIntf {
-    void getMute();
-    void setMute();
-    void getVolume();
-    void setVolume();
+    boolean getMute();
+    void setMute(boolean value);
+    void toggleMute();
+    int getVolume();
+    void setVolume(int volume);
 }
index b05441af66e19ad23c121db91a30b0707b334e4f..3d73d6cf6bbc2390219b63b0088f9dbb28d454ed 100644 (file)
@@ -1,34 +1,47 @@
 /*****************************************************************************
  * InputIntf.java: Input interface
  *****************************************************************************
+ *
  * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
+ * 
+ * Created on 28-feb-2006
  *
  * $Id$
  *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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
+ * 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;
 
 public interface InputIntf {
-     void getLength();
-     void getTime();
-     void getPosition();
-     void setTime();
-     double getFPS();
-    
+    /**
+     * This function returns the total length of the current file playing
+     * in millis.
+     */
+    long getInputLength();
+
+    /**
+     * This function returns the current position in millis within the
+     * currently playing playlist item.
+     */
+    long getInputTime();
+    void getInputPosition();
+    void setInputTime();
+    double getInputFPS();
 }
index 11eae50d521be8b053e39665524c06076d0a3fac..3d2e64223c99dd508833cfbf0f74eec700c6f984 100644 (file)
@@ -1,26 +1,30 @@
 /*****************************************************************************
- * JLibVLC.java: Main library interface 
+ * JLibVLC.java: Main library interface
  *****************************************************************************
+ *
  * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
+ * 
+ * Created on 28-feb-2006
  *
  * $Id$
  *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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
+ * 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;
 
index e3102a36b3106a6659915858ca474ec553cf6e0d..66632f69a402dcdd2b818164f86b6bcfeffcec2a 100644 (file)
@@ -25,9 +25,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  * 
  */
-/**
- * @author Filippo Carone <filippo@carone.org>
- */
+
 
 package org.videolan.jvlc;
 
@@ -65,6 +63,13 @@ public class JVLC implements JLibVLC {
     private native void                _toggleMute();
     private native int         _getVolume();
     private native void                _setVolume( int volume );
+
+    /*
+     *  Input native methods
+     */
+    private native long     _getInputLength();
+    private native long     _getInputTime();
+
     
     /*
      * Video native methods
@@ -75,7 +80,6 @@ public class JVLC implements JLibVLC {
  
     
     public boolean getMute() {
-        // TODO Auto-generated method stub
         return _getMute();
     }
 
@@ -111,27 +115,25 @@ public class JVLC implements JLibVLC {
        return _getFullscreen();        
     }
 
-    public void getLength() {
-        // TODO Auto-generated method stub
-        
+    public long getInputLength() {
+        return _getInputLength();        
     }
 
-    public void getTime() {
-        // TODO Auto-generated method stub
-        
+    public long getInputTime() {
+        return _getInputTime();
     }
 
-    public void getPosition() {
+    public void getInputPosition() {
         // TODO Auto-generated method stub
         
     }
 
-    public void setTime() {
+    public void setInputTime() {
         // TODO Auto-generated method stub
         
     }
 
-    public double getFPS() {
+    public double getInputFPS() {
         // TODO Auto-generated method stub
         return 0;
     }
index 70fff6c8f998f49105c67482357e79f8a4ff5433..f7f376eb64439a632b7c41b6b150a1f2d1b934a7 100644 (file)
@@ -1,26 +1,30 @@
 /*****************************************************************************
  * JVLCCanvas.java: AWT Canvas containing VLC Video Output
  *****************************************************************************
+ * 
  * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
  *
- * $Id$
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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.
+ * Created on 25-nov-2005
  *
- * 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
+ * $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;
 
@@ -31,12 +35,13 @@ public class JVLCCanvas extends Canvas {
 
     public native void paint(Graphics g);
 
-    private final JVLC jvlc = new JVLC();
+    private final JVLC jvlc;
     
     /**
      * Default constructor. The canvas is set a dimension of 200x200
      */
     public JVLCCanvas() {
+        jvlc = new JVLC();
         setSize(200, 200);
     }
     
@@ -45,9 +50,13 @@ public class JVLCCanvas extends Canvas {
      * @param height The initial canvas height
      */
     public JVLCCanvas(int width, int height) {
+        jvlc = new JVLC();
         setSize(width, height);
     }
 
+    public JVLCCanvas(JVLC jvlc) {
+        this.jvlc = jvlc;
+    }
     
     public JVLC getJVLC() {
         return jvlc;
index 3c308254dd16cfdbcfd994df417f36e77abbb91e..5edef1042b745a6c8067d64f9d470a0001f98c22 100644 (file)
@@ -1,26 +1,31 @@
 /*****************************************************************************
  * JVLCPanel.java: Java Swing JPanel embedding VLC Video Output
  *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
  *
+ * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
+ * 
+ * Created on 28-nov-2005
+ * 
  * $Id$
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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
+ * 
+ * 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;
 
index 0046190a0c4d61acef8260537f61bca038e6fa33..b19fe74dba811af713be9a6126d2880e173061aa 100644 (file)
@@ -1,26 +1,31 @@
 /*****************************************************************************
- * Playlist.java: The playlist class
+ * PlaylistIntf.java: The playlist interface
  *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
- *
- * $Id$
  *
- * Authors: Filippo Carone <filippo@carone.org>
+ * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
  *
- * 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.
+ * Created on 28-feb-2006
  *
- * 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.
+ * $Id$
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * 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;
 
@@ -33,21 +38,27 @@ public class Playlist implements PlaylistIntf {
         this.libvlcInstance = _libvlcInstance;
     }
     
-    native private int _playlist_add(String uri, String name);
+    native private int _playlist_add(String uri, String name, String[] options);
     native private void _play(int _id, String[] options);
     native private void _pause();
     native private void _stop();
     native private void _next();
     native private void _prev();
     native private void _clear();
+    native private void _deleteItem(int itemID);
     
     native private int _itemsCount();
     native private int _isPlaying();
+    
+
 
     public void play(int id, String[] options) {
         _play(id, options);
     }
 
+    public void play() {
+        play(-1, null);
+    }
 
     public void pause() {
         _pause();
@@ -59,7 +70,7 @@ public class Playlist implements PlaylistIntf {
     }
 
     public boolean isPlaying() {
-        return (_isPlaying() == 1)? false : true ;
+         return (_isPlaying() == 0)? false : true ;
     }
 
     public int itemsCount() {
@@ -67,6 +78,8 @@ public class Playlist implements PlaylistIntf {
     }
 
     public void next() {
+        if (! isPlaying())
+            play();
         _next();
     }
 
@@ -75,17 +88,26 @@ public class Playlist implements PlaylistIntf {
     }
 
     public void clear() {
+        if (! isPlaying())
+            play();
         _clear();
     }
 
+    public int add(String uri, String name, String[] options) {
+        return _playlist_add(uri, name, options);
+    }
+    
     public int add(String uri, String name) {
-        return _playlist_add(uri, name);
+        return add(uri, name, null);
     }
 
     public void addExtended() {
-        // TODO Auto-generated method stub
     }
 
+    public void deleteItem(int itemID) {
+        _deleteItem(itemID);
+    }
+    
     public long getInstance() {
         return libvlcInstance;
     }
index fae3ecb314b3ccaf7aada8a56d44b8f658424aa5..a6d430b1eb5feb0075dbdbff55a44f52efe69c65 100644 (file)
@@ -1,26 +1,31 @@
 /*****************************************************************************
  * PlaylistIntf.java: The playlist interface
  *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
- *
- * $Id$
  *
- * Authors: Filippo Carone <filippo@carone.org>
+ * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
  *
- * 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.
+ * Created on 28-feb-2006
  *
- * 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.
+ * $Id$
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * 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;
 
diff --git a/bindings/java/org/videolan/jvlc/SWTVideoWidget.java b/bindings/java/org/videolan/jvlc/SWTVideoWidget.java
deleted file mode 100644 (file)
index 05fa4cf..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * SWTVideoWidget.java: A component usable in SWT Application, embeds JVLC
- *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
- *
- * $Id$
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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;
-
-
-import org.eclipse.swt.awt.SWT_AWT;
-import org.eclipse.swt.widgets.Composite;
-
-import java.awt.Frame;
-
-public class SWTVideoWidget {
-    /*
-     * This class implements an SWTCanvas containing VLC Video Output
-     */
-
-    /*
-     * The root SWT Frame we embed JVLCCanvas in
-     */
-    public Frame rootFrame;
-    private JVLCCanvas jvlcCanvas;
-    
-    /*
-     * This class 'installs' the VLC video output window
-     * in a Composite container such as a canvas. 
-     */
-    public SWTVideoWidget( Composite parent ) {
-       // allocate the new AWT Frame to embed in the Composite
-       rootFrame = SWT_AWT.new_Frame( parent );
-
-       // add the JVLCCanvas to the Frame
-       jvlcCanvas = new JVLCCanvas();
-       rootFrame.add( jvlcCanvas );
-    }
-    
-    
-       public JVLC getJVLC() {
-               return jvlcCanvas.getJVLC();
-       }
-}
index 4f5abb6d34ca4ddb98d83c3ecf0690ef9845c6f4..ece411b091489e207f2281f8018e6d338fa05d6d 100644 (file)
@@ -1,36 +1,40 @@
 /*****************************************************************************
  * VLMIntf.java: VLM Interface
  *****************************************************************************
+ * 
  * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
+ * 
+ * Created on 28-feb-2006
  *
  * $Id$
  *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- * 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
+ * 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;
 
 public interface VLMIntf {
-    void addBroadcast();
-    void deleteMedia();
-    void setEnabled();
-    void setOutput();
-    void setInput();
-    void setLoop();
-    void changeMedia();
+    void addBroadcast( String name, String input, String output, String[] options, boolean enabled, boolean loop );
+    void deleteMedia( String name );
+    void setEnabled( String name, boolean enabled );
+    void setOutput( String name, String output );
+    void setInput( String name, String input );
+    void setLoop( String name, boolean loop );
+    void changeMedia( String name, String input, String output, String[] options, boolean enabled, boolean loop );
     
 }
index d0bbe480ac6bfc52860eb5cd4dd4f7236f764c31..7f6dd69338b73740013ebf21df059f2590a6f4e1 100644 (file)
@@ -1,4 +1,11 @@
-/*
+/*****************************************************************************
+ * VideoIntf.java: Video methods interface
+ *****************************************************************************
+ * 
+ * Copyright (C) 1998-2006 the VideoLAN team
+ * 
+ * Author: Filippo Carone <filippo@carone.org>
+ * 
  * Created on 28-feb-2006
  *
  * $Id$
  * 
  * 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-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  * 
  */
-/**
- * @author Filippo Carone <filippo@carone.org>
- */
+
 
 package org.videolan.jvlc;
 
 public interface VideoIntf {
     void toggleFullscreen();
-    void setFullscreen();
-    void getFullscreen();
+    void setFullscreen( boolean value );
+    boolean getFullscreen();
     
 }
index 2ca140c6ca6db46d10a5951d6c20e75f67e9c64c..9dbab05276534eb8b8c6349a9a0a7c5a211536b0 100644 (file)
@@ -68,12 +68,14 @@ JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC_createInstance___3Ljava_lang
 
     libvlc_exception_init( exception );
   
-    argc = (int) env->GetArrayLength((jarray) args);
+    argc = (int) env->GetArrayLength((jarray) args) + 1;
     argv = (const char **) malloc(argc * sizeof(char*));
-    for (int i = 0; i < argc; i++) {
-        argv[i] = env->GetStringUTFChars((jstring) env->GetObjectArrayElement(args, i),
+    sprintf( (char *) argv[0], "%s", "jvlc" );
+    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 );
@@ -317,9 +319,11 @@ JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_JVLC__1getFullscreen (JNIEnv *
  * Playlist native functions
  */
 
-JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1playlist_1add (JNIEnv *env, jobject _this, jstring uri, jstring name) {
+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 ));
@@ -328,8 +332,20 @@ JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1playlist_1add (JNIEnv *
 
     instance = getPlaylistInstance( env, _this );
 
-    res = libvlc_playlist_add( (libvlc_instance_t*) instance, psz_uri, psz_name, exception );
-  
+    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 );
+    } else {
+        res = libvlc_playlist_add( ( libvlc_instance_t * ) instance, psz_uri, psz_name, exception );
+    }
     /// \todo check exceptions
 
     /* free resources */
@@ -345,20 +361,29 @@ JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1playlist_1add (JNIEnv *
     return res;
 }
 
+
 JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1play (JNIEnv *env, jobject _this, jint id, jobjectArray options) {
 
     long instance = 0;
     int i_options = 0;
-    char** ppsz_options = NULL;
+    const char** ppsz_options = NULL;
     instance = getPlaylistInstance( env, _this );
     libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
 
     libvlc_exception_init( exception );
 
-    if ( options != NULL ) ;
-    /// \TODO: parse options 
+    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" );
 
-    libvlc_playlist_play( ( libvlc_instance_t* ) instance, id, i_options, ppsz_options, exception );
+       for ( int i = 0; i < i_options - 1; i++ ) {
+           ppsz_options[ i+1 ] = 
+               env->GetStringUTFChars( ( jstring ) env->GetObjectArrayElement( options, i ), 0 );
+       }
+    }
+
+    libvlc_playlist_play( ( libvlc_instance_t * ) instance, id, i_options, ( char **  ) ppsz_options, exception );
 
     free( exception );
     return;
@@ -428,6 +453,20 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Playlist__1clear (JNIEnv *env, job
     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 );
+
+    free( exception );
+    return;
+}
+
+
 JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1itemsCount (JNIEnv *env, jobject _this) {
     long instance = 0;
     int res = 0;
@@ -456,6 +495,49 @@ JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1isPlaying (JNIEnv *env,
 
 }
 
+/*
+ * 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 );
+    /// \todo check exceptions
+    
+    res = libvlc_input_get_length( input, 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 );
+    /// \todo check exceptions
+    
+    res = libvlc_input_get_time( input, exception );
+
+    free( exception );
+    return res;    
+}
+
+
 
 /*
  * Utility functions