I have all required .so libraries and header files to play a video. I want to play video from the Raw folder. I am struck at CPP code. Unable to pass a video file path to CPP code. The following is my native-lib.cpp code
const char *file = env->GetStringUTFChars(path, 0);
if (file == NULL) {
printf("The file is a null object.");
}
av_register_all();
int ret = 0;
char errbuf[256];
AVFormatContext *fmt_ctx = avformat_alloc_context();
int ret12 = avformat_open_input(&fmt_ctx, file, NULL, NULL);
if (ret12 < 0) {
av_strerror(ret, errbuf, sizeof(errbuf));
__android_log_print(ANDROID_LOG_ERROR, "ffmpeg", "%s", errbuf);
__android_log_print(ANDROID_LOG_ERROR, "ffmpeg", "%i", ret12);
return;
}
The above ret12 returning -ve value and it is returning the control out