android.media.MediaExtractor.release()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中android.media.MediaExtractor.release()方法的一些代码示例,展示了MediaExtractor.release()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaExtractor.release()方法的具体详情如下:
包路径:android.media.MediaExtractor
类名称:MediaExtractor
方法名:release

MediaExtractor.release介绍

暂无

代码示例

代码示例来源:origin: TeamNewPipe/NewPipe

tracks[i].release();
tracksIndex[i] = -1;

代码示例来源:origin: guoxiaoxing/phoenix

mExtractor.release();
mExtractor = null;

代码示例来源:origin: windrunnerlihuan/DogCamera

private void releaseSugarExtractor() {
    if (mSugarExtractor != null) {
      mSugarExtractor.release();
      mSugarExtractor = null;
    }
  }
}

代码示例来源:origin: lijundacom/AndroidRTSPLib2

public void stop(){
  mediaExtractor.release();
}

代码示例来源:origin: bitmovin/bitcodin-android-demo

@Override
public void release() {
 Assertions.checkState(remainingReleaseCount > 0);
 if (--remainingReleaseCount == 0 && extractor != null) {
  extractor.release();
  extractor = null;
 }
}

代码示例来源:origin: sealtalk/sealtalk-android

private void release() {
  if (codecWrapper != null) {
    codecWrapper.stopAndRelease();
  }
  extractor.release();
}

代码示例来源:origin: yinzhengwei/SoundTouchDemo

@Override
public void close() {
  try {
    codec.stop();
  } catch (IllegalStateException e) {
    e.printStackTrace();
  }
  codec.release();
  codec = null;
  extractor.release();
  extractor = null;
}

代码示例来源:origin: yangjie10930/OpenGL4Android

public void close() {
  try {
    if (decoder != null) {
      decoder.stop();
      decoder.release();
    }
    if (extractor != null) {
      extractor.release();
      extractor = null;
    }
  }catch (IllegalStateException e){
    e.printStackTrace();
  }
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

public void stop() {
 decoding = false;
 seekTime = 0;
 if (thread != null) {
  thread.interrupt();
  try {
   thread.join(100);
  } catch (InterruptedException e) {
   thread.interrupt();
  }
  thread = null;
 }
 if (videoDecoder != null) {
  videoDecoder.stop();
  videoDecoder.release();
  videoDecoder = null;
 }
 if (videoExtractor != null) {
  videoExtractor.release();
  videoExtractor = null;
 }
}

代码示例来源:origin: yangjie10930/OpenGL4Android

public void close() {
  try {
    if (decoder != null) {
      decoder.stop();
      decoder.release();
    }
    if (extractor != null) {
      extractor.release();
      extractor = null;
    }
  } catch (IllegalStateException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

public void stop() {
 decoding = false;
 seekTime = 0;
 if (thread != null) {
  thread.interrupt();
  try {
   thread.join(100);
  } catch (InterruptedException e) {
   thread.interrupt();
  }
  thread = null;
 }
 if (audioDecoder != null) {
  audioDecoder.stop();
  audioDecoder.release();
  audioDecoder = null;
 }
 if (audioExtractor != null) {
  audioExtractor.release();
  audioExtractor = null;
 }
}

代码示例来源:origin: aserbao/AndroidCamera

private void release() {
  if (extractor != null) {
    extractor.release();
    extractor = null;
  }
  if (codec != null) {
    codec.stop();
    codec.release();
    codec = null;
  }
}

代码示例来源:origin: googlesamples/android-BasicMediaDecoder

@Override
protected void onPause() {
  super.onPause();
  if(mTimeAnimator != null && mTimeAnimator.isRunning()) {
    mTimeAnimator.end();
  }
  if (mCodecWrapper != null ) {
    mCodecWrapper.stopAndRelease();
    mExtractor.release();
  }
}

代码示例来源:origin: saki4510t/libcommon

private void internal_release() {
  if (mMediaCodec != null) {
    mMediaCodec.release();
    mMediaCodec = null;
  }
  if (mMediaExtractor != null) {
    mMediaExtractor.release();
    mMediaExtractor = null;
  }
  if (mMediaMetadataRetriever != null) {
    mMediaMetadataRetriever.release();
    mMediaMetadataRetriever = null;
  }
  mTrackIndex = -1;
  mDuration = 0;
  mBitRate = 0;
}

代码示例来源:origin: ywwynm/EverythingDone

public static int getAudioSampleRate(String pathName) {
  MediaExtractor extractor = new MediaExtractor();
  try {
    extractor.setDataSource(pathName);
    MediaFormat mf = extractor.getTrackFormat(0);
    return mf.getInteger(MediaFormat.KEY_SAMPLE_RATE);
  } catch (Exception e) {
    e.printStackTrace();
    return -1;
  } finally {
    extractor.release();
  }
}

代码示例来源:origin: lizhifeng-sky/VideoEdit

mex.release();

代码示例来源:origin: aserbao/AndroidCamera

extractor.release();
Log.e(TAG, "mediaExtractorDecoderAudio: " + (System.currentTimeMillis() - mStartTime)/(float)1000 + "s" );
extractor = null;

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

public int retrieveFrameRate() {
  MediaExtractor extractor = new MediaExtractor();
  int frameRate = -1;
  try {
    //Adjust data source as per the requirement if file, URI, etc.
    extractor.setDataSource(getPath());
    int numTracks = extractor.getTrackCount();
    for (int i = 0; i < numTracks; i++) {
      MediaFormat format = extractor.getTrackFormat(i);
      if (format.containsKey(MediaFormat.KEY_FRAME_RATE)) {
        frameRate = format.getInteger(MediaFormat.KEY_FRAME_RATE);
      }
    }
  } catch (IOException e) {
    e.printStackTrace();
  } finally {
    //Release stuff
    extractor.release();
  }
  return frameRate;
}

代码示例来源:origin: lijundacom/AndroidRTSPLib2

mediaExtractor.release();

代码示例来源:origin: stackoverflow.com

MediaExtractor extractor = new MediaExtractor();
extractor.setDataSource(...);
int numTracks = extractor.getTrackCount();
for (int i = 0; i < numTracks; ++i) {
 MediaFormat format = extractor.getTrackFormat(i);
 String mime = format.getString(MediaFormat.KEY_MIME);
 if (weAreInterestedInThisTrack) {
  extractor.selectTrack(i);
 }
}
ByteBuffer inputBuffer = ByteBuffer.allocate(...)
while (extractor.readSampleData(inputBuffer, ...) >= 0) {
 int trackIndex = extractor.getSampleTrackIndex();
 long presentationTimeUs = extractor.getSampleTime();
 ...
 extractor.advance();
}
extractor.release();
extractor = null;

相关文章