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
85d419a3
Commit
85d419a3
authored
Dec 05, 2006
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java bindings update: various enhancements; paint system changed; reparenting works again.
parent
a10792f2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
232 additions
and
123 deletions
+232
-123
bindings/java/Makefile.am
bindings/java/Makefile.am
+1
-1
bindings/java/org/videolan/jvlc/Input.java
bindings/java/org/videolan/jvlc/Input.java
+2
-2
bindings/java/org/videolan/jvlc/JVLC.java
bindings/java/org/videolan/jvlc/JVLC.java
+30
-32
bindings/java/org/videolan/jvlc/JVLCCanvas.java
bindings/java/org/videolan/jvlc/JVLCCanvas.java
+13
-1
bindings/java/org/videolan/jvlc/Video.java
bindings/java/org/videolan/jvlc/Video.java
+16
-6
bindings/java/org/videolan/jvlc/VideoIntf.java
bindings/java/org/videolan/jvlc/VideoIntf.java
+1
-2
bindings/java/src/core-jni.cc
bindings/java/src/core-jni.cc
+3
-0
bindings/java/src/graphics-jni.cc
bindings/java/src/graphics-jni.cc
+77
-77
bindings/java/src/video-jni.cc
bindings/java/src/video-jni.cc
+89
-2
No files found.
bindings/java/Makefile.am
View file @
85d419a3
...
@@ -33,7 +33,7 @@ EXTRA_DIST+= \
...
@@ -33,7 +33,7 @@ EXTRA_DIST+= \
if
BUILD_JAVA
if
BUILD_JAVA
OBJECTS
=
org/videolan/jvlc/VLM.class 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/GenericVideoWidget.class
OBJECTS
=
org/videolan/jvlc/VLM.class 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/
JVLCCanvas.class org/videolan/jvlc/Video.class org/videolan/jvlc/JLibVLC.class org/videolan/jvlc/JVLC.class
org/videolan/jvlc/JVLCPanel.class org/videolan/jvlc/VLMIntf.class org/videolan/jvlc/GenericVideoWidget.class
PROCESSOR_FAMILY
=
`
uname
-m
|
sed
-e
's/^i.86/i386/'
|
sed
-e
's/^x86_64/amd64/'
`
PROCESSOR_FAMILY
=
`
uname
-m
|
sed
-e
's/^i.86/i386/'
|
sed
-e
's/^x86_64/amd64/'
`
...
...
bindings/java/org/videolan/jvlc/Input.java
View file @
85d419a3
...
@@ -14,7 +14,7 @@ public class Input implements InputIntf {
...
@@ -14,7 +14,7 @@ public class Input implements InputIntf {
private
native
void
_setTime
(
long
value
);
private
native
void
_setTime
(
long
value
);
private
native
void
_setPosition
(
float
value
);
private
native
void
_setPosition
(
float
value
);
private
native
boolean
_isPlaying
();
private
native
boolean
_isPlaying
();
private
native
boolean
_hasVout
();
private
native
boolean
_hasVout
()
throws
VLCException
;
public
Input
(
long
instance
)
{
public
Input
(
long
instance
)
{
...
...
bindings/java/org/videolan/jvlc/JVLC.java
View file @
85d419a3
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
package
org.videolan.jvlc
;
package
org.videolan.jvlc
;
public
class
JVLC
implements
Runnable
{
public
class
JVLC
implements
Runnable
{
static
{
static
{
...
@@ -92,8 +91,11 @@ public class JVLC implements Runnable {
...
@@ -92,8 +91,11 @@ public class JVLC implements Runnable {
*/
*/
public
void
destroy
()
{
public
void
destroy
()
{
beingDestroyed
=
true
;
beingDestroyed
=
true
;
if
(!
beingDestroyed
)
{
_destroy
();
_destroy
();
}
}
}
/*
/*
...
@@ -138,37 +140,33 @@ public class JVLC implements Runnable {
...
@@ -138,37 +140,33 @@ public class JVLC implements Runnable {
* In this thread we check the playlist and input status.
* In this thread we check the playlist and input status.
*/
*/
public
void
run
()
{
public
void
run
()
{
while
(!
beingDestroyed
)
{
try
{
try
{
while
(
playlist
.
isRunning
())
{
while
(!
beingDestroyed
)
{
if
(
input
.
isPlaying
())
{
inputPlaying
=
true
;
}
else
{
inputPlaying
=
false
;
}
if
(
input
.
hasVout
())
{
inputVout
=
true
;
}
else
{
inputVout
=
false
;
}
try
{
try
{
while
(
playlist
.
isRunning
())
{
inputPlaying
=
input
.
isPlaying
();
inputVout
=
input
.
hasVout
();
Thread
.
sleep
(
resolution
);
Thread
.
sleep
(
resolution
);
}
catch
(
InterruptedException
e
)
{
}
// while playlist running
}
catch
(
VLCException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
catch
(
VLCException
e1
)
{
}
// while playlist running
inputPlaying
=
false
;
inputPlaying
=
false
;
inputVout
=
false
;
inputVout
=
false
;
try
{
Thread
.
sleep
(
resolution
);
Thread
.
sleep
(
resolution
);
}
// while ! being destroyed
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
// try
}
}
// while ! being destroyed
}
}
// run
/* (non-Javadoc)
* @see java.lang.Object#finalize()
*/
protected
void
finalize
()
throws
Throwable
{
destroy
();
super
.
finalize
();
}
}
}
bindings/java/org/videolan/jvlc/JVLCCanvas.java
View file @
85d419a3
...
@@ -33,7 +33,9 @@ import java.awt.Graphics;
...
@@ -33,7 +33,9 @@ import java.awt.Graphics;
public
class
JVLCCanvas
extends
Canvas
{
public
class
JVLCCanvas
extends
Canvas
{
public
native
void
paint
(
Graphics
g
);
public
void
paint
(
Graphics
g
)
{
jvlc
.
video
.
paint
(
g
);
}
private
final
JVLC
jvlc
;
private
final
JVLC
jvlc
;
...
@@ -41,12 +43,16 @@ public class JVLCCanvas extends Canvas {
...
@@ -41,12 +43,16 @@ public class JVLCCanvas extends Canvas {
* Default constructor. The canvas is set a dimension of 200x200
* Default constructor. The canvas is set a dimension of 200x200
*/
*/
public
JVLCCanvas
()
{
public
JVLCCanvas
()
{
super
();
jvlc
=
new
JVLC
();
jvlc
=
new
JVLC
();
jvlc
.
video
.
setActualCanvas
(
this
);
setSize
(
200
,
200
);
setSize
(
200
,
200
);
}
}
public
JVLCCanvas
(
String
[]
args
)
{
public
JVLCCanvas
(
String
[]
args
)
{
super
();
jvlc
=
new
JVLC
(
args
);
jvlc
=
new
JVLC
(
args
);
jvlc
.
video
.
setActualCanvas
(
this
);
setSize
(
200
,
200
);
setSize
(
200
,
200
);
}
}
...
@@ -55,17 +61,23 @@ public class JVLCCanvas extends Canvas {
...
@@ -55,17 +61,23 @@ public class JVLCCanvas extends Canvas {
* @param height The initial canvas height
* @param height The initial canvas height
*/
*/
public
JVLCCanvas
(
int
width
,
int
height
)
{
public
JVLCCanvas
(
int
width
,
int
height
)
{
super
();
jvlc
=
new
JVLC
();
jvlc
=
new
JVLC
();
jvlc
.
video
.
setActualCanvas
(
this
);
setSize
(
width
,
height
);
setSize
(
width
,
height
);
}
}
public
JVLCCanvas
(
String
[]
args
,
int
width
,
int
height
)
{
public
JVLCCanvas
(
String
[]
args
,
int
width
,
int
height
)
{
super
();
jvlc
=
new
JVLC
(
args
);
jvlc
=
new
JVLC
(
args
);
jvlc
.
video
.
setActualCanvas
(
this
);
setSize
(
width
,
height
);
setSize
(
width
,
height
);
}
}
public
JVLCCanvas
(
JVLC
jvlc
)
{
public
JVLCCanvas
(
JVLC
jvlc
)
{
super
();
this
.
jvlc
=
jvlc
;
this
.
jvlc
=
jvlc
;
jvlc
.
video
.
setActualCanvas
(
this
);
}
}
public
JVLC
getJVLC
()
{
public
JVLC
getJVLC
()
{
...
...
bindings/java/org/videolan/jvlc/Video.java
View file @
85d419a3
...
@@ -3,16 +3,17 @@
...
@@ -3,16 +3,17 @@
*/
*/
package
org.videolan.jvlc
;
package
org.videolan.jvlc
;
import
java.awt.Component
;
import
java.awt.Dimension
;
import
java.awt.Dimension
;
import
java.awt.Graphics
;
public
final
class
Video
implements
VideoIntf
{
public
final
class
Video
implements
VideoIntf
{
private
long
libvlcInstance
;
private
long
libvlcInstance
;
private
JVLCCanvas
actualCanvas
;
public
Video
(
long
libvlcInstance
)
{
public
Video
(
long
libvlcInstance
)
{
this
.
libvlcInstance
=
libvlcInstance
;
this
.
libvlcInstance
=
libvlcInstance
;
}
}
/*
/*
...
@@ -25,8 +26,9 @@ public final class Video implements VideoIntf {
...
@@ -25,8 +26,9 @@ public final class Video implements VideoIntf {
private
native
int
_getWidth
();
private
native
int
_getWidth
();
private
native
void
_getSnapshot
(
String
filename
);
private
native
void
_getSnapshot
(
String
filename
);
private
native
void
_destroyVideo
();
private
native
void
_destroyVideo
();
private
native
void
_reparent
(
Component
component
);
private
native
void
_reparent
(
JVLCCanvas
component
);
private
native
void
_setSize
(
int
width
,
int
height
);
private
native
void
_setSize
(
int
width
,
int
height
);
private
native
void
_paint
(
JVLCCanvas
canvas
,
Graphics
g
);
/* (non-Javadoc)
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#destroyVideo()
* @see org.videolan.jvlc.VideoIntf#destroyVideo()
...
@@ -66,8 +68,9 @@ public final class Video implements VideoIntf {
...
@@ -66,8 +68,9 @@ public final class Video implements VideoIntf {
/* (non-Javadoc)
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#reparentVideo(java.awt.Component)
* @see org.videolan.jvlc.VideoIntf#reparentVideo(java.awt.Component)
*/
*/
public
void
reparent
(
Component
c
)
throws
VLCException
{
public
void
reparent
(
JVLCCanvas
c
)
throws
VLCException
{
_reparent
(
c
);
_reparent
(
c
);
setActualCanvas
(
c
);
}
}
/* (non-Javadoc)
/* (non-Javadoc)
...
@@ -75,7 +78,6 @@ public final class Video implements VideoIntf {
...
@@ -75,7 +78,6 @@ public final class Video implements VideoIntf {
*/
*/
public
void
setSize
(
int
width
,
int
height
)
throws
VLCException
{
public
void
setSize
(
int
width
,
int
height
)
throws
VLCException
{
_setSize
(
width
,
height
);
_setSize
(
width
,
height
);
}
}
/* (non-Javadoc)
/* (non-Javadoc)
...
@@ -106,6 +108,14 @@ public final class Video implements VideoIntf {
...
@@ -106,6 +108,14 @@ public final class Video implements VideoIntf {
setSize
(
d
.
width
,
d
.
height
);
setSize
(
d
.
width
,
d
.
height
);
}
}
public
void
paint
(
Graphics
g
)
{
_paint
(
actualCanvas
,
g
);
}
public
void
setActualCanvas
(
JVLCCanvas
canvas
)
{
actualCanvas
=
canvas
;
}
public
long
getInstance
()
{
public
long
getInstance
()
{
return
libvlcInstance
;
return
libvlcInstance
;
}
}
...
...
bindings/java/org/videolan/jvlc/VideoIntf.java
View file @
85d419a3
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
package
org.videolan.jvlc
;
package
org.videolan.jvlc
;
import
java.awt.Component
;
import
java.awt.Dimension
;
import
java.awt.Dimension
;
...
@@ -91,7 +90,7 @@ public interface VideoIntf {
...
@@ -91,7 +90,7 @@ public interface VideoIntf {
* @param c
* @param c
* @throws VLCException
* @throws VLCException
*/
*/
void
reparent
(
Component
c
)
throws
VLCException
;
void
reparent
(
JVLCCanvas
c
)
throws
VLCException
;
/**
/**
* Resizes video output to width and height. This operation could be necessary
* Resizes video output to width and height. This operation could be necessary
...
...
bindings/java/src/core-jni.cc
View file @
85d419a3
...
@@ -82,6 +82,9 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1destroy (JNIEnv *env, jobje
...
@@ -82,6 +82,9 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1destroy (JNIEnv *env, jobje
}
}
//JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLC__1paint (JNIEnv *env, jobject _this, jobject canvas, jobject graphics)
/*
/*
* Utility functions
* Utility functions
*/
*/
...
...
bindings/java/src/graphics-jni.cc
View file @
85d419a3
...
@@ -39,91 +39,91 @@
...
@@ -39,91 +39,91 @@
jlong
getJVLCInstance
(
JNIEnv
*
env
,
jobject
_this
);
jlong
getJVLCInstance
(
JNIEnv
*
env
,
jobject
_this
);
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_JVLCCanvas_paint
(
JNIEnv
*
env
,
jobject
canvas
,
jobject
graphics
)
{
//
JNIEXPORT void JNICALL Java_org_videolan_jvlc_JVLCCanvas_paint (JNIEnv *env, jobject canvas, jobject graphics) {
JAWT
awt
;
//
JAWT awt;
JAWT_DrawingSurface
*
ds
;
//
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo
*
dsi
;
//
JAWT_DrawingSurfaceInfo* dsi;
#ifdef WIN32
//
#ifdef WIN32
JAWT_Win32DrawingSurfaceInfo
*
dsi_win
;
//
JAWT_Win32DrawingSurfaceInfo* dsi_win;
#else
//
#else
JAWT_X11DrawingSurfaceInfo
*
dsi_x11
;
//
JAWT_X11DrawingSurfaceInfo* dsi_x11;
GC
gc
;
//
GC gc;
#endif
//
#endif
jint
lock
;
//
jint lock;
libvlc_drawable_t
drawable
;
//
libvlc_drawable_t drawable;
libvlc_exception_t
*
exception
=
(
libvlc_exception_t
*
)
malloc
(
sizeof
(
libvlc_exception_t
));
//
libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ));
libvlc_exception_init
(
exception
);
//
libvlc_exception_init( exception );
/* Get the AWT */
//
/* Get the AWT */
awt
.
version
=
JAWT_VERSION_1_3
;
//
awt.version = JAWT_VERSION_1_3;
if
(
JAWT_GetAWT
(
env
,
&
awt
)
==
JNI_FALSE
)
{
//
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
printf
(
"AWT Not found
\n
"
);
//
printf("AWT Not found\n");
return
;
//
return;
}
//
}
/* Get the drawing surface */
//
/* Get the drawing surface */
ds
=
awt
.
GetDrawingSurface
(
env
,
canvas
);
//
ds = awt.GetDrawingSurface(env, canvas);
if
(
ds
==
NULL
)
{
//
if (ds == NULL) {
printf
(
"NULL drawing surface
\n
"
);
//
printf("NULL drawing surface\n");
return
;
//
return;
}
//
}
/* Lock the drawing surface */
//
/* Lock the drawing surface */
lock
=
ds
->
Lock
(
ds
);
//
lock = ds->Lock(ds);
if
((
lock
&
JAWT_LOCK_ERROR
)
!=
0
)
{
//
if((lock & JAWT_LOCK_ERROR) != 0) {
printf
(
"Error locking surface
\n
"
);
//
printf("Error locking surface\n");
awt
.
FreeDrawingSurface
(
ds
);
//
awt.FreeDrawingSurface(ds);
return
;
//
return;
}
//
}
/* Get the drawing surface info */
//
/* Get the drawing surface info */
dsi
=
ds
->
GetDrawingSurfaceInfo
(
ds
);
//
dsi = ds->GetDrawingSurfaceInfo(ds);
if
(
dsi
==
NULL
)
{
//
if (dsi == NULL) {
printf
(
"Error getting surface info
\n
"
);
//
printf("Error getting surface info\n");
ds
->
Unlock
(
ds
);
//
ds->Unlock(ds);
awt
.
FreeDrawingSurface
(
ds
);
//
awt.FreeDrawingSurface(ds);
return
;
//
return;
}
//
}
#ifdef WIN32
//
#ifdef WIN32
/* Get the platform-specific drawing info */
//
/* Get the platform-specific drawing info */
dsi_win
=
(
JAWT_Win32DrawingSurfaceInfo
*
)
dsi
->
platformInfo
;
//
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
/* Now paint */
//
/* Now paint */
drawable
=
reinterpret_cast
<
int
>
(
dsi_win
->
hwnd
);
//
drawable = reinterpret_cast<int>(dsi_win->hwnd);
long
vlcInstance
=
getJVLCInstance
(
env
,
canvas
);
//
long vlcInstance = getJVLCInstance( env, canvas );
libvlc_video_set_parent
(
(
libvlc_instance_t
*
)
vlcInstance
,
drawable
,
exception
);
//
libvlc_video_set_parent( (libvlc_instance_t *) vlcInstance, drawable, exception );
#else // UNIX
//
#else // UNIX
/* Get the platform-specific drawing info */
//
/* Get the platform-specific drawing info */
dsi_x11
=
(
JAWT_X11DrawingSurfaceInfo
*
)
dsi
->
platformInfo
;
//
dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
/* Now paint */
//
/* Now paint */
gc
=
XCreateGC
(
dsi_x11
->
display
,
dsi_x11
->
drawable
,
0
,
0
);
//
gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0);
XSetBackground
(
dsi_x11
->
display
,
gc
,
0
);
//
XSetBackground(dsi_x11->display, gc, 0);
drawable
=
dsi_x11
->
drawable
;
//
drawable = dsi_x11->drawable;
long
vlcInstance
=
getJVLCInstance
(
env
,
canvas
);
//
long vlcInstance = getJVLCInstance( env, canvas );
libvlc_video_set_parent
(
(
libvlc_instance_t
*
)
vlcInstance
,
drawable
,
exception
);
//
libvlc_video_set_parent( (libvlc_instance_t *)vlcInstance, drawable, exception );
XFreeGC
(
dsi_x11
->
display
,
gc
);
//
XFreeGC(dsi_x11->display, gc);
#endif
//
#endif
/* Free the drawing surface info */
//
/* Free the drawing surface info */
ds
->
FreeDrawingSurfaceInfo
(
dsi
);
//
ds->FreeDrawingSurfaceInfo(dsi);
/* Unlock the drawing surface */
//
/* Unlock the drawing surface */
ds
->
Unlock
(
ds
);
//
ds->Unlock(ds);
/* Free the drawing surface */
//
/* Free the drawing surface */
awt
.
FreeDrawingSurface
(
ds
);
//
awt.FreeDrawingSurface(ds);
}
//
}
/*
/*
* Utility functions
* Utility functions
...
...
bindings/java/src/video-jni.cc
View file @
85d419a3
...
@@ -183,7 +183,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
...
@@ -183,7 +183,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
dsi_win
=
(
JAWT_Win32DrawingSurfaceInfo
*
)
dsi
->
platformInfo
;
dsi_win
=
(
JAWT_Win32DrawingSurfaceInfo
*
)
dsi
->
platformInfo
;
drawable
=
reinterpret_cast
<
int
>
(
dsi_win
->
hwnd
);
drawable
=
reinterpret_cast
<
int
>
(
dsi_win
->
hwnd
);
libvlc_video_
re
parent
(
input
,
drawable
,
exception
);
libvlc_video_
set_
parent
(
input
,
drawable
,
exception
);
CHECK_EXCEPTION_FREE
;
CHECK_EXCEPTION_FREE
;
...
@@ -198,7 +198,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
...
@@ -198,7 +198,7 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
/* and reparent */
/* and reparent */
drawable
=
dsi_x11
->
drawable
;
drawable
=
dsi_x11
->
drawable
;
libvlc_video_
reparent
(
input
,
drawable
,
exception
);
libvlc_video_
set_parent
(
(
libvlc_instance_t
*
)
instance
,
drawable
,
exception
);
CHECK_EXCEPTION_FREE
;
CHECK_EXCEPTION_FREE
;
...
@@ -215,6 +215,93 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
...
@@ -215,6 +215,93 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Video__1reparent (JNIEnv *env, job
awt
.
FreeDrawingSurface
(
ds
);
awt
.
FreeDrawingSurface
(
ds
);
}
}
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1paint
(
JNIEnv
*
env
,
jobject
_this
,
jobject
canvas
,
jobject
graphics
)
{
INIT_FUNCTION
;
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_set_parent
(
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_set_parent
(
(
libvlc_instance_t
*
)
instance
,
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
)
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Video__1setSize
(
JNIEnv
*
env
,
jobject
_this
,
jint
width
,
jint
height
)
{
{
...
...
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