I am trying to open a file descriptor from a URI CATEGORY_OPENABLE
from the repository access frame. I first try with the file on the SD card, which I can already solve using the file path using the column _data
and open (I try to get away from this and use the file descriptor instead).
I get my own int fd as follows:
int fd = getContentResolver().openFileDescriptor(data.getData(), "r").detachFd();
Then in C ++ I try to open it like this, an idea taken from How to properly transfer a FileDescriptor file to FFmpeg using JNI in Android :
pFormatCtx = avformat_alloc_context();
pFormatCtx->iformat = av_find_input_format("mp3");
char path[50];
sprintf(path, "pipe:%d", fd);
int e;
if(e=(avformat_open_input(&pFormatCtx,path,NULL,NULL)!=0)){
av_strerror(e, path, 50);
return error;
}
" " avformat_open_input
. , jni- jniGetFDFromFileDescriptor
, FileDescriptor
, int fd. URI FFMPEG , ?