/** * if it returns bigger than 0 it is successfull */ JNIEXPORT jint JNICALL Java_net_butterflytv_rtmp_1client_RTMPMuxer_open(JNIEnv *env, jobject instance, jstring url_) { const char *url = (*env)->GetStringUTFChars(env, url_, 0); int result = rtmp_open_for_write(url); (*env)->ReleaseStringUTFChars(env, url_, url); return result; }
/** * if it returns bigger than 0 it is successfull */ JNIEXPORT jint JNICALL Java_net_butterflytv_rtmp_1client_RTMPMuxer_open(JNIEnv *env, jobject thiz, jstring url_) { jfieldID fid = (*env)->GetFieldID(env, (*env)->GetObjectClass(env, thiz), "rtmp", "J"); jlong raw_rtmp = (*env)->GetLongField(env, thiz, fid); RTMP *rtmp = (RTMP*)(*(void**)&raw_rtmp); if(rtmp != NULL) { return -50; } const char *url = (*env)->GetStringUTFChars(env, url_, 0); int result = rtmp_open_for_write(url, &rtmp); (*env)->ReleaseStringUTFChars(env, url_, url); raw_rtmp = (jlong)rtmp; (*env)->SetLongField(env, thiz, fid, raw_rtmp); return result; }