public class TuSdkMediaFileExtractor extends java.lang.Object implements TuSdkMediaExtractor
限定符和类型 | 字段和说明 |
---|---|
static int |
AUDIO_THREAD |
static int |
VIDEO_THREAD |
构造器和说明 |
---|
TuSdkMediaFileExtractor() |
限定符和类型 | 方法和说明 |
---|---|
protected void |
_asyncMediaThread()
异步媒体线程
|
boolean |
advance()
Advance to the next sample.
|
long |
advanceNestest(long timeUs)
遍历移动到最接近的时间 [为-1即到结尾]
|
protected android.media.MediaExtractor |
buildExtractor()
创建媒体分离器
|
protected void |
finalize() |
long |
getCachedDuration()
Returns an estimate of how much data is presently cached in memory
expressed in microseconds.
|
android.media.MediaExtractor.CasInfo |
getCasInfo(int index)
Retrieves the information about the conditional access system used to scramble
a track.
|
android.media.DrmInitData |
getDrmInitData()
Extract DRM initialization data if it exists
|
TuSdkMediaFrameInfo |
getFrameInfo()
帧信息
|
long |
getFrameIntervalUs()
获取实时帧间隔时间
|
android.os.PersistableBundle |
getMetrics()
Return Metrics data about the current media container.
|
java.util.Map<java.util.UUID,byte[]> |
getPsshInfo()
Get the PSSH info if present.
|
boolean |
getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo info)
If the sample flags indicate that the current sample is at least
partially encrypted, this call returns relevant information about
the structure of the sample data required for decryption.
|
int |
getSampleFlags()
Returns the current sample's flags.
|
long |
getSampleTime()
Returns the current sample's presentation time in microseconds.
|
int |
getSampleTrackIndex()
Returns the track index the current sample originates from (or -1
if no more samples are available)
|
int |
getTrackCount()
Count the number of tracks found in the data source.
|
android.media.MediaFormat |
getTrackFormat(int index)
Get the track format at the specified index.
|
boolean |
hasCacheReachedEndOfStream()
Returns true iff we are caching data and the cache has reached the
end of the data stream (for now, a future seek may of course restart
the fetching of data).
|
boolean |
isPlaying()
是否正在播放
|
void |
pause()
暂停播放
|
void |
play()
执行数据分离
|
int |
readSampleData(java.nio.ByteBuffer byteBuf,
int offset)
Retrieve the current encoded sample and store it in the byte buffer
starting at the given offset.
|
void |
release()
销毁
|
void |
resume()
恢复播放
|
long |
seekTo(long timeUs)
跳转到指定时间
使用 MediaExtractor.SEEK_TO_CLOSEST_SYNC
|
long |
seekTo(long timeUs,
boolean reverse)
跳转到指定时间内
normal : MediaExtractor.SEEK_TO_NEXT_SYNC
reverse: MediaExtractor.SEEK_TO_PREVIOUS_SYNC
|
long |
seekTo(long timeUs,
int mode)
跳转到指定时间
|
void |
selectTrack(int index)
Subsequent calls to
readSampleData(java.nio.ByteBuffer, int) , and
getSampleTime() only retrieve information for the subset of tracks
selected. |
TuSdkMediaFileExtractor |
setDataSource(android.content.res.AssetFileDescriptor afd)
Sets the data source (AssetFileDescriptor) to use.
|
TuSdkMediaFileExtractor |
setDataSource(android.content.Context context,
android.net.Uri uri,
java.util.Map<java.lang.String,java.lang.String> headers)
Sets the data source as a content Uri.
|
TuSdkMediaFileExtractor |
setDataSource(java.io.FileDescriptor fd)
Sets the data source (FileDescriptor) to use.
|
TuSdkMediaFileExtractor |
setDataSource(java.io.FileDescriptor fd,
long offset,
long length)
Sets the data source (FileDescriptor) to use.
|
TuSdkMediaFileExtractor |
setDataSource(android.media.MediaDataSource dataSource)
Sets the data source (MediaDataSource) to use.
|
TuSdkMediaFileExtractor |
setDataSource(java.lang.String path)
Sets the data source (file-path or http URL) to use.
|
TuSdkMediaFileExtractor |
setDataSource(java.lang.String path,
java.util.Map<java.lang.String,java.lang.String> headers)
Sets the data source (file-path or http URL) to use.
|
TuSdkMediaFileExtractor |
setDataSource(org.lasque.tusdk.core.struct.TuSdkMediaDataSource mediaDataSource)
Set the data source for TuSdkMediaDataSource
|
TuSdkMediaFileExtractor |
setDecodecOperation(TuSdkDecodecOperation decodecOperation)
设置解码器
|
void |
setThreadType(int type)
设置线程类型
|
void |
syncPlay()
同步方式启动
|
public static final int VIDEO_THREAD
public static final int AUDIO_THREAD
public final TuSdkMediaFileExtractor setDataSource(android.media.MediaDataSource dataSource)
dataSource
- the MediaDataSource for the media you want to extract frompublic final TuSdkMediaFileExtractor setDataSource(android.content.Context context, android.net.Uri uri, java.util.Map<java.lang.String,java.lang.String> headers)
context
- the Context to use when resolving the Uriuri
- the Content URI of the data you want to extract from.
When uri
refers to a network file the
Manifest.permission.INTERNET
permission is required.
headers
- the headers to be sent together with the request for the data.
This can be null
if no specific headers are to be sent with the
request.public final TuSdkMediaFileExtractor setDataSource(java.lang.String path)
path
- the path of the file, or the http URL of the streampublic final TuSdkMediaFileExtractor setDataSource(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> headers)
path
- the path of the file, or the http URL
When path
refers to a network file the
Manifest.permission.INTERNET
permission is required.
headers
- the headers associated with the http request for the stream you want to play.
This can be null
if no specific headers are to be sent with the
request.public final TuSdkMediaFileExtractor setDataSource(android.content.res.AssetFileDescriptor afd)
afd
- the AssetFileDescriptor for the file you want to extract from.public final TuSdkMediaFileExtractor setDataSource(java.io.FileDescriptor fd)
fd
- the FileDescriptor for the file you want to extract from.public final TuSdkMediaFileExtractor setDataSource(java.io.FileDescriptor fd, long offset, long length)
fd
- the FileDescriptor for the file you want to extract from.offset
- the offset into the file where the data to be extracted starts, in byteslength
- the length in bytes of the data to be extractedpublic final TuSdkMediaFileExtractor setDataSource(org.lasque.tusdk.core.struct.TuSdkMediaDataSource mediaDataSource)
mediaDataSource
- the MediaDataSource by TuSdkMediaDataSourcepublic TuSdkMediaFileExtractor setDecodecOperation(TuSdkDecodecOperation decodecOperation)
public void release()
release
在接口中 TuSdkMediaExtractor
protected void finalize() throws java.lang.Throwable
finalize
在类中 java.lang.Object
java.lang.Throwable
public void syncPlay()
syncPlay
在接口中 TuSdkMediaExtractor
public void play()
play
在接口中 TuSdkMediaExtractor
public void setThreadType(int type)
type
- 1 视频解码线程 2 音频解码线程protected void _asyncMediaThread()
protected android.media.MediaExtractor buildExtractor()
public android.media.MediaFormat getTrackFormat(int index)
getTrackFormat
在接口中 TuSdkMediaExtractor
index
- track indexpublic int getTrackCount()
getTrackCount
在接口中 TuSdkMediaExtractor
public void selectTrack(int index)
readSampleData(java.nio.ByteBuffer, int)
, and
getSampleTime()
only retrieve information for the subset of tracks
selected.
Selecting the same track multiple times has no effect, the track is
only selected once.selectTrack
在接口中 TuSdkMediaExtractor
public long getSampleTime()
getSampleTime
在接口中 TuSdkMediaExtractor
public int getSampleFlags()
getSampleFlags
在接口中 TuSdkMediaExtractor
public int getSampleTrackIndex()
getSampleTrackIndex
在接口中 TuSdkMediaExtractor
public boolean getSampleCryptoInfo(android.media.MediaCodec.CryptoInfo info)
getSampleCryptoInfo
在接口中 TuSdkMediaExtractor
info
- The android.media.MediaCodec.CryptoInfo structure
to be filled in.public long getCachedDuration()
getCachedDuration
在接口中 TuSdkMediaExtractor
public android.media.MediaExtractor.CasInfo getCasInfo(int index)
getCasInfo
在接口中 TuSdkMediaExtractor
index
- of the track.MediaExtractor.CasInfo
object describing the conditional access system.public android.media.DrmInitData getDrmInitData()
getDrmInitData
在接口中 TuSdkMediaExtractor
null
if no recognizable DRM format is found;DrmInitData
public android.os.PersistableBundle getMetrics()
getMetrics
在接口中 TuSdkMediaExtractor
PersistableBundle
containing the set of attributes and values
available for the media container being handled by this instance
of MediaExtractor.
The attributes are descibed in MediaExtractor.MetricsConstants
.
Additional vendor-specific fields may also be present in the return value.
public java.util.Map<java.util.UUID,byte[]> getPsshInfo()
getPsshInfo
在接口中 TuSdkMediaExtractor
null
if the source does not contain PSSH info.public boolean hasCacheReachedEndOfStream()
getCachedDuration()
indicates the presence of a cache, i.e. does NOT return -1.public boolean isPlaying()
isPlaying
在接口中 TuSdkMediaExtractor
public void pause()
pause
在接口中 TuSdkMediaExtractor
public void resume()
resume
在接口中 TuSdkMediaExtractor
public long seekTo(long timeUs)
seekTo
在接口中 TuSdkMediaExtractor
timeUs
- 跳转到指定时间(微秒)public long seekTo(long timeUs, boolean reverse)
seekTo
在接口中 TuSdkMediaExtractor
timeUs
- 跳转到指定时间(微秒)reverse
- 是否为倒序public long seekTo(long timeUs, int mode)
seekTo
在接口中 TuSdkMediaExtractor
timeUs
- 跳转到指定时间(微秒)mode
- 模式:
MediaExtractor.SEEK_TO_PREVIOUS_SYNC
MediaExtractor.SEEK_TO_NEXT_SYNC
MediaExtractor.SEEK_TO_CLOSEST_SYNCpublic boolean advance()
When extracting a local file, the behaviors of advance()
and
readSampleData(java.nio.ByteBuffer, int)
are undefined in presence of concurrent
writes to the same local file; more specifically, end of stream
could be signalled earlier than expected.
advance
在接口中 TuSdkMediaExtractor
public int readSampleData(java.nio.ByteBuffer byteBuf, int offset)
Note:As of API 21, on success the position and limit of
byteBuf
is updated to point to the data just read.
readSampleData
在接口中 TuSdkMediaExtractor
byteBuf
- the destination byte bufferpublic long getFrameIntervalUs()
getFrameIntervalUs
在接口中 TuSdkMediaExtractor
public long advanceNestest(long timeUs)
advanceNestest
在接口中 TuSdkMediaExtractor
public TuSdkMediaFrameInfo getFrameInfo()
getFrameInfo
在接口中 TuSdkMediaExtractor