2017-01-11 5 views
0

私はアンドロイドライブラリのffmpegを勉強していましたが、コードの一部を理解できませんでした。あなたはandroidでffmpegを使ってビデオを録画する

mCamera.setPreviewCallbackWithBuffer(new PreviewCallback() { 
    public void onPreviewFrame(byte[] imageData, Camera arg1) { 
     <<<Your logic here>>> 
    } 
    } 

のようにcameraCallbacksを提供する場合

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); 
    } 
} 

答えて

関連する問題