title: Camera preview image data processing with Android L and Camera2 API
body: <p>I'm working on an android app that is processing the input image from the camera and displays it to the user. This is fairly simple, I register a <code>PreviewCallback</code> on the camera object with the <code>setPreviewCallbackWithBuffer</code>.
  This is easy and works smoothly with the old camera API</p>
  
  <pre><code>public void onPreviewFrame(byte[] data, Camera cam) {
      // custom image data processing
  }
  </code></pre>
  
  <p>I'm trying to port my app to take advantage of the new Camera2 API and I'm not sure how exactly shall I do that. I followed the Camera2Video in L Preview samples that allows to record a video. However, there is no direct image data transfer in the sample, so I don't understand where exactly shall I get the image pixel data and how to process it.</p>
  
  <p>Could anybody help me or suggest the way how one can get the the functionality of <code>PreviewCallback</code> in android L, or how it's possible to process preview data from the camera before displaying it to the screen? (there is no preview callback on the camera object)</p>
  
  <p>Thank you!</p>