public abstract class

VideoBufEncoderBase

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

Class Overview

Base class of video encoder with ImgBufFrame as input.

Summary

Constants
int VIDEO_CACHE_ITEM_SIZE
int VIDEO_CACHE_NUM
[Expand]
Inherited Constants
From class org.opencdnunion.media.streamer.encoder.Encoder
Fields
protected boolean mFirstFrame
protected FrameBufferCache mFrameBufferCache
protected VideoEncodeConfig mOutConfig
protected VideoEncodeConfig mVideoEncodeConfig
[Expand]
Inherited Fields
From class org.opencdnunion.media.streamer.encoder.Encoder
Public Constructors
VideoBufEncoderBase()
Public Methods
int getEncoderType()
Implement by child class, to define what type of encoder this instance is.
Protected Methods
abstract int doEncode(ImgBufFrame frame)
Encode an video frame.
void doFormatChanged(Object format)
int doFrameAvailable(ImgBufFrame frame)
void doFrameDropped(ImgBufFrame frame)
int doStart(Object encodeConfig)
abstract int doStart(VideoEncodeConfig config)
Start video encoder in encoding thread.
boolean onFrameAvailable(ImgBufFrame frame)
Give child class a chance to handle onFrameAvailable
void sendEncodedPacket(ByteBuffer data, long dts, long pts, int flags)
boolean updateEncodeFormat(Object src, Object dst)
Update encode format with input frame format.
[Expand]
Inherited Methods
From class org.opencdnunion.media.streamer.encoder.Encoder
From class java.lang.Object

Constants

protected static final int VIDEO_CACHE_ITEM_SIZE

Constant Value: 2097152 (0x00200000)

protected static final int VIDEO_CACHE_NUM

Constant Value: 1 (0x00000001)

Fields

protected boolean mFirstFrame

protected FrameBufferCache mFrameBufferCache

protected VideoEncodeConfig mOutConfig

protected VideoEncodeConfig mVideoEncodeConfig

Public Constructors

public VideoBufEncoderBase ()

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

Protected Methods

protected abstract int doEncode (ImgBufFrame frame)

Encode an video frame.

Parameters
frame video frame to be encoded.
Returns
  • 0 on success, or error code.

protected void doFormatChanged (Object format)

protected int doFrameAvailable (ImgBufFrame frame)

protected void doFrameDropped (ImgBufFrame frame)

protected int doStart (Object encodeConfig)

protected abstract int doStart (VideoEncodeConfig config)

Start video encoder in encoding thread.

Parameters
config video encode configuration.
Returns
  • 0 on success, or error code.

protected boolean onFrameAvailable (ImgBufFrame 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 void sendEncodedPacket (ByteBuffer data, long dts, long pts, int flags)

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