Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ca250026
Commit
ca250026
authored
Nov 04, 2006
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport java bindings
parent
e53d8f51
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1169 additions
and
1001 deletions
+1169
-1001
bindings/java/Makefile.am
bindings/java/Makefile.am
+70
-25
bindings/java/SWTUglyPlayer.java
bindings/java/SWTUglyPlayer.java
+0
-118
bindings/java/VlcClient.java
bindings/java/VlcClient.java
+34
-3
bindings/java/org/videolan/jvlc/Audio.java
bindings/java/org/videolan/jvlc/Audio.java
+42
-0
bindings/java/org/videolan/jvlc/AudioIntf.java
bindings/java/org/videolan/jvlc/AudioIntf.java
+49
-19
bindings/java/org/videolan/jvlc/GenericVideoWidget.java
bindings/java/org/videolan/jvlc/GenericVideoWidget.java
+59
-0
bindings/java/org/videolan/jvlc/Input.java
bindings/java/org/videolan/jvlc/Input.java
+61
-0
bindings/java/org/videolan/jvlc/InputIntf.java
bindings/java/org/videolan/jvlc/InputIntf.java
+73
-20
bindings/java/org/videolan/jvlc/JLibVLC.java
bindings/java/org/videolan/jvlc/JLibVLC.java
+21
-17
bindings/java/org/videolan/jvlc/JVLC.java
bindings/java/org/videolan/jvlc/JVLC.java
+115
-94
bindings/java/org/videolan/jvlc/JVLCCanvas.java
bindings/java/org/videolan/jvlc/JVLCCanvas.java
+36
-17
bindings/java/org/videolan/jvlc/JVLCPanel.java
bindings/java/org/videolan/jvlc/JVLCPanel.java
+22
-17
bindings/java/org/videolan/jvlc/Playlist.java
bindings/java/org/videolan/jvlc/Playlist.java
+66
-37
bindings/java/org/videolan/jvlc/PlaylistIntf.java
bindings/java/org/videolan/jvlc/PlaylistIntf.java
+101
-24
bindings/java/org/videolan/jvlc/VLCException.java
bindings/java/org/videolan/jvlc/VLCException.java
+46
-0
bindings/java/org/videolan/jvlc/VLM.java
bindings/java/org/videolan/jvlc/VLM.java
+74
-0
bindings/java/org/videolan/jvlc/VLMIntf.java
bindings/java/org/videolan/jvlc/VLMIntf.java
+96
-22
bindings/java/org/videolan/jvlc/Video.java
bindings/java/org/videolan/jvlc/Video.java
+113
-0
bindings/java/org/videolan/jvlc/VideoIntf.java
bindings/java/org/videolan/jvlc/VideoIntf.java
+90
-8
bindings/java/vlc-graphics-jni.cc
bindings/java/vlc-graphics-jni.cc
+0
-103
bindings/java/vlc-libvlc-jni.cc
bindings/java/vlc-libvlc-jni.cc
+0
-477
configure.ac
configure.ac
+1
-0
No files found.
bindings/java/Makefile.am
View file @
ca250026
...
...
@@ -2,47 +2,92 @@
# VLC Java Bindings
#######################################################################
if
BUILD_JAVA
#SUBDIRS= src
DIST_SUBDIRS
=
src
EXTRA_DIST
=
\
FAQ
\
TODO
\
README
\
THANKS
\
javadoc.xml
\
VlcClient.java
\
VLCExample.java
EXTRA_DIST
+=
\
org/videolan/jvlc/AudioIntf.java
\
org/videolan/jvlc/Audio.java
\
org/videolan/jvlc/GenericVideoWidget.java
\
org/videolan/jvlc/InputIntf.java
\
org/videolan/jvlc/Input.java
\
org/videolan/jvlc/JLibVLC.java
\
org/videolan/jvlc/JVLCCanvas.java
\
org/videolan/jvlc/JVLC.java
\
org/videolan/jvlc/JVLCPanel.java
\
org/videolan/jvlc/PlaylistIntf.java
\
org/videolan/jvlc/Playlist.java
\
org/videolan/jvlc/VideoIntf.java
\
org/videolan/jvlc/Video.java
\
org/videolan/jvlc/VLCException.java
\
org/videolan/jvlc/VLMIntf.java
\
org/videolan/jvlc/VLM.java
OBJECTS
=
org/videolan/jvlc/VLCException.class org/videolan/jvlc/Playlist.class org/videolan/jvlc/AudioIntf.class org/videolan/jvlc/Audio.class org/videolan/jvlc/InputIntf.class org/videolan/jvlc/Input.class org/videolan/jvlc/PlaylistIntf.class org/videolan/jvlc/VideoIntf.class org/videolan/jvlc/Video.class org/videolan/jvlc/JLibVLC.class org/videolan/jvlc/JVLC.class org/videolan/jvlc/JVLCCanvas.class org/videolan/jvlc/JVLCPanel.class org/videolan/jvlc/VLMIntf.class org/videolan/jvlc/VLM.class org/videolan/jvlc/GenericVideoWidget.class
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
JNIHEADERS
=
org_videolan_jvlc_JVLC.h org_videolan_jvlc_JVLCCanvas.h org_videolan_jvlc_JVLCPanel.h
COBJECTS
=
src/utils.o src/video-jni.o src/audio-jni.o src/input-jni.o src/playlist-jni.o src/vlm-jni.o src/core-jni.o src/graphics-jni.o
if
BUILD_JAVA
# Include some JAVA stuff
PROCESSOR_FAMILY
=
`
uname
-m
|
sed
-e
's/^i.86/i386/'
|
sed
-e
's/^x86_64/amd64/'
`
if
HAVE_WIN32
JINCLUDES
=
-I
${JAVA_HOME}
/include
-I
${JAVA_HOME}
/include/win32
LIBJINCLUDES
=
-L
${JAVA_HOME}
/lib
-ljawt
JCH
=
javah
JAVACXXFLAGS
=
`
top_builddir
=
../.. ../../vlc-config
--cflags
pic
`
-I
../../
-I
../../include
$(JINCLUDES)
JAVALDFLAGS
=
-mno-cygwin
-L
../../src
-lvlc
`
top_builddir
=
../.. ../../vlc-config
--libs
builtin
vlc pic
`
-Wl
,--kill-at
else
JINCLUDES
=
-I
$(JAVA_HOME)
/include
-I
$(JAVA_HOME)
/include/linux
LIBJINCLUDES
=
-L
$(JAVA_HOME)
/jre/lib/
$(PROCESSOR_FAMILY)
-ljawt
SWT_PATH
=
/usr/share/java
# Binaries
JCC
=
gcj
-g
-I
${SWT_PATH}
/swt-gtk.jar
JCH
=
gcjh
-jni
# Compile flags
JAVACXXFLAGS
=
`
top_builddir
=
../.. ../../vlc-config
--cflags
pic
`
-I
../../
-I
../../include
$(JINCLUDES)
JAVALDFLAGS
=
-L
../../lib
-lvlc_pic
`
top_builddir
=
../.. ../../vlc-config
--libs
builtin
vlc pic
`
# Build targets
all
:
libjvlc.so VlcClient
JAVALDFLAGS
=
-L
../../src
-lvlc
`
top_builddir
=
../.. ../../vlc-config
--libs
builtin
vlc pic
`
endif
libjvlc.so
:
vlc-libvlc-jni.o vlc-graphics-jni.o
$(CXX)
-shared
vlc-libvlc-jni.o vlc-graphics-jni.o
$(LIBJINCLUDES)
$(LDFLAGS)
$(JAVALDFLAGS)
-o
libjvlc.so
export
JINCLUDES
vlc-graphics-jni.o
:
VlcClient
$(CXX)
-c
vlc-graphics-jni.cc
$(CXXFLAGS)
$(JAVACXXFLAGS)
# Build targets
all
:
libjvlc.so VlcClient VLCExample
vlc-libvlc-jni.o
:
VlcClient
$(CXX)
-c
vlc-libvlc-jni.cc
$(CXXFLAGS)
$(JAVACXXFLAGS)
if
HAVE_WIN32
libjvlc.so
:
$(OBJECTS)
$(MAKE)
-C
src
$(CXX)
-shared
$(COBJECTS)
$(LIBJINCLUDES)
$(LDFLAGS)
$(JAVALDFLAGS)
-o
jvlc.dll
else
libjvlc.so
:
$(OBJECTS)
$(MAKE)
-C
src
$(CXX)
-shared
$(COBJECTS)
$(LIBJINCLUDES)
$(LDFLAGS)
$(JAVALDFLAGS)
-o
libjvlc.so
endif
VlcClient
:
$(OBJECTS)
$(J
CC)
-C
VlcClient.java
$(J
AVAC)
VlcClient.java
VLCExample
:
$(OBJECTS)
$(JAVAC)
VLCExample.java
if
HAVE_WIN32
%.class
:
%.java
$(JAVAC)
$?
$(JCH)
org.videolan.jvlc.
$
(
*
F
)
else
%.class
:
%.java
$(JCC)
-C
$?
$(JCH)
org/videolan/jvlc/
$
(
*
F
)
$(JAVAC)
$?
$(JCH)
$
(
@D
)
/
$
(
*
F
)
-o
includes/
$
(
*
F
)
.h
endif
clean
:
rm
-f
*
.class
*
~ org/videolan/jvlc/
*
.class org_videolan
*
.h
*
.so
*
.o
clean
-local
:
rm
-f
*
.class
*
~ org/videolan/jvlc/
*
.class org_videolan
*
.h
includes/
*
.h src/
*
.o
*
.so
*
.o
*
.dll
endif
bindings/java/SWTUglyPlayer.java
deleted
100644 → 0
View file @
e53d8f51
/*****************************************************************************
* 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
();
}
}
bindings/java/VlcClient.java
View file @
ca250026
/*****************************************************************************
* VlcClient.java: Sample Swing player
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* Created on 28-feb-2006
*
* $Id: AudioIntf.java 8 2006-02-28 12:03:47Z little $
*
* 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.
*
*/
import
java.awt.Frame
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
org.videolan.jvlc.JVLCPanel
;
import
org.videolan.jvlc.JVLC
;
import
org.videolan.jvlc.VLCException
;
class
VLCPlayerFrame
extends
Frame
{
public
VLCPlayerFrame
()
{
...
...
@@ -109,15 +135,20 @@ class VLCPlayerFrame extends Frame {
private
void
pauseButtonActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
try
{
//System.out.println(mci.getMediaPosition(PositionOrigin.ABSOLUTE, PositionKey.BYTECOUNT));
jvlc
.
playlist
.
p
ause
();
jvlc
.
playlist
.
toggleP
ause
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
setButtonActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
jvlc
.
playlist
.
add
(
"file:///home/little/a.avi"
,
"a.avi"
);
jvlc
.
playlist
.
play
(-
1
,
null
);
try
{
jvlc
.
playlist
.
add
(
"file:///home/little/a.avi"
,
"a.avi"
);
jvlc
.
playlist
.
play
(-
1
,
null
);
}
catch
(
VLCException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
private
void
fullScreenButtonActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
...
...
bindings/java/org/videolan/jvlc/Audio.java
0 → 100644
View file @
ca250026
package
org.videolan.jvlc
;
public
class
Audio
implements
AudioIntf
{
private
long
libvlcInstance
;
private
native
boolean
_getMute
();
private
native
void
_setMute
(
boolean
value
);
private
native
void
_toggleMute
();
private
native
int
_getVolume
();
private
native
void
_setVolume
(
int
volume
);
public
Audio
(
long
instance
)
{
this
.
libvlcInstance
=
instance
;
}
public
boolean
getMute
()
throws
VLCException
{
return
_getMute
();
}
public
void
setMute
(
boolean
value
)
throws
VLCException
{
_setMute
(
value
);
}
public
void
toggleMute
()
throws
VLCException
{
_toggleMute
();
}
public
int
getVolume
()
throws
VLCException
{
return
_getVolume
();
}
public
void
setVolume
(
int
volume
)
throws
VLCException
{
_setVolume
(
volume
);
}
public
long
getInstance
()
{
return
libvlcInstance
;
}
}
bindings/java/org/videolan/jvlc/AudioIntf.java
View file @
ca250026
/*****************************************************************************
* AudioIntf.java: Audio methods interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-feb-2006
*
* $Id$
*
*
* Authors: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
public
interface
AudioIntf
{
void
getMute
();
void
setMute
();
void
getVolume
();
void
setVolume
();
/**
* @return True if input is currently muted.
* @throws VLCException
*/
boolean
getMute
()
throws
VLCException
;
/**
* @param value If true, then the input is muted.
* @throws VLCException
*/
void
setMute
(
boolean
value
)
throws
VLCException
;
/**
* Toggles mute
* @throws VLCException
*/
void
toggleMute
()
throws
VLCException
;
/**
* @return The volume level
* @throws VLCException
*/
int
getVolume
()
throws
VLCException
;
/**
* @param volume The volume level (0-200) to set.
* @throws VLCException
*/
void
setVolume
(
int
volume
)
throws
VLCException
;
}
bindings/java/org/videolan/jvlc/
SWT
VideoWidget.java
→
bindings/java/org/videolan/jvlc/
Generic
VideoWidget.java
View file @
ca250026
/*****************************************************************************
* 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.
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Kuldipsingh Pabla <Kuldipsingh.Pabla@sun.com>
*
* Created on 10-jun-2006
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* $Id $
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
package
org.videolan.jvlc
;
*
*/
import
org.eclipse.swt.awt.SWT_AWT
;
import
org.eclipse.swt.widgets.Composite
;
package
org.videolan.jvlc
;
import
java.awt.Frame
;
import
java.awt.Component
;
public
class
SWT
VideoWidget
{
public
class
Generic
VideoWidget
{
/*
* This class implements a
n SWTCanvas containing
VLC Video Output
* This class implements a
Composite container for
VLC Video Output
*/
/*
...
...
@@ -41,13 +43,9 @@ public class SWTVideoWidget {
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
)
{
public
GenericVideoWidget
(
Component
parent
)
{
// allocate the new AWT Frame to embed in the Composite
rootFrame
=
SWT_AWT
.
new_Frame
(
parent
);
rootFrame
=
new
Frame
(
);
// add the JVLCCanvas to the Frame
jvlcCanvas
=
new
JVLCCanvas
();
...
...
bindings/java/org/videolan/jvlc/Input.java
0 → 100644
View file @
ca250026
package
org.videolan.jvlc
;
public
class
Input
implements
InputIntf
{
private
long
libvlcInstance
;
/*
* Input native methods
*/
private
native
long
_getLength
();
private
native
float
_getPosition
();
private
native
long
_getTime
();
private
native
float
_getFPS
();
private
native
void
_setTime
(
long
value
);
private
native
void
_setPosition
(
float
value
);
private
native
boolean
_isPlaying
();
private
native
boolean
_hasVout
();
public
Input
(
long
instance
)
{
this
.
libvlcInstance
=
instance
;
}
public
long
getLength
()
throws
VLCException
{
return
_getLength
();
}
public
long
getTime
()
throws
VLCException
{
return
_getTime
();
}
public
float
getPosition
()
throws
VLCException
{
return
_getPosition
();
}
public
void
setTime
(
long
time
)
throws
VLCException
{
_setTime
(
time
);
}
public
void
setPosition
(
float
position
)
throws
VLCException
{
_setPosition
(
position
);
}
public
double
getFPS
()
throws
VLCException
{
return
_getFPS
();
}
public
boolean
isPlaying
()
throws
VLCException
{
return
_isPlaying
();
}
public
boolean
hasVout
()
throws
VLCException
{
return
_hasVout
();
}
public
long
getInstance
()
{
return
libvlcInstance
;
}
}
bindings/java/org/videolan/jvlc/InputIntf.java
View file @
ca250026
/*****************************************************************************
* InputIntf.java: Input interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-feb-2006
*
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
/**
* @author little
*
*/
public
interface
InputIntf
{
void
getLength
();
void
getTime
();
void
getPosition
();
void
setTime
();
double
getFPS
();
/**
* @return The total length of the current file playing in millis.
* @throws VLCException
*/
long
getLength
()
throws
VLCException
;
/**
* @return The current position in millis within the playing item.
* @throws VLCException
*/
long
getTime
()
throws
VLCException
;
/**
* @return The position in %.
* @throws VLCException
*/
float
getPosition
()
throws
VLCException
;
/**
* Moves current input to position specified in a float [0-1].
* @param value The position, from 0 to 1, to move the input to.
* @throws VLCException
*/
void
setPosition
(
float
value
)
throws
VLCException
;
/**
* Moves current input to time specified in value
* @param value The time in milliseconds to move the input to.
* @throws VLCException
*/
void
setTime
(
long
value
)
throws
VLCException
;
/**
* @return If the playing item is a video file, returns the FPS, otherwise 0.
* @throws VLCException
*/
double
getFPS
()
throws
VLCException
;
/**
* @return True if the current input is really playing
*/
boolean
isPlaying
()
throws
VLCException
;
/**
* @return True if the current input has spawned a video output window
*/
boolean
hasVout
()
throws
VLCException
;
}
bindings/java/org/videolan/jvlc/JLibVLC.java
View file @
ca250026
/*****************************************************************************
* JLibVLC.java: Main library interface
* JLibVLC.java: Main library interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-feb-2006
*
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
public
interface
JLibVLC
extends
AudioIntf
,
VideoIntf
,
InputIntf
{
}
public
interface
JLibVLC
extends
AudioIntf
,
VideoIntf
,
InputIntf
,
VLMIntf
{
}
bindings/java/org/videolan/jvlc/JVLC.java
View file @
ca250026
...
...
@@ -5,7 +5,8 @@
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* Philippe Morin <phmorin@free.fr>
*
* Created on 28-feb-2006
*
* $Id$
...
...
@@ -25,126 +26,146 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*
*/
/**
* @author Filippo Carone <filippo@carone.org>
*/
package
org.videolan.jvlc
;
public
class
JVLC
implements
JLibVLC
{
public
class
JVLC
implements
Runnable
{
static
{
System
.
load
(
System
.
getProperty
(
"user.dir"
)
+
"/libjvlc.so
"
);
System
.
load
Library
(
"jvlc
"
);
}
private
long
_instance
;
public
Playlist
playlist
;
public
JVLC
()
{
_instance
=
createInstance
();
playlist
=
new
Playlist
(
_instance
);
}
public
JVLC
(
String
[]
args
)
{
_instance
=
createInstance
(
args
);
playlist
=
new
Playlist
(
_instance
);
}
/*
* Core methods
/**
* These are set as final since they live along the jvlc object
*/
private
native
long
createInstance
();
private
native
long
createInstance
(
String
[]
args
);
private
final
long
_instance
;
/*
* Audio native methods
*/
private
native
boolean
_getMute
();
private
native
void
_setMute
(
boolean
value
);
private
native
void
_toggleMute
();
private
native
int
_getVolume
();
private
native
void
_setVolume
(
int
volume
);
public
final
Playlist
playlist
;
public
final
Video
video
;
public
final
Audio
audio
;
public
final
Input
input
;
public
final
VLM
vlm
;
/*
* Video native methods
private
boolean
beingDestroyed
=
false
;
/**
* This is the time in millis VLC checks for internal status
*/
private
native
void
_toggleFullscreen
();
private
native
void
_setFullscreen
(
boolean
value
);
private
native
boolean
_getFullscreen
();
private
long
resolution
=
50
;
public
boolean
getMute
()
{
// TODO Auto-generated method stub
return
_getMute
();
}
public
void
setMute
(
boolean
value
)
{
_setMute
(
value
);
}
private
boolean
inputPlaying
=
false
;
private
boolean
inputVout
=
false
;
public
void
toggleMute
()
{
_toggleMute
();
}
public
int
getVolume
()
{
return
_getVolume
();
}
public
void
setVolume
(
int
volume
)
{
_setVolume
(
volume
);
}
public
void
toggleFullscreen
()
{
_toggleFullscreen
();
}
public
void
setFullscreen
(
boolean
value
)
{
_setFullscreen
(
value
);
}
public
boolean
getFullscreen
()
{
return
_getFullscreen
();
}
public
void
getLength
()
{
// TODO Auto-generated method stub
}
public
void
getTime
()
{
// TODO Auto-generated method stub
public
JVLC
()
{
String
[]
args
=
new
String
[
1
];
args
[
0
]
=
"jvlc"
;
_instance
=
createInstance
(
args
);
playlist
=
new
Playlist
(
_instance
);
video
=
new
Video
(
_instance
);
audio
=
new
Audio
(
_instance
);
input
=
new
Input
(
_instance
);
vlm
=
new
VLM
(
_instance
);
new
Thread
(
this
).
start
();
}
public
void
getPosition
()
{
// TODO Auto-generated method stub
public
JVLC
(
String
[]
args
)
{
_instance
=
createInstance
(
args
);
playlist
=
new
Playlist
(
_instance
);
video
=
new
Video
(
_instance
);
audio
=
new
Audio
(
_instance
);
input
=
new
Input
(
_instance
);
vlm
=
new
VLM
(
_instance
);
new
Thread
(
this
).
start
();
}
public
void
setTime
()
{
// TODO Auto-generated method stub
/**
* Destroys the current instance of jvlc, cleaning up objects.
* This is unreversible.
*/
public
void
destroy
()
{
beingDestroyed
=
true
;
_destroy
();
}
public
double
getFPS
()
{
// TODO Auto-generated method stub
return
0
;
}
/*
* Core methods
*/
private
native
long
createInstance
(
String
[]
args
);
private
native
void
_destroy
();
public
long
getInstance
()
{
public
long
getInstance
()
throws
VLCException
{
return
_instance
;
}
/*
* Getters and setters
*/
public
Playlist
getPlaylist
()
{
public
Playlist
getPlaylist
()
throws
VLCException
{
return
playlist
;
}
/**
* Checks if the input is playing.
* @return True if there is a playing input.
*/
public
boolean
isInputPlaying
()
{
return
inputPlaying
;
}
/**
* Checks if the input has spawned a video window.
* @return True if there is a video window.
*/
public
boolean
hasVout
()
{
return
inputVout
;
}
/*
* (non-Javadoc)
* @see java.lang.Runnable#run()
*
* In this thread we check the playlist and input status.
*/
public
void
run
()
{
while
(!
beingDestroyed
)
{
try
{
while
(
playlist
.
isRunning
())
{
if
(
input
.
isPlaying
())
{
inputPlaying
=
true
;
}
else
{
inputPlaying
=
false
;
}
if
(
input
.
hasVout
())
{
inputVout
=
true
;
}
else
{
inputVout
=
false
;
}
try
{
Thread
.
sleep
(
resolution
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
catch
(
VLCException
e1
)
{
}
// while playlist running
inputPlaying
=
false
;
inputVout
=
false
;
try
{
Thread
.
sleep
(
resolution
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
// try
}
// while ! being destroyed
}
// run
}
bindings/java/org/videolan/jvlc/JVLCCanvas.java
View file @
ca250026
/*****************************************************************************
* JVLCCanvas.java: AWT Canvas containing VLC Video Output
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Created on 25-nov-2005
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* $Id$
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
...
...
@@ -31,23 +35,38 @@ 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
);
}
public
JVLCCanvas
(
String
[]
args
)
{
jvlc
=
new
JVLC
(
args
);
setSize
(
200
,
200
);
}
/**
* @param width The initial canvas width
* @param height The initial canvas height
*/
public
JVLCCanvas
(
int
width
,
int
height
)
{
jvlc
=
new
JVLC
();
setSize
(
width
,
height
);
}
public
JVLCCanvas
(
String
[]
args
,
int
width
,
int
height
)
{
jvlc
=
new
JVLC
(
args
);
setSize
(
width
,
height
);
}
public
JVLCCanvas
(
JVLC
jvlc
)
{
this
.
jvlc
=
jvlc
;
}
public
JVLC
getJVLC
()
{
return
jvlc
;
...
...
bindings/java/org/videolan/jvlc/JVLCPanel.java
View file @
ca250026
/*****************************************************************************
* JVLCPanel.java: Java Swing JPanel embedding VLC Video Output
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-nov-2005
*
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
...
...
bindings/java/org/videolan/jvlc/Playlist.java
View file @
ca250026
/*****************************************************************************
* Playlist.java:
The playlist
class
/*****************************************************************************
* Playlist.java:
PlaylistIntf implementation
class
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Created on 28-feb-2006
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* $Id$
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
...
...
@@ -33,63 +38,87 @@ 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
_is
Play
ing
();
native
private
int
_is
Runn
ing
();
public
void
play
(
int
id
,
String
[]
options
)
{
public
synchronized
void
play
(
int
id
,
String
[]
options
)
throws
VLCException
{
_play
(
id
,
options
);
}
public
synchronized
void
play
()
throws
VLCException
{
play
(-
1
,
null
);
}
public
void
pause
()
{
public
synchronized
void
togglePause
()
throws
VLCException
{
_pause
();
}
public
void
stop
()
{
public
synchronized
void
stop
()
throws
VLCException
{
_stop
();
// do {
// try {
// Thread.sleep(50);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// } while (isRunning());
}
public
boolean
is
Playing
()
{
return
(
_isPlaying
()
==
1
)?
false
:
true
;
public
boolean
is
Running
()
throws
VLCException
{
return
(
_isRunning
()
==
0
)?
false
:
true
;
}
public
int
itemsCount
()
{
public
synchronized
int
itemsCount
()
throws
VLCException
{
return
_itemsCount
();
}
public
void
next
()
{
public
synchronized
void
next
()
throws
VLCException
{
if
(!
isRunning
())
play
();
_next
();
}
public
void
prev
()
{
public
synchronized
void
prev
()
throws
VLCException
{
if
(!
isRunning
())
play
();
_prev
();
}
public
void
clear
()
{
_clear
();
public
synchronized
void
clear
()
throws
VLCException
{
_clear
();
}
public
int
add
(
String
uri
,
String
name
)
{
return
_playlist_add
(
uri
,
name
);
public
synchronized
int
add
(
String
uri
,
String
name
,
String
[]
options
)
throws
VLCException
{
return
_playlist_add
(
uri
,
name
,
options
);
}
public
synchronized
int
add
(
String
uri
,
String
name
)
throws
VLCException
{
return
add
(
uri
,
name
,
null
);
}
public
void
addExtended
()
{
// TODO Auto-generated method stub
public
synchronized
void
addExtended
()
{
}
public
long
getInstance
()
{
public
synchronized
void
deleteItem
(
int
itemID
)
throws
VLCException
{
_deleteItem
(
itemID
);
}
public
long
getInstance
()
throws
VLCException
{
return
libvlcInstance
;
}
public
void
setPause
(
boolean
pause
)
throws
VLCException
{
// TODO Auto-generated method stub
}
}
bindings/java/org/videolan/jvlc/PlaylistIntf.java
View file @
ca250026
/*****************************************************************************
* PlaylistIntf.java: The playlist interface
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Created on 28-feb-2006
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* $Id$
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
public
interface
PlaylistIntf
{
void
play
(
int
id
,
String
[]
options
);
void
pause
();
void
stop
();
boolean
isPlaying
();
int
itemsCount
();
void
next
();
void
prev
();
void
clear
();
int
add
(
String
uri
,
String
name
);
/**
* Plays the item specified in id, with options. At the moment options
* has no effect and can be safely set to null.
* @param id The ID to play
* @param options Options to play the item with
*/
void
play
(
int
id
,
String
[]
options
)
throws
VLCException
;
/**
* Plays the current item in the playlist.
*/
void
play
()
throws
VLCException
;
/**
* Toggles pause for the current item.
*/
void
togglePause
()
throws
VLCException
;
/**
* Pauses the currently playing item if pause value is true. Plays it
* otherwise. If you set pause to true and the current item is already
* playing, this has no effect.
*
* @param pause
* @throws VLCException
*/
void
setPause
(
boolean
pause
)
throws
VLCException
;
/**
* Stops the currently playing item. Differently from pause, stopping
* an item destroys any information related to the item.
*/
void
stop
()
throws
VLCException
;
/**
* This function returns true if the current item has not been stopped.
* @return True if the current item has not been stopped
*/
boolean
isRunning
()
throws
VLCException
;
/**
* TODO: this should return the number of items added with add, with no
* respect to videolan internal playlist.
*
* Returns the number of items in the playlist. Beware that this number
* could be bigger than the number of times add() has been called.
*
* @return Current number of items in the playlist
*/
int
itemsCount
()
throws
VLCException
;
/**
* Move to next item in the playlist and play it.
*/
void
next
()
throws
VLCException
;
/**
* Move to previous item in the playlist and play it.
*/
void
prev
()
throws
VLCException
;
/**
* Clear the playlist which becomes empty after this call.
*/
void
clear
()
throws
VLCException
;
/**
* TODO: document the kind of items that can be added.
* Add a new item in the playlist.
*
* @param uri Location of the item
* @param name Name of the item
* @return The item ID
*/
int
add
(
String
uri
,
String
name
)
throws
VLCException
;
/**
* Currently not implemented
*/
void
addExtended
();
}
bindings/java/org/videolan/jvlc/VLCException.java
0 → 100644
View file @
ca250026
/*****************************************************************************
* JVLC.java: Main Java Class, represents a libvlc_instance_t object
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Philippe Morin <phmorin@free.fr>
*
* Created on 18-jul-2006
*
* $Id $
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*
*/
package
org.videolan.jvlc
;
import
java.lang.Exception
;
public
class
VLCException
extends
Exception
{
public
VLCException
()
{
super
();
}
public
VLCException
(
String
message
)
{
super
(
message
);
}
public
VLCException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
VLCException
(
Throwable
cause
)
{
super
(
cause
);
}
}
bindings/java/org/videolan/jvlc/VLM.java
0 → 100644
View file @
ca250026
package
org.videolan.jvlc
;
public
class
VLM
implements
VLMIntf
{
private
long
libvlcInstance
;
private
native
void
_addBroadcast
(
String
mediaName
,
String
meditInputMRL
,
String
mediaOutputMRL
,
String
[]
additionalOptions
,
boolean
enableBroadcast
,
boolean
isPlayableInLoop
);
private
native
void
_deleteMedia
(
String
mediaName
);
private
native
void
_setEnabled
(
String
mediaName
,
boolean
newStatus
);
private
native
void
_setOutput
(
String
mediaName
,
String
mediaOutputMRL
);
private
native
void
_setInput
(
String
mediaName
,
String
mediaInputMRL
);
private
native
void
_setLoop
(
String
mediaName
,
boolean
isPlayableInLoop
);
private
native
void
_changeMedia
(
String
newMediaName
,
String
inputMRL
,
String
outputMRL
,
String
[]
additionalOptions
,
boolean
enableNewBroadcast
,
boolean
isPlayableInLoop
);
private
native
void
_playMedia
(
String
mediaName
);
private
native
void
_stopMedia
(
String
mediaName
);
private
native
void
_pauseMedia
(
String
mediaName
);
public
VLM
(
long
instance
)
{
this
.
libvlcInstance
=
instance
;
}
public
void
addBroadcast
(
String
name
,
String
input
,
String
output
,
String
[]
options
,
boolean
enabled
,
boolean
loop
)
throws
VLCException
{
_addBroadcast
(
name
,
input
,
output
,
options
,
enabled
,
loop
);
}
public
void
deleteMedia
(
String
name
)
throws
VLCException
{
_deleteMedia
(
name
);
}
public
void
setEnabled
(
String
name
,
boolean
enabled
)
throws
VLCException
{
_setEnabled
(
name
,
enabled
);
}
public
void
setOutput
(
String
name
,
String
output
)
throws
VLCException
{
_setOutput
(
name
,
output
);
}
public
void
setInput
(
String
name
,
String
input
)
throws
VLCException
{
_setInput
(
name
,
input
);
}
public
void
setLoop
(
String
name
,
boolean
loop
)
throws
VLCException
{
_setLoop
(
name
,
loop
);
}
public
void
changeMedia
(
String
name
,
String
input
,
String
output
,
String
[]
options
,
boolean
enabled
,
boolean
loop
)
throws
VLCException
{
_changeMedia
(
name
,
input
,
output
,
options
,
enabled
,
loop
);
}
public
void
playMedia
(
String
name
)
throws
VLCException
{
_playMedia
(
name
);
}
public
void
stopMedia
(
String
name
)
throws
VLCException
{
_stopMedia
(
name
);
}
public
void
pauseMedia
(
String
name
)
throws
VLCException
{
_pauseMedia
(
name
);
}
public
long
getInstance
()
{
return
libvlcInstance
;
}
}
bindings/java/org/videolan/jvlc/VLMIntf.java
View file @
ca250026
/*****************************************************************************
* VLMIntf.java: VLM Interface
*****************************************************************************
*
* Copyright (C) 1998-2006 the VideoLAN team
*
* Author: Filippo Carone <filippo@carone.org>
*
* Created on 28-feb-2006
*
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*
*/
package
org.videolan.jvlc
;
public
interface
VLMIntf
{
void
addBroadcast
();
void
deleteMedia
();
void
setEnabled
();
void
setOutput
();
void
setInput
();
void
setLoop
();
void
changeMedia
();
/**
* Add a broadcast, with one input
* @param name the name of the new broadcast
* @param input the input MRL
* @param output the output MRL (the parameter to the "sout" variable)
* @param options additional options
* @param enabled boolean for enabling the new broadcast
* @param loop Should this broadcast be played in loop ?
*/
void
addBroadcast
(
String
name
,
String
input
,
String
output
,
String
[]
options
,
boolean
enabled
,
boolean
loop
)
throws
VLCException
;
/**
* Delete a media (vod or broadcast)
* @param name the media to delete
*/
void
deleteMedia
(
String
name
)
throws
VLCException
;
/**
* Enable or disable a media (vod or broadcast)
* @param name the media to work on
* @param enabled the new status
*/
void
setEnabled
(
String
name
,
boolean
enabled
)
throws
VLCException
;
/**
* Set the output for a media
* @param name the media to work on
* @param output the output MRL (the parameter to the "sout" variable)
*/
void
setOutput
(
String
name
,
String
output
)
throws
VLCException
;
/**
* Set a media's input MRL. This will delete all existing inputs and
* add the specified one.
* @param name the media to work on
* @param input the input MRL
*/
void
setInput
(
String
name
,
String
input
)
throws
VLCException
;
/**
* Set loop mode for a media
* @param name the media to work on
* @param loop the new status
*/
void
setLoop
(
String
name
,
boolean
loop
)
throws
VLCException
;
/**
* Edit the parameters of a media. This will delete all existing inputs and
* add the specified one.
* @param name the name of the new broadcast
* @param input the input MRL
* @param output the output MRL (the parameter to the "sout" variable)
* @param options additional options
* @param enabled boolean for enabling the new broadcast
* @param loop Should this broadcast be played in loop ?
*/
void
changeMedia
(
String
name
,
String
input
,
String
output
,
String
[]
options
,
boolean
enabled
,
boolean
loop
)
throws
VLCException
;
/**
* Plays a media
* @param name of the broadcast to play
*/
void
playMedia
(
String
name
)
throws
VLCException
;
/**
* Stops a media
* @param name of the broadcast to stop
*/
void
stopMedia
(
String
name
)
throws
VLCException
;
/**
* Pauses a media
* @param name name of the broadcast to pause
*/
void
pauseMedia
(
String
name
)
throws
VLCException
;
}
bindings/java/org/videolan/jvlc/Video.java
0 → 100644
View file @
ca250026
/**
*
*/
package
org.videolan.jvlc
;
import
java.awt.Component
;
import
java.awt.Dimension
;
public
final
class
Video
implements
VideoIntf
{
private
long
libvlcInstance
;
public
Video
(
long
libvlcInstance
)
{
this
.
libvlcInstance
=
libvlcInstance
;
}
/*
* Video native methods
*/
private
native
void
_toggleFullscreen
();
private
native
void
_setFullscreen
(
boolean
value
);
private
native
boolean
_getFullscreen
();
private
native
int
_getHeight
();
private
native
int
_getWidth
();
private
native
void
_getSnapshot
(
String
filename
);
private
native
void
_destroyVideo
();
private
native
void
_reparent
(
Component
component
);
private
native
void
_setSize
(
int
width
,
int
height
);
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#destroyVideo()
*/
public
void
destroyVideo
()
throws
VLCException
{
_destroyVideo
();
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getFullscreen()
*/
public
boolean
getFullscreen
()
throws
VLCException
{
return
_getFullscreen
();
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getSnapshot(java.lang.String)
*/
public
void
getSnapshot
(
String
filepath
)
throws
VLCException
{
_getSnapshot
(
filepath
);
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getVideoHeight()
*/
public
int
getHeight
()
throws
VLCException
{
return
_getHeight
();
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getVideoWidth()
*/
public
int
getWidth
()
throws
VLCException
{
return
_getWidth
();
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#reparentVideo(java.awt.Component)
*/
public
void
reparent
(
Component
c
)
throws
VLCException
{
_reparent
(
c
);
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#resizeVideo(int, int)
*/
public
void
setSize
(
int
width
,
int
height
)
throws
VLCException
{
_setSize
(
width
,
height
);
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#setFullscreen(boolean)
*/
public
void
setFullscreen
(
boolean
fullscreen
)
throws
VLCException
{
_setFullscreen
(
fullscreen
);
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#toggleFullscreen()
*/
public
void
toggleFullscreen
()
throws
VLCException
{
_toggleFullscreen
();
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getSize()
*/
public
Dimension
getSize
()
throws
VLCException
{
return
new
Dimension
(
getWidth
(),
getHeight
());
}
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#setSize(java.awt.Dimension)
*/
public
void
setSize
(
Dimension
d
)
throws
VLCException
{
setSize
(
d
.
width
,
d
.
height
);
}
public
long
getInstance
()
{
return
libvlcInstance
;
}
}
bindings/java/org/videolan/jvlc/VideoIntf.java
View file @
ca250026
/*
/*****************************************************************************
* 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,93 @@
*
* 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., 5
9 Temple Place, Suite 330, Boston, MA 02111-1307
, USA.
* Foundation, Inc., 5
1 Franklin Street, Fifth Floor, Boston MA 02110-1301
, USA.
*
*/
/**
* @author Filippo Carone <filippo@carone.org>
*/
package
org.videolan.jvlc
;
import
java.awt.Component
;
import
java.awt.Dimension
;
public
interface
VideoIntf
{
void
toggleFullscreen
();
void
setFullscreen
();
void
getFullscreen
();
/**
* Toggles the fullscreen.
*/
void
toggleFullscreen
()
throws
VLCException
;
/**
* Sets fullscreen if fullscreen argument is true.
* @param fullscreen
*/
void
setFullscreen
(
boolean
fullscreen
)
throws
VLCException
;
/**
* @return True if the current video window is in fullscreen mode.
*/
boolean
getFullscreen
()
throws
VLCException
;
/**
* Saves a snapshot of the current video window.
* @param filepath The full path (including filename) were to save the snapshot to.
* If you only give a path, not including the filename, the snapshot will be saved in
* the specified path using vlc naming conventions.
*/
void
getSnapshot
(
String
filepath
)
throws
VLCException
;
/**
* @return The current video window height
*/
int
getHeight
()
throws
VLCException
;
/**
* @return The current video window width
*/
int
getWidth
()
throws
VLCException
;
/**
* Get the size of the video output window as a Dimension object.
* @return The video size in a Dimension object.
* @throws VLCException
*/
Dimension
getSize
()
throws
VLCException
;
/**
* Destroys video output, but the item continues to play.
* @throws VLCException
*/
void
destroyVideo
()
throws
VLCException
;
/**
* Moves video output from the current Canvas to another. This funtion
* doens't resize the video output to the new canvas size. See resizeVideo().
* @param c
* @throws VLCException
*/
void
reparent
(
Component
c
)
throws
VLCException
;
/**
* Resizes video output to width and height. This operation could be necessary
* after reparenting. See reparentVideo().
* @param width The new video output width
* @param height The new video output height
* @throws VLCException
*/
void
setSize
(
int
width
,
int
height
)
throws
VLCException
;
/**
* Resizes video output to width and height. This operation could be necessary
* after reparenting. See reparentVideo().
*
* @param d The new size of video
* @throws VLCException
*/
void
setSize
(
Dimension
d
)
throws
VLCException
;
}
bindings/java/vlc-graphics-jni.cc
deleted
100644 → 0
View file @
e53d8f51
/*****************************************************************************
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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
);
}
bindings/java/vlc-libvlc-jni.cc
deleted
100644 → 0
View file @
e53d8f51
This diff is collapsed.
Click to expand it.
configure.ac
View file @
ca250026
...
...
@@ -5427,6 +5427,7 @@ AC_CONFIG_FILES([
activex/axvlc.inf
bindings/Makefile
bindings/java/Makefile
bindings/java/src/Makefile
bindings/mediacontrol-python/Makefile
doc/Makefile
intl/Makefile
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment