-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It may be bug in avformat.avio_open2 JNI wrapper #97
Comments
Seems it is not a bug, but @ByPtrPtr requires workaround. |
The JNI code is generated at build time, when executing JNIEXPORT jint JNICALL Java_org_bytedeco_javacpp_avformat_avio_1open2__Lorg_bytedeco_javacpp_avformat_00024AVIOContext_2Ljava_lang_String_2ILorg_bytedeco_javacpp_avformat_00024AVIOInterruptCB_2Lorg_bytedeco_javacpp_avutil_00024AVDictionary_2(JNIEnv* env, jclass cls, jobject arg0, jstring arg1, jint arg2, jobject arg3, jobject arg4) {
::AVIOContext* ptr0 = arg0 == NULL ? NULL : (::AVIOContext*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID));
jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID);
ptr0 += position0;
const char* ptr1 = arg1 == NULL ? NULL : env->GetStringUTFChars(arg1, NULL);
::AVIOInterruptCB* ptr3 = arg3 == NULL ? NULL : (::AVIOInterruptCB*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID));
jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID);
ptr3 += position3;
::AVDictionary* ptr4 = arg4 == NULL ? NULL : (::AVDictionary*)jlong_to_ptr(env->GetLongField(arg4, JavaCPP_addressFID));
jint rarg = 0;
jthrowable exc = NULL;
try {
int rvalue = avio_open2((arg0 == NULL ? NULL : &ptr0), ptr1, arg2, (const ::AVIOInterruptCB*)ptr3, (arg4 == NULL ? NULL : &ptr4));
rarg = (jint)rvalue;
} catch (...) {
exc = JavaCPP_handleException(env, 17);
}
ptr0 -= position0;
if (arg0 != NULL) env->SetLongField(arg0, JavaCPP_addressFID, ptr_to_jlong(ptr0));
if (arg1 != NULL) env->ReleaseStringUTFChars(arg1, ptr1);
if (arg4 != NULL) env->SetLongField(arg4, JavaCPP_addressFID, ptr_to_jlong(ptr4));
if (exc != NULL) {
env->Throw(exc);
}
return rarg;
} So, as you can see, when |
Let's see, I think you are asking about the first parameter? Yes, I see how this can be problematic... As you found out, and as stated in the AVIOContext ioctx = new AVIOContext(null);
avformat.avio_open2(ioctx, ...);
fmtctx.pb(ioctx); Unfortunately, I don't know of a nicer way to make this work, but if you have any ideas, please do share them! Thanks for reporting |
Hello,
I can not find from which source the FFMPEG JNI came to your project, but it seems bug in
public static native int avio_open2(@ByPtrPtr avformat.AVIOContext var0, String var1, int var2, @const avformat.AVIOInterruptCB var3, @ByPtrPtr AVDictionary var4);
when call as
avformat.avio_open2(lDstContext.pb(), destination, avformat.AVIO_FLAG_WRITE, null, null);
APK crashes inside avio_open2/sub_... because storing value to null.
If you point me where you get JNI wrappers, I will check and send fix there.
Regards.
The text was updated successfully, but these errors were encountered: