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
e0cbe2c8
Commit
e0cbe2c8
authored
Nov 04, 2006
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src dir in java bindings added
parent
ca250026
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1204 additions
and
0 deletions
+1204
-0
bindings/java/src/Makefile.am
bindings/java/src/Makefile.am
+29
-0
bindings/java/src/audio-jni.cc
bindings/java/src/audio-jni.cc
+86
-0
bindings/java/src/core-jni.cc
bindings/java/src/core-jni.cc
+98
-0
bindings/java/src/graphics-jni.cc
bindings/java/src/graphics-jni.cc
+140
-0
bindings/java/src/input-jni.cc
bindings/java/src/input-jni.cc
+132
-0
bindings/java/src/playlist-jni.cc
bindings/java/src/playlist-jni.cc
+186
-0
bindings/java/src/utils.cc
bindings/java/src/utils.cc
+52
-0
bindings/java/src/utils.h
bindings/java/src/utils.h
+35
-0
bindings/java/src/video-jni.cc
bindings/java/src/video-jni.cc
+228
-0
bindings/java/src/vlm-jni.cc
bindings/java/src/vlm-jni.cc
+218
-0
No files found.
bindings/java/src/Makefile.am
0 → 100644
View file @
e0cbe2c8
COBJECTS
=
utils.o video-jni.o audio-jni.o input-jni.o playlist-jni.o vlm-jni.o core-jni.o graphics-jni.o
EXTRA_DIST
=
\
audio-jni.cc
\
core-jni.cc
\
graphics-jni.cc
\
input-jni.cc
\
playlist-jni.cc
\
utils.cc
\
utils.h
\
video-jni.cc
\
vlm-jni.cc
if
BUILD_JAVA
JAVACXXFLAGS
=
-I
.
-Isrc
-I
../../
-I
../../include
-I
../../../include
$(JINCLUDES)
`
top_builddir
=
../../.. ../../../vlc-config
--cflags
pic
`
-c
all
:
$(COBJECTS)
.cc.o
:
$(CXX)
$?
$(CXXFLAGS)
$(JAVACXXFLAGS)
-o
$@
.PHONY
:
clean-local
clean-local
:
rm
-f
*
.o
*
~
endif
bindings/java/src/audio-jni.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* audio-jni.cc: JNI native audio functions for VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* 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 distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* These are a must*/
#include <jni.h>
#include <vlc/libvlc.h>
/* JVLC internal imports, generated by gcjh */
#include "../includes/Audio.h"
#include "utils.h"
JNIEXPORT
jboolean
JNICALL
Java_org_videolan_jvlc_Audio__1getMute
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
jboolean
res
;
res
=
(
jboolean
)
libvlc_audio_get_mute
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION
;
return
res
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Audio__1setMute
(
JNIEnv
*
env
,
jobject
_this
,
jboolean
value
)
{
INIT_FUNCTION
;
libvlc_audio_set_mute
(
(
libvlc_instance_t
*
)
instance
,
value
,
exception
);
CHECK_EXCEPTION
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Audio__1toggleMute
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
libvlc_audio_get_mute
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION
;
}
JNIEXPORT
jint
JNICALL
Java_org_videolan_jvlc_Audio__1getVolume
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
jint
res
=
0
;
res
=
libvlc_audio_get_volume
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION
;
return
res
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Audio__1setVolume
(
JNIEnv
*
env
,
jobject
_this
,
jint
volume
)
{
INIT_FUNCTION
;
libvlc_audio_set_volume
(
(
libvlc_instance_t
*
)
instance
,
volume
,
exception
);
CHECK_EXCEPTION
;
}
bindings/java/src/core-jni.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* vlc-libvlc-jni.cc: JNI interface for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* Authors: Filippo Carone <filippo@carone.org>
* Philippe Morin <phmorin@free.fr>
*
* $Id: core-jni.cc 156 2006-08-01 09:23:01Z littlejohn $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* These are a must*/
#include <jni.h>
#include <vlc/libvlc.h>
#include <stdio.h> // for printf
#include <stdlib.h> // for calloc
#include <string.h> // for strcmp
#include <unistd.h> // for usleep
/* JVLC internal imports, generated by gcjh */
#include "../includes/JVLC.h"
#include <jawt.h>
#include <jawt_md.h>
#include "utils.h"
jlong
getClassInstance
(
JNIEnv
*
env
,
jobject
_this
);
JNIEXPORT
jlong
JNICALL
Java_org_videolan_jvlc_JVLC_createInstance
(
JNIEnv
*
env
,
jobject
_this
,
jobjectArray
args
)
{
long
res
;
int
argc
;
const
char
**
argv
;
libvlc_exception_t
*
exception
=
(
libvlc_exception_t
*
)
malloc
(
sizeof
(
libvlc_exception_t
)
);
libvlc_exception_init
(
exception
);
argc
=
(
int
)
env
->
GetArrayLength
((
jarray
)
args
)
+
1
;
argv
=
(
const
char
**
)
malloc
(
argc
*
sizeof
(
char
*
));
argv
[
0
]
=
"vlc"
;
for
(
int
i
=
0
;
i
<
argc
-
1
;
i
++
)
{
argv
[
i
+
1
]
=
env
->
GetStringUTFChars
((
jstring
)
env
->
GetObjectArrayElement
(
args
,
i
),
0
);
}
res
=
(
long
)
libvlc_new
(
argc
,
(
char
**
)
argv
,
exception
);
free
(
exception
);
free
(
argv
);
return
res
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_JVLC__1destroy
(
JNIEnv
*
env
,
jobject
_this
)
{
long
instance
;
instance
=
getClassInstance
(
env
,
_this
);
libvlc_destroy
(
(
libvlc_instance_t
*
)
instance
);
return
;
}
/*
* Utility functions
*/
jlong
getClassInstance
(
JNIEnv
*
env
,
jobject
_this
)
{
/* get the id field of object */
jclass
cls
=
env
->
GetObjectClass
(
_this
);
jmethodID
mid
=
env
->
GetMethodID
(
cls
,
"getInstance"
,
"()J"
);
jlong
field
=
env
->
CallLongMethod
(
_this
,
mid
);
return
field
;
}
bindings/java/src/graphics-jni.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* JVLC.java: JNI interface for vlc Java Bindings
*****************************************************************************
* Copyright (C) 1998-2005 the VideoLAN team
*
* Authors: Filippo Carone <filippo@carone.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* These are a must*/
#include <jni.h>
#include <vlc/vlc.h>
#include <vlc/libvlc.h>
#include <jawt.h>
#include <jawt_md.h>
#ifndef WIN32
#include <X11/Xlib.h> // for Xlibs graphics functions
#endif
#include <stdio.h> // for printf
#include <stdlib.h> // for malloc
/* JVLC internal imports, generated by gcjh */
#include "../includes/JVLCCanvas.h"
jlong
getJVLCInstance
(
JNIEnv
*
env
,
jobject
_this
);
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_JVLCCanvas_paint
(
JNIEnv
*
env
,
jobject
canvas
,
jobject
graphics
)
{
JAWT
awt
;
JAWT_DrawingSurface
*
ds
;
JAWT_DrawingSurfaceInfo
*
dsi
;
#ifdef WIN32
JAWT_Win32DrawingSurfaceInfo
*
dsi_win
;
#else
JAWT_X11DrawingSurfaceInfo
*
dsi_x11
;
GC
gc
;
#endif
jint
lock
;
libvlc_drawable_t
drawable
;
libvlc_exception_t
*
exception
=
(
libvlc_exception_t
*
)
malloc
(
sizeof
(
libvlc_exception_t
));
libvlc_exception_init
(
exception
);
/* 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
;
}
#ifdef WIN32
/* Get the platform-specific drawing info */
dsi_win
=
(
JAWT_Win32DrawingSurfaceInfo
*
)
dsi
->
platformInfo
;
/* Now paint */
drawable
=
reinterpret_cast
<
int
>
(
dsi_win
->
hwnd
);
long
vlcInstance
=
getJVLCInstance
(
env
,
canvas
);
libvlc_video_set_parent
(
(
libvlc_instance_t
*
)
vlcInstance
,
drawable
,
exception
);
#else // UNIX
/* 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
);
drawable
=
dsi_x11
->
drawable
;
long
vlcInstance
=
getJVLCInstance
(
env
,
canvas
);
libvlc_video_set_parent
(
(
libvlc_instance_t
*
)
vlcInstance
,
drawable
,
exception
);
XFreeGC
(
dsi_x11
->
display
,
gc
);
#endif
/* Free the drawing surface info */
ds
->
FreeDrawingSurfaceInfo
(
dsi
);
/* Unlock the drawing surface */
ds
->
Unlock
(
ds
);
/* Free the drawing surface */
awt
.
FreeDrawingSurface
(
ds
);
}
/*
* Utility functions
*/
jlong
getJVLCInstance
(
JNIEnv
*
env
,
jobject
_this
)
{
/* get the id field of object */
jclass
canvascls
=
env
->
GetObjectClass
(
_this
);
jmethodID
canvasmid
=
env
->
GetMethodID
(
canvascls
,
"getJVLC"
,
"()Lorg/videolan/jvlc/JVLC;"
);
jobject
canvasjvlc
=
env
->
CallObjectMethod
(
_this
,
canvasmid
);
jclass
cls
=
env
->
GetObjectClass
(
canvasjvlc
);
jmethodID
mid
=
env
->
GetMethodID
(
cls
,
"getInstance"
,
"()J"
);
jlong
field
=
env
->
CallLongMethod
(
canvasjvlc
,
mid
);
return
field
;
}
bindings/java/src/input-jni.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* input-jni.cc: JNI native input functions for VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* 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 distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <jni.h>
#include <vlc/libvlc.h>
/* JVLC internal imports, generated by gcjh */
#include "../includes/Input.h"
#include "utils.h"
JNIEXPORT
jlong
JNICALL
Java_org_videolan_jvlc_Input__1getLength
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
vlc_int64_t
res
=
0
;
GET_INPUT_THREAD
;
res
=
libvlc_input_get_length
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
jfloat
JNICALL
Java_org_videolan_jvlc_Input__1getPosition
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
jfloat
res
;
GET_INPUT_THREAD
;
res
=
libvlc_input_get_position
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
jlong
JNICALL
Java_org_videolan_jvlc_Input__1getTime
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
vlc_int64_t
res
=
0
;
GET_INPUT_THREAD
;
res
=
libvlc_input_get_time
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
jfloat
JNICALL
Java_org_videolan_jvlc_Input__1getFPS
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
float
res
;
GET_INPUT_THREAD
;
res
=
libvlc_input_get_fps
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Input__1setTime
(
JNIEnv
*
env
,
jobject
_this
,
jlong
time
)
{
INIT_FUNCTION
;
GET_INPUT_THREAD
;
libvlc_input_set_time
(
input
,
time
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Input__1setPosition
(
JNIEnv
*
env
,
jobject
_this
,
jfloat
position
)
{
INIT_FUNCTION
;
GET_INPUT_THREAD
;
libvlc_input_set_position
(
input
,
position
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
jboolean
JNICALL
Java_org_videolan_jvlc_Input__1isPlaying
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
vlc_bool_t
res
=
0
;
GET_INPUT_THREAD
;
res
=
libvlc_input_will_play
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
jboolean
JNICALL
Java_org_videolan_jvlc_Input__1hasVout
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
vlc_bool_t
res
=
0
;
GET_INPUT_THREAD
;
res
=
libvlc_input_has_vout
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
bindings/java/src/playlist-jni.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* playlist-jni.cc: JNI native playlist functions for VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* 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 distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* These are a must*/
#include <jni.h>
#include <vlc/libvlc.h>
#include <unistd.h>
#include <stdio.h>
/* JVLC internal imports, generated by gcjh */
#include "../includes/Playlist.h"
#include "utils.h"
JNIEXPORT
jint
JNICALL
Java_org_videolan_jvlc_Playlist__1playlist_1add
(
JNIEnv
*
env
,
jobject
_this
,
jstring
uri
,
jstring
name
,
jobjectArray
options
)
{
INIT_FUNCTION
;
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
);
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
);
CHECK_EXCEPTION_FREE
;
}
else
{
res
=
libvlc_playlist_add
(
(
libvlc_instance_t
*
)
instance
,
psz_uri
,
psz_name
,
exception
);
CHECK_EXCEPTION_FREE
;
}
if
(
psz_uri
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
uri
,
psz_uri
);
}
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
return
res
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Playlist__1play
(
JNIEnv
*
env
,
jobject
_this
,
jint
id
,
jobjectArray
options
)
{
INIT_FUNCTION
;
int
i_options
=
0
;
const
char
**
ppsz_options
=
NULL
;
if
(
options
!=
NULL
)
{
i_options
=
(
int
)
env
->
GetArrayLength
(
(
jarray
)
options
);
ppsz_options
=
(
const
char
**
)
malloc
(
i_options
*
sizeof
(
char
*
)
);
for
(
int
i
=
0
;
i
<
i_options
-
1
;
i
++
)
{
ppsz_options
[
i
]
=
env
->
GetStringUTFChars
(
(
jstring
)
env
->
GetObjectArrayElement
(
options
,
i
),
0
);
}
}
libvlc_playlist_play
(
(
libvlc_instance_t
*
)
instance
,
id
,
i_options
,
(
char
**
)
ppsz_options
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Playlist__1pause
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
libvlc_playlist_pause
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Playlist__1stop
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
libvlc_playlist_stop
(
(
libvlc_instance_t
*
)
instance
,
exception
);
while
(
libvlc_playlist_isplaying
(
(
libvlc_instance_t
*
)
instance
,
exception
)
)
{
usleep
(
100
);
}
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Playlist__1next
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
libvlc_playlist_next
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Playlist__1prev
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
libvlc_playlist_prev
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Playlist__1clear
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
libvlc_playlist_clear
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Playlist__1deleteItem
(
JNIEnv
*
env
,
jobject
_this
,
jint
itemID
)
{
INIT_FUNCTION
;
libvlc_playlist_delete_item
(
(
libvlc_instance_t
*
)
instance
,
itemID
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
jint
JNICALL
Java_org_videolan_jvlc_Playlist__1itemsCount
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
int
res
=
0
;
res
=
libvlc_playlist_items_count
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
jint
JNICALL
Java_org_videolan_jvlc_Playlist__1isRunning
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
int
res
=
0
;
res
=
libvlc_playlist_isplaying
(
(
libvlc_instance_t
*
)
instance
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
bindings/java/src/utils.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* utils.cc: Utility functions for VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* 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 distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* These are a must*/
#include <jni.h>
#include "utils.h"
JAWT
awt
;
JAWT_DrawingSurfaceInfo
*
dsi
;
void
handle_vlc_exception
(
JNIEnv
*
env
,
libvlc_exception_t
*
exception
)
{
jclass
newExcCls
;
// raise a Java exception
newExcCls
=
env
->
FindClass
(
"org/videolan/jvlc/VLCException"
);
if
(
newExcCls
==
0
)
{
/* Unable to find the new exception class, give up. */
return
;
}
env
->
ThrowNew
(
newExcCls
,
libvlc_exception_get_message
(
exception
));
}
jlong
getInstance
(
JNIEnv
*
env
,
jobject
_this
)
{
/* get the id field of object */
jclass
cls
=
env
->
GetObjectClass
(
_this
);
jmethodID
mid
=
env
->
GetMethodID
(
cls
,
"getInstance"
,
"()J"
);
jlong
field
=
env
->
CallLongMethod
(
_this
,
mid
);
return
field
;
}
bindings/java/src/utils.h
0 → 100644
View file @
e0cbe2c8
/* These are a must*/
#include <jni.h>
#include <jawt.h>
#include <jawt_md.h>
#include <vlc/libvlc.h>
#include <stdlib.h> // for free
void
handle_vlc_exception
(
JNIEnv
*
,
libvlc_exception_t
*
);
jlong
getInstance
(
JNIEnv
*
,
jobject
);
#define CHECK_EXCEPTION_FREE \
if ( libvlc_exception_raised( exception )) \
{ \
handle_vlc_exception( env, exception ); \
} \
free( exception );
#define CHECK_EXCEPTION \
if ( libvlc_exception_raised( exception )) \
{ \
handle_vlc_exception( env, exception ); \
}
#define INIT_FUNCTION \
long instance; \
libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t )); \
libvlc_exception_init( exception ); \
instance = getInstance( env, _this );
#define GET_INPUT_THREAD \
libvlc_input_t *input; \
input = libvlc_playlist_get_input( ( libvlc_instance_t *) instance, exception ); \
CHECK_EXCEPTION ;
bindings/java/src/video-jni.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* video-jni.cc: JNI native video functions for VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* 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 distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* These are a must*/
#include <jni.h>
#include <vlc/libvlc.h>
/* JVLC internal imports, generated by gcjh */
#include "../includes/Video.h"
#include "utils.h"
#include <stdio.h>
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1toggleFullscreen
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
GET_INPUT_THREAD
;
libvlc_toggle_fullscreen
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1setFullscreen
(
JNIEnv
*
env
,
jobject
_this
,
jboolean
value
)
{
INIT_FUNCTION
;
GET_INPUT_THREAD
;
libvlc_set_fullscreen
(
input
,
value
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
jboolean
JNICALL
Java_org_videolan_jvlc_Video__1getFullscreen
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
int
res
=
0
;
GET_INPUT_THREAD
;
res
=
libvlc_get_fullscreen
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
jint
JNICALL
Java_org_videolan_jvlc_Video__1getHeight
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
int
res
=
0
;
GET_INPUT_THREAD
;
res
=
libvlc_video_get_height
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
jint
JNICALL
Java_org_videolan_jvlc_Video__1getWidth
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
int
res
=
0
;
GET_INPUT_THREAD
;
res
=
libvlc_video_get_width
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
return
res
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1getSnapshot
(
JNIEnv
*
env
,
jobject
_this
,
jstring
filepath
)
{
INIT_FUNCTION
;
const
char
*
psz_filepath
=
env
->
GetStringUTFChars
(
filepath
,
0
);
GET_INPUT_THREAD
;
libvlc_video_take_snapshot
(
input
,
(
char
*
)
psz_filepath
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_filepath
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
filepath
,
psz_filepath
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1destroyVideo
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
GET_INPUT_THREAD
;
libvlc_video_destroy
(
input
,
exception
);
CHECK_EXCEPTION_FREE
;
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1reparent
(
JNIEnv
*
env
,
jobject
_this
,
jobject
canvas
)
{
INIT_FUNCTION
;
GET_INPUT_THREAD
;
libvlc_drawable_t
drawable
;
JAWT
awt
;
JAWT_DrawingSurface
*
ds
;
JAWT_DrawingSurfaceInfo
*
dsi
;
#ifdef WIN32
JAWT_Win32DrawingSurfaceInfo
*
dsi_win
;
#else
JAWT_X11DrawingSurfaceInfo
*
dsi_x11
;
GC
gc
;
#endif
jint
lock
;
/* 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
;
}
#ifdef WIN32
/* Get the platform-specific drawing info */
dsi_win
=
(
JAWT_Win32DrawingSurfaceInfo
*
)
dsi
->
platformInfo
;
drawable
=
reinterpret_cast
<
int
>
(
dsi_win
->
hwnd
);
libvlc_video_reparent
(
input
,
drawable
,
exception
);
CHECK_EXCEPTION_FREE
;
#else // UNIX
/* 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
);
/* and reparent */
drawable
=
dsi_x11
->
drawable
;
libvlc_video_reparent
(
input
,
drawable
,
exception
);
CHECK_EXCEPTION_FREE
;
XFreeGC
(
dsi_x11
->
display
,
gc
);
#endif
/* Free the drawing surface info */
ds
->
FreeDrawingSurfaceInfo
(
dsi
);
/* Unlock the drawing surface */
ds
->
Unlock
(
ds
);
/* Free the drawing surface */
awt
.
FreeDrawingSurface
(
ds
);
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1setSize
(
JNIEnv
*
env
,
jobject
_this
,
jint
width
,
jint
height
)
{
INIT_FUNCTION
;
GET_INPUT_THREAD
;
libvlc_video_resize
(
input
,
width
,
height
,
exception
);
CHECK_EXCEPTION_FREE
;
}
bindings/java/src/vlm-jni.cc
0 → 100644
View file @
e0cbe2c8
/*****************************************************************************
* vlm-jni.cc: JNI native VLM functions for VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2006 the VideoLAN team
*
* Authors: Philippe Morin <phmorin@free.fr>
*
*
* $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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <jni.h>
#include <vlc/libvlc.h>
/* JVLC internal imports, generated by gcjh */
#include "../includes/VLM.h"
#include "utils.h"
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1addBroadcast
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
,
jstring
inputmrl
,
jstring
outputmrl
,
jobjectArray
options
,
jboolean
enable
,
jboolean
loop
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
const
char
*
psz_inputmrl
=
env
->
GetStringUTFChars
(
inputmrl
,
0
);
const
char
*
psz_outputmrl
=
env
->
GetStringUTFChars
(
outputmrl
,
0
);
int
i_options
=
0
;
const
char
**
ppsz_options
=
NULL
;
if
(
options
!=
NULL
)
{
i_options
=
(
int
)
env
->
GetArrayLength
(
(
jarray
)
options
);
ppsz_options
=
(
const
char
**
)
malloc
(
i_options
*
sizeof
(
char
*
)
);
for
(
int
i
=
0
;
i
<
i_options
-
1
;
i
++
)
{
ppsz_options
[
i
]
=
env
->
GetStringUTFChars
(
(
jstring
)
env
->
GetObjectArrayElement
(
options
,
i
),
0
);
}
}
libvlc_vlm_add_broadcast
(
(
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
(
char
*
)
psz_inputmrl
,
(
char
*
)
psz_outputmrl
,
i_options
,
(
char
**
)
ppsz_options
,
enable
,
loop
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
if
(
psz_inputmrl
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
inputmrl
,
psz_inputmrl
);
}
if
(
psz_outputmrl
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
outputmrl
,
psz_outputmrl
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1deleteMedia
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
libvlc_vlm_del_media
(
(
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1setEnabled
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
,
jboolean
newStatus
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
libvlc_vlm_set_enabled
(
(
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
newStatus
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1setOutput
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
,
jstring
mrl
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
const
char
*
psz_mrl
=
env
->
GetStringUTFChars
(
mrl
,
0
);
libvlc_vlm_set_output
((
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
(
char
*
)
psz_mrl
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
if
(
psz_mrl
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
mrl
,
psz_mrl
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1setInput
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
,
jstring
mrl
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
const
char
*
psz_mrl
=
env
->
GetStringUTFChars
(
mrl
,
0
);
libvlc_vlm_set_input
((
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
(
char
*
)
psz_mrl
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
if
(
psz_mrl
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
mrl
,
psz_mrl
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1setLoop
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
,
jboolean
newStatus
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
libvlc_vlm_set_loop
((
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
newStatus
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1changeMedia
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
,
jstring
inputmrl
,
jstring
outputmrl
,
jobjectArray
options
,
jboolean
enablenewbroadcast
,
jboolean
broadcast
)
{
INIT_FUNCTION
;
int
i_options
=
0
;
const
char
**
ppsz_options
=
NULL
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
const
char
*
psz_inputmrl
=
env
->
GetStringUTFChars
(
inputmrl
,
0
);
const
char
*
psz_outputmrl
=
env
->
GetStringUTFChars
(
outputmrl
,
0
);
if
(
options
!=
NULL
)
{
i_options
=
(
int
)
env
->
GetArrayLength
(
(
jarray
)
options
);
ppsz_options
=
(
const
char
**
)
malloc
(
i_options
*
sizeof
(
char
*
)
);
for
(
int
i
=
0
;
i
<
i_options
-
1
;
i
++
)
{
ppsz_options
[
i
]
=
env
->
GetStringUTFChars
(
(
jstring
)
env
->
GetObjectArrayElement
(
options
,
i
),
0
);
}
}
libvlc_vlm_change_media
(
(
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
(
char
*
)
psz_inputmrl
,
(
char
*
)
psz_outputmrl
,
i_options
,
(
char
**
)
ppsz_options
,
enablenewbroadcast
,
broadcast
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
if
(
psz_inputmrl
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_inputmrl
);
}
if
(
psz_outputmrl
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_outputmrl
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1playMedia
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
libvlc_vlm_play_media
(
(
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1stopMedia
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
libvlc_vlm_stop_media
(
(
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_VLM__1pauseMedia
(
JNIEnv
*
env
,
jobject
_this
,
jstring
name
)
{
INIT_FUNCTION
;
const
char
*
psz_name
=
env
->
GetStringUTFChars
(
name
,
0
);
libvlc_vlm_pause_media
(
(
libvlc_instance_t
*
)
instance
,
(
char
*
)
psz_name
,
exception
);
CHECK_EXCEPTION_FREE
;
if
(
psz_name
!=
NULL
)
{
env
->
ReleaseStringUTFChars
(
name
,
psz_name
);
}
}
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