本文整理了Java中android.media.MediaMuxer.setLocation()
方法的一些代码示例,展示了MediaMuxer.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaMuxer.setLocation()
方法的具体详情如下:
包路径:android.media.MediaMuxer
类名称:MediaMuxer
方法名:setLocation
暂无
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!