public abstract class TuSDKMediaDecoder<T extends TuSDKMovieReader> extends java.lang.Object implements TuSDKMediaDecoderInterface
限定符和类型 | 类和说明 |
---|---|
static class |
TuSDKMediaDecoder.TuSDKMediaDecoderError
解码器错误信息
|
限定符和类型 | 字段和说明 |
---|---|
static int |
INVALID_TRACK_FLAG
无效的Track index
|
protected android.media.MediaCodec |
mAudioDecoder
视频解码器
|
protected TuSDKMediaDataSource |
mDataSource
file path
|
protected T |
mMovieReader
媒体信息提取
|
protected android.media.MediaCodec |
mVideoDecoder
解码器
|
static long |
TIME_US_BASE
timeus base
|
protected static int |
TIMEOUT_USEC
解码等待时间
|
构造器和说明 |
---|
TuSDKMediaDecoder(java.lang.String encodeFile) |
TuSDKMediaDecoder(TuSDKMediaDataSource dataSource) |
限定符和类型 | 方法和说明 |
---|---|
android.media.MediaCodec |
createAudioDecoder()
获取 MediaDecoder 用于音视频解码
|
android.media.MediaCodec |
createMediaDecoder(java.lang.String type)
创建解码器
|
T |
createMovieReader()
初始化MediaExtractor 用于读取音视频信息
|
android.media.MediaCodec |
createVideoDecoder(android.view.Surface surface)
获取 MediaDecoder 用于视频解码
|
void |
destroy()
销毁
|
protected void |
destroyMediaReader()
销毁MediaExtractor
|
int |
findAudioTrack()
查找音频Track
|
int |
findVideoTrack()
查找视频Track
|
android.media.MediaFormat |
getAudioTrackFormat()
获取音频轨道MediaFormat
|
long |
getCurrentSampleTimeUs()
获取当前位置
|
T |
getMediaReader()
获取 MediaExtractor
|
long |
getVideoFrameIntervalTimeUs()
获取视频帧平均间隔时间
|
android.media.MediaFormat |
getVideoTrackFormat()
获取视频轨道MediaFormat
|
protected void |
onDecoderError(TuSDKMediaDecoder.TuSDKMediaDecoderError error)
遇到错误
|
void |
seekTo(long timeUs)
将视频 seek 至指定位置
|
void |
seekTo(long timeUs,
int mode)
将视频 seek 至指定位置
|
int |
selectAudioTrack()
Selects the audio track, if any.
|
int |
selectVideoTrack()
Selects the video track, if any.
|
void |
start()
启动解码
|
void |
stop()
停止解码
|
void |
unselectAudioTrack()
取消选中音频轨道
|
void |
unselectVideoTrack()
取消选中视频轨道
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAudioDecoder, getVideoDecoder
public static final long TIME_US_BASE
public static final int INVALID_TRACK_FLAG
protected static final int TIMEOUT_USEC
protected T extends TuSDKMovieReader mMovieReader
protected android.media.MediaCodec mVideoDecoder
protected android.media.MediaCodec mAudioDecoder
protected TuSDKMediaDataSource mDataSource
public TuSDKMediaDecoder(java.lang.String encodeFile)
public TuSDKMediaDecoder(TuSDKMediaDataSource dataSource)
dataSource
- protected void onDecoderError(TuSDKMediaDecoder.TuSDKMediaDecoderError error)
error
- public void start()
start
在接口中 TuSDKMediaDecoderInterface
public void stop()
stop
在接口中 TuSDKMediaDecoderInterface
public long getCurrentSampleTimeUs()
getCurrentSampleTimeUs
在接口中 TuSDKMediaDecoderInterface
public long getVideoFrameIntervalTimeUs()
public void seekTo(long timeUs)
timeUs
- 设置当前帧 单位: 微妙public void seekTo(long timeUs, int mode)
timeUs
- 设置当前帧 单位: 微妙mode
- SEEK_TO_CLOSEST_SYNC
SEEK_TO_NEXT_SYNC
SEEK_TO_PREVIOUS_SYNCpublic T createMovieReader()
public android.media.MediaCodec createMediaDecoder(java.lang.String type)
type
- The mime type of the input data.public T getMediaReader()
getMediaReader
在接口中 TuSDKMediaDecoderInterface
public android.media.MediaCodec createAudioDecoder()
public android.media.MediaCodec createVideoDecoder(android.view.Surface surface)
public int findVideoTrack()
findVideoTrack
在接口中 TuSDKMediaDecoderInterface
public int selectVideoTrack()
selectVideoTrack
在接口中 TuSDKMediaDecoderInterface
public void unselectVideoTrack()
unselectVideoTrack
在接口中 TuSDKMediaDecoderInterface
public android.media.MediaFormat getVideoTrackFormat()
getVideoTrackFormat
在接口中 TuSDKMediaDecoderInterface
public int findAudioTrack()
findAudioTrack
在接口中 TuSDKMediaDecoderInterface
public int selectAudioTrack()
selectAudioTrack
在接口中 TuSDKMediaDecoderInterface
public void unselectAudioTrack()
unselectAudioTrack
在接口中 TuSDKMediaDecoderInterface
public android.media.MediaFormat getAudioTrackFormat()
getAudioTrackFormat
在接口中 TuSDKMediaDecoderInterface
protected void destroyMediaReader()
public void destroy()
destroy
在接口中 TuSDKMediaDecoderInterface