发布网友 发布时间:2022-05-06 09:18
共1个回答
热心网友 时间:2022-06-29 05:56
public void onPreviewFrame(byte[] data, Camera camera) { tick = 1; //到1帧的时候,将此帧的画面形成,然后发送出去 while(tick == ) { System.out.println("data len: " + data.length); try {// File file = new File("/sdcard/pal+"+UUID.randomUUID()+".3gp"); File file = new File("/sdcard/test/pal.jpg"); if (!file.exists()) file.createNewFile(); RandomAccessFile raf = new RandomAccessFile(file, "rw"); byte[] rgbBuf = new byte[width*height*6]; ConvertTools.decodeYUV420SP(rgbBuf, data, width, height); raf.write(rgbBuf); } catch (Exception ex) { Log.v("System.out", ex.toString()); }// } tick++; }