This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Image+Trim.swift | |
// | |
// Copyright © 2020 Christopher Zielinski. | |
// https://gist.github.com/chriszielinski/aec9a2f2ba54745dc715dd55f5718177 | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)getPixelBuffer:(CVPixelBufferRef *)pbuf { | |
@synchronized (self) { | |
if(!_pFrame || !_pFrame->data[0]) | |
return; | |
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: | |
// [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey, | |
// [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey, | |
@(_pFrame->linesize[0]), kCVPixelBufferBytesPerRowAlignmentKey, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <JRSwizzle/JRSwizzle.h> | |
@implementation AVPlayerItem (MLWPerformance) | |
+ (void)load { | |
[AVPlayerItem jr_swizzleMethod:NSSelectorFromString(@"_attachToFigPlayer") withMethod:@selector(mlw_attachToFigPlayer) error:nil]; | |
} | |
- (void)mlw_attachToFigPlayer { | |
static dispatch_queue_t queue = nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <AVFoundation/AVFoundation.h> | |
@interface MLWAsyncAVPlayer : AVPlayer | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Direction { | |
case forward | |
case backward | |
} | |
internal var player: AVPlayer? | |
private var isSeekInProgress = false | |
private var chaseTime = kCMTimeZero | |
private var preferredFrameRate: Float = 23.98 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> DESCRIPTION OF PROBLEM | |
> In Photos.app, Videos.app, and iMovie.app, local videos can be rewound using the video scrubber. Scrubbing backwards in a video is extremely smooth and satisfying. | |
> | |
> Using AVPlayer in our app, ScoreBreak, we cannot achieve the same smoothness when scrubbing a video backwards. There are reports on stack overflow which indicate that this is due to the codec used by AVPlayer. | |
> | |
> We would like to deliver the same beautiful user interaction with videos as offered by your system apps. Can you instruct us on how to achieve this while using AVFoundation? | |
> | |
> STEPS TO REPRODUCE | |
> • Create test application which utilizes AVPlayer for local video file playback | |
> • Scrub backwards using AVPlayer controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object mail { | |
implicit def stringToSeq(single: String): Seq[String] = Seq(single) | |
implicit def liftToOption[T](t: T): Option[T] = Some(t) | |
sealed abstract class MailType | |
case object Plain extends MailType | |
case object Rich extends MailType | |
case object MultiPart extends MailType |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-Xms1024m | |
-Xmx3072m | |
-Xss64m | |
-Dfile.encoding=UTF-8 | |
-Djava.net.preferIPv4Stack=true | |
-Dsun.io.useCanonCaches=false | |
-XX:+AggressiveOpts | |
-XX:+AlwaysPreTouch | |
-XX:+CMSClassUnloadingEnabled | |
-XX:+CMSIncrementalMode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import org.apache.lucene.analysis.*; | |
import org.apache.lucene.util.Version; | |
public class MyAnalyzer extends Analyzer { | |
public TokenStream tokenStream(String fieldName, Reader reader) { | |
return | |
new StopFilter( | |
true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val scalacOptions ++= Seq( | |
"-encoding", | |
"utf-8", // Specify character encoding used by source files. | |
"-deprecation", // Emit warning and location for usages of deprecated APIs. | |
"-explaintypes", // Explain type errors in more detail. | |
"-feature", // Emit warning and location for usages of features that should be imported explicitly. | |
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred | |
"-language:experimental.macros", // Allow macro definition (besides implementation and application) | |
"-language:higherKinds", // Allow higher-kinded types | |
"-language:implicitConversions", // Allow definition of implicit functions called views |
NewerOlder