本文整理了Java中android.media.MediaMuxer.start()
方法的一些代码示例,展示了MediaMuxer.start()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaMuxer.start()
方法的具体详情如下:
包路径:android.media.MediaMuxer
类名称:MediaMuxer
方法名:start
暂无
代码示例来源:origin: TeamNewPipe/NewPipe
long nextReport = NOTIFY_BYTES_INTERVAL;
muxer.start();
代码示例来源:origin: guardianproject/haven
mMuxer.start();
mMuxerStarted = true;
} else if (encoderStatus < 0)
代码示例来源:origin: robolectric/robolectric
muxer.start();
代码示例来源: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: ChillingVan/AndroidInstantVideo
@Override
public void onStart() {
isStart = true;
mMuxer.start();
}
代码示例来源:origin: saki4510t/libcommon
@Override
public void start() {
mMuxer.start();
mIsStarted = true;
}
代码示例来源:origin: WangShuo1143368701/WSLiveDemo
/**
* request start recording from encoder
* @return true when muxer is ready to write
*/
/*package*/ synchronized boolean start() {
if (DEBUG) Log.v(TAG, "start:");
mStatredCount++;
if ((mEncoderCount > 0) && (mStatredCount == mEncoderCount)) {
mMediaMuxer.start();
mIsStarted = true;
notifyAll();
if (DEBUG) Log.v(TAG, "MediaMuxer started:");
}
return mIsStarted;
}
代码示例来源:origin: saki4510t/AudioVideoRecordingSample
/**
* request start recording from encoder
* @return true when muxer is ready to write
*/
/*package*/ synchronized boolean start() {
if (DEBUG) Log.v(TAG, "start:");
mStatredCount++;
if ((mEncoderCount > 0) && (mStatredCount == mEncoderCount)) {
mMediaMuxer.start();
mIsStarted = true;
notifyAll();
if (DEBUG) Log.v(TAG, "MediaMuxer started:");
}
return mIsStarted;
}
代码示例来源:origin: FacePlusPlus/MegviiFacepp-Android-SDK
/**
* request start recording from encoder
* @return true when muxer is ready to write
*/
/*package*/ synchronized boolean start() {
if (DEBUG) Log.v(TAG, "start:");
mStatredCount++;
if ((mEncoderCount > 0) && (mStatredCount == mEncoderCount)) {
mMediaMuxer.start();
mIsStarted = true;
notifyAll();
if (DEBUG) Log.v(TAG, "MediaMuxer started:");
}
return mIsStarted;
}
代码示例来源:origin: saki4510t/ScreenRecordingSample
/**
* request start recording from encoder
* @return true when muxer is ready to write
*/
/*package*/ synchronized boolean start() {
if (DEBUG) Log.v(TAG, "start:");
mStatredCount++;
if ((mEncoderCount > 0) && (mStatredCount == mEncoderCount)) {
mMediaMuxer.start();
mIsStarted = true;
notifyAll();
if (DEBUG) Log.v(TAG, "MediaMuxer started:");
}
return mIsStarted;
}
代码示例来源:origin: MasayukiSuda/CameraRecorder-android
/**
* request start recording from encoder
*
* @return true when muxer is ready to write
*/
synchronized boolean start() {
Log.v(TAG, "start:");
startedCount++;
if ((encoderCount > 0) && (startedCount == encoderCount)) {
mediaMuxer.start();
isStarted = true;
notifyAll();
Log.v(TAG, "MediaMuxer started:");
}
return isStarted;
}
代码示例来源:origin: MasayukiSuda/GPUVideo-android
/**
* request start recording from encoder
*
* @return true when muxer is ready to write
*/
synchronized boolean start() {
Log.v(TAG, "start:");
startedCount++;
if ((encoderCount > 0) && (startedCount == encoderCount)) {
mediaMuxer.start();
isStarted = true;
notifyAll();
Log.v(TAG, "MediaMuxer started:");
}
return isStarted;
}
代码示例来源:origin: aserbao/AndroidCamera
/**
* 请求混合器开始启动
*/
private void requestStart() {
synchronized (lock) {
if (isMuxerStart()) {
mediaMuxer.start();
Log.e(TAG, "requestStart启动混合器..开始等待数据输入...");
lock.notify();
}
}
}
代码示例来源:origin: dingjikerbo/Android-RTSP
public int addTrack(MediaFormat trackFormat) {
if (mStarted) {
throw new IllegalStateException();
}
synchronized (mMuxer) {
int track = mMuxer.addTrack(trackFormat);
if (++mNumTracks == mExpectedNumTracks) {
mMuxer.start();
mStarted = true;
}
return track;
}
}
代码示例来源:origin: windrunnerlihuan/DogCamera
public int addTrack(MediaFormat trackFormat) {
if (mStarted) {
throw new IllegalStateException();
}
synchronized (mMuxer) {
int track = mMuxer.addTrack(trackFormat);
if (++mNumTracks == mExpectedNumTracks) {
mMuxer.start();
mStarted = true;
}
return track;
}
}
代码示例来源:origin: WangShuo1143368701/VideoView
private void resetOutputFormat() {
// should happen before receiving buffers, and should only happen once
if (mMuxerStarted) {
throw new IllegalStateException("output format already changed!");
}
MediaFormat newFormat = mMediaCodec.getOutputFormat();
Log.i(TAG, "output format changed.\n new format: " + newFormat.toString());
mVideoTrackIndex = mMuxer.addTrack(newFormat);
mMuxer.start();
mMuxerStarted = true;
Log.i(TAG, "started media muxer, videoIndex=" + mVideoTrackIndex);
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getVideoData(ByteBuffer h264Buffer, MediaCodec.BufferInfo info) {
if (recording) {
if (info.flags == MediaCodec.BUFFER_FLAG_KEY_FRAME
&& !canRecord
&& videoFormat != null
&& audioFormat != null) {
videoTrack = mediaMuxer.addTrack(videoFormat);
audioTrack = mediaMuxer.addTrack(audioFormat);
mediaMuxer.start();
canRecord = true;
}
if (canRecord) mediaMuxer.writeSampleData(videoTrack, h264Buffer, info);
}
if (streaming) getH264DataRtp(h264Buffer, info);
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getVideoData(ByteBuffer h264Buffer, MediaCodec.BufferInfo info) {
if (recording) {
if (info.flags == MediaCodec.BUFFER_FLAG_KEY_FRAME
&& !canRecord
&& videoFormat != null
&& audioFormat != null) {
videoTrack = mediaMuxer.addTrack(videoFormat);
audioTrack = mediaMuxer.addTrack(audioFormat);
mediaMuxer.start();
canRecord = true;
}
if (canRecord) mediaMuxer.writeSampleData(videoTrack, h264Buffer, info);
}
if (streaming) getH264DataRtp(h264Buffer, info);
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getVideoData(ByteBuffer h264Buffer, MediaCodec.BufferInfo info) {
if (recording) {
if (info.flags == MediaCodec.BUFFER_FLAG_KEY_FRAME
&& !canRecord
&& videoFormat != null
&& audioFormat != null) {
videoTrack = mediaMuxer.addTrack(videoFormat);
audioTrack = mediaMuxer.addTrack(audioFormat);
mediaMuxer.start();
canRecord = true;
}
if (canRecord) mediaMuxer.writeSampleData(videoTrack, h264Buffer, info);
}
if (streaming) getH264DataRtp(h264Buffer, info);
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
public void getVideoData(ByteBuffer h264Buffer, MediaCodec.BufferInfo info) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && recording) {
if (info.flags == MediaCodec.BUFFER_FLAG_KEY_FRAME
&& !canRecord
&& videoFormat != null
&& audioFormat != null) {
videoTrack = mediaMuxer.addTrack(videoFormat);
audioTrack = mediaMuxer.addTrack(audioFormat);
mediaMuxer.start();
canRecord = true;
}
if (canRecord) mediaMuxer.writeSampleData(videoTrack, h264Buffer, info);
}
if (streaming) getH264DataRtp(h264Buffer, info);
}
内容来源于网络,如有侵权,请联系作者删除!