Created
May 2, 2020 21:16
-
-
Save keivanh/2d4309f5fa88dc520264c21cd10bbb43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class foo{ | |
private DJICodecManager.YuvDataCallback frameListener; | |
private DJICodecManager codecManager = null; | |
private void createCodecManager(){ | |
frameListener = new DJICodecManager.YuvDataCallback() { | |
@Override | |
public void onYuvDataReceived(MediaFormat mediaFormat, ByteBuffer byteBuffer, int i, int i1, int i2) { | |
// You have your frame byteBuffer here (it is indirect buffer) | |
// To get bitmap you have to decode YUV frame | |
} | |
} | |
// mContext is activity or application context, you should pass it here somehow (I use the constructor) | |
// Ignore DJIYVUWidth and DJIYVUHeight, whatever you pass SDK ignores it! | |
codecManager = new DJICodecManager(mContext, null, DJIYVUWidth, DJIYVUHeight, UsbAccessoryService.VideoStreamSource.Camera); | |
codecManager.enabledYuvData(true); | |
codecManager.setYuvDataCallback(frameListener); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment