mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Video avatar fixes
This commit is contained in:
parent
9d6d332623
commit
d2f67127b7
@ -351,6 +351,10 @@
|
||||
if (TGOrientationIsSideward(adjustments.cropOrientation, NULL))
|
||||
outputDimensions = CGSizeMake(outputDimensions.height, outputDimensions.width);
|
||||
|
||||
if ((preset == TGMediaVideoConversionPresetProfile || preset == TGMediaVideoConversionPresetProfileHigh || preset == TGMediaVideoConversionPresetProfileVeryHigh) && MIN(outputDimensions.width, outputDimensions.height) < 160.0) {
|
||||
outputDimensions = CGSizeMake(160.0, 160.0);
|
||||
}
|
||||
|
||||
AVMutableCompositionTrack *compositionTrack = [composition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
|
||||
[compositionTrack insertTimeRange:timeRange ofTrack:videoTrack atTime:kCMTimeZero error:NULL];
|
||||
|
||||
|
@ -328,7 +328,7 @@
|
||||
_previewView.clipsToBounds = true;
|
||||
[_previewView setSnapshotImage:_screenImage];
|
||||
[_photoEditor setPreviewOutput:_previewView];
|
||||
[self updatePreviewView];
|
||||
[self updatePreviewView:true];
|
||||
|
||||
if ([self presentedForAvatarCreation]) {
|
||||
CGSize fittedSize = TGScaleToSize(_photoEditor.originalSize, CGSizeMake(1024, 1024));
|
||||
@ -1267,6 +1267,8 @@
|
||||
strongSelf->_dotImageView.cropOrientation = strongSelf->_photoEditor.cropOrientation;
|
||||
strongSelf->_dotImageView.cropMirrored = strongSelf->_photoEditor.cropMirrored;
|
||||
[strongSelf->_dotImageView updateCropping:true];
|
||||
|
||||
[strongSelf updatePreviewView:false];
|
||||
}
|
||||
};
|
||||
cropController.beginTransitionIn = ^UIView *(CGRect *referenceFrame, UIView **parentView, bool *noTransitionView)
|
||||
@ -1584,7 +1586,7 @@
|
||||
{
|
||||
__strong TGPhotoEditorController *strongSelf = weakSelf;
|
||||
if (strongSelf != nil)
|
||||
[strongSelf updatePreviewView];
|
||||
[strongSelf updatePreviewView:true];
|
||||
};
|
||||
_currentTabController.tabsChanged = ^
|
||||
{
|
||||
@ -1610,10 +1612,16 @@
|
||||
[self setNeedsUpdateOfScreenEdgesDeferringSystemGestures];
|
||||
}
|
||||
|
||||
- (void)updatePreviewView
|
||||
- (void)updatePreviewView:(bool)full
|
||||
{
|
||||
if (full)
|
||||
[_previewView setPaintingImageWithData:_photoEditor.paintingData];
|
||||
[_previewView setCropRect:_photoEditor.cropRect cropOrientation:_photoEditor.cropOrientation cropRotation:_photoEditor.cropRotation cropMirrored:_photoEditor.cropMirrored originalSize:_photoEditor.originalSize];
|
||||
|
||||
UIImageOrientation cropOrientation = _photoEditor.cropOrientation;
|
||||
if ([self presentedForAvatarCreation]) {
|
||||
cropOrientation = UIImageOrientationUp;
|
||||
}
|
||||
[_previewView setCropRect:_photoEditor.cropRect cropOrientation:cropOrientation cropRotation:_photoEditor.cropRotation cropMirrored:_photoEditor.cropMirrored originalSize:_photoEditor.originalSize];
|
||||
}
|
||||
|
||||
- (void)updateEditorButtons
|
||||
@ -1823,6 +1831,9 @@
|
||||
|
||||
if (paintingData != nil)
|
||||
[TGPaintingData storePaintingData:paintingData inContext:self.editingContext forItem:_item forVideo:(_intent == TGPhotoEditorControllerVideoIntent)];
|
||||
|
||||
[_previewView setPaintingImageWithData:_photoEditor.paintingData];
|
||||
[_previewView setPaintingHidden:false];
|
||||
}
|
||||
|
||||
- (void)applyEditor
|
||||
|
@ -117,7 +117,6 @@ const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f;
|
||||
TGMenuContainerView *_menuContainerView;
|
||||
|
||||
TGPaintingData *_resultData;
|
||||
UIImage *_stillImage;
|
||||
|
||||
TGPaintingWrapperView *_paintingWrapperView;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
arc4random_buf(&fileId, sizeof(fileId));
|
||||
NSString *videoMp4FilePath = [tmpPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%" PRId64 ".mp4", fileId]];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:videoMp4FilePath error:nil];
|
||||
[[NSFileManager defaultManager] createSymbolicLinkAtPath:videoMp4FilePath withDestinationPath:video.path error:nil];
|
||||
[[NSFileManager defaultManager] copyItemAtPath:video.path toPath:videoMp4FilePath error:nil];
|
||||
video = [NSURL fileURLWithPath:videoMp4FilePath];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user