diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-07 20:28:07 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-07 20:28:07 +0100 |
commit | 39c37184f126c2f3cada5d824fbd7b2ab7ee5d19 (patch) | |
tree | 7b0fd1b57f75696a8185a2c355fbcf785f225560 | |
parent | 7685c46c5af7154c6fb59ab020a174923643bd48 (diff) |
update androidTranscoder to version 0.3
4 files changed, 80 insertions, 19 deletions
diff --git a/build.gradle b/build.gradle index 8017acc7b..755250906 100644 --- a/build.gradle +++ b/build.gradle @@ -36,10 +36,6 @@ configurations { standardPushImplementation } -ext { - supportLibVersion = '28.0.0' -} - dependencies { implementation project(':libs:android-transcoder') standardPushImplementation ('com.google.firebase:firebase-messaging:17.3.4') { @@ -63,16 +59,16 @@ dependencies { implementation 'jetty:javax.servlet:5.1.12' implementation 'com.google.code.gson:gson:2.8.2' implementation 'com.android.support:multidex:1.0.3' - implementation "com.android.support:support-v13:$supportLibVersion" - implementation "com.android.support:appcompat-v7:$supportLibVersion" - implementation "com.android.support:exifinterface:$supportLibVersion" - implementation "com.android.support:support-v4:$supportLibVersion" - implementation "com.android.support:support-emoji:$supportLibVersion" - implementation "com.android.support:support-emoji-bundled:$supportLibVersion" - implementation "com.android.support:support-emoji-appcompat:$supportLibVersion" - implementation "com.android.support:exifinterface:$supportLibVersion" - implementation "com.android.support:design:$supportLibVersion" - implementation "com.android.support:cardview-v7:$supportLibVersion" + implementation 'com.android.support:support-v13:28.0.0' + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support:exifinterface:28.0.0' + implementation 'com.android.support:support-v4:28.0.0' + implementation 'com.android.support:support-emoji:28.0.0' + implementation 'com.android.support:support-emoji-bundled:28.0.0' + implementation 'com.android.support:support-emoji-appcompat:28.0.0' + implementation 'com.android.support:exifinterface:28.0.0' + implementation 'com.android.support:design:28.0.0' + implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.github.bumptech.glide:glide:3.8.0' implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0' implementation 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.3' @@ -99,8 +95,8 @@ android { minSdkVersion 16 targetSdkVersion 28 - versionCode 250 - versionName "2.1.5" + versionCode 251 + versionName "2.1.6 beta (2019-01-07)" archivesBaseName += "-$versionName" applicationId "de.pixart.messenger" diff --git a/libs/android-transcoder/CHANGELOG.md b/libs/android-transcoder/CHANGELOG.md new file mode 100644 index 000000000..a79483bd0 --- /dev/null +++ b/libs/android-transcoder/CHANGELOG.md @@ -0,0 +1,17 @@ +## 0.3.0 +- Fix cancel() sometimes not working. (Thanks @strayerM and @PinkFloyded) +- Geolocation support on API>=19. (Thanks @hkurokawa) + +## 0.2.0 +- Experimental audio transcoding support. (Thanks @aaron112) +- Fix transcode does not run on Huawei Ascend P7. (Thanks @spiritedRunning) +- Fix race condition caused by not closing output before callback. (Thanks @ryanwilliams83) + +## 0.1.10 +- `Future` support. (Thanks @MaiKambayashi) + +## 0.1.X +- Stability updates. (Thanks @ozyozyo) + +## 0.1.0 +- First release. diff --git a/libs/android-transcoder/src/main/java/net/ypresto/androidtranscoder/engine/MediaTranscoderEngine.java b/libs/android-transcoder/src/main/java/net/ypresto/androidtranscoder/engine/MediaTranscoderEngine.java index e56e307b1..3abdbaf54 100644 --- a/libs/android-transcoder/src/main/java/net/ypresto/androidtranscoder/engine/MediaTranscoderEngine.java +++ b/libs/android-transcoder/src/main/java/net/ypresto/androidtranscoder/engine/MediaTranscoderEngine.java @@ -19,9 +19,12 @@ import android.media.MediaExtractor; import android.media.MediaFormat; import android.media.MediaMetadataRetriever; import android.media.MediaMuxer; +import android.os.Build; import android.util.Log; +import net.ypresto.androidtranscoder.BuildConfig; import net.ypresto.androidtranscoder.format.MediaFormatStrategy; +import net.ypresto.androidtranscoder.utils.ISO6709LocationParser; import net.ypresto.androidtranscoder.utils.MediaExtractorUtils; import java.io.FileDescriptor; @@ -137,9 +140,17 @@ public class MediaTranscoderEngine { // skip } - // TODO: parse ISO 6709 - // String locationString = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_LOCATION); - // mMuxer.setLocation(Integer.getInteger(rotationString, 0)); + 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; diff --git a/libs/android-transcoder/src/main/java/net/ypresto/androidtranscoder/utils/ISO6709LocationParser.java b/libs/android-transcoder/src/main/java/net/ypresto/androidtranscoder/utils/ISO6709LocationParser.java new file mode 100644 index 000000000..273007d3c --- /dev/null +++ b/libs/android-transcoder/src/main/java/net/ypresto/androidtranscoder/utils/ISO6709LocationParser.java @@ -0,0 +1,37 @@ +package net.ypresto.androidtranscoder.utils; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class ISO6709LocationParser { + private final Pattern pattern; + + public ISO6709LocationParser() { + this.pattern = Pattern.compile("([+\\-][0-9.]+)([+\\-][0-9.]+)"); + } + + /** + * This method parses the given string representing a geographic point location by coordinates in ISO 6709 format + * and returns the latitude and the longitude in float. If <code>location</code> is not in ISO 6709 format, + * this method returns <code>null</code> + * + * @param location a String representing a geographic point location by coordinates in ISO 6709 format + * @return <code>null</code> if the given string is not as expected, an array of floats with size 2, + * where the first element represents latitude and the second represents longitude, otherwise. + */ + public float[] parse(String location) { + if (location == null) return null; + Matcher m = pattern.matcher(location); + if (m.find() && m.groupCount() == 2) { + String latstr = m.group(1); + String lonstr = m.group(2); + try { + float lat = Float.parseFloat(latstr); + float lon = Float.parseFloat(lonstr); + return new float[]{lat, lon}; + } catch (NumberFormatException ignored) { + } + } + return null; + } +} |