From 34566237d07105dc8560a3339ca05df4dd657c8a Mon Sep 17 00:00:00 2001 From: Zach Nelson Date: Thu, 19 Nov 2026 19:14:00 -0600 Subject: [PATCH] Render the exact frame a player shows at a time --- CHANGELOG.md | 5 + CoreZen.xcodeproj/project.pbxproj | 4 + CoreZen/CoreZen.docc/Media.md | 14 ++ CoreZen/Media/FrameRenderer.h | 53 +++++-- CoreZen/Media/FrameRenderer.m | 15 +- CoreZen/Media/LibAV/LibAVRenderController.h | 3 + CoreZen/Media/LibAV/LibAVRenderController.m | 154 +++++++++++++++----- CoreZenTests/MediaTests.m | 72 +++++++++ CoreZenTests/Resources/start-offset.ts | Bin 0 -> 25756 bytes 9 files changed, 273 insertions(+), 47 deletions(-) create mode 100644 CoreZenTests/Resources/start-offset.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 910ea9d..d587138 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ To note a change, add a line under Unreleased, in a group such as Added, Changed ### Added - Documentation for the persistence and media APIs, built with DocC: doc comments in their headers, which Xcode shows in Quick Help, and an article with examples for each. +- `-[ZENFrameRenderer renderExactFrameAtSeconds:width:height:completion:]`, which renders the frame a player shows at a time, rather than the keyframe at or before it. + +### Fixed + +- Frames rendered from a file whose timestamps don't start at 0, such as an MPEG transport stream, come from the time asked for. Before, times counted from timestamp 0, so frames came from too early and their actual times were off by the file's start, and a rough seek could land a keyframe or more late. ## 0.1.0 - 2026-11-19 diff --git a/CoreZen.xcodeproj/project.pbxproj b/CoreZen.xcodeproj/project.pbxproj index 65d0370..6d9e9a7 100644 --- a/CoreZen.xcodeproj/project.pbxproj +++ b/CoreZen.xcodeproj/project.pbxproj @@ -111,6 +111,7 @@ CC00000228860A0000000006 /* TestDomainObject.m in Sources */ = {isa = PBXBuildFile; fileRef = CC00000128860A0000000009 /* TestDomainObject.m */; }; 0313158D2D7374094EFBE6DC /* MediaTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D27F0ECF10C39A3A06669EF /* MediaTests.m */; }; 030EFFD5692EA63A973B2FE9 /* video.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 7C383F9E59E944DEF41405A3 /* video.mp4 */; }; + CCD9DDD06C5517F511A366AC /* start-offset.ts in Resources */ = {isa = PBXBuildFile; fileRef = 2431BF153CB5C75BE727866E /* start-offset.ts */; }; 3A881C011BDBA50B90143879 /* audio.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 318D307DF615F0093C6C9C47 /* audio.m4a */; }; 7C83D0F62FF8F1D1569E4B13 /* silent.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 75E34DE8F29716419674A2D5 /* silent.mp4 */; }; 55364405F0E577C93535A30F /* last-keyframe.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 212C13ED5A3034EA43EE5679 /* last-keyframe.mp4 */; }; @@ -300,6 +301,7 @@ CC00000128860A0000000009 /* TestDomainObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestDomainObject.m; sourceTree = ""; }; 7D27F0ECF10C39A3A06669EF /* MediaTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediaTests.m; sourceTree = ""; }; 7C383F9E59E944DEF41405A3 /* video.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video.mp4; sourceTree = ""; }; + 2431BF153CB5C75BE727866E /* start-offset.ts */ = {isa = PBXFileReference; lastKnownFileType = file; path = "start-offset.ts"; sourceTree = ""; }; 318D307DF615F0093C6C9C47 /* audio.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = audio.m4a; sourceTree = ""; }; 75E34DE8F29716419674A2D5 /* silent.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = silent.mp4; sourceTree = ""; }; 212C13ED5A3034EA43EE5679 /* last-keyframe.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = last-keyframe.mp4; sourceTree = ""; }; @@ -844,6 +846,7 @@ isa = PBXGroup; children = ( 7C383F9E59E944DEF41405A3 /* video.mp4 */, + 2431BF153CB5C75BE727866E /* start-offset.ts */, 318D307DF615F0093C6C9C47 /* audio.m4a */, 75E34DE8F29716419674A2D5 /* silent.mp4 */, 212C13ED5A3034EA43EE5679 /* last-keyframe.mp4 */, @@ -1218,6 +1221,7 @@ buildActionMask = 2147483647; files = ( 030EFFD5692EA63A973B2FE9 /* video.mp4 in Resources */, + CCD9DDD06C5517F511A366AC /* start-offset.ts in Resources */, 3A881C011BDBA50B90143879 /* audio.m4a in Resources */, 7C83D0F62FF8F1D1569E4B13 /* silent.mp4 in Resources */, 55364405F0E577C93535A30F /* last-keyframe.mp4 in Resources */, diff --git a/CoreZen/CoreZen.docc/Media.md b/CoreZen/CoreZen.docc/Media.md index e1a06f7..d2ae17c 100644 --- a/CoreZen/CoreZen.docc/Media.md +++ b/CoreZen/CoreZen.docc/Media.md @@ -33,6 +33,20 @@ ZENFrameRenderer *renderer = [ZENFrameRenderer frameRendererWithMediaFile:file]; Making a media file reads from disk, so for a file that may be slow to reach, make it on a background queue. Terminate the media file once you're done with it, which also stops any renders still waiting. +These renders show keyframes, which are quick to find, so a frame can come from a few seconds before the position asked for. + +### Render the Frame a Player Shows + +To capture the frame a player is showing, such as for a poster, render the exact frame at its position: + +```objc +[renderer renderExactFrameAtSeconds:player.positionSeconds width:640 height:640 completion:^(ZENRenderedFrame *frame) { + // frame.image is the frame on screen, and frame.actualSeconds its time +}]; +``` + +It decodes every frame from the keyframe before the position up to it, so it's slower than rendering a keyframe. + ### Quit Cleanly Before the app quits, call ``ZENMediaPlayer/terminateAllPlayers`` and ``ZENMediaFile/terminateAllMediaFiles``, so that every player shuts its mpv instance down, and every media file closes its file. diff --git a/CoreZen/Media/FrameRenderer.h b/CoreZen/Media/FrameRenderer.h index ea78265..4c0138b 100644 --- a/CoreZen/Media/FrameRenderer.h +++ b/CoreZen/Media/FrameRenderer.h @@ -29,12 +29,18 @@ typedef NS_ENUM(NSInteger, ZENFrameRequestType) { /// A frame rendered from a media file, with the position it was asked for and /// the position it came from. /// -/// The renderer shows the keyframe at or before the position asked for, which -/// is fast, so the frame can come from earlier. Each position is given three -/// ways: in seconds; as a fraction of the duration, from 0 to 1, despite the -/// name "percentage"; and as a timestamp, in the units of the video stream's -/// time base. A position the renderer couldn't work out, such as for a file it -/// couldn't open, is 0. +/// Most renders show the keyframe at or before the position asked for, which is +/// fast, so the frame can come from earlier. +/// ``ZENFrameRenderer/renderExactFrameAtSeconds:width:height:completion:`` +/// shows the frame at the position instead. +/// +/// Each position is given three ways: in seconds, counted from the start of the +/// file as a player counts them; as a fraction of the duration, from 0 to 1, +/// despite the name "percentage"; and as a timestamp, in the units of the video +/// stream's time base. Timestamps are the stream's own, which don't always start +/// at 0: in an MPEG transport stream, they usually start a second or so in. A +/// position the renderer couldn't work out, such as for a file it couldn't open, +/// is 0. @interface ZENRenderedFrame : NSObject /// The frame's image, or nil if it couldn't be rendered. @@ -71,7 +77,7 @@ typedef NS_ENUM(NSInteger, ZENFrameRequestType) { @class ZENMediaFile; @protocol ZENFrameRenderController; -/// Renders a media file's frames as images, for thumbnails. +/// Renders a media file's frames as images, for thumbnails and posters. /// /// Renders run one at a time, in the order they're asked for. Every render /// method calls its completion exactly once, on a background queue. A frame's @@ -86,7 +92,12 @@ typedef NS_ENUM(NSInteger, ZENFrameRequestType) { /// Makes a renderer for a media file's frames. + (instancetype)frameRendererWithMediaFile:(ZENMediaFile *)mediaFile; -/// Renders the frame at a time in seconds, at most a width and height in pixels. +/// Renders the keyframe at or before a time in seconds, at most a width and +/// height in pixels. +/// +/// A keyframe is quick to render, but can be as far before the time as the +/// video's keyframes are apart, often a few seconds. For the frame a player +/// shows at the time, use ``renderExactFrameAtSeconds:width:height:completion:``. /// /// It returns a token to cancel the render with, or nil if there's nothing to /// cancel because the media file was terminated already. The completion is @@ -96,8 +107,28 @@ typedef NS_ENUM(NSInteger, ZENFrameRequestType) { height:(NSUInteger)height completion:(ZENRenderFrameResultsBlock)completion; -/// Renders the frame at a fraction of the duration, from 0 to 1, at most a -/// width and height in pixels. +/// Renders the frame a player shows at a time in seconds, at most a width and +/// height in pixels. +/// +/// That's the first frame at or after the time, as a player shows after seeking +/// there, or the last frame if the time is past it. Given a player's position, +/// such as ``ZENMediaPlayer/positionSeconds``, it's the frame the player is +/// showing. It's slower than ``renderFrameAtSeconds:width:height:completion:``, +/// since it decodes every frame from the keyframe before the time up to it. +/// +/// It returns a token to cancel the render with, or nil if there's nothing to +/// cancel because the media file was terminated already. The completion is +/// called either way. +- (nullable ZENWorkQueueToken *)renderExactFrameAtSeconds:(double)seconds + width:(NSUInteger)width + height:(NSUInteger)height + completion:(ZENRenderFrameResultsBlock)completion; + +/// Renders the keyframe at or before a fraction of the duration, from 0 to 1, +/// at most a width and height in pixels. +/// +/// Like ``renderFrameAtSeconds:width:height:completion:``, the keyframe can be +/// a few seconds before the position. /// /// It returns a token to cancel the render with, or nil if there's nothing to /// cancel because the media file was terminated already. The completion is @@ -107,7 +138,7 @@ typedef NS_ENUM(NSInteger, ZENFrameRequestType) { height:(NSUInteger)height completion:(ZENRenderFrameResultsBlock)completion; -/// Renders frames spread evenly across the file, each at most a width and +/// Renders keyframes spread evenly across the file, each at most a width and /// height in pixels. /// /// The frames go from the start of the file, at 0, to its end, at 1, and a diff --git a/CoreZen/Media/FrameRenderer.m b/CoreZen/Media/FrameRenderer.m index e4f39ea..485f693 100644 --- a/CoreZen/Media/FrameRenderer.m +++ b/CoreZen/Media/FrameRenderer.m @@ -44,7 +44,18 @@ - (ZENWorkQueueToken *)renderFrameAtSeconds:(double)seconds frame.requestType = ZENFrameRequestTypeSeconds; frame.requestedSeconds = seconds; - return [self.frameRenderController renderFrame:frame size:NSMakeSize(width, height) completion:completion]; + return [self.frameRenderController renderFrame:frame size:NSMakeSize(width, height) exact:NO completion:completion]; +} + +- (ZENWorkQueueToken *)renderExactFrameAtSeconds:(double)seconds + width:(NSUInteger)width + height:(NSUInteger)height + completion:(ZENRenderFrameResultsBlock)completion { + ZENRenderedFrame *frame = [ZENRenderedFrame new]; + frame.requestType = ZENFrameRequestTypeSeconds; + frame.requestedSeconds = seconds; + + return [self.frameRenderController renderFrame:frame size:NSMakeSize(width, height) exact:YES completion:completion]; } - (ZENWorkQueueToken *)renderFrameAtPercentage:(double)percentage @@ -55,7 +66,7 @@ - (ZENWorkQueueToken *)renderFrameAtPercentage:(double)percentage frame.requestType = ZENFrameRequestTypePercentage; frame.requestedPercentage = percentage; - return [self.frameRenderController renderFrame:frame size:NSMakeSize(width, height) completion:completion]; + return [self.frameRenderController renderFrame:frame size:NSMakeSize(width, height) exact:NO completion:completion]; } - (ZENWorkQueueToken *)renderFrames:(NSUInteger)count diff --git a/CoreZen/Media/LibAV/LibAVRenderController.h b/CoreZen/Media/LibAV/LibAVRenderController.h index f8df97a..adba1d9 100644 --- a/CoreZen/Media/LibAV/LibAVRenderController.h +++ b/CoreZen/Media/LibAV/LibAVRenderController.h @@ -17,8 +17,11 @@ - (void)terminate; +// With exact NO, renders the keyframe at or before the frame's requested time; +// with YES, the first frame at or after it - (ZENWorkQueueToken *)renderFrame:(ZENRenderedFrame *)renderedFrame size:(NSSize)size + exact:(BOOL)exact completion:(ZENRenderFrameResultsBlock)completion; @end diff --git a/CoreZen/Media/LibAV/LibAVRenderController.m b/CoreZen/Media/LibAV/LibAVRenderController.m index dec5450..8ed7039 100644 --- a/CoreZen/Media/LibAV/LibAVRenderController.m +++ b/CoreZen/Media/LibAV/LibAVRenderController.m @@ -37,10 +37,16 @@ @interface ZENLibAVRenderController () { - (void)avInitWithCodec:(const AVCodec *)codec stream:(const AVStream *)stream; +- (BOOL)decodeRawFrame:(AVFrame *)frame + formatContext:(AVFormatContext *)formatContext + stream:(const AVStream *)stream + threshold:(int64_t)threshold; + - (BOOL)renderRawFrame:(AVFrame *)frame formatContext:(AVFormatContext *)formatContext stream:(const AVStream *)stream - timestamp:(int64_t)timestamp; + timestamp:(int64_t)timestamp + exact:(BOOL)exact; - (BOOL)resizeRawFrame:(AVFrame **)frame maxSize:(NSSize)size @@ -112,55 +118,123 @@ - (void)terminate { sws_free_context(&_scaler); } -// Decodes the first frame from the keyframe at or before timestamp -- (BOOL)renderRawFrame:(AVFrame *)frame +// A seek that lands after the time asked for is tried again further back, at most +// this many times in all, going back 1 s, then 2 s, 4 s and so on: 255 s at most +static const int kMaxSeekAttempts = 8; + +// Decodes frames into frame, from where the last seek or decode left off, until +// one's timestamp is at or after threshold, or the stream ends. frame keeps the +// last frame decoded. Returns NO if no frame was decoded. +- (BOOL)decodeRawFrame:(AVFrame *)frame formatContext:(AVFormatContext *)formatContext stream:(const AVStream *)stream - timestamp:(int64_t)timestamp { + threshold:(int64_t)threshold { int streamIndex = stream->index; - int result = av_seek_frame(formatContext, streamIndex, timestamp, AVSEEK_FLAG_BACKWARD); - if (result < 0) { - os_log_error(ZENLogMedia(), "av_seek_frame failed: %{public}s (%d)", av_err2str(result), result); - return NO; - } - - // Drop what the decoder holds from the last render. This also resets a - // decoder that was drained at the end of the file. - avcodec_flush_buffers(_codecContext); - AVPacket *packet = av_packet_alloc(); - if (!packet) { - os_log_error(ZENLogMedia(), "av_packet_alloc failed"); + AVFrame *decodedFrame = av_frame_alloc(); + if (!packet || !decodedFrame) { + os_log_error(ZENLogMedia(), "av_packet_alloc or av_frame_alloc failed"); + av_packet_free(&packet); + av_frame_free(&decodedFrame); return NO; } - // The decoder may hold frames back to put them in display order, so feed it - // packets until it has a frame for us - while ((result = avcodec_receive_frame(_codecContext, frame)) == AVERROR(EAGAIN)) { - result = av_read_frame(formatContext, packet); - if (result == AVERROR_EOF) { - // Out of packets: an empty packet tells the decoder to output the - // frames it's still holding, then report the end - result = avcodec_send_packet(_codecContext, NULL); - } else if (result >= 0) { - if (packet->stream_index == streamIndex) { - result = avcodec_send_packet(_codecContext, packet); + BOOL decoded = NO; + int result; + while (YES) { + result = avcodec_receive_frame(_codecContext, decodedFrame); + if (result == AVERROR(EAGAIN)) { + // The decoder may hold frames back to put them in display order, so + // feed it packets until it has a frame for us + result = av_read_frame(formatContext, packet); + if (result == AVERROR_EOF) { + // Out of packets: an empty packet tells the decoder to output the + // frames it's still holding, then report the end + result = avcodec_send_packet(_codecContext, NULL); + } else if (result >= 0) { + if (packet->stream_index == streamIndex) { + result = avcodec_send_packet(_codecContext, packet); + } + av_packet_unref(packet); } - av_packet_unref(packet); + if (result < 0) { + break; + } + continue; } if (result < 0) { break; } + + // Keep each frame, in case the stream ends before one reaches threshold + av_frame_unref(frame); + av_frame_move_ref(frame, decodedFrame); + decoded = YES; + int64_t frameTimestamp = frame->best_effort_timestamp; + if (frameTimestamp == AV_NOPTS_VALUE || frameTimestamp >= threshold) { + break; + } } av_packet_free(&packet); + av_frame_free(&decodedFrame); // AVERROR_EOF only means the stream ended without another frame if (result < 0 && result != AVERROR_EOF) { os_log_error(ZENLogMedia(), "Decoding a frame failed: %{public}s (%d)", av_err2str(result), result); } - return (result >= 0); + return decoded; +} + +// Decodes the first frame from the keyframe at or before timestamp. With exact, +// goes on decoding to the first frame at or after timestamp, as a player shows +// after seeking there, or the last frame if the stream ends first. +- (BOOL)renderRawFrame:(AVFrame *)frame + formatContext:(AVFormatContext *)formatContext + stream:(const AVStream *)stream + timestamp:(int64_t)timestamp + exact:(BOOL)exact { + // A position from a player, turned into a timestamp, can round to just after + // the frame it came from, so a frame this close before timestamp is at it + int64_t tolerance = MAX(1, av_rescale_q(1000, (AVRational){ 1, 1000000 }, stream->time_base)); + + // Some formats only seek roughly. An MPEG transport stream seeks by its clock, + // which runs ahead of its video's timestamps, so a seek can land a keyframe or + // more after timestamp. Then seek further back, until the first frame is at or + // before timestamp, or seeking back finds nothing earlier: the file's start. + int64_t seekTimestamp = timestamp; + int64_t backoff = MAX(1, av_rescale_q(1, (AVRational){ 1, 1 }, stream->time_base)); + int64_t previousFirstTimestamp = AV_NOPTS_VALUE; + for (int attempt = 0; attempt < kMaxSeekAttempts; attempt++) { + int result = av_seek_frame(formatContext, stream->index, seekTimestamp, AVSEEK_FLAG_BACKWARD); + if (result < 0) { + os_log_error(ZENLogMedia(), "av_seek_frame failed: %{public}s (%d)", av_err2str(result), result); + return NO; + } + + // Drop what the decoder holds from the last render. This also resets a + // decoder that was drained at the end of the file. + avcodec_flush_buffers(_codecContext); + + if (![self decodeRawFrame:frame formatContext:formatContext stream:stream threshold:INT64_MIN]) { + return NO; + } + int64_t firstTimestamp = frame->best_effort_timestamp; + if (firstTimestamp == AV_NOPTS_VALUE || firstTimestamp <= timestamp + tolerance || firstTimestamp == previousFirstTimestamp) { + break; + } + previousFirstTimestamp = firstTimestamp; + seekTimestamp -= backoff; + backoff *= 2; + } + + int64_t frameTimestamp = frame->best_effort_timestamp; + if (exact && frameTimestamp != AV_NOPTS_VALUE && frameTimestamp < timestamp - tolerance) { + // frame keeps the last frame before timestamp if the stream ends first + [self decodeRawFrame:frame formatContext:formatContext stream:stream threshold:timestamp - tolerance]; + } + return YES; } // Scales frame to fit maxSize as it's shown, with its pixels stretched to @@ -310,7 +384,8 @@ - (NSImage *)convertRawFrameToImage:(AVFrame *)frame // to render: no video stream (audio-only files), a file libav couldn't open, a // decoder that didn't open, or an unknown duration. - (void)renderFrameOnWorkQueue:(ZENRenderedFrame *)renderedFrame - size:(NSSize)size { + size:(NSSize)size + exact:(BOOL)exact { ZENLibAVInfoController *infoController = self.infoController; double durationSeconds = infoController.durationSeconds; @@ -338,16 +413,26 @@ - (void)renderFrameOnWorkQueue:(ZENRenderedFrame *)renderedFrame if (durationStreamTicks <= 0) { return; } - int64_t frameTimestamp = durationStreamTicks * renderedFrame.requestedPercentage; + // Times count from the start of the file, as players show them, which needn't + // be timestamp 0: an MPEG transport stream's often starts a second or so in. + // mpv counts from the start of the file as a whole, as libav works it out, so + // a player's position renders the frame it shows. + int64_t startStreamTicks = 0; + if (formatContext->start_time != AV_NOPTS_VALUE) { + startStreamTicks = av_rescale_q(formatContext->start_time, AV_TIME_BASE_Q, stream->time_base); + } else if (stream->start_time != AV_NOPTS_VALUE) { + startStreamTicks = stream->start_time; + } + int64_t frameTimestamp = startStreamTicks + llround(durationStreamTicks * renderedFrame.requestedPercentage); renderedFrame.requestedTimestamp = frameTimestamp; AVFrame *rawFrame = av_frame_alloc(); // Render the frame at timestamp from media file - if ([self renderRawFrame:rawFrame formatContext:formatContext stream:stream timestamp:frameTimestamp]) { + if ([self renderRawFrame:rawFrame formatContext:formatContext stream:stream timestamp:frameTimestamp exact:exact]) { renderedFrame.actualTimestamp = rawFrame->best_effort_timestamp; - renderedFrame.actualPercentage = renderedFrame.actualTimestamp / (double)durationStreamTicks; + renderedFrame.actualPercentage = (renderedFrame.actualTimestamp - startStreamTicks) / (double)durationStreamTicks; renderedFrame.actualSeconds = renderedFrame.actualPercentage * durationSeconds; // The image is turned upright last, so a quarter turn means fitting the @@ -371,6 +456,7 @@ - (void)renderFrameOnWorkQueue:(ZENRenderedFrame *)renderedFrame - (ZENWorkQueueToken *)renderFrame:(ZENRenderedFrame *)renderedFrame size:(NSSize)size + exact:(BOOL)exact completion:(ZENRenderFrameResultsBlock)completion { void (^complete)(void) = ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ @@ -380,7 +466,7 @@ - (ZENWorkQueueToken *)renderFrame:(ZENRenderedFrame *)renderedFrame ZENWorkQueueToken *token = [self.workQueue async:^(ZENWorkQueueToken *canceled) { if (!canceled.canceled) { - [self renderFrameOnWorkQueue:renderedFrame size:size]; + [self renderFrameOnWorkQueue:renderedFrame size:size exact:exact]; } complete(); }]; diff --git a/CoreZenTests/MediaTests.m b/CoreZenTests/MediaTests.m index 836fa9e..fd3c16f 100644 --- a/CoreZenTests/MediaTests.m +++ b/CoreZenTests/MediaTests.m @@ -241,6 +241,78 @@ - (void)testRenderFrameAfterRenderingTheEnd { XCTAssertEqualWithAccuracy(frame.actualSeconds, 1.0, 0.05, @"Should render the keyframe at 1 s"); } +#pragma mark - Exact frames + +- (ZENRenderedFrame *)renderFrameAtSeconds:(double)seconds + exact:(BOOL)exact + ofMediaFile:(ZENMediaFile *)mediaFile { + ZENFrameRenderer *renderer = [ZENFrameRenderer frameRendererWithMediaFile:mediaFile]; + XCTestExpectation *rendered = [self expectationWithDescription:@"frame rendered"]; + __block ZENRenderedFrame *result = nil; + ZENRenderFrameResultsBlock completion = ^(ZENRenderedFrame *frame) { + result = frame; + [rendered fulfill]; + }; + if (exact) { + [renderer renderExactFrameAtSeconds:seconds width:32 height:32 completion:completion]; + } else { + [renderer renderFrameAtSeconds:seconds width:32 height:32 completion:completion]; + } + [self waitForExpectations:@[rendered] timeout:kRenderTimeout]; + return result; +} + +// video.mp4 has 10 frames a second, and a keyframe every half second +- (void)testRenderExactFrameBetweenKeyframes { + ZENMediaFile *mediaFile = [self mediaFileNamed:@"video.mp4"]; + + ZENRenderedFrame *keyframe = [self renderFrameAtSeconds:0.7 exact:NO ofMediaFile:mediaFile]; + XCTAssertNotNil(keyframe.image); + XCTAssertEqualWithAccuracy(keyframe.actualSeconds, 0.5, 0.001, @"Should render the keyframe before"); + + ZENRenderedFrame *exact = [self renderFrameAtSeconds:0.7 exact:YES ofMediaFile:mediaFile]; + XCTAssertNotNil(exact.image); + XCTAssertEqualWithAccuracy(exact.actualSeconds, 0.7, 0.001, @"Should render the frame at 0.7 s"); + XCTAssertEqualWithAccuracy(exact.requestedSeconds, 0.7, 0.001); +} + +- (void)testRenderExactFrameFromAPlayerPosition { + ZENMediaFile *mediaFile = [self mediaFileNamed:@"video.mp4"]; + // A position can be a hair either side of the frame's time + XCTAssertEqualWithAccuracy([self renderFrameAtSeconds:0.6996 exact:YES ofMediaFile:mediaFile].actualSeconds, 0.7, 0.001); + XCTAssertEqualWithAccuracy([self renderFrameAtSeconds:0.7004 exact:YES ofMediaFile:mediaFile].actualSeconds, 0.7, 0.001); + // Between frames, the next one, as a player shows after seeking there + XCTAssertEqualWithAccuracy([self renderFrameAtSeconds:0.75 exact:YES ofMediaFile:mediaFile].actualSeconds, 0.8, 0.001); + // At a keyframe, the keyframe + XCTAssertEqualWithAccuracy([self renderFrameAtSeconds:1.0 exact:YES ofMediaFile:mediaFile].actualSeconds, 1.0, 0.001); +} + +- (void)testRenderExactFramePastTheEnd { + ZENMediaFile *mediaFile = [self mediaFileNamed:@"video.mp4"]; + ZENRenderedFrame *frame = [self renderFrameAtSeconds:5.0 exact:YES ofMediaFile:mediaFile]; + XCTAssertNotNil(frame.image); + XCTAssertEqualWithAccuracy(frame.actualSeconds, 1.9, 0.001, @"Should render the last frame"); +} + +// start-offset.ts is video.mp4 in an MPEG transport stream, whose timestamps +// start 1.58 s in, and whose first frame is at 1.6 s +- (void)testRenderTimesCountFromTheStartOfTheFile { + ZENMediaFile *mediaFile = [self mediaFileNamed:@"start-offset.ts"]; + + ZENRenderedFrame *first = [self renderFrameAtSeconds:0.0 exact:NO ofMediaFile:mediaFile]; + XCTAssertNotNil(first.image); + XCTAssertEqualWithAccuracy(first.actualSeconds, 0.023, 0.002, @"The first frame is just after the start"); + + ZENRenderedFrame *exact = [self renderFrameAtSeconds:0.7 exact:YES ofMediaFile:mediaFile]; + XCTAssertNotNil(exact.image); + XCTAssertGreaterThanOrEqual(exact.actualSeconds, 0.7); + XCTAssertLessThan(exact.actualSeconds, 0.8, @"Should render the first frame at or after 0.7 s"); + + // The frame's own time renders it again, as a player's position would + ZENRenderedFrame *again = [self renderFrameAtSeconds:exact.actualSeconds exact:YES ofMediaFile:mediaFile]; + XCTAssertEqual(again.actualTimestamp, exact.actualTimestamp); +} + #pragma mark - Rotation // The red, green and blue values of image, from 0 to 255 in sRGB, at a point given diff --git a/CoreZenTests/Resources/start-offset.ts b/CoreZenTests/Resources/start-offset.ts new file mode 100644 index 0000000000000000000000000000000000000000..affee67551a1b3c087abf345b995075bff7b850e GIT binary patch literal 25756 zcmeHv2UJwemTm)zM9D}_l9kkel5<7`L2{CuGm^6)QIZ6e3?h;x2qIZP1eBZ-o%iP6JD0Vl7ppnleNNR^yS}Qk_gA})q7)G!L}rTxg4Pa!AkYvH zG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