Commit 53e8222b authored by Clément Stenac's avatar Clément Stenac

Java bindings by Filippo Carone.

Tweaked to integrate into build system
parent 7f2b618b
......@@ -100,6 +100,11 @@ C: bozo
D: SDL video output
S: France
N: Filippo Carone
E: filippo[dontspam]@carone.org
D: Java bindings
S: Italy
N: Tony Castley
E: tony@castley.net
C: tcastley
......
SUBDIRS = python
SUBDIRS = python java
#######################################################################
# VLC Java Bindings
#######################################################################
if BUILD_JAVA
OBJECTS = org/videolan/jvlc/JVLCNoSuchVariableNameException.class org/videolan/jvlc/JVLCBoolVariable.class org/videolan/jvlc/JVLCIntVariable.class org/videolan/jvlc/JVLCTimeVariable.class org/videolan/jvlc/JVLCVarValue.class org/videolan/jvlc/JVLCVariable.class org/videolan/jvlc/JVLCFloatVariable.class org/videolan/jvlc/JVLCStringVariable.class org/videolan/jvlc/JVLCVarVariable.class org/videolan/jvlc/JVLC.class org/videolan/jvlc/JVLCCanvas.class
JNIHEADERS = org/videolan/jvlc/JVLCNoSuchVariableNameException.h org_videolan_jvlc_JVLCBoolVariable.h org_videolan_jvlc_JVLCFloatVariable.h org_videolan_jvlc_JVLC.h org_videolan_jvlc_JVLCIntVariable.h org_videolan_jvlc_JVLCStringVariable.h org_videolan_jvlc_JVLCTimeVariable.h org_videolan_jvlc_JVLCVariable.h org_videolan_jvlc_JVLCVarValue.h org_videolan_jvlc_JVLCVarVariable.h org_videolan_jvlc_JVLCCanvas.h
# Include some JAVA stuff
JINCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux
LIBJINCLUDES = -L${JAVA_HOME}/jre/lib/i386 -ljawt
# Binaries
JCC = gcj -g
JCH = gcjh -jni
# Compile flags
CXXFLAGS += `top_builddir=../.. ../../vlc-config --cflags` -I../../ -I ../../include ${JINCLUDES}
LDFLAGS += -L../../lib -lvlc_pic -fPIC `top_builddir=../.. ../../vlc-config --libs builtin pic`
# Build targets
all: libjvlc.so VlcClient
# FIXME: -ldbus-1 and -lhal are UGLY
# Problem is vlc-config --libs builtin does not output what is needed to build
# vlc. We need to clean up vlc-config first
libjvlc.so: vlc-glue-jni.o vlc-graphics-jni.o
$(CXX) -ldbus-1 -lhal -shared vlc-glue-jni.o vlc-graphics-jni.o $(LIBJINCLUDES) ${LDFLAGS} -o libjvlc.so
vlc-graphics-jni.o: VlcClient
$(CXX) -c vlc-graphics-jni.cc $(CXXFLAGS)
vlc-glue-jni.o: VlcClient
$(CXX) -c vlc-glue-jni.cc $(CXXFLAGS)
VlcClient: $(OBJECTS)
$(JCC) -C VlcClient.java
%.class: %.java
$(JCC) -C $?
$(JCH) org/videolan/jvlc/$(*F)
clean:
rm -f *.class *~ org/videolan/jvlc/*.class org_videolan*.h *.so *.o
endif
First of all, this is a *developers* only version
Usage
-----
In order to use these bindings you have to compile vlc from source. I
recommend you to take the latest version from videolan svn repository
by doing:
svn co svn://svn.videolan.org/vlc/trunk vlc-trunk
bootstrap and configure. At the configure give the command:
./configure --enable-mozilla && make && make install
to enable compilation of _pic version of libraries. If you give a
prefix be sure to change the PREFIX variable in the Makefile from
/usr/local to your prefix.
Once you've done with vlc you can run make in jvlc directory. Be sure
you have gcj, gcjh and if you want to use the SUN Java compiler,
change the Makefile accordingly. You will probably need to change also
JINCLUDES
LIBJINCLUDES
In the next releases I will automate this process.
To run JVLC issue:
java -Djava.library.path=. VlcClient
Be sure your ldconfig can find libjawt.so and libmawt.so or you will
get linking errors when you run the program.
Happy playing.
\ No newline at end of file
[MediaControl - in progress]
* enums will be final classes with private constructor, for type safety
[JNI]
* mediacontrol
[general]
* JUnit testing
* configure / make install
* find a good way to divide CNI and JNI versions (same Java classes,
different interfaces) maybe: two JVLC.java classes, one with the
System.loadLibray for jni and the other without
[CNI]
* mediacontrol
Items are ordered by priority, the first having the highest priority
import org.videolan.jvlc.*;
import java.awt.*;
import java.awt.event.*;
class VLCPlayerFrame extends Frame {
public VLCPlayerFrame() {
initComponents();
}
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
fullScreenButton = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
setButton = new javax.swing.JButton();
pauseButton = new javax.swing.JButton();
stopButton = new javax.swing.JButton();
// jPanel = new javax.swing.JPanel();
jvcc = new JVLCCanvas();
jvlc = jvcc.getJVLCObject();
// jPanel.add( jvcc );
add( jvcc );
// FIXME: Does not work with GridBagLayout
setLayout(new java.awt.GridLayout(3,2));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
// add( jPanel , gridBagConstraints);
fullScreenButton.setText("FullScreen");
fullScreenButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fullScreenButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add( fullScreenButton, gridBagConstraints);
jTextField1.setText("URL");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
add(jTextField1, gridBagConstraints);
setButton.setText("Set item");
setButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
setButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add(setButton, gridBagConstraints);
pauseButton.setText("Play/Pause");
pauseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pauseButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add(pauseButton, gridBagConstraints);
stopButton.setText("Stop");
stopButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
stopButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add(stopButton, gridBagConstraints);
pack();
}
private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {
jvlc.stop();
}
private void pauseButtonActionPerformed(java.awt.event.ActionEvent evt) {
jvlc.pause();
}
private void setButtonActionPerformed(java.awt.event.ActionEvent evt) {
jvlc.stop();
jvlc.playlistClear();
jvlc.addTarget( jTextField1.getText(), null, 1, -666 );
jvlc.play();
}
private void fullScreenButtonActionPerformed(java.awt.event.ActionEvent evt) {
jvlc.fullScreen();
}
private javax.swing.JButton setButton;
private javax.swing.JButton pauseButton;
private javax.swing.JButton stopButton;
private javax.swing.JButton fullScreenButton;
private javax.swing.JTextField jTextField1;
private javax.swing.JPanel jPanel;
private JVLCCanvas jvcc;
public JVLC jvlc;
}
public class VlcClient {
public static void main(String[] args) {
Frame f = new VLCPlayerFrame();
f.setBounds(0, 0, 500, 500);
f.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent ev) {
System.exit(0);
}
} );
f.setVisible(true);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project default="javadoc">
<target name="javadoc">
<javadoc access="public" author="true" classpath="." destdir="doc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.4" sourcefiles="org/videolan/jvlc/JVLC.java" sourcepath="." splitindex="true" use="true" version="true"/>
</target>
</project>
package org.videolan.jvlc;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This is the main Java VLC class which represents a vlc_object_t. Through this
* class it's possible to control media loading/playing. It's possible to have
* more than one JVLC object in the same program.
*/
public class JVLC {
static {
System.loadLibrary("jvlc");
}
private int id;
/**
* @param args Arguments for the vlc object. These are the same as the
* original C version of VLC.
*/
public JVLC(String[] args) {
String[] properArgs = new String[args.length + 1];
properArgs[0] = "jvlc";
for (int i = 0; i < args.length; i++)
properArgs[i+1] = args[i];
this.id = create();
init(properArgs);
}
public JVLC() {
new JVLC(new String[]{""});
}
/**
* @return Returns the ID of the VLC Object
*/
public int getID() {
return this.id;
}
/**
* Cleanup the VLC Object. It's the equivalent of
* calling VLC_Die() and VLC_CleanUp()
*/
public void quit() {
this.die();
this.cleanUp();
}
private native int create();
private native int init(String[] args);
/**
*
* Creates the interface of the videolan player
*
* @param moduleName The interface module to display
* @param blocking True if the interface is blocking, otherwise it runs on its own thread
* @param startPlay True if the player starts to play as soon as the interface is displayed
* @return An int which is &lt; 0 on error
*/
public native int addInterface(String moduleName, boolean blocking, boolean startPlay);
/**
*
* Creates the interface of the videolan player with the default interface
* or the interface set by -I
*
* @param blocking True if the interface is blocking, otherwise it runs on its own thread
* @param startPlay True if the player starts to play as soon as the interface is displayed
* @return An int which is &lt; 0 on error
*/
public int addInterface(boolean blocking, boolean startPlay) {
return addInterface(null, blocking, startPlay);
}
/**
* @return The version of the VideoLan object
*/
public native String getVersion();
public native String getError(int errorCode);
private native int die();
private native int cleanUp();
public native int setVariable(JVLCVariable jvlcVariable);
public native JVLCVariable getVariable(String varName); // XXX in progress
public native int addTarget(String URI, String[] options, int insertMode, int position);
/**
* Plays the media
*
* @return An int which is &lt; 0 on error
*/
public native int play();
/**
*
* Pauses the media. If the media is already paused, pause() restarts it.
*
* @return
*/
public native int pause();
/**
*
* Stops the media
*
* @return
*/
public native int stop();
/**
* @return True if the player is actually playing something
*/
public native boolean isPlaying();
/**
* @return The absolute position within the media
*/
public native float getPosition();
public native float setPosition(float position);
public native int getTime();
public native int setTime(int seconds, boolean relative);
public native int getLength();
public native float speedFaster();
public native float speedSlower();
public native int getPlaylistIndex();
public native int getPlaylistItems();
public native int playlistNext();
public native int playlistPrev();
public native int playlistClear();
public native int getVolume();
public native int setVolume(int volume);
public native int muteVolume();
public native int fullScreen();
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public class JVLCBoolVariable extends JVLCVariable {
public JVLCBoolVariable(String name, int value) throws JVLCNoSuchVariableNameException {
super(name);
this.value = (value != 0)? new Integer(1) : new Integer(0);
}
public int getBoolValue() {
return ((Integer)value).intValue();
}
}
/*
* Created on 25-nov-2005
*
* 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-1307, USA.
*
*/
/**
* @author Filippo Carone <filippo@carone.org>
*/
package org.videolan.jvlc;
import java.awt.Canvas;
import java.awt.Graphics;
public class JVLCCanvas extends Canvas {
public native void paint(Graphics g);
private final JVLC jvlcObject = new JVLC();
public JVLCCanvas() {
jvlcObject.addInterface("dummy", false, false);
}
public JVLC getJVLCObject() {
return jvlcObject;
}
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public class JVLCFloatVariable extends JVLCVariable {
public JVLCFloatVariable(String name, float value) throws JVLCNoSuchVariableNameException {
super(name);
this.value = new Float(value);
}
public float getFloatValue() {
return ((Float)value).floatValue();
}
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public class JVLCIntVariable extends JVLCVariable {
public JVLCIntVariable(String name, int value) throws JVLCNoSuchVariableNameException {
super(name);
this.value = new Integer(value);
}
public int getIntValue() {
return ((Integer)value).intValue();
}
}
/*
* Created on 22-nov-2005
*
* 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-1307, USA.
*
*/
/**
* @author Filippo Carone <filippo@carone.org>
*/
package org.videolan.jvlc;
public class JVLCNoSuchVariableNameException extends Exception {
public JVLCNoSuchVariableNameException() {
super();
// TODO Auto-generated constructor stub
}
public JVLCNoSuchVariableNameException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public JVLCNoSuchVariableNameException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public JVLCNoSuchVariableNameException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public class JVLCStringVariable extends JVLCVariable {
public JVLCStringVariable(String name, String value) throws JVLCNoSuchVariableNameException {
super(name);
this.value = value;
}
public String getStringValue() {
return (String)value;
}
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public class JVLCTimeVariable extends JVLCVariable {
public JVLCTimeVariable(String name, long value) throws JVLCNoSuchVariableNameException {
super(name);
this.value = new Long(value);
}
public long getTimeValue() {
return ((Long)value).longValue();
}
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public class JVLCVarValue {
String name;
int OID;
public JVLCVarValue(String name, int OID) {
this.name = name;
this.OID = OID;
}
public String getName() {
return name;
}
public int getOID() {
return OID;
}
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLCVarVariable.java: Varying Variable
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public class JVLCVarVariable extends JVLCVariable {
public JVLCVarVariable(String name, JVLCVarValue value) throws JVLCNoSuchVariableNameException {
super(name);
this.value = value;
}
public JVLCVarValue getVarValue() {
return (JVLCVarValue)value;
}
}
package org.videolan.jvlc;
/*****************************************************************************
* JVLCVariable.java: Abstract Variable class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2005 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/**
* This class is part of JVLC<Type>Variable pool.
*/
public abstract class JVLCVariable {
protected String name;
protected Object value;
public JVLCVariable(String name) throws JVLCNoSuchVariableNameException {
if (name == null) throw new JVLCNoSuchVariableNameException();
this.name = name;
}
public String getName() {
return name;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
public class MediaControl {
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
public class MediaControlException extends Exception {
int code;
String message;
public MediaControlException() { // XXX maybe this is not the constructor signature
super();
}
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
import org.videolan.jvlc.JVLC;
public class MediaControlInstance {
JVLC vlc;
//Playlist playlist;
//intf thread;
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
public class MediaControlPlaylistSeq {
private int size;
private String[] data; // char**
public MediaControlPlaylistSeq() {
}
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
public class MediaControlPosition {
private long value;
int origin; // one of MediaControlPositionOriginEnum
int key; // one of MediaControlPositionOriginEnum
/*
* Constructor
*/
public MediaControlPosition() {
}
/*
* Getters/Setters
*/
public long getValue() {
return value;
}
public void setValue(long value) {
this.value = value;
}
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* MediaControlPositionOrigin.java: class for vlc MediaControl Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
public class MediaControlPositionKeyEnum {
public static final int BYTECOUNT = 1;
public static final int SAMPLECOUNT = 2;
public static final int MEDIATIME = 3;
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* MediaControlPositionOrigin.java: class for vlc MediaControl Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
public class MediaControlPositionOrigin {
public static final int AbsolutePosition = 1;
public static final int RelativePosition = 2;
public static final int ModuloPosition = 3;
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* MediaControlPositionOrigin.java: class for vlc MediaControl Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
public class MediaControlPositionOriginEnum {
public static final int ABSOLUTEPOSITION = 1;
public static final int RELATIVEPOSITION = 2;
public static final int MODULOPOSITION = 3;
}
package org.videolan.jvlc.mediacontrol;
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
import java.util.Date;
public class MediaControlRGBPicture {
private int width;
private int height;
long type;
Date date;
int size;
String data; // char *data
public MediaControlRGBPicture() {
}
}
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* JVLC.java: JNI interface for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2005 the VideoLAN team
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* These are a must*/
#include <jni.h>
#include <vlc/vlc.h>
#include <jawt.h>
#include <jawt_md.h>
#include <X11/Xlib.h> // for Xlibs graphics functions
/* JVLC internal imports, generated by gcjh */
#include "org_videolan_jvlc_JVLCCanvas.h"
/*
* This will only work on X11 at the moment
*/
JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLCCanvas_paint (JNIEnv *env, jobject canvas, jobject graphics) {
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
JAWT_X11DrawingSurfaceInfo* dsi_x11;
jboolean result;
jint lock;
GC gc;
vlc_value_t value;
short i;
/* 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;
}
/* 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);
value.i_int = dsi_x11->drawable;
VLC_VariableSet( 0, "drawable", value );
XFreeGC(dsi_x11->display, gc);
/* Free the drawing surface info */
ds->FreeDrawingSurfaceInfo(dsi);
/* Unlock the drawing surface */
ds->Unlock(ds);
/* Free the drawing surface */
awt.FreeDrawingSurface(ds);
}
......@@ -4823,6 +4823,17 @@ then
build_pic=yes
fi
dnl
dnl Java bindings
dnl
AC_ARG_ENABLE(java-bindings,
[ --enable-java-bindings Enable Java bindings (default disabled)])
AM_CONDITIONAL( BUILD_JAVA, [test "${enable_java_bindings}" = "yes"] )
if test "${enable_java_bindings}" = "yes"
then
build_pic=yes
fi
dnl
dnl test plugins
......@@ -5033,6 +5044,7 @@ AC_CONFIG_FILES([
activex/Makefile
activex/axvlc.inf
bindings/Makefile
bindings/java/Makefile
bindings/python/Makefile
debian/Makefile
doc/Makefile
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment