Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
e7adbbfe
Commit
e7adbbfe
authored
May 19, 2007
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sample java listener and jni callback functions added
parent
12c291f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
0 deletions
+80
-0
bindings/java/org/videolan/jvlc/VolumeListener.java
bindings/java/org/videolan/jvlc/VolumeListener.java
+7
-0
bindings/java/src/callback-jni.cc
bindings/java/src/callback-jni.cc
+73
-0
No files found.
bindings/java/org/videolan/jvlc/VolumeListener.java
0 → 100644
View file @
e7adbbfe
package
org.videolan.jvlc
;
public
interface
VolumeListener
{
void
volumeChanged
();
}
bindings/java/src/callback-jni.cc
0 → 100644
View file @
e7adbbfe
/*****************************************************************************
* callback-jni.cc: JNI native callback 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>
#ifdef WIN32
#include <windows.h>
#undef usleep
#define usleep(var) Sleep(var/1000)
#else
#include <unistd.h>
#endif
#include <stdio.h>
#include "utils.h"
#include "../includes/Audio.h"
static
JavaVM
*
jvm
;
static
jclass
audioClass
;
static
jmethodID
wakeupListenersMethod
;
void
volumeChangedCallback
(
libvlc_instance_t
*
p_instance
,
libvlc_event_t
*
event
,
void
*
user_data
);
JNIEXPORT
void
JNICALL
Java_org_videolan_jvlc_Audio__1install_1callback
(
JNIEnv
*
env
,
jobject
_this
)
{
INIT_FUNCTION
;
if
(
jvm
==
NULL
)
{
env
->
GetJavaVM
(
&
jvm
);
audioClass
=
env
->
GetObjectClass
(
_this
);
wakeupListenersMethod
=
env
->
GetStaticMethodID
(
audioClass
,
"wakeupListeners"
,
"()V"
);
}
libvlc_callback_register_for_event
(
(
libvlc_instance_t
*
)
instance
,
VOLUME_CHANGED
,
volumeChangedCallback
,
&
_this
,
exception
);
CHECK_EXCEPTION_FREE
;
}
void
volumeChangedCallback
(
struct
libvlc_instance_t
*
p_instance
,
libvlc_event_t
*
event
,
void
*
user_data
)
{
JNIEnv
*
env
;
jvm
->
AttachCurrentThread
(
(
void
**
)
&
env
,
NULL
);
env
->
CallStaticVoidMethod
(
audioClass
,
wakeupListenersMethod
);
}
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