public class VideoEncoderCore
extends java.lang.Object
Once created, frames are fed to the input surface. Remember to provide the presentation time stamp, and always call drainEncoder() before swapBuffers() to ensure that the producer side doesn't get backed up.
This class is not thread-safe, with one exception: it is valid to use the input surface on one thread, and drain the output on a different thread.
Constructor and Description |
---|
VideoEncoderCore(int width,
int height,
int bitRate,
int frameRate)
Configures encoder and muxer state, and prepares the input Surface.
|
VideoEncoderCore(int width,
int height,
int bitRate,
int frameRate,
IMediaMuxer writerHandler) |
Modifier and Type | Method and Description |
---|---|
void |
drainEncoder(boolean endOfStream)
Extracts all pending data from the encoder and forwards it to the muxer.
|
android.view.Surface |
getInputSurface()
Returns the encoder's input surface.
|
void |
release()
Releases encoder resources.
|
void |
stopMuxer() |
public VideoEncoderCore(int width, int height, int bitRate, int frameRate) throws java.io.IOException
java.io.IOException
public VideoEncoderCore(int width, int height, int bitRate, int frameRate, IMediaMuxer writerHandler) throws java.io.IOException
java.io.IOException
public android.view.Surface getInputSurface()
public void release()
public void drainEncoder(boolean endOfStream)
If endOfStream is not set, this returns when there is no more data to drain. If it is set, we send EOS to the encoder, and then iterate until we see EOS on the output. Calling this with endOfStream set should be done once, swipe_right before stopping the muxer.
We're just using the muxer to get a .mp4 file (instead of a raw H.264 stream). We're not recording audio.
public void stopMuxer()