[英]Recording video using ffmpeg in android
i was studying ffmpeg for android library,was unable to understand a part of the code.我正在研究 ffmpeg for android library,无法理解部分代码。
public void onPreviewFrame(byte[] data, Camera camera)
{
if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING)
{
startTime = System.currentTimeMillis();
return;
}
if (RECORD_LENGTH > 0) {
int i = imagesIndex++ % images.length;
yuvImage = images[i];
timestamps[i] = 1000 * (System.currentTimeMillis() - startTime);
}
//till here i was able to understand but the first statement is for what purpose?
/* get video data */
if (yuvImage != null && recording) {
((ByteBuffer)yuvImage.image[0].position(0)).put(data);
}
}
onPreviewFrame is a overridden method if you provide cameraCallbacks as in如果您提供 cameraCallbacks,则 onPreviewFrame 是一个被覆盖的方法
mCamera.setPreviewCallbackWithBuffer(new PreviewCallback() {
public void onPreviewFrame(byte[] imageData, Camera arg1) {
<<<Your logic here>>>
}
}
Please refer this link http://www.programcreek.com/java-api-examples/index.php?api=android.hardware.Camera.PreviewCallback请参考此链接http://www.programcreek.com/java-api-examples/index.php?api=android.hardware.Camera.PreviewCallback
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.