Commit dba57fda authored by Felix Paul Kühne's avatar Felix Paul Kühne

Thumbnailer: further iterate on reliability

parent cb6709c2
......@@ -38,7 +38,8 @@
NSTimer *_parsingTimeoutTimer;
NSTimer *_thumbnailingTimeoutTimer;
CGFloat _thumbnailHeight,_thumbnailWidth,_snapshotPosition;
CGFloat _thumbnailHeight,_thumbnailWidth;
float _snapshotPosition;
CGFloat _effectiveThumbnailHeight,_effectiveThumbnailWidth;
int _numberOfReceivedFrames;
BOOL _shouldRejectFrames;
......@@ -75,7 +76,7 @@
* has been called.
* @return snapshot position. Default value 0.5
*/
@property (readwrite, assign) CGFloat snapshotPosition;
@property (readwrite, assign) float snapshotPosition;
@end
@protocol VLCMediaThumbnailerDelegate
......
......@@ -49,7 +49,7 @@ static void *lock(void *opaque, void **pixels)
static const size_t kDefaultImageWidth = 320;
static const size_t kDefaultImageHeight = 240;
static const float kSnapshotPosition = 0.5;
static const float kSnapshotPosition = 0.3;
static const long long kStandardStartTime = 150000;
void unlock(void *opaque, void *picture, void *const *p_pixels)
......@@ -247,14 +247,18 @@ void unlock(void *opaque, void *picture, void *const *p_pixels)
libvlc_media_player_set_position(_mp, self.snapshotPosition);
return;
}
if (length < kStandardStartTime * 2 && _numberOfReceivedFrames < 3) {
if ((length < kStandardStartTime * 2 && _numberOfReceivedFrames < 5) && self.snapshotPosition == kSnapshotPosition) {
libvlc_media_player_set_position(_mp, kSnapshotPosition);
return;
}
if ((length > 1000 || position <= 0.0) && _numberOfReceivedFrames < 10) {
if ((position <= 0.05 && _numberOfReceivedFrames < 8) && length > 1000) {
// Arbitrary choice to work around broken files.
libvlc_media_player_set_position(_mp, kSnapshotPosition);
return;
}
// it isn't always best what comes first
if (_numberOfReceivedFrames < 4)
return;
NSAssert(_data, @"We have no data");
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment