Fixed video compression in Android L, bug fixes
This commit is contained in:
parent
bc76df2f99
commit
87cb843ea0
@ -24,8 +24,8 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 21
|
||||||
buildToolsVersion '20.0.0'
|
buildToolsVersion '21.0.0'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
debug {
|
debug {
|
||||||
@ -80,7 +80,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 19
|
targetSdkVersion 19
|
||||||
versionCode 359
|
versionCode 361
|
||||||
versionName "1.9.5"
|
versionName "1.9.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,9 @@ public class ImageReceiver {
|
|||||||
if (img == null) {
|
if (img == null) {
|
||||||
isPlaceholder = true;
|
isPlaceholder = true;
|
||||||
ImageLoader.getInstance().loadImage(fileLocation, httpUrl, this, size, cacheOnly);
|
ImageLoader.getInstance().loadImage(fileLocation, httpUrl, this, size, cacheOnly);
|
||||||
|
if (parentView != null) {
|
||||||
|
parentView.invalidate();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setImageBitmap(img, currentPath);
|
setImageBitmap(img, currentPath);
|
||||||
}
|
}
|
||||||
|
@ -2081,12 +2081,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
|||||||
if (end < 0 || info.presentationTimeUs < end) {
|
if (end < 0 || info.presentationTimeUs < end) {
|
||||||
info.offset = 0;
|
info.offset = 0;
|
||||||
info.flags = extractor.getSampleFlags();
|
info.flags = extractor.getSampleFlags();
|
||||||
if (!isAudio) {
|
if (mediaMuxer.writeSampleData(muxerTrackIndex, buffer, info, isAudio)) {
|
||||||
buffer.limit(info.offset + info.size);
|
|
||||||
buffer.position(info.offset);
|
|
||||||
buffer.putInt(info.size - 4);
|
|
||||||
}
|
|
||||||
if (mediaMuxer.writeSampleData(muxerTrackIndex, buffer, info)) {
|
|
||||||
didWriteData(messageObject, file, false, false);
|
didWriteData(messageObject, file, false, false);
|
||||||
}
|
}
|
||||||
extractor.advance();
|
extractor.advance();
|
||||||
@ -2168,6 +2163,23 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
|||||||
resultWidth = temp;
|
resultWidth = temp;
|
||||||
rotationValue = 90;
|
rotationValue = 90;
|
||||||
rotateRender = 270;
|
rotateRender = 270;
|
||||||
|
} else if (Build.VERSION.SDK_INT > 20) {
|
||||||
|
if (rotationValue == 90) {
|
||||||
|
int temp = resultHeight;
|
||||||
|
resultHeight = resultWidth;
|
||||||
|
resultWidth = temp;
|
||||||
|
rotationValue = 0;
|
||||||
|
rotateRender = 270;
|
||||||
|
} else if (rotationValue == 180) {
|
||||||
|
rotateRender = 180;
|
||||||
|
rotationValue = 0;
|
||||||
|
} else if (rotationValue == 270) {
|
||||||
|
int temp = resultHeight;
|
||||||
|
resultHeight = resultWidth;
|
||||||
|
resultWidth = temp;
|
||||||
|
rotationValue = 0;
|
||||||
|
rotateRender = 90;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File inputFile = new File(videoPath);
|
File inputFile = new File(videoPath);
|
||||||
@ -2374,10 +2386,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
|||||||
}
|
}
|
||||||
if (info.size > 1) {
|
if (info.size > 1) {
|
||||||
if ((info.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) == 0) {
|
if ((info.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) == 0) {
|
||||||
encodedData.limit(info.offset + info.size);
|
if (mediaMuxer.writeSampleData(videoTrackIndex, encodedData, info, false)) {
|
||||||
encodedData.position(info.offset);
|
|
||||||
encodedData.putInt(Integer.reverseBytes(info.size - 4));
|
|
||||||
if (mediaMuxer.writeSampleData(videoTrackIndex, encodedData, info)) {
|
|
||||||
didWriteData(messageObject, cacheFile, false, false);
|
didWriteData(messageObject, cacheFile, false, false);
|
||||||
}
|
}
|
||||||
} else if (videoTrackIndex == -5) {
|
} else if (videoTrackIndex == -5) {
|
||||||
|
@ -54,12 +54,13 @@ public class MP4Builder {
|
|||||||
|
|
||||||
private InterleaveChunkMdat mdat = null;
|
private InterleaveChunkMdat mdat = null;
|
||||||
private Mp4Movie currentMp4Movie = null;
|
private Mp4Movie currentMp4Movie = null;
|
||||||
FileOutputStream fos = null;
|
private FileOutputStream fos = null;
|
||||||
private FileChannel fc = null;
|
private FileChannel fc = null;
|
||||||
private long dataOffset = 0;
|
private long dataOffset = 0;
|
||||||
private long writedSinceLastMdat = 0;
|
private long writedSinceLastMdat = 0;
|
||||||
private boolean writeNewMdat = true;
|
private boolean writeNewMdat = true;
|
||||||
HashMap<Track, long[]> track2SampleSizes = new HashMap<Track, long[]>();
|
private HashMap<Track, long[]> track2SampleSizes = new HashMap<Track, long[]>();
|
||||||
|
private ByteBuffer sizeBuffer = null;
|
||||||
|
|
||||||
public MP4Builder createMovie(Mp4Movie mp4Movie) throws Exception {
|
public MP4Builder createMovie(Mp4Movie mp4Movie) throws Exception {
|
||||||
currentMp4Movie = mp4Movie;
|
currentMp4Movie = mp4Movie;
|
||||||
@ -74,6 +75,8 @@ public class MP4Builder {
|
|||||||
|
|
||||||
mdat = new InterleaveChunkMdat();
|
mdat = new InterleaveChunkMdat();
|
||||||
|
|
||||||
|
sizeBuffer = ByteBuffer.allocateDirect(4);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +90,7 @@ public class MP4Builder {
|
|||||||
fos.flush();
|
fos.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean writeSampleData(int trackIndex, ByteBuffer byteBuf, MediaCodec.BufferInfo bufferInfo) throws Exception {
|
public boolean writeSampleData(int trackIndex, ByteBuffer byteBuf, MediaCodec.BufferInfo bufferInfo, boolean isAudio) throws Exception {
|
||||||
if (writeNewMdat) {
|
if (writeNewMdat) {
|
||||||
mdat.setContentSize(0);
|
mdat.setContentSize(0);
|
||||||
mdat.getBox(fc);
|
mdat.getBox(fc);
|
||||||
@ -109,9 +112,16 @@ public class MP4Builder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentMp4Movie.addSample(trackIndex, dataOffset, bufferInfo);
|
currentMp4Movie.addSample(trackIndex, dataOffset, bufferInfo);
|
||||||
byteBuf.position(bufferInfo.offset);
|
byteBuf.position(bufferInfo.offset + (isAudio ? 0 : 4));
|
||||||
byteBuf.limit(bufferInfo.offset + bufferInfo.size);
|
byteBuf.limit(bufferInfo.offset + bufferInfo.size);
|
||||||
|
|
||||||
|
if (!isAudio) {
|
||||||
|
sizeBuffer.position(0);
|
||||||
|
sizeBuffer.putInt(bufferInfo.size - 4);
|
||||||
|
sizeBuffer.position(0);
|
||||||
|
fc.write(sizeBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
fc.write(byteBuf);
|
fc.write(byteBuf);
|
||||||
dataOffset += bufferInfo.size;
|
dataOffset += bufferInfo.size;
|
||||||
|
|
||||||
|
@ -370,6 +370,7 @@ public class TLClassStore {
|
|||||||
classStore.put(TLRPC.TL_userRequest_old.constructor, TLRPC.TL_userRequest_old.class);
|
classStore.put(TLRPC.TL_userRequest_old.constructor, TLRPC.TL_userRequest_old.class);
|
||||||
classStore.put(TLRPC.TL_userForeign_old.constructor, TLRPC.TL_userForeign_old.class);
|
classStore.put(TLRPC.TL_userForeign_old.constructor, TLRPC.TL_userForeign_old.class);
|
||||||
classStore.put(TLRPC.TL_userDeleted_old.constructor, TLRPC.TL_userDeleted_old.class);
|
classStore.put(TLRPC.TL_userDeleted_old.constructor, TLRPC.TL_userDeleted_old.class);
|
||||||
|
classStore.put(TLRPC.TL_messageEcryptedAction.constructor, TLRPC.TL_messageEcryptedAction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TLClassStore store = null;
|
static TLClassStore store = null;
|
||||||
|
@ -278,9 +278,11 @@ public class ChatActionCell extends BaseCell {
|
|||||||
imageReceiver.draw(canvas, imageReceiver.getImageX(), imageReceiver.getImageY(), imageReceiver.getImageWidth(), imageReceiver.getImageHeight());
|
imageReceiver.draw(canvas, imageReceiver.getImageX(), imageReceiver.getImageY(), imageReceiver.getImageWidth(), imageReceiver.getImageHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (textLayout != null) {
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.translate(textXLeft, textY);
|
canvas.translate(textXLeft, textY);
|
||||||
textLayout.draw(canvas);
|
textLayout.draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -926,7 +926,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||||||
@Override
|
@Override
|
||||||
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||||
if (visibleItemCount > 0) {
|
if (visibleItemCount > 0) {
|
||||||
if (firstVisibleItem <= 4) {
|
if (firstVisibleItem <= 10) {
|
||||||
if (!endReached && !loading) {
|
if (!endReached && !loading) {
|
||||||
if (messagesByDays.size() != 0) {
|
if (messagesByDays.size() != 0) {
|
||||||
MessagesController.getInstance().loadMessages(dialog_id, 20, maxMessageId, !cacheEndReaced, minDate, classGuid, false, false, null);
|
MessagesController.getInstance().loadMessages(dialog_id, 20, maxMessageId, !cacheEndReaced, minDate, classGuid, false, false, null);
|
||||||
|
74
TMessagesProj/src/main/res/values-v21/styles.xml
Normal file
74
TMessagesProj/src/main/res/values-v21/styles.xml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<!--
|
||||||
|
~ This is the source code of Telegram for Android v. 1.7.x.
|
||||||
|
~ It is licensed under GNU GPL v. 2 or later.
|
||||||
|
~ You should have received a copy of the license in this archive (see LICENSE).
|
||||||
|
~
|
||||||
|
~ Copyright Nikolai Kudashov, 2013-2014.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!--THEMES-->
|
||||||
|
|
||||||
|
<style name="Theme.TMessages.Start" parent="@android:style/Theme.Material">
|
||||||
|
<item name="android:actionBarStyle">@style/ActionBar.Transparent.TMessages.Start</item>
|
||||||
|
<item name="android:colorBackground">@android:color/white</item>
|
||||||
|
<item name="android:windowBackground">@android:color/white</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.TMessages" parent="@android:style/Theme.Material.Light">
|
||||||
|
<item name="android:windowActionBar">false</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowActionBarOverlay">false</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:colorBackground">@android:color/white</item>
|
||||||
|
<item name="android:windowBackground">@android:color/white</item>
|
||||||
|
<item name="android:itemTextAppearance">@style/ActionBar.Transparent.TMessages.Item</item>
|
||||||
|
<item name="android:listViewStyle">@style/Theme.TMessages.ListView</item>
|
||||||
|
<!--<item name="android:listChoiceBackgroundIndicator">@drawable/list_selector</item>-->
|
||||||
|
<item name="android:editTextStyle">@style/Theme.TMessages.EditText</item>
|
||||||
|
<item name="android:actionBarItemBackground">@drawable/bar_selector_style</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.TMessages.PopupNotification" parent="Theme.TMessages">
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowAnimationStyle">@null</item>
|
||||||
|
<item name="android:windowActionBar">false</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!--ACTION BAR-->
|
||||||
|
|
||||||
|
<style name="ActionBar.Transparent.TMessages.Start" parent="android:style/Widget.Material.Light.ActionBar">
|
||||||
|
<item name="android:background">@color/header</item>
|
||||||
|
<item name="android:logo">@drawable/transparent</item>
|
||||||
|
<item name="android:title">""</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!--ACTION BAR ITEMS-->
|
||||||
|
|
||||||
|
<style name="ActionBar.Transparent.TMessages.Item" parent="@android:TextAppearance.Widget.IconMenu.Item">
|
||||||
|
<item name="android:textColor">#000000</item>
|
||||||
|
<item name="android:textSize">18sp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!--LIST VIEW-->
|
||||||
|
|
||||||
|
<style name="Theme.TMessages.ListView" parent="@android:style/Widget.Material.Light.ListView">
|
||||||
|
<!--<item name="android:listSelector">@drawable/list_selector</item>-->
|
||||||
|
<item name="android:fadingEdge">none</item>
|
||||||
|
<item name="android:dividerHeight">1dp</item>
|
||||||
|
<item name="android:divider">@color/divider</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!--EDIT TEXT-->
|
||||||
|
|
||||||
|
<style name="Theme.TMessages.EditText" parent="android:Widget.Material.Light.EditText">
|
||||||
|
<item name="android:background">@drawable/holo_edit_text_light</item>
|
||||||
|
<item name="android:textColor">#000000</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
Loading…
Reference in New Issue
Block a user