Commit bc14424e authored by Filippo Carone's avatar Filippo Carone

Java bindings updated to latest jvlc version.

SWT components removed until we are able to configure and check for swt-*.jar
presence.

parent 88b0a696
= 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
......@@ -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
......
/*****************************************************************************
* 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();
}
}
/*****************************************************************************
* 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 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.
* 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
* 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);
}
/*****************************************************************************
* InputIntf.java: Input interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-feb-2006
*
* Authors: Filippo Carone <filippo@carone.org>
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is 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.
* 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
* 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();
}
/*****************************************************************************
* JLibVLC.java: Main library interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
* Author: Filippo Carone <filippo@carone.org>
*
* Authors: Filippo Carone <filippo@carone.org>
* Created on 28-feb-2006
*
* 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.
* $Id$
*
* 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.
* 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.
*
* 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 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;
......
......@@ -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;
......@@ -66,6 +64,13 @@ public class JVLC implements JLibVLC {
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;
}
......
/*****************************************************************************
* JVLCCanvas.java: AWT Canvas containing VLC Video Output
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
* Author: Filippo Carone <filippo@carone.org>
*
* Authors: Filippo Carone <filippo@carone.org>
* Created on 25-nov-2005
*
* $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 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.
* 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
* 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;
......
/*****************************************************************************
* JVLCPanel.java: Java Swing JPanel embedding VLC Video Output
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
* Author: Filippo Carone <filippo@carone.org>
*
* Authors: Filippo Carone <filippo@carone.org>
* Created on 28-nov-2005
*
* $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 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.
* 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
* 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;
......
/*****************************************************************************
* Playlist.java: The playlist class
* PlaylistIntf.java: The playlist interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
* Author: Filippo Carone <filippo@carone.org>
*
* Authors: Filippo Carone <filippo@carone.org>
* Created on 28-feb-2006
*
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is 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.
* 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
* 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,15 +88,24 @@ 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() {
......
/*****************************************************************************
* PlaylistIntf.java: The playlist interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-feb-2006
*
* Authors: Filippo Carone <filippo@carone.org>
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is 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.
* 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
* 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;
......
/*****************************************************************************
* 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();
}
}
/*****************************************************************************
* VLMIntf.java: VLM Interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
* Author: Filippo Carone <filippo@carone.org>
*
* Authors: Filippo Carone <filippo@carone.org>
* Created on 28-feb-2006
*
* 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.
* $Id$
*
* 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.
* 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.
*
* 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 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 );
}
/*
/*****************************************************************************
* VideoIntf.java: Video methods interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-feb-2006
*
* $Id$
......@@ -15,18 +22,16 @@
*
* 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();
}
......@@ -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,7 +332,19 @@ 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
......@@ -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" );
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, ppsz_options, exception );
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
......
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