Surfaces are the "producer" side of the consumer-producer side. Generally speaking, the API is centered around consumers who create both ends and then pass the producer interface (surface) back.
So, for a SurfaceView or MediaCodec encoder, you create an object and get its Surface. Then you send graphic data buffers to them with Canvas, OpenGL ES or MediaCodec decoder.
Encoder SurfaceView Surface - . SurfaceView (SurfaceFlinger), , " ". MediaCodec , .
MediaCodec SurfaceView , MediaCodec. , . , .
, Surface (BufferQueue), ( Lollipop) , API Lollipop, . , , - .
SurfaceTexture (a/k/a GLConsumer), . Surface, . MediaCodec. , , GLES SurfaceTexture. SurfaceView .
Grafika doc.