aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-09-19 19:32:02 +0200
committerChristian Schneppe <christian@pix-art.de>2017-09-19 19:35:04 +0200
commitb52d0e489bf24193d5f677958d488b4374bec12d (patch)
tree8636e1336571a79c577cd79b8709c4b96680e3ef /src/main/java/de
parenteb56936af7f10ceedfedc1df86b52837c2dfc596 (diff)
don't change video compression quality for files longer than 8 seconds
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java5
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java4
2 files changed, 3 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
index 707bd6ed4..40e8bd242 100644
--- a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
+++ b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java
@@ -6,7 +6,6 @@ import android.os.ParcelFileDescriptor;
import android.util.Log;
import net.ypresto.androidtranscoder.MediaTranscoder;
-import net.ypresto.androidtranscoder.format.MediaFormatStrategy;
import net.ypresto.androidtranscoder.format.MediaFormatStrategyPresets;
import java.io.FileDescriptor;
@@ -79,12 +78,10 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod
message.setRelativeFilePath(fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4) + "_komp.mp4");
final DownloadableFile file = mXmppConnectionService.getFileBackend().getFile(message);
final int runtime = mXmppConnectionService.getFileBackend().getMediaRuntime(uri);
- MediaFormatStrategy formatStrategy = runtime >= 8000 ? MediaFormatStrategyPresets.createExportPreset960x540Strategy() : MediaFormatStrategyPresets.createAndroid720pStrategy();
- Log.d(Config.LOGTAG, "runtime " + runtime);
file.getParentFile().mkdirs();
ParcelFileDescriptor parcelFileDescriptor = mXmppConnectionService.getContentResolver().openFileDescriptor(uri, "r");
FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
- MediaTranscoder.getInstance().transcodeVideo(fileDescriptor, file.getAbsolutePath(), formatStrategy, this);
+ MediaTranscoder.getInstance().transcodeVideo(fileDescriptor, file.getAbsolutePath(), MediaFormatStrategyPresets.createAndroidStandardStrategy(mXmppConnectionService.getCompressVideoBitratePreference(), mXmppConnectionService.getCompressVideoResolutionPreference()), this);
}
@Override
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index dda022caf..0d367b3d7 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -835,7 +835,7 @@ public class XmppConnectionService extends Service {
}
}
- private int getCompressVideoResolutionPreference() {
+ public int getCompressVideoResolutionPreference() {
switch (getPreferences().getString("video_compression", getResources().getString(R.string.video_compression))) {
case "low":
return 144;
@@ -848,7 +848,7 @@ public class XmppConnectionService extends Service {
}
}
- private int getCompressVideoBitratePreference() {
+ public int getCompressVideoBitratePreference() {
switch (getPreferences().getString("video_compression", getResources().getString(R.string.video_compression))) {
case "low":
return 100000;