文件
dayu-color/大鱼调色/Plugin/DYScopeDisplayTime.h
T

19 行
1.5 KiB
Objective-C

#pragma once
#import <CoreMedia/CoreMedia.h>
// FCP can expose the exclusive input out point to custom views while its viewer
// holds the last visible frame. Only that exact boundary has a previous frame.
static inline CMTime DYScopeDisplayTime(CMTime requested,CMTime start,CMTime duration,CMTime frame){
if(!CMTIME_IS_NUMERIC(requested)||!CMTIME_IS_NUMERIC(start)||!CMTIME_IS_NUMERIC(duration)||!CMTIME_IS_NUMERIC(frame)||duration.value<=0||frame.value<=0||duration.epoch||frame.epoch)return requested;
CMTime end=CMTimeAdd(start,duration);if(!CMTIME_IS_NUMERIC(end)||CMTimeCompare(requested,end)!=0)return requested;
CMTime last=CMTimeSubtract(end,frame);return CMTimeCompare(last,start)<0?start:last;
}
#import <FxPlug/FxPlugSDK.h>
// Caller must already hold a custom parameter action. OSC events keep their
// provided time; this only normalizes the custom-view clock used to guard them.
static inline CMTime DYHostDisplayedFrameTime(id<PROAPIAccessing> host,CMTime current){
id<FxTimingAPI_v4>timing=[host apiForProtocol:@protocol(FxTimingAPI_v4)];CMTime start=kCMTimeInvalid,duration=kCMTimeInvalid,frame=kCMTimeInvalid;
if([timing respondsToSelector:@selector(startTimeOfInputToFilter:)]&&[timing respondsToSelector:@selector(durationTimeOfInputToFilter:)]&&[timing respondsToSelector:@selector(frameDuration:)]){[timing startTimeOfInputToFilter:&start];[timing durationTimeOfInputToFilter:&duration];[timing frameDuration:&frame];}
return DYScopeDisplayTime(current,start,duration,frame);
}