public class TuSdkMediaFileMuxer extends java.lang.Object implements TuSdkMediaMuxer
构造器和说明 |
---|
TuSdkMediaFileMuxer() |
限定符和类型 | 方法和说明 |
---|---|
int |
addTrack(android.media.MediaFormat format)
Adds a track with the specified format.
|
protected void |
finalize() |
boolean |
isWorking()
合成器是否开始执行
|
void |
pause()
暂停合成
|
boolean |
prepare()
准备开始合成
|
void |
release()
销毁
|
TuSdkMediaFileMuxer |
resume()
恢复合成
|
void |
setAudioOperation(TuSdkEncodecOperation audioOperation)
音频编码处理器
|
TuSdkMediaFileMuxer |
setFileDescriptor(java.io.FileDescriptor fileDescriptor)
The FileDescriptor of the output media file.
|
void |
setLocation(float latitude,
float longitude)
Set and store the geodata (latitude and longitude) in the output file.
|
TuSdkMediaFileMuxer |
setMediaMuxerFormat(int mediaMuxerFormat)
The format of the output media file. default: MUXER_OUTPUT_MPEG_4
|
void |
setOrientationHint(int degrees)
Sets the orientation hint for output video playback.
|
TuSdkMediaFileMuxer |
setPath(java.lang.String path)
The path of the output media file.
|
void |
setVideoOperation(TuSdkEncodecOperation videoOperation)
视频编码处理器
|
void |
writeSampleData(int trackIndex,
java.nio.ByteBuffer byteBuf,
android.media.MediaCodec.BufferInfo bufferInfo)
Writes an encoded sample into the muxer.
|
public TuSdkMediaFileMuxer setMediaMuxerFormat(int mediaMuxerFormat)
public TuSdkMediaFileMuxer setPath(java.lang.String path)
public TuSdkMediaFileMuxer setFileDescriptor(java.io.FileDescriptor fileDescriptor)
public void setVideoOperation(TuSdkEncodecOperation videoOperation)
public void setAudioOperation(TuSdkEncodecOperation audioOperation)
public void pause()
public TuSdkMediaFileMuxer resume()
public boolean isWorking()
public boolean prepare()
public void release()
protected void finalize() throws java.lang.Throwable
finalize
在类中 java.lang.Object
java.lang.Throwable
public int addTrack(android.media.MediaFormat format)
The following table summarizes support for specific format keys across android releases. Keys marked with '+:' are required.
addTrack
在接口中 TuSdkMediaMuxer
format
- The media format for the track. This must not be an empty
MediaFormat.writeSampleData(int, java.nio.ByteBuffer, android.media.MediaCodec.BufferInfo)
. 如果返回-1即为添加失败java.lang.IllegalArgumentException
- if format is invalid.java.lang.IllegalStateException
- if muxer is in the wrong state.public void writeSampleData(int trackIndex, java.nio.ByteBuffer byteBuf, android.media.MediaCodec.BufferInfo bufferInfo)
The application needs to make sure that the samples are written into the right tracks. Also, it needs to make sure the samples for each track are written in chronological order (e.g. in the order they are provided by the encoder.)
writeSampleData
在接口中 TuSdkMediaMuxer
trackIndex
- The track index for this sample.byteBuf
- The encoded sample.bufferInfo
- The buffer information related to this sample.java.lang.IllegalArgumentException
- if trackIndex, byteBuf or bufferInfo is invalid.java.lang.IllegalStateException
- if muxer is in wrong state.
MediaMuxer uses the flags provided in MediaCodec.BufferInfo
,
to signal sync frames.public void setLocation(float latitude, float longitude)
MediaMuxer.OutputFormat#MUXER_OUTPUT_MPEG_4
, and is ignored for other output
formats. The geodata is stored according to ISO-6709 standard.latitude
- Latitude in degrees. Its value must be in the range [-90,
90].longitude
- Longitude in degrees. Its value must be in the range
[-180, 180].java.lang.IllegalArgumentException
- If the given latitude or longitude is out
of range.java.lang.IllegalStateException
- If this method is called after MediaMuxer start.public void setOrientationHint(int degrees)
This method should be called after prepare before MediaMuxer start. Calling this
method will not rotate the video frame when muxer is generating the file,
but add a composition matrix containing the rotation angle in the output
video if the output format is
MediaMuxer.OutputFormat#MUXER_OUTPUT_MPEG_4
so that a video player can
choose the proper orientation for playback. Note that some video players
may choose to ignore the composition matrix in a video during playback.
By default, the rotation degree is 0.
degrees
- the angle to be rotated clockwise in degrees.
The supported angles are 0, 90, 180, and 270 degrees.java.lang.IllegalArgumentException
- if degree is not supported.java.lang.IllegalStateException
- If this method is called after MediaMuxer start.