I’m trying to make a Video Player using ffmpeg and I use this tutorial http://dranger.com/ffmpeg/tutorial08.html, what I understand this tutorial convert a video to a video Image YUV, I’m trying to make the file that interact from .c to .java, I have this
code c from the tutorial08(http://dranger.com/ffmpeg/tutorial08.c), then I made
public class RtspReceiver extends Activity {
public SurfaceView sfv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.principal);
sfv=(SurfaceView) findViewById(R.id.im);
}
/* load our native library */
static {
System.loadLibrary("Interface");
}
private static native void Receive(SurfaceView sf);
}
In the c I’m trying to understand how I can use this
JNIEXPORT void JNICALL isec_projecto_rtspreceiver_RtspReceiver_Receive(JNIEnv * env, jobject obj, jobject Surface)
{
//what I have to put in here?
}
How can I put the SurfaceView that I have in the java, in the c???
and other thing, in the tutorial08.c how can I extract the video and put them in the java? am I thinking correctly?
This tutorial hasn’t been written with Android or Java in mind.
One thing you can do is to do all the
FFMPEGstuff in your C code, putting your decoded images in a queue. From JavaSurfaceView, from a separate thread, you will then be passing a bitmap to the native code. In the native code you will be filling the pixels of that bitmap from your decoded images usingAndroidBitmap_lockPixelsand other such stuff.There is a
'bitmap-plasma'sample in the NDK. Although it is not related toFFMPEGit shows how you can operate on aBitmapfrom the native code.