android - geting no result from GetStringUTFChars JNI -
android ndk android application. stuck on starting lines , not compiling further. following code. doest not compile after "str = (*env)->getstringutfchars(env, filename, null);". please check java , c code
the java code:
public class myffmpegactivity extends activity { private static native int logfileinfo(string filename); static { log.i("heha", "hoha"); system.loadlibrary("mylib"); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_myffmpeg); string path=environment.getexternalstoragedirectory().getpath(); path=path+"/test.mp4"; log.i("name returned ", ":"+path); int x=logfileinfo(path); }
the c code
jint java_com_example_myffmpegtest_myffmpegactivity_logfileinfo(jnienv * env, jobject this, jstring filename) { av_register_all(); avformatcontext *pformatctx; const jbyte *str; str = (*env)->getstringutfchars(env, filename, null); if(av_open_input_file(&pformatctx, str, null, 0, null)!=0) { loge("can't open file '%s'\n", str); return 1; } else { logi("file opened\n"); logi("file '%s', codec %s", pformatctx->filename, pformatctx->iformat->name ); } return 0;}
here correct syntax:
const char *str; str = (*env)->getstringutfchars(env, filename, null);
also, looks trying develop created solution for. check out ffmpegmediametadataretriever.
Comments
Post a Comment