Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
improve getNativeLastCommandOutput checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Oct 28, 2019
1 parent f7957bf commit 9bf06a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 10 additions & 8 deletions android/app/src/main/cpp/mobileffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,14 +848,16 @@ JNIEXPORT int JNICALL Java_com_arthenica_mobileffmpeg_Config_setNativeEnvironmen
* @return output of the last executed command
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeLastCommandOutput(JNIEnv *env, jclass object) {
int size = strlen(lastCommandOutput);
if (lastCommandOutput != NULL) {
int size = strlen(lastCommandOutput);

if (size > 0) {
jbyteArray byteArray = (*env)->NewByteArray(env, size);
(*env)->SetByteArrayRegion(env, byteArray, 0, size, lastCommandOutput);
jstring charsetName = (*env)->NewStringUTF(env, "UTF-8");
return (jstring) (*env)->NewObject(env, stringClass, stringConstructor, byteArray, charsetName);
} else {
return (*env)->NewStringUTF(env, "");
if (size > 0) {
jbyteArray byteArray = (*env)->NewByteArray(env, size);
(*env)->SetByteArrayRegion(env, byteArray, 0, size, lastCommandOutput);
jstring charsetName = (*env)->NewStringUTF(env, "UTF-8");
return (jstring) (*env)->NewObject(env, stringClass, stringConstructor, byteArray, charsetName);
}
}

return (*env)->NewStringUTF(env, "");
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public void onClick(View v) {
outputText = getView().findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
}

android.util.Log.d(MainActivity.TAG, "Last command output was: " + FFmpeg.getLastCommandOutput());
}

@Override
Expand Down

0 comments on commit 9bf06a9

Please sign in to comment.