Commit 92fcb9b5 authored by Filippo Carone's avatar Filippo Carone

Java bindings update to latest JVLC (step 1/2)

JNI: unused files removed
JNI: libvlc.h dependent file added 
A sample SWT (ugly) player added
Old java bindings files removed
parent 77fa066c
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 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();
}
}
/*****************************************************************************
* JVLC.java: global class for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2004 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 org.videolan.jvlc.*; import org.videolan.jvlc.*;
import java.awt.*; import java.awt.*;
......
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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
*
* $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., 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
/* 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);
JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC_createInstance__ (JNIEnv *env, jobject _this) {
long res;
libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
libvlc_exception_init( exception );
res = ( long ) libvlc_new( 0, NULL, exception );
free( exception );
return res;
}
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);
argv = (const char **) malloc(argc * sizeof(char*));
for (int i = 0; i < argc; i++) {
argv[i] = env->GetStringUTFChars((jstring) env->GetObjectArrayElement(args, i),
0
);
}
res = (long) libvlc_new(argc, (char**) argv, exception );
free( exception );
free( argv );
return res;
}
/*
* Playlist native functions
*/
JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1playlist_1add (JNIEnv *env, jobject _this, jstring uri, jstring name) {
long instance = 0;
int res = 0;
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 );
res = libvlc_playlist_add( (libvlc_instance_t*) instance, psz_uri, psz_name, 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) {
long instance = 0;
int i_options = 0;
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
libvlc_playlist_play( ( libvlc_instance_t* ) instance, id, i_options, ppsz_options, 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 );
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 );
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 );
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 );
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 );
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 );
free( exception );
return res;
}
JNIEXPORT jint JNICALL Java_org_videolan_jvlc_Playlist__1isPlaying (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 );
free( exception );
return res;
}
/*
* 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;
}
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