本文整理了Java中android.media.MediaMuxer.writeSampleData()
方法的一些代码示例,展示了MediaMuxer.writeSampleData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaMuxer.writeSampleData()
方法的具体详情如下:
包路径:android.media.MediaMuxer
类名称:MediaMuxer
方法名:writeSampleData
暂无
代码示例来源:origin: TeamNewPipe/NewPipe
muxer.writeSampleData(tracksIndex[i], buffer, info);
written += info.size;
done++;
代码示例来源:origin: guardianproject/haven
mMuxer.writeSampleData(mTrackIndex, encodedData,
mBufferInfo);
} catch (Exception e)
代码示例来源:origin: robolectric/robolectric
bufferInfo.set(0, inputSize, 0, 0);
muxer.writeSampleData(trackIndex, inputBuffer, bufferInfo);
muxer.stop();
代码示例来源:origin: guoxiaoxing/phoenix
public void writeSampleData(SampleType sampleType, ByteBuffer byteBuf, MediaCodec.BufferInfo bufferInfo) {
if (mStarted) {
mMuxer.writeSampleData(getTrackIndexForSampleType(sampleType), byteBuf, bufferInfo);
return;
}
byteBuf.limit(bufferInfo.offset + bufferInfo.size);
byteBuf.position(bufferInfo.offset);
if (mByteBuffer == null) {
mByteBuffer = ByteBuffer.allocateDirect(BUFFER_SIZE).order(ByteOrder.nativeOrder());
}
mByteBuffer.put(byteBuf);
mSampleInfoList.add(new SampleInfo(sampleType, bufferInfo.size, bufferInfo));
}
代码示例来源:origin: guoxiaoxing/phoenix
private void onSetOutputFormat() {
if (mVideoFormat == null || mAudioFormat == null) return;
mListener.onDetermineOutputFormat();
mVideoTrackIndex = mMuxer.addTrack(mVideoFormat);
Log.v(TAG, "Added track #" + mVideoTrackIndex + " with " + mVideoFormat.getString(MediaFormat.KEY_MIME) + " to muxer");
mAudioTrackIndex = mMuxer.addTrack(mAudioFormat);
Log.v(TAG, "Added track #" + mAudioTrackIndex + " with " + mAudioFormat.getString(MediaFormat.KEY_MIME) + " to muxer");
mMuxer.start();
mStarted = true;
if (mByteBuffer == null) {
mByteBuffer = ByteBuffer.allocate(0);
}
mByteBuffer.flip();
Log.v(TAG, "Output format determined, writing " + mSampleInfoList.size() +
" samples / " + mByteBuffer.limit() + " bytes to muxer.");
MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
int offset = 0;
for (SampleInfo sampleInfo : mSampleInfoList) {
sampleInfo.writeToBufferInfo(bufferInfo, offset);
mMuxer.writeSampleData(getTrackIndexForSampleType(sampleInfo.mSampleType), mByteBuffer, bufferInfo);
offset += sampleInfo.mSize;
}
mSampleInfoList.clear();
mByteBuffer = null;
}
代码示例来源:origin: WangShuo1143368701/WSLiveDemo
/**
* write encoded data to muxer
* @param trackIndex
* @param byteBuf
* @param bufferInfo
*/
/*package*/ synchronized void writeSampleData(final int trackIndex, final ByteBuffer byteBuf, final MediaCodec.BufferInfo bufferInfo) {
if (mStatredCount > 0)
mMediaMuxer.writeSampleData(trackIndex, byteBuf, bufferInfo);
}
代码示例来源:origin: saki4510t/ScreenRecordingSample
/**
* write encoded data to muxer
* @param trackIndex
* @param byteBuf
* @param bufferInfo
*/
/*package*/ synchronized void writeSampleData(final int trackIndex, final ByteBuffer byteBuf, final MediaCodec.BufferInfo bufferInfo) {
if (mStatredCount > 0)
mMediaMuxer.writeSampleData(trackIndex, byteBuf, bufferInfo);
}
代码示例来源:origin: FacePlusPlus/MegviiFacepp-Android-SDK
/**
* write encoded data to muxer
* @param trackIndex
* @param byteBuf
* @param bufferInfo
*/
/*package*/ synchronized void writeSampleData(final int trackIndex, final ByteBuffer byteBuf, final MediaCodec.BufferInfo bufferInfo) {
if (mStatredCount > 0)
mMediaMuxer.writeSampleData(trackIndex, byteBuf, bufferInfo);
}
代码示例来源:origin: saki4510t/AudioVideoRecordingSample
/**
* write encoded data to muxer
* @param trackIndex
* @param byteBuf
* @param bufferInfo
*/
/*package*/ synchronized void writeSampleData(final int trackIndex, final ByteBuffer byteBuf, final MediaCodec.BufferInfo bufferInfo) {
if (mStatredCount > 0)
mMediaMuxer.writeSampleData(trackIndex, byteBuf, bufferInfo);
}
代码示例来源:origin: dingjikerbo/Android-RTSP
public void writeSampleData(int trackIndex, ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
synchronized (mMuxer) {
mMuxer.writeSampleData(trackIndex, encodedData, bufferInfo);
}
}
代码示例来源:origin: windrunnerlihuan/DogCamera
@TargetApi(18)
public void writeSampleData(int trackIndex, ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo) {
synchronized (mMuxer) {
mMuxer.writeSampleData(trackIndex, encodedData, bufferInfo);
}
}
代码示例来源:origin: saki4510t/libcommon
@Override
public void writeSampleData(final int trackIndex,
@NonNull final ByteBuffer byteBuf, @NonNull final BufferInfo bufferInfo) {
if (!mReleased) {
mMuxer.writeSampleData(trackIndex, byteBuf, bufferInfo);
}
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getAacData(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
if (recording && canRecord) {
mediaMuxer.writeSampleData(audioTrack, aacBuffer, info);
}
if (streaming) getAacDataRtp(aacBuffer, info);
}
代码示例来源:origin: ChillingVan/AndroidInstantVideo
@Override
public void onSendAudio(FramePool.Frame sendFrame) {
if (isStart) {
mMuxer.writeSampleData(audioTrackIndex, ByteBuffer.wrap(sendFrame.data), sendFrame.bufferInfo.getBufferInfo());
}
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getAacData(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
if (recording && canRecord) {
mediaMuxer.writeSampleData(audioTrack, aacBuffer, info);
}
if (streaming) getAacDataRtp(aacBuffer, info);
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getAacData(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && recording && canRecord) {
mediaMuxer.writeSampleData(audioTrack, aacBuffer, info);
}
if (streaming) getAacDataRtp(aacBuffer, info);
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getAacData(ByteBuffer aacBuffer, MediaCodec.BufferInfo info) {
if (canRecord && recording) mediaMuxer.writeSampleData(audioTrack, aacBuffer, info);
if (streaming) getAacDataRtp(aacBuffer, info);
}
代码示例来源:origin: ChillingVan/AndroidInstantVideo
@Override
public void onSendVideo(FramePool.Frame sendFrame) {
if (isStart) {
mMuxer.writeSampleData(videoTrackIndex, ByteBuffer.wrap(sendFrame.data), sendFrame.bufferInfo.getBufferInfo());
}
}
代码示例来源:origin: MasayukiSuda/Mp4Composer-android
void writeSampleData(SampleType sampleType, ByteBuffer byteBuf, MediaCodec.BufferInfo bufferInfo) {
if (started) {
muxer.writeSampleData(getTrackIndexForSampleType(sampleType), byteBuf, bufferInfo);
return;
}
byteBuf.limit(bufferInfo.offset + bufferInfo.size);
byteBuf.position(bufferInfo.offset);
if (byteBuffer == null) {
byteBuffer = ByteBuffer.allocateDirect(BUFFER_SIZE).order(ByteOrder.nativeOrder());
}
byteBuffer.put(byteBuf);
sampleInfoList.add(new SampleInfo(sampleType, bufferInfo.size, bufferInfo));
}
代码示例来源:origin: MasayukiSuda/GPUVideo-android
void writeSampleData(SampleType sampleType, ByteBuffer byteBuf, MediaCodec.BufferInfo bufferInfo) {
if (started) {
muxer.writeSampleData(getTrackIndexForSampleType(sampleType), byteBuf, bufferInfo);
return;
}
byteBuf.limit(bufferInfo.offset + bufferInfo.size);
byteBuf.position(bufferInfo.offset);
if (byteBuffer == null) {
byteBuffer = ByteBuffer.allocateDirect(BUFFER_SIZE).order(ByteOrder.nativeOrder());
}
byteBuffer.put(byteBuf);
sampleInfoList.add(new SampleInfo(sampleType, bufferInfo.size, bufferInfo));
}
内容来源于网络,如有侵权,请联系作者删除!