public class

MediaCodecSurfaceEncoder

extends MediaCodecEncoderBase<I, O>
java.lang.Object
   ↳ org.opencdnunion.media.streamer.encoder.Encoder<I, O>
     ↳ org.opencdnunion.media.streamer.encoder.MediaCodecEncoderBase<I, O>
       ↳ org.opencdnunion.media.streamer.encoder.MediaCodecSurfaceEncoder

Class Overview

MediaCodec encoder with surface as input source.

Summary

[Expand]
Inherited Constants
From class org.opencdnunion.media.streamer.encoder.Encoder
[Expand]
Inherited Fields
From class org.opencdnunion.media.streamer.encoder.MediaCodecEncoderBase
From class org.opencdnunion.media.streamer.encoder.Encoder
Public Constructors
MediaCodecSurfaceEncoder(GLRender glRender)
Public Methods
int getEncoderType()
Implement by child class, to define what type of encoder this instance is.
void release()
Protected Methods
void doFormatChanged(Object format)
int doFrameAvailable(ImgTexFrame frame)
void doFrameDropped(ImgTexFrame frame)
int doStart(Object encodeConfig)
void doStop()
ImgPacket getOutFrame(ByteBuffer buffer, MediaCodec.BufferInfo bufferInfo)
boolean onFrameAvailable(ImgTexFrame frame)
Give child class a chance to handle onFrameAvailable
boolean updateEncodeFormat(Object src, Object dst)
Update encode format with input frame format.
void updateOutFormat(MediaFormat mediaFormat)
[Expand]
Inherited Methods
From class org.opencdnunion.media.streamer.encoder.MediaCodecEncoderBase
From class org.opencdnunion.media.streamer.encoder.Encoder
From class java.lang.Object

Public Constructors

public MediaCodecSurfaceEncoder (GLRender glRender)

Public Methods

public int getEncoderType ()

Implement by child class, to define what type of encoder this instance is.

Returns
  • type as AVConst.MEDIA_TYPE_XXX

public void release ()

Protected Methods

protected void doFormatChanged (Object format)

protected int doFrameAvailable (ImgTexFrame frame)

protected void doFrameDropped (ImgTexFrame frame)

protected int doStart (Object encodeConfig)

protected void doStop ()

protected ImgPacket getOutFrame (ByteBuffer buffer, MediaCodec.BufferInfo bufferInfo)

protected boolean onFrameAvailable (ImgTexFrame frame)

Give child class a chance to handle onFrameAvailable

Parameters
frame frame
Returns
  • true if handled by child, and Encoder would ignore this frame, false otherwise.

protected boolean updateEncodeFormat (Object src, Object dst)

Update encode format with input frame format.

Parameters
src input frame format
dst encode format to be updated
Returns
  • true if success, false otherwise

protected void updateOutFormat (MediaFormat mediaFormat)