mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 07:38:09 +00:00
JNI wrapping of linphone_player_destroy()
This commit is contained in:
parent
9cee579ee1
commit
e7b469eded
4 changed files with 16 additions and 22 deletions
|
|
@ -5295,6 +5295,16 @@ extern "C" void Java_org_linphone_core_LinphonePlayerImpl_close(JNIEnv *env, job
|
|||
linphone_player_close(player);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphonePlayerImpl_destroy(JNIEnv *env, jobject jobj, jlong playerPtr) {
|
||||
LinphonePlayer *player = (LinphonePlayer *)playerPtr;
|
||||
if(player->user_data) {
|
||||
delete (LinphonePlayerData *)player->user_data;
|
||||
}
|
||||
jobject window_id = (jobject)ms_media_player_get_window_id((MSMediaPlayer *)player->impl);
|
||||
if(window_id) env->DeleteGlobalRef(window_id);
|
||||
linphone_player_destroy(player);
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createPlayer(JNIEnv *env, jobject jobj, jlong ptr, jobject window) {
|
||||
jobject window_ref = NULL;
|
||||
MSSndCard *snd_card = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
|
||||
|
|
@ -5312,13 +5322,3 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createPlayer(JNIEnv *en
|
|||
return (jlong)player;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_destroyPlayer(JNIEnv *env, jobject jobj, jlong playerPtr) {
|
||||
LinphonePlayer *player = (LinphonePlayer *)playerPtr;
|
||||
if(player->user_data) {
|
||||
delete (LinphonePlayerData *)player->user_data;
|
||||
}
|
||||
jobject window_id = (jobject)ms_media_player_get_window_id((MSMediaPlayer *)player->impl);
|
||||
if(window_id) env->DeleteGlobalRef(window_id);
|
||||
linphone_player_destroy(player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1787,10 +1787,4 @@ public interface LinphoneCore {
|
|||
* @return An object that implement LinphonePlayer
|
||||
*/
|
||||
public LinphonePlayer createPlayer(AndroidVideoWindowImpl window);
|
||||
|
||||
/**
|
||||
* Destroy a player
|
||||
* @param player Player to destroy
|
||||
*/
|
||||
public void destroyPlayer(LinphonePlayer player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1290,10 +1290,4 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private native void destroyPlayer(long playerPtr);
|
||||
@Override
|
||||
public synchronized void destroyPlayer(LinphonePlayer player) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,10 @@ public class LinphonePlayerImpl implements LinphonePlayer {
|
|||
public synchronized void close() {
|
||||
close(nativePtr);
|
||||
}
|
||||
|
||||
private native void destroy(long nativePtr);
|
||||
@Override
|
||||
protected void finalize() {
|
||||
destroy(nativePtr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue