android.media.MediaMuxer.setOrientationHint()方法的使用及代码示例

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

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

MediaMuxer.setOrientationHint介绍

暂无

代码示例

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

private void setupMetadata() throws IOException {
  MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
  mediaMetadataRetriever.setDataSource(mInputFileDescriptor);
  String rotationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
  try {
    mMuxer.setOrientationHint(Integer.parseInt(rotationString));
  } catch (NumberFormatException e) {
    // skip
  }
  // TODO: parse ISO 6709
  // String locationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_LOCATION);
  // mMuxer.setLocation(Integer.getInteger(rotationString, 0));
  try {
    mDurationUs = Long.parseLong(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) * 1000;
  } catch (NumberFormatException e) {
    mDurationUs = -1;
  }
  Log.d(TAG, "Duration (us): " + mDurationUs);
}

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

/**
 * 生成视频的角度
 */
public void setOrientation(int orientation) {
  mMuxer.setOrientationHint(orientation);
}

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

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
private void setupMetadata() throws IOException {
  MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
  mediaMetadataRetriever.setDataSource(mInputFileDescriptor);
  String rotationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
  try {
    mMuxer.setOrientationHint(Integer.parseInt(rotationString));
  } catch (NumberFormatException e) {
    // skip
  }
  // TODO: parse ISO 6709
  // String locationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_LOCATION);
  // mMuxer.setLocation(Integer.getInteger(rotationString, 0));
  try {
    mDurationUs = Long.parseLong(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) * 1000;
  } catch (NumberFormatException e) {
    mDurationUs = -1;
  }
  Log.d(TAG, "Duration (us): " + mDurationUs);
}

代码示例来源:origin: GoBelieveIO/im_android

private void setupMetadata() throws IOException {
  MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
  mediaMetadataRetriever.setDataSource(mInputFileDescriptor);
  String rotationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
  try {
    mMuxer.setOrientationHint(Integer.parseInt(rotationString));
  } catch (NumberFormatException e) {
    // skip
  }
  // TODO: parse ISO 6709
  // String locationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_LOCATION);
  // mMuxer.setLocation(Integer.getInteger(rotationString, 0));
  try {
    mDurationUs = Long.parseLong(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) * 1000;
  } catch (NumberFormatException e) {
    mDurationUs = -1;
  }
  Log.d(TAG, "Duration (us): " + mDurationUs);
}

代码示例来源:origin: ypresto/android-transcoder

private void setupMetadata() throws IOException {
  MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
  mediaMetadataRetriever.setDataSource(mInputFileDescriptor);
  String rotationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
  try {
    mMuxer.setOrientationHint(Integer.parseInt(rotationString));
  } catch (NumberFormatException e) {
    // skip
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    String locationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_LOCATION);
    if (locationString != null) {
      float[] location = new ISO6709LocationParser().parse(locationString);
      if (location != null) {
        mMuxer.setLocation(location[0], location[1]);
      } else {
        Log.d(TAG, "Failed to parse the location metadata: " + locationString);
      }
    }
  }
  try {
    mDurationUs = Long.parseLong(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) * 1000;
  } catch (NumberFormatException e) {
    mDurationUs = -1;
  }
  Log.d(TAG, "Duration (us): " + mDurationUs);
}

代码示例来源:origin: kriztan/Pix-Art-Messenger

private void setupMetadata() throws IOException {
  MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
  mediaMetadataRetriever.setDataSource(mInputFileDescriptor);
  String rotationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
  try {
    mMuxer.setOrientationHint(Integer.parseInt(rotationString));
  } catch (NumberFormatException e) {
    // skip
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    String locationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_LOCATION);
    if (locationString != null) {
      float[] location = new ISO6709LocationParser().parse(locationString);
      if (location != null) {
        mMuxer.setLocation(location[0], location[1]);
      } else {
        Log.d(TAG, "Failed to parse the location metadata: " + locationString);
      }
    }
  }
  try {
    mDurationUs = Long.parseLong(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) * 1000;
  } catch (NumberFormatException e) {
    mDurationUs = -1;
  }
  Log.d(TAG, "Duration (us): " + mDurationUs);
}

相关文章