[Android] [WIP PATCH 09/11] libvlc: add Media, MediaList, MediaDiscoverer
Thomas Guillem
thomas at gllm.fr
Tue Dec 23 18:38:30 CET 2014
A MediaDiscoverer can create a MediaList that can create several Media.
---
libvlc/jni/Android.mk | 1 +
libvlc/jni/libvlcjni-media.c | 124 +++++++++++++++++
libvlc/jni/libvlcjni-mediadiscoverer.c | 96 +++++++++++++
libvlc/jni/libvlcjni-medialist.c | 135 +++++++++++++++++++
libvlc/src/org/videolan/libvlc/Media.java | 62 +++++++++
.../src/org/videolan/libvlc/MediaDiscoverer.java | 68 ++++++++++
libvlc/src/org/videolan/libvlc/MediaList.java | 148 +++++++++++++++++++++
7 files changed, 634 insertions(+)
create mode 100644 libvlc/jni/libvlcjni-media.c
create mode 100644 libvlc/jni/libvlcjni-mediadiscoverer.c
create mode 100644 libvlc/jni/libvlcjni-medialist.c
create mode 100644 libvlc/src/org/videolan/libvlc/Media.java
create mode 100644 libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
create mode 100644 libvlc/src/org/videolan/libvlc/MediaList.java
diff --git a/libvlc/jni/Android.mk b/libvlc/jni/Android.mk
index e2f1166..42d8fd0 100644
--- a/libvlc/jni/Android.mk
+++ b/libvlc/jni/Android.mk
@@ -6,6 +6,7 @@ LOCAL_MODULE := libvlcjni
LOCAL_SRC_FILES := libvlcjni.c libvlcjni-util.c libvlcjni-track.c
LOCAL_SRC_FILES += libvlcjni-equalizer.c
LOCAL_SRC_FILES += libvlcjni-vlcobject.c
+LOCAL_SRC_FILES += libvlcjni-media.c libvlcjni-medialist.c libvlcjni-mediadiscoverer.c
LOCAL_SRC_FILES += aout.c vout.c native_crash_handler.c thumbnailer.c
ifneq ($(ANDROID_API),android-21)
# compat functions not needed after android-21
diff --git a/libvlc/jni/libvlcjni-media.c b/libvlc/jni/libvlcjni-media.c
new file mode 100644
index 0000000..785ca00
--- /dev/null
+++ b/libvlc/jni/libvlcjni-media.c
@@ -0,0 +1,124 @@
+/*****************************************************************************
+ * libvlcjni-media.c
+ *****************************************************************************
+ * Copyright © 2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ *****************************************************************************/
+#include "libvlcjni-vlcobject.h"
+
+static const libvlc_event_type_t m_events[] = {
+ // XXX
+ -1,
+};
+
+static void
+Media_nativeNewCommon(JNIEnv *env, jobject thiz, vlcjni_object *p_obj)
+{
+ if (!p_obj->u.p_m)
+ {
+ VlcJniObject_release(env, thiz, p_obj);
+ throw_exception(env, "can't create Media instance");
+ return;
+ }
+ VlcJniObject_attachEvents(p_obj,
+ libvlc_media_event_manager(p_obj->u.p_m),
+ m_events);
+}
+
+void
+Java_org_videolan_libvlc_Media_nativeNewFromMrl(JNIEnv *env, jobject thiz,
+ jobject libVlc, jstring jmrl)
+{
+ vlcjni_object *p_obj;
+ const char* p_mrl;
+
+ if (!jmrl || !(p_mrl = (*env)->GetStringUTFChars(env, jmrl, 0)))
+ {
+ throw_exception(env, "arguments invalid");
+ return;
+ }
+
+ p_obj = VlcJniObject_newFromJavaLibVlc(env, thiz, libVlc);
+
+ if (!p_obj) {
+ (*env)->ReleaseStringUTFChars(env, jmrl, p_mrl);
+ throw_exception(env, "can't create VlcObject");
+ return;
+ }
+
+ if (p_mrl[0] == '/' || p_mrl[0] == '\\')
+ p_obj->u.p_m = libvlc_media_new_path(p_obj->p_libvlc, p_mrl);
+ else
+ p_obj->u.p_m = libvlc_media_new_location(p_obj->p_libvlc, p_mrl);
+
+ (*env)->ReleaseStringUTFChars(env, jmrl, p_mrl);
+
+ Media_nativeNewCommon(env, thiz, p_obj);
+}
+
+void
+Java_org_videolan_libvlc_Media_nativeNewFromMediaList(JNIEnv *env, jobject thiz,
+ jobject ml, jint index)
+{
+ vlcjni_object *p_ml_obj = VlcJniObject_getInstance(env, ml);
+ vlcjni_object *p_obj;
+
+ if (!p_ml_obj) {
+ throw_exception(env, "can't get MediaList instance");
+ return;
+ }
+
+ p_obj = VlcJniObject_newFromLibVlc(env, thiz, p_ml_obj->p_libvlc);
+ if (!p_obj) {
+ throw_exception(env, "can't create VlcObject");
+ return;
+ }
+
+ p_obj->u.p_m = libvlc_media_list_item_at_index(p_ml_obj->u.p_ml, index);
+
+ Media_nativeNewCommon(env, thiz, p_obj);
+}
+
+void
+Java_org_videolan_libvlc_Media_nativeRelease(JNIEnv *env, jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj)
+ return;
+
+ libvlc_media_release(p_obj->u.p_m);
+
+ VlcJniObject_release(env, thiz, p_obj);
+}
+
+jstring
+Java_org_videolan_libvlc_Media_nativeGetMrl(JNIEnv *env, jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+ const char *psz_mrl;
+
+ if (!p_obj) {
+ throw_exception(env, "can't get Media instance");
+ return NULL;
+ }
+
+ psz_mrl = libvlc_media_get_mrl(p_obj->u.p_m);
+ if (psz_mrl)
+ return (*env)->NewStringUTF(env, psz_mrl);
+
+ return NULL;
+}
diff --git a/libvlc/jni/libvlcjni-mediadiscoverer.c b/libvlc/jni/libvlcjni-mediadiscoverer.c
new file mode 100644
index 0000000..21f536f
--- /dev/null
+++ b/libvlc/jni/libvlcjni-mediadiscoverer.c
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ * libvlcjni-mediadiscoverer.c
+ *****************************************************************************
+ * Copyright © 2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ *****************************************************************************/
+#include "libvlcjni-vlcobject.h"
+
+void
+Java_org_videolan_libvlc_MediaDiscoverer_nativeNew(JNIEnv *env,
+ jobject thiz, jobject libVlc,
+ jstring jname)
+{
+ vlcjni_object *p_obj;
+ const char* p_name;
+
+ if (!jname || !(p_name = (*env)->GetStringUTFChars(env, jname, 0)))
+ {
+ throw_exception(env, "arguments invalid");
+ return;
+ }
+
+ p_obj = VlcJniObject_newFromJavaLibVlc(env, thiz, libVlc);
+
+ if (!p_obj) {
+ (*env)->ReleaseStringUTFChars(env, jname, p_name);
+ throw_exception(env, "can't create VlcObject");
+ return;
+ }
+
+ p_obj->u.p_md = libvlc_media_discoverer_new(p_obj->p_libvlc, p_name);
+
+ (*env)->ReleaseStringUTFChars(env, jname, p_name);
+
+ if (!p_obj->u.p_md)
+ {
+ VlcJniObject_release(env, thiz, p_obj);
+ throw_exception(env, "can't create MediaDiscoverer instance");
+ return;
+ }
+}
+
+void
+Java_org_videolan_libvlc_MediaDiscoverer_nativeRelease(JNIEnv *env,
+ jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj)
+ return;
+
+ libvlc_media_discoverer_release(p_obj->u.p_md);
+
+ VlcJniObject_release(env, thiz, p_obj);
+}
+
+jboolean
+Java_org_videolan_libvlc_MediaDiscoverer_nativeStart(JNIEnv *env, jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj)
+ {
+ throw_exception(env, "can't get MediaDiscoverer instance");
+ return false;
+ }
+
+ return libvlc_media_discoverer_start(p_obj->u.p_md) == 0 ? true : false;
+}
+
+void
+Java_org_videolan_libvlc_MediaDiscoverer_nativeStop(JNIEnv *env, jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj)
+ {
+ throw_exception(env, "can't get MediaDiscoverer instance");
+ return;
+ }
+
+ libvlc_media_discoverer_stop(p_obj->u.p_md);
+}
diff --git a/libvlc/jni/libvlcjni-medialist.c b/libvlc/jni/libvlcjni-medialist.c
new file mode 100644
index 0000000..c098be8
--- /dev/null
+++ b/libvlc/jni/libvlcjni-medialist.c
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ * libvlcjni-medialist.c
+ *****************************************************************************
+ * Copyright © 2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ *****************************************************************************/
+#include "libvlcjni-vlcobject.h"
+
+static const libvlc_event_type_t ml_events[] = {
+ libvlc_MediaListItemAdded,
+ libvlc_MediaListItemDeleted,
+ -1,
+};
+
+static void
+MediaList_nativeNewCommon(JNIEnv *env, jobject thiz, vlcjni_object *p_obj)
+{
+ if (!p_obj->u.p_ml)
+ {
+ VlcJniObject_release(env, thiz, p_obj);
+ throw_exception(env, "can't create MediaList instance");
+ return;
+ }
+ VlcJniObject_attachEvents(p_obj,
+ libvlc_media_list_event_manager(p_obj->u.p_ml),
+ ml_events);
+}
+
+void
+Java_org_videolan_libvlc_MediaList_nativeNewFromLibVlc(JNIEnv *env,
+ jobject thiz,
+ jobject libVlc)
+{
+ vlcjni_object *p_obj = VlcJniObject_newFromJavaLibVlc(env, thiz, libVlc);
+
+ if (!p_obj) {
+ throw_exception(env, "can't create VlcObject");
+ return;
+ }
+
+ p_obj->u.p_ml = libvlc_media_list_new(p_obj->p_libvlc);
+
+ MediaList_nativeNewCommon(env, thiz, p_obj);
+}
+
+void
+Java_org_videolan_libvlc_MediaList_nativeNewFromMediaDiscoverer(JNIEnv *env,
+ jobject thiz,
+ jobject md)
+{
+ vlcjni_object *p_md_obj = VlcJniObject_getInstance(env, md);
+ vlcjni_object *p_obj;
+
+ if (!p_md_obj)
+ {
+ throw_exception(env, "can't get MediaDiscoverer instance");
+ return;
+ }
+
+ p_obj = VlcJniObject_newFromLibVlc(env, thiz, p_md_obj->p_libvlc);
+ if (!p_obj) {
+ throw_exception(env, "can't create VlcObject");
+ return;
+ }
+
+ p_obj->u.p_ml = libvlc_media_discoverer_media_list(p_md_obj->u.p_md);
+
+ MediaList_nativeNewCommon(env, thiz, p_obj);
+}
+
+void
+Java_org_videolan_libvlc_MediaList_nativeRelease(JNIEnv *env, jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj)
+ return;
+
+ libvlc_media_list_release(p_obj->u.p_ml);
+
+ VlcJniObject_release(env, thiz, p_obj);
+}
+
+jint
+Java_org_videolan_libvlc_MediaList_nativeGetCount(JNIEnv *env, jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj) {
+ throw_exception(env, "can't get MediaList instance");
+ return 0;
+ }
+
+ return libvlc_media_list_count(p_obj->u.p_ml);
+}
+
+void
+Java_org_videolan_libvlc_MediaList_nativeParseStart(JNIEnv *env, jobject thiz,
+ jobject media)
+{
+ vlcjni_object *p_m_obj = VlcJniObject_getInstance(env, media);
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj || !p_m_obj) {
+ throw_exception(env, "can't get MediaList or Media instance");
+ return;
+ }
+ libvlc_media_list_set_media(p_obj->u.p_ml, p_m_obj->u.p_m);
+ libvlc_media_list_parse_start(p_obj->u.p_ml);
+}
+
+void
+Java_org_videolan_libvlc_MediaList_nativeParseStop(JNIEnv *env, jobject thiz)
+{
+ vlcjni_object *p_obj = VlcJniObject_getInstance(env, thiz);
+
+ if (!p_obj) {
+ throw_exception(env, "can't get MediaList instance");
+ return;
+ }
+ libvlc_media_list_parse_stop(p_obj->u.p_ml);
+}
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
new file mode 100644
index 0000000..2c7eea8
--- /dev/null
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * LibVLC.java
+ *****************************************************************************
+ * Copyright © 2010-2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.libvlc;
+
+public class Media extends VlcObject {
+ private final static String TAG = "LibVLC/Media";
+
+ private String mMrl = null;
+
+ public Media(LibVLC libVLC, String mrl) throws LibVlcException {
+ nativeNewFromMrl(libVLC, mrl);
+ }
+
+ protected Media(MediaList ml, int index) throws LibVlcException {
+ nativeNewFromMediaList(ml, index);
+ }
+
+ @Override
+ protected void onEvent(int event, long arg1, long arg2) {
+ }
+
+ /**
+ * Get the MRL associated with the Media
+ *
+ * @return
+ * @throws LibVlcException
+ */
+ public String getMrl() throws LibVlcException {
+ if (mMrl == null)
+ mMrl = nativeGetMrl();
+ return mMrl;
+ }
+
+ @Override
+ protected void onRelease() {
+ nativeRelease();
+ }
+
+ /* JNI */
+ private native void nativeNewFromMrl(LibVLC libVLC, String mrl) throws LibVlcException;
+ private native void nativeNewFromMediaList(MediaList ml, int index) throws LibVlcException;
+ private native void nativeRelease();
+ private native String nativeGetMrl() throws LibVlcException;
+}
diff --git a/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java b/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
new file mode 100644
index 0000000..e732ecd
--- /dev/null
+++ b/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * LibVLC.java
+ *****************************************************************************
+ * Copyright © 2010-2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.libvlc;
+
+public class MediaDiscoverer extends VlcObject {
+ private final static String TAG = "LibVLC/MediaDiscoverer";
+ private MediaList mMediaList;
+
+ public MediaDiscoverer(LibVLC libVLC, String name) throws LibVlcException {
+ nativeNew(libVLC, name);
+ }
+
+ public boolean start() throws LibVlcException {
+ return nativeStart();
+ }
+
+ public void stop() throws LibVlcException {
+ nativeStop();
+ }
+
+ @Override
+ protected void onEvent(int event, long arg1, long arg2) {
+ }
+
+ /**
+ * Get the MediaList associated with the MediaDiscoverer.
+ *
+ * @return MediaList, Should NOT be released.
+ * @throws LibVlcException
+ */
+ public synchronized MediaList getMediaList() throws LibVlcException {
+ if (mMediaList == null)
+ mMediaList = new MediaList(this);
+ return mMediaList;
+ }
+
+ @Override
+ protected void onRelease() {
+ if (mMediaList != null)
+ mMediaList.release();
+ nativeRelease();
+ }
+
+ /* JNI */
+ private long mInstance = 0; // Read-only, reserved for JNI
+ private native void nativeNew(LibVLC libVLC, String name) throws LibVlcException;
+ private native void nativeRelease();
+ private native boolean nativeStart() throws LibVlcException;
+ private native void nativeStop() throws LibVlcException;
+}
diff --git a/libvlc/src/org/videolan/libvlc/MediaList.java b/libvlc/src/org/videolan/libvlc/MediaList.java
new file mode 100644
index 0000000..328407f
--- /dev/null
+++ b/libvlc/src/org/videolan/libvlc/MediaList.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * LibVLC.java
+ *****************************************************************************
+ * Copyright © 2010-2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.libvlc;
+
+import android.util.SparseArray;
+
+public class MediaList extends VlcObject {
+ private final static String TAG = "LibVLC/MediaList";
+
+ private int mCount = 0;
+ private Media mParsedMedia = null;
+ private SparseArray<Media> mMediaArray = new SparseArray<Media>();
+
+ private void init() throws LibVlcException {
+ mCount = nativeGetCount();
+ }
+
+ public MediaList(LibVLC libVLC) throws LibVlcException {
+ nativeNewFromLibVlc(libVLC);
+ init();
+ }
+
+ protected MediaList(MediaDiscoverer md) throws LibVlcException {
+ nativeNewFromMediaDiscoverer(md);
+ init();
+ }
+
+ private synchronized void insertMedia(int index) {
+ mCount++;
+
+ for (int i = mCount - 1; i >= index; --i)
+ mMediaArray.put(i + 1, mMediaArray.valueAt(i));
+ mMediaArray.put(index, null);
+ }
+
+ private synchronized void removeMedia(int index) {
+ mCount--;
+ Media media = mMediaArray.get(index);
+ if (media != null)
+ media.release();
+ for (int i = index; i < mCount; ++i) {
+ mMediaArray.put(i, mMediaArray.valueAt(i + 1));
+ }
+ }
+
+ @Override
+ protected void onEvent(int event, long arg1, long arg2) {
+ int index = -1;
+ switch (event) {
+ case MediaListItemAdded:
+ index = (int) arg1;
+ if (index != -1)
+ insertMedia(index);
+ break;
+ case MediaListItemDeleted:
+ index = (int) arg1;
+ if (index != -1)
+ removeMedia(index);
+ break;
+ }
+ }
+
+ /**
+ * Get number of Media
+ *
+ * @return
+ * @throws LibVlcException
+ */
+ public synchronized int getCount() throws LibVlcException {
+ return mCount;
+ }
+
+ /**
+ * Get a Media at specified index
+ *
+ * @param index
+ * @return Media hold by MediaList, Should NOT be released.
+ * @throws LibVlcException
+ */
+ public synchronized Media getMediaAt(int index) throws LibVlcException {
+ if (index < 0 || index > getCount())
+ return null;
+ Media media = mMediaArray.get(index);
+ if (media == null) {
+ media = new Media(this, index);
+ mMediaArray.put(index, media);
+ }
+ return media;
+ }
+
+ @Override
+ public void onRelease() {
+ for (int i = 0; i < mMediaArray.size(); ++i) {
+ final Media media = mMediaArray.get(i);
+ if (media != null)
+ media.release();
+ }
+ if (mParsedMedia != null)
+ mParsedMedia.release();
+ nativeRelease();
+ }
+
+ /**
+ * parse a directory
+ *
+ * clean up with parseStop() or release()
+ * @param media
+ * @throws LibVlcException
+ */
+ public synchronized void parseStart(Media media) throws LibVlcException {
+ if (mParsedMedia != null)
+ mParsedMedia.release();
+ mParsedMedia = media;
+ mParsedMedia.retain();
+ nativeParseStart(mParsedMedia);
+ }
+
+ public synchronized void parseStop() throws LibVlcException {
+ nativeParseStop();
+ }
+
+ /* JNI */
+ private native void nativeNewFromLibVlc(LibVLC libvlc) throws LibVlcException;
+ private native void nativeNewFromMediaDiscoverer(MediaDiscoverer md) throws LibVlcException;
+ private native void nativeRelease();
+ private native int nativeGetCount() throws LibVlcException;
+ private native void nativeParseStart(Media media) throws LibVlcException;
+ private native void nativeParseStop() throws LibVlcException;
+
+}
--
2.1.3
More information about the Android
mailing list