diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index dbd072a..143065b 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -18,21 +18,22 @@ add_library( # Sets the name of the library. # Provides a relative path to your source file(s). - src/main/cpp/ffmpeg/cmdutils.c - src/main/cpp/ffmpeg/ffmpeg.c - src/main/cpp/ffmpeg/ffmpeg_filter.c - src/main/cpp/ffmpeg/ffmpeg_opt.c - src/main/cpp/ffmpeg_cmd.c - src/main/cpp/ffmpeg/ffprobe.c - src/main/cpp/audio_player.c - src/main/cpp/openSL_audio_player.c - src/main/cpp/video_player.c - src/main/cpp/ffmpeg_pusher.cpp - src/main/cpp/AVpacket_queue.c - src/main/cpp/media_player.c - src/main/cpp/video_filter.c - src/main/cpp/audio_lame.c - src/main/cpp/fast_start.c + src/main/cpp/ffmpeg/cmdutils.c + src/main/cpp/ffmpeg/ffmpeg.c + src/main/cpp/ffmpeg/ffmpeg_filter.c + src/main/cpp/ffmpeg/ffmpeg_opt.c + src/main/cpp/ffmpeg_cmd.c + src/main/cpp/ffmpeg/ffprobe.c + src/main/cpp/audio_player.c + src/main/cpp/openSL_audio_player.c + src/main/cpp/video_player.c + src/main/cpp/ffmpeg_pusher.cpp + src/main/cpp/AVpacket_queue.c + src/main/cpp/media_player.c + src/main/cpp/video_filter.c + src/main/cpp/audio_lame.c + src/main/cpp/fast_start.c + src/main/cpp/ffprobe_cmd.c ) add_library( ffmpeg diff --git a/app/src/main/cpp/ffprobe_cmd.c b/app/src/main/cpp/ffprobe_cmd.c new file mode 100644 index 0000000..b702339 --- /dev/null +++ b/app/src/main/cpp/ffprobe_cmd.c @@ -0,0 +1,33 @@ +// +// Created by frank on 2020-01-06. +// + +#include +#include +#include +#include +#include + +FFMPEG_FUNC(jstring , handleProbe, jobjectArray commands) { + int argc = (*env)->GetArrayLength(env, commands); + char **argv = (char**)malloc(argc * sizeof(char*)); + int i; + for (i = 0; i < argc; i++) { + jstring jstr = (jstring) (*env)->GetObjectArrayElement(env, commands, i); + char* temp = (char*) (*env)->GetStringUTFChars(env, jstr, 0); + argv[i] = malloc(1024); + strcpy(argv[i], temp); + (*env)->ReleaseStringUTFChars(env, jstr, temp); + } + //execute ffprobe command + char* result = ffprobe_run(argc, argv); + //release memory + for (i = 0; i < argc; i++) { + free(argv[i]); + } + free(argv); + + return (*env)->NewStringUTF(env, result); +} + +