Page 1 of 1

android-vlc on android 2.1 nativeInit();

Posted: 29 May 2012 10:42
by kick_2012
hello everyone.
i run the project on android 2.1,libvlcjni.so is loaded,but when it comes to nativeInit();,the project crashed.
what should i do ,can anybody help me here?
thanks.

Re: android-vlc on android 2.1 nativeInit();

Posted: 29 May 2012 10:52
by Jean-Baptiste Kempf
You should debug it.

Seriously, how can you expect people to answer to such vague questions?

Re: android-vlc on android 2.1 nativeInit();

Posted: 29 May 2012 15:36
by kick_2012
You should debug it.

Seriously, how can you expect people to answer to such vague questions?

i debuged it ,when the project run,it get an Instance of LibVLC in public ThumbnailerManager(VideoListActivity videoListActivity);
mLibVlc = LibVLC.getInstance();
here is getInstance() in LibVLC.java
public static LibVLC getInstance() throws LibVlcException {
if (sInstance == null) {
sInstance = new LibVLC();
sInstance.init();
}
return sInstance;
}
here is init() in LibVLC.java
/**
* Initialize the libVLC class
*/
private void init() throws LibVlcException {
Log.v(TAG, "Initializing LibVLC");
if (!mIsInitialized) {
nativeInit();
setEventManager(EventManager.getIntance());
mIsInitialized = true;
}
}
nativeInit() is native code in /jni/libvlcjni.c
void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
{
//only use OpenSLES if java side says we can
jclass cls = (*env)->GetObjectClass(env, thiz);
jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
bool use_opensles = (*env)->CallIntMethod(env, thiz, methodId) == AOUT_OPENSLES;
libvlc_log_subscribe(&debug_subscriber, debug_log, NULL);
/* Don't add any invalid options, otherwise it causes LibVLC to crash */
const char *argv[] = {
"-I", "dummy",
"-vv",
"--no-osd",
"--no-video-title-show",
"--no-stats",
"--no-plugins-cache",
"--no-drop-late-frames",
"--avcodec-fast",
use_opensles ? "--aout=opensles" : "--aout=android_audiotrack"
};
libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);///////// when the propram comes to here it crashed.
jclass clazz = (*env)->GetObjectClass(env, thiz);
jfieldID field = (*env)->GetFieldID(env, clazz, "mLibVlcInstance", "I");
(*env)->SetIntField(env, thiz, field, (jint) instance);
if (!instance)
{
jclass exc = (*env)->FindClass(env, "org/videolan/vlc/LibVlcException");
(*env)->ThrowNew(env, exc, "Unable to instantiate LibVLC");
}
LOGI("LibVLC initialized: %p", instance);
}
the os of my device is android 2.1

how should i fix this problem
many thanks.

Re: android-vlc on android 2.1 nativeInit();

Posted: 25 Jun 2012 04:33
by edwardw
Fixed in latest git master. Use export ANDROID_ABI=armeabi and export NO_FPU=1