-
Notifications
You must be signed in to change notification settings - Fork 246
rawVideoData
xinbaicheng edited this page May 31, 2016
·
10 revisions
//[important]make sure it is called before "prepareAsync"
ksyMediaPlayer.setOption(KSYMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", KSYMediaPlayer.SDL_FCC_RV32);
ByteBuffer rawBuffer[] = new ByteBuffer[5]; //5 buffers is just an example
for(int index=0; index<rawBuffer.length; index++)
{
rawBuffer[index] = ByteBuffer.allocate(1280*720*4); //make sure it is big enougth, not smaller than the maximum video resolution
ksyMediaPlayer.addVideoRawBuffer(rawBuffer[index].array());
}
ksyMediaPlayer.setVideoRawDataListener(new KSYMediaPlayer.OnVideoRawDataListener() {
@Override
public void onVideoRawDataAvailable(IMediaPlayer mp, byte[] buf, int size, int width, int height, int format) {
//todo: handle rgb raw data.
//You can handle it in another thread, but never forget calling addVideoRawBuffer after it is done
//....
ksyMediaPlayer.addVideoRawBuffer(buf); //MUST call it after the buf is handled
}
}