21 #include <sys/types.h>
25 #include "libavcodec/jni.h"
26 #include "libavutil/bprint.h"
44 jstring *tempArray = NULL;
45 int argumentCount = 1;
48 if (stringArray != NULL) {
49 int programArgumentCount = (*env)->GetArrayLength(env, stringArray);
50 argumentCount = programArgumentCount + 1;
52 tempArray = (jstring *) av_malloc(
sizeof(jstring) * programArgumentCount);
59 argv = (
char **)av_malloc(
sizeof(
char*) * (argumentCount));
60 argv[0] = (
char *)av_malloc(
sizeof(
char) * (strlen(
LIB_NAME) + 1));
64 if (stringArray != NULL) {
65 for (
int i = 0; i < (argumentCount - 1); i++) {
66 tempArray[i] = (jstring) (*env)->GetObjectArrayElement(env, stringArray, i);
67 if (tempArray[i] != NULL) {
68 argv[i + 1] = (
char *) (*env)->GetStringUTFChars(env, tempArray[i], 0);
80 if (tempArray != NULL) {
81 for (
int i = 0; i < (argumentCount - 1); i++) {
82 (*env)->ReleaseStringUTFChars(env, tempArray[i], argv[i + 1]);