Skip to content
Snippets Groups Projects
Commit 315b8cf5 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Merge setup and init methods for Medialibrary

parent 96ac3134
No related branches found
No related tags found
No related merge requests found
......@@ -22,18 +22,13 @@ AndroidMediaLibrary *MediaLibrary_getInstance(JNIEnv *env, jobject thiz);
static void
MediaLibrary_setInstance(JNIEnv *env, jobject thiz, AndroidMediaLibrary *p_obj);
void
setup(JNIEnv* env, jobject thiz) {
AndroidMediaLibrary *aml = new AndroidMediaLibrary(myVm, &ml_fields, thiz);
MediaLibrary_setInstance(env, thiz, aml);
}
jboolean
init(JNIEnv* env, jobject thiz, jstring dbPath, jstring thumbsPath)
{
AndroidMediaLibrary *aml = new AndroidMediaLibrary(myVm, &ml_fields, thiz);
MediaLibrary_setInstance(env, thiz, aml);
const char *db_utfchars = env->GetStringUTFChars(dbPath, JNI_FALSE);
const char *thumbs_utfchars = env->GetStringUTFChars(thumbsPath, JNI_FALSE);
AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
m_IsInitialized = aml->initML(db_utfchars, thumbs_utfchars);
env->ReleaseStringUTFChars(dbPath, db_utfchars);
env->ReleaseStringUTFChars(thumbsPath, thumbs_utfchars);
......@@ -741,7 +736,6 @@ playlistDelete(JNIEnv* env, jobject thiz, jobject medialibrary, jlong playlistId
* JNI stuff
*/
static JNINativeMethod methods[] = {
{"nativeSetup", "()V", (void*)setup },
{"nativeInit", "(Ljava/lang/String;Ljava/lang/String;)Z", (void*)init },
{"nativeStart", "()V", (void*)start },
{"nativeRelease", "()V", (void*)release },
......
......@@ -72,10 +72,6 @@ public class Medialibrary {
System.loadLibrary("mla");
}
public void setup() {
nativeSetup();
}
public boolean init(Context context) {
mIsInitiated = nativeInit(context.getCacheDir()+ VLC_MEDIA_DB_NAME, context.getExternalFilesDir(null).getAbsolutePath()+ THUMBS_FOLDER_NAME);
return mIsInitiated;
......@@ -552,7 +548,6 @@ public class Medialibrary {
// Native methods
private native void nativeSetup();
private native boolean nativeInit(String dbPath, String thumbsPath);
private native void nativeStart();
private native void nativeRelease();
......
......@@ -199,7 +199,6 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
@Override
public void run() {
boolean shouldInit = !(new File(MediaParsingService.this.getCacheDir()+Medialibrary.VLC_MEDIA_DB_NAME).exists());
mMedialibrary.setup();
if (mMedialibrary.init(VLCApplication.getAppContext())) {
List<String> devices = new ArrayList<>();
devices.add(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment