title: Android encoding using MediaCodec and a Surface
body: <p>I've been rendering video through the MediaCodec directly to a Surface that was taken from a SurfaceView in my UI.  This works great.</p>
  
  <p>I am now attempting to use MediaCodec as an encoder.  As a test, I want to render to the Surface (as in above) and loopback through a different instance of MediaCodec configured as an encoder.  </p>
  
  <p>I see the createInputSurface() method of the encoder.  I think I want the encoder to create this surface and then have the decoder MediaCodec use this as the surface to draw to.  First off, is this possible?</p>
  
  <p>Secondly, I'm not sure how to create a SurfaceView from the Surface that the encoder creates.  I've only extracted a Surface from a SurfaceView and I don't see, from the docs, how to do this in reverse.</p>