public abstract class AbstractEncoder extends java.lang.Object implements Encoder, java.lang.Runnable
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
MIME_TYPE
MIME
|
protected boolean |
mIsCapturing
エンコード実行中フラグ
|
protected boolean |
mIsEOS
終了フラグ
|
protected android.media.MediaCodec |
mMediaCodec
エンコーダーの本体MediaCodecインスタンス
|
protected boolean |
mRecorderStarted
ファイルへの出力中フラグ
|
protected boolean |
mRequestStop
終了要求フラグ(新規エンコード禁止フラグ)
|
protected java.lang.Object |
mSync
フラグの排他制御用
|
protected int |
mTrackIndex
トラックインデックス
|
protected static byte[] |
START_MARK
codec specific dataの先頭マーカー
|
static int |
TIMEOUT_USEC |
| Constructor and Description |
|---|
AbstractEncoder(java.lang.String mime_type,
IRecorder recorder,
EncoderListener listener) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
byteComp(byte[] array,
int offset,
byte[] search,
int len)
byte[]を検索して一致する先頭インデックスを返す
|
protected void |
callOnError(java.lang.Exception e)
エラー発生時に呼び出す
|
protected void |
callOnStartEncode(android.view.Surface source,
int captureFormat,
boolean mayFail)
prepareの最後に呼び出すこと
|
static boolean |
checkProfileLevel(java.lang.String mimeType,
android.media.MediaCodecInfo info)
プロファイル・レベルが低ければtrueを返す
|
protected abstract android.media.MediaFormat |
createOutputFormat(byte[] csd,
int size,
int ix0,
int ix1) |
static void |
dumpProfileLevel(java.lang.String mimeType,
android.media.MediaCodecInfo info) |
void |
encode(java.nio.ByteBuffer buffer) |
void |
encode(java.nio.ByteBuffer buffer,
int length,
long presentationTimeUs)
バイト配列をエンコードする場合
|
protected void |
finalize() |
void |
frameAvailableSoon()
フレームデータの読込み準備要求
native側からも呼び出されるので名前を変えちゃダメ
|
static android.media.MediaCodecInfo.CodecCapabilities |
getCodecCapabilities(android.media.MediaCodecInfo codecInfo,
java.lang.String mimeType) |
static int |
getCodecCount() |
static android.media.MediaCodecInfo |
getCodecInfoAt(int ix) |
static java.util.List<android.media.MediaCodecInfo> |
getCodecs() |
protected long |
getInputPTSUs()
今回の書き込み用のpresentationTimeUs値を取得
System.nanoTime()を1000で割ってマイクロ秒にしただけ(切り捨て)
|
protected long |
getNextOutputPTSUs(long presentationTimeUs)
Muxerの今回の書き込み用のpresentationTimeUs値を取得
|
java.lang.String |
getOutputPath()
出力ファイルのパスを返す
|
static java.lang.String |
getProfileLevelString(java.lang.String mimeType,
android.media.MediaCodecInfo.CodecProfileLevel profileLevel) |
IRecorder |
getRecorder()
出力用のMuxerWrapperを返す
|
boolean |
isCapturing() |
void |
release()
子クラスでOverrideした時でもEncoder#releaseを呼び出すこと
|
void |
run() |
void |
signalEndOfInputStream()
ストリーミング終了指示を送る
|
void |
start()
エンコード開始要求(Recorderから呼び出される)
|
boolean |
startRecorder(IRecorder recorder,
android.media.MediaFormat outFormat)
コーデックからの出力フォーマットを取得してnative側へ引き渡してRecorderをスタートさせる
|
void |
stop()
エンコーダ終了要求(Recorderから呼び出される)
|
void |
stopRecorder(IRecorder recorder) |
public static final int TIMEOUT_USEC
protected volatile boolean mIsCapturing
protected boolean mRequestStop
protected volatile boolean mRecorderStarted
protected boolean mIsEOS
protected int mTrackIndex
protected android.media.MediaCodec mMediaCodec
protected final java.lang.Object mSync
protected final java.lang.String MIME_TYPE
protected static final byte[] START_MARK
public AbstractEncoder(java.lang.String mime_type,
IRecorder recorder,
EncoderListener listener)
public static final int getCodecCount()
public static final java.util.List<android.media.MediaCodecInfo> getCodecs()
public static final android.media.MediaCodecInfo getCodecInfoAt(int ix)
public static android.media.MediaCodecInfo.CodecCapabilities getCodecCapabilities(android.media.MediaCodecInfo codecInfo,
java.lang.String mimeType)
public IRecorder getRecorder()
public java.lang.String getOutputPath()
getOutputPath in interface Encoderprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwableprotected void callOnStartEncode(android.view.Surface source,
int captureFormat,
boolean mayFail)
source - captureFormat - protected void callOnError(java.lang.Exception e)
e - public void frameAvailableSoon()
frameAvailableSoon in interface Encoderpublic void run()
run in interface java.lang.Runnablepublic void release()
public void signalEndOfInputStream()
signalEndOfInputStream in interface Encoderpublic boolean isCapturing()
isCapturing in interface Encoderpublic void encode(java.nio.ByteBuffer buffer,
int length,
long presentationTimeUs)
protected abstract android.media.MediaFormat createOutputFormat(byte[] csd,
int size,
int ix0,
int ix1)
public boolean startRecorder(IRecorder recorder, android.media.MediaFormat outFormat)
public void stopRecorder(IRecorder recorder)
protected long getInputPTSUs()
protected long getNextOutputPTSUs(long presentationTimeUs)
public static boolean checkProfileLevel(java.lang.String mimeType,
android.media.MediaCodecInfo info)
mimeType - info - public static void dumpProfileLevel(java.lang.String mimeType,
android.media.MediaCodecInfo info)
public static java.lang.String getProfileLevelString(java.lang.String mimeType,
android.media.MediaCodecInfo.CodecProfileLevel profileLevel)
protected final int byteComp(byte[] array,
int offset,
byte[] search,
int len)
array - 検索されるbyte[]search - 検索するbyte[]len - 検索するバイト数