Show synchronized frame previews and progress for stamp and mask tracking
这个提交包含在:
1 父节点
7b6a3106ca
当前提交
687a366e1c
11 个文件已更改
+363
-17
没有与搜索条件相匹配的文件
@@ -6,7 +6,7 @@
|
||||
- (void)tearDownToolHost {
|
||||
[_viewerParameterBridge invalidate];[_viewerParameterBridge release];_viewerParameterBridge=nil;
|
||||
[_toolAnalysisTimer invalidate];[_toolAnalysisTimer release];@synchronized(DYToolCanvasSessions()){if(_toolSession)[DYToolCanvasSessions()removeObjectForKey:_toolSession];}
|
||||
[_toolCanvasDocument release];[_toolSession release];[_selectedToolNode release];[_selectedToolMask release];[_toolCanvasDraft release];[_toolCanvasOriginal release];[_trackingNode release];[_trackingMaskID release];[_trackingFrozenMask release];[_trackingCandidate release];[_trackingSamples release];[_trackingMessage release];[_toolCaptureDevices release];
|
||||
[_toolCanvasDocument release];[_toolSession release];[_selectedToolNode release];[_selectedToolMask release];[_toolCanvasDraft release];[_toolCanvasOriginal release];[_trackingNode release];[_trackingMaskID release];[_trackingFrozenMask release];[_trackingCandidate release];[_trackingSamples release];[_trackingMessage release];[_trackingPreviewFrame release];[_toolCaptureDevices release];
|
||||
}
|
||||
- (void)adoptToolCanvasDocument:(NSDictionary*)document {
|
||||
if(!document)return;@synchronized(self){[_toolCanvasDocument release];_toolCanvasDocument=[document copy];if([self toolMask:_selectedToolMask node:_selectedToolNode document:document])return;NSString *node=nil,*maskID=nil;for(NSString *type in DYToolTypes())for(NSDictionary *mask in DYMasksForTool(document,[@"base:" stringByAppendingString:type]))if(!node&&[mask[@"enabled"]boolValue]){node=[@"base:" stringByAppendingString:type];maskID=mask[@"id"];}for(NSDictionary *layer in document[@"layers"])for(NSDictionary *mask in DYMasksForTool(document,layer[@"id"]))if(!node&&[mask[@"enabled"]boolValue]){node=layer[@"id"];maskID=mask[@"id"];}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[maskID copy];}
|
||||
@@ -19,6 +19,37 @@
|
||||
- (void)toolStatus:(NSString*)message {
|
||||
NSString *node=[[_trackingNode?:_selectedToolNode copy]autorelease],*mask=[[_trackingMaskID?:_selectedToolMask copy]autorelease];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrackingStatus" object:self->_apiManager userInfo:@{@"node":node?:@"",@"mask":mask?:@"",@"message":message?:@""}];});
|
||||
}
|
||||
- (void)postTrackingPreview:(NSDictionary*)frame active:(BOOL)active message:(NSString*)message {
|
||||
NSMutableDictionary *info=[NSMutableDictionary dictionaryWithDictionary:frame?:@{}];
|
||||
info[@"node"]=_trackingNode?:@"";info[@"mask"]=_trackingMaskID?:@"";
|
||||
info[@"tracking"]=@(active);info[@"message"]=message;
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrackingStatus" object:_apiManager userInfo:info];
|
||||
}
|
||||
- (void)publishTrackingPreview {
|
||||
NSDictionary *frame=nil;
|
||||
@synchronized(self){
|
||||
frame=[_trackingPreviewFrame autorelease];_trackingPreviewFrame=nil;_trackingPreviewQueued=NO;
|
||||
}
|
||||
if(!frame||!_trackingActive.load())return;
|
||||
NSUInteger done=[frame[@"completed"]unsignedIntegerValue],total=[frame[@"total"]unsignedIntegerValue];
|
||||
NSString *direction=[frame[@"backward"]boolValue]?@"反向":@"正向";
|
||||
NSString *message=total?[NSString stringWithFormat:@"%@ · %lu / %lu 帧 · %.0f%%",direction,(unsigned long)done,(unsigned long)total,100.*done/total]
|
||||
:[NSString stringWithFormat:@"%@ · 已分析 %lu 帧",direction,(unsigned long)done];
|
||||
[self postTrackingPreview:frame active:YES message:message];
|
||||
}
|
||||
- (void)queueTrackingPreview:(NSDictionary*)frame {
|
||||
uint64_t generation=_trackingGeneration;
|
||||
@synchronized(self){
|
||||
[_trackingPreviewFrame release];_trackingPreviewFrame=[frame copy];
|
||||
if(_trackingPreviewQueued)return;
|
||||
_trackingPreviewQueued=YES;
|
||||
}
|
||||
// Keep one coherent packet pending. A slow UI may skip intermediate updates
|
||||
// without ever pairing geometry from one frame with pixels from another.
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,NSEC_PER_SEC/30),dispatch_get_main_queue(),^{
|
||||
if(self->_trackingGeneration==generation)[self publishTrackingPreview];
|
||||
});
|
||||
}
|
||||
- (void)toolCanvasSelection:(NSNotification*)notification {
|
||||
NSString *node=notification.userInfo[@"node"],*mask=notification.userInfo[@"mask"];if(!node||!mask)return;NSDictionary *document=notification.userInfo[@"document"];if(document&&DYValidToolDocument(document)){DYToolDocument *immutable=[[[DYToolDocument alloc]init]autorelease];immutable.document=document;[self adoptToolCanvasDocument:immutable.document];}os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_selected");
|
||||
@synchronized(self){if(DYSharedMaskWithID(_toolCanvasDocument,mask))node=@"shared";if(_trackingActive.load()&&(![_trackingNode isEqual:node]||![_trackingMaskID isEqual:mask])){_trackingCancelled.store(true);_trackingDiscard=YES;}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[mask copy];_toolCanvasHidden=[notification.userInfo[@"hidden"]boolValue];_toolDrawingPen=[notification.userInfo[@"draw"]boolValue];NSDictionary *shape=[self toolMask:mask node:node document:_toolCanvasDocument];DYMaskParameters shapeParameters=DYMaskAtTime(shape,kCMTimeInvalid);_toolDrawingShape=shape&&shapeParameters.kind<2&&[notification.userInfo[@"drawShape"]boolValue];if(_toolDrawingShape)_toolDrawingPen=NO;++_toolCanvasRevision;_toolCanvasEditTime=kCMTimeInvalid;_toolDragPart=0;_toolCanvasHasHover=NO;[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;}[self postToolCanvasStatus:_toolDrawingPen?@"钢笔:点击放点,拖出曲柄;点首节点或完成绘制闭合。":_toolDrawingShape?@"在画面按下并拖出蒙版区域;Esc 取消。":@"已选中本层蒙版"];
|
||||
@@ -98,9 +129,20 @@
|
||||
std::min(8.f,[source[3] floatValue]*_trackingStampMotion.sourceScaleY),0};
|
||||
}
|
||||
_trackingReferenceTime=time;_trackingSeed=seed;_trackingBackward=direction<0;_trackingBoth=direction==0;_trackingSingle=std::abs((int)direction)==2;_trackingDiscard=NO;_trackingCancelled.store(false);_trackingFinishing.store(false);_trackingActive.store(true);++_trackingGeneration;_trackingStarted=NSProcessInfo.processInfo.systemUptime;
|
||||
_trackingPreviewInputRange=kCMTimeRangeInvalid;_trackingPreviewTotal=_trackingPreviewCompleted=0;
|
||||
@synchronized(self){[_trackingPreviewFrame release];_trackingPreviewFrame=nil;_trackingPreviewQueued=NO;}
|
||||
os_log(OS_LOG_DEFAULT,"dayu_tool_track_start direction=%{public}ld reference=%{public}.6f cached=%{public}d",(long)direction,CMTimeGetSeconds(time),_trackingReferenceFrame.valid());
|
||||
NSError *error=nil;BOOL started=_trackingBackward?[analysis startBackwardAnalysis:kFxAnalysisLocation_GPU error:&error]:[analysis startForwardAnalysis:kFxAnalysisLocation_GPU error:&error];if(!started){_trackingActive.store(false);[self toolStatus:error.localizedDescription?:@"宿主未启动逐帧分析"];return;}
|
||||
[self toolStatus:@"正在读取宿主源帧并跟踪…"];if(!_toolAnalysisTimer)_toolAnalysisTimer=[[NSTimer scheduledTimerWithTimeInterval:.3 target:self selector:@selector(pollToolAnalysis:) userInfo:nil repeats:YES]retain];
|
||||
if(_trackingSingle)[self toolStatus:@"正在读取下一张源帧…"];
|
||||
else{
|
||||
uint64_t generation=_trackingGeneration;
|
||||
dispatch_async(dispatch_get_main_queue(),^{
|
||||
if(self->_trackingGeneration!=generation||!self->_trackingActive.load())return;
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYColorWorkspaceRequested" object:self->_apiManager userInfo:@{@"page":@"tracking"}];
|
||||
[self postTrackingPreview:nil active:YES message:@"正在读取宿主源帧…"];
|
||||
});
|
||||
}
|
||||
if(!_toolAnalysisTimer)_toolAnalysisTimer=[[NSTimer scheduledTimerWithTimeInterval:.3 target:self selector:@selector(pollToolAnalysis:) userInfo:nil repeats:YES]retain];
|
||||
}@finally{[a endAction:self];}
|
||||
}
|
||||
- (void)pollToolAnalysis:(NSTimer*)timer {
|
||||
@@ -116,10 +158,20 @@
|
||||
}
|
||||
- (BOOL)desiredAnalysisTimeRange:(CMTimeRange*)out forInputWithTimeRange:(CMTimeRange)input error:(NSError**)error {
|
||||
CMTime end=CMTimeRangeGetEnd(input),ref=_trackingReferenceTime,step=_trackingFrameDuration;if(!CMTIME_IS_NUMERIC(input.start)||!CMTIME_IS_NUMERIC(end)||!CMTIME_IS_NUMERIC(ref)||ref.epoch!=input.start.epoch||ref.epoch!=end.epoch||CMTimeCompare(ref,input.start)<0||CMTimeCompare(ref,end)>=0||!CMTIME_IS_NUMERIC(step)||step.value<=0)return [self stopToolAnalysis:@"跟踪起点或帧长无效" error:error];
|
||||
_trackingPreviewInputRange=input;
|
||||
CMTime lo=_trackingBackward?input.start:ref,hi=_trackingBackward?CMTimeAdd(ref,step):end;if(_trackingSingle){if(_trackingBackward){lo=CMTimeSubtract(ref,step);if(CMTimeCompare(lo,input.start)<0)lo=input.start;}else hi=CMTimeAdd(ref,CMTimeMultiply(step,2));}if(CMTimeCompare(hi,end)>0)hi=end;if(_trackingBackward&&CMTimeCompare(ref,input.start)==0&&!_trackingBoth){[_trackingMessage release];_trackingMessage=[@"已到片段边界,未产生新轨迹" copy];}*out=CMTimeRangeFromTimeToTime(lo,hi);return out->duration.value>0;
|
||||
}
|
||||
- (BOOL)setupAnalysisForTimeRange:(CMTimeRange)range frameDuration:(CMTime)duration error:(NSError**)error {
|
||||
if(!CMTIME_IS_NUMERIC(duration)||duration.value<=0||duration.epoch!=0)return [self stopToolAnalysis:@"宿主分析帧长无效" error:error];_trackingFrameDuration=duration;_trackingPreviousTime=kCMTimeInvalid;_trackingFlip=NO;[_trackingSamples removeAllObjects];
|
||||
if(!_trackingSingle&&CMTIMERANGE_IS_VALID(_trackingPreviewInputRange)){
|
||||
double step=CMTimeGetSeconds(duration);
|
||||
double forward=CMTimeGetSeconds(CMTimeSubtract(CMTimeRangeGetEnd(_trackingPreviewInputRange),_trackingReferenceTime))/step;
|
||||
double backward=CMTimeGetSeconds(CMTimeSubtract(_trackingReferenceTime,_trackingPreviewInputRange.start))/step;
|
||||
// Backward includes the reference frame. A bidirectional run counts it once.
|
||||
forward=std::max(1.,std::ceil(forward-1e-7));backward=std::floor(backward+1e-7);
|
||||
double total=_trackingBoth?forward+backward:_trackingBackward?backward+1:forward;
|
||||
_trackingPreviewTotal=NSUInteger(std::clamp(total,1.,double(INT_MAX)));
|
||||
}
|
||||
std::vector<dy::FlowPoint>polygon;NSData *nodes=_trackingCandidate[@"nodes"];if(_trackingSeed.kind==DYMaskBezier){auto path=dyFlattenMask((const DYBezierNode*)nodes.bytes,nodes.length/sizeof(DYBezierNode));for(int i=0;i<path.count;i++)polygon.push_back({path.x[i],path.y[i]});}else if(_trackingSeed.kind==DYMaskRectangle)polygon={{-.5f,-.5f},{.5f,-.5f},{.5f,.5f},{-.5f,.5f}};else for(int i=0;i<128;i++){float angle=i*(2.f*M_PI/128);polygon.push_back({.5f*std::cos(angle),.5f*std::sin(angle)});}
|
||||
if(_trackingStampMotion.active)_stampSourceTracker.setMask(polygon);
|
||||
_toolTracker.setMask(std::move(polygon));return YES;
|
||||
@@ -142,7 +194,9 @@
|
||||
if(!_trackingActive.load()||_trackingFinishing.load()){if(error)*error=[NSError errorWithDomain:FxPlugErrorDomain code:kFxError_UserCancelled userInfo:nil];return NO;}_trackingInFrame.store(true);@try{
|
||||
if(_trackingCancelled.load())return [self finishToolAnalysis:@"已取消;保留最后连续可信轨迹" error:error];if(_trackingSingle&&_trackingSamples.count>=2)return [self finishToolAnalysis:nil error:error];if(_trackingSamples.count>=DYToolKeyLimit)return [self finishToolAnalysis:@"轨迹已到数量上限,保留已完成部分" error:error];
|
||||
CMTime expected=CMTIME_IS_NUMERIC(_trackingPreviousTime)?(_trackingBackward?CMTimeSubtract(_trackingPreviousTime,_trackingFrameDuration):CMTimeAdd(_trackingPreviousTime,_trackingFrameDuration)):_trackingReferenceTime;if(!CMTIME_IS_NUMERIC(time)||time.epoch!=expected.epoch||CMTimeCompare(time,expected)!=0)return [self stopToolAnalysis:@"宿主帧序列不连续,停在最后可信帧" error:error];
|
||||
dy::GrayFrame frame=[self toolGrayFrame:tile error:error];if(!frame.valid())return [self stopToolAnalysis:@"宿主未返回完整源画面" error:error];
|
||||
NSDictionary *preview=nil;
|
||||
dy::GrayFrame frame=[self toolGrayFrame:tile preview:_trackingSingle?nullptr:&preview error:error];
|
||||
if(!frame.valid())return [self stopToolAnalysis:@"宿主未返回完整源画面" error:error];
|
||||
if(!_trackingSamples.count){if(_trackingReferenceFrame.valid()&&frame.width==_trackingReferenceFrame.width&&frame.height==_trackingReferenceFrame.height){double same=0,flip=0;size_t count=0;for(int y=0;y<frame.height;y+=8)for(int x=0;x<frame.width;x+=8){float p=frame.pixels[y*frame.width+x];same+=fabs(p-_trackingReferenceFrame.pixels[y*frame.width+x]);flip+=fabs(p-_trackingReferenceFrame.pixels[(frame.height-1-y)*frame.width+x]);count++;}same/=MAX(size_t(1),count);flip/=MAX(size_t(1),count);_trackingFlip=flip<.035&&flip+.008<same&&flip<same*.8;}os_log(OS_LOG_DEFAULT,"dayu_tool_track_seed width=%{public}d height=%{public}d flip=%{public}d time=%{public}.6f",frame.width,frame.height,(int)_trackingFlip,CMTimeGetSeconds(time));}
|
||||
if(_trackingFlip)for(int y=0;y<frame.height/2;y++)for(int x=0;x<frame.width;x++)std::swap(frame.pixels[y*frame.width+x],frame.pixels[(frame.height-1-y)*frame.width+x]);
|
||||
BOOL stamp=_trackingStampMotion.active;
|
||||
@@ -183,9 +237,28 @@
|
||||
}
|
||||
if(!dyValidMaskParameters(p))return [self stopToolAnalysis:@"跟踪变换无效,未写入错误结果" error:error];
|
||||
[_trackingSamples addObject:DYStampKey(time,p,NO,confidence,motion)];_trackingPreviousTime=time;
|
||||
if(!_trackingSingle){
|
||||
if(!(_trackingBoth&&_trackingBackward&&_trackingSamples.count==1&&_trackingPreviewCompleted))++_trackingPreviewCompleted;
|
||||
DYMaskParameters covered=p;
|
||||
NSMutableDictionary *packet=[NSMutableDictionary dictionaryWithDictionary:preview?:@{}];
|
||||
if(stamp){
|
||||
covered.width*=motion.targetScaleX;covered.height*=motion.targetScaleY;
|
||||
DYMaskParameters sampled=covered;
|
||||
sampled.centerX=source.cx;sampled.centerY=source.cy;
|
||||
sampled.width=_trackingStampSourceSeed.width*source.scaleX;
|
||||
sampled.height=_trackingStampSourceSeed.height*source.scaleY;
|
||||
packet[@"sourceShape"]=[NSData dataWithBytes:&sampled length:sizeof(sampled)];
|
||||
}
|
||||
packet[@"shape"]=[NSData dataWithBytes:&covered length:sizeof(covered)];
|
||||
packet[@"nodes"]=_trackingFrozenMask[@"nodes"];
|
||||
packet[@"flip"]=@(_trackingFlip);packet[@"time"]=@(CMTimeGetSeconds(time));
|
||||
packet[@"completed"]=@(_trackingPreviewCompleted);
|
||||
packet[@"total"]=@(MAX(_trackingPreviewTotal,_trackingPreviewCompleted));
|
||||
packet[@"backward"]=@(_trackingBackward);
|
||||
[self queueTrackingPreview:packet];
|
||||
}
|
||||
if(_trackingSamples.count==1||_trackingSamples.count%15==0){
|
||||
if(stamp)os_log(OS_LOG_DEFAULT,"dayu_stamp_track_pair time=%{public}.6f target=%{public}.5f,%{public}.5f source=%{public}.5f,%{public}.5f target_scale=%{public}.4f,%{public}.4f source_scale=%{public}.4f,%{public}.4f",CMTimeGetSeconds(time),target.cx,target.cy,source.cx,source.cy,motion.targetScaleX,motion.targetScaleY,motion.sourceScaleX,motion.sourceScaleY);
|
||||
[self toolStatus:[NSString stringWithFormat:stamp?@"已跟踪取样与覆盖 %lu 帧 · 置信度 %.0f%%":@"已分析 %lu 帧 · 置信度 %.0f%%",(unsigned long)_trackingSamples.count,confidence*100]];
|
||||
}
|
||||
return YES;
|
||||
}@finally{_trackingInFrame.store(false);}
|
||||
@@ -196,12 +269,15 @@
|
||||
if(_trackingStampMotion.active)_stampSourceTracker.stop();
|
||||
uint64_t generation=_trackingGeneration;BOOL second=_trackingBoth&&!_trackingBackward&&!_trackingCancelled.load()&&!_trackingDiscard;
|
||||
dispatch_async(dispatch_get_main_queue(),^{if(self->_trackingGeneration!=generation)return;
|
||||
if(!self->_trackingSingle)[self publishTrackingPreview];
|
||||
if(second){self->_trackingBackward=YES;self->_trackingFinishing.store(false);self->_trackingStarted=NSProcessInfo.processInfo.systemUptime;id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];BOOL started=NO;if(a){[a startAction:self];@try{started=[[self->_apiManager apiForProtocol:@protocol(FxAnalysisAPI)]startBackwardAnalysis:kFxAnalysisLocation_GPU error:nil];}@finally{[a endAction:self];}}if(started){[self toolStatus:@"正向完成,正在从同一起点反向跟踪…"];return;}self->_trackingFinishing.store(true);}
|
||||
BOOL hasResults=![self->_trackingCandidate[@"keys"]isEqual:self->_trackingFrozenMask[@"keys"]];NSString *message=self->_trackingMessage?:[NSString stringWithFormat:@"%@跟踪完成 · %lu 个轨迹键",self->_trackingBoth?@"双向":(self->_trackingBackward?@"反向":@"正向"),(unsigned long)[self->_trackingCandidate[@"keys"]count]];
|
||||
if(hasResults&&!self->_trackingDiscard){id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(a){[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,a.currentTime).document);NSString *node=DYSharedMaskWithID(doc,self->_trackingMaskID)?@"shared":self->_trackingNode;NSMutableDictionary *mask=[self toolMask:self->_trackingMaskID node:node document:doc];if(mask&&[mask isEqual:self->_trackingFrozenMask]){self->_trackingCandidate[@"status"]=message;[mask setDictionary:self->_trackingCandidate];id<FxUndoAPI>undo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:mask[@"stampSource"]?@"仿制图章跟踪":@"蒙版区域跟踪"];BOOL written=DYWriteTools(self->_apiManager,doc,a.currentTime);[undo endUndoGroup];if(!written)message=@"宿主未接受轨迹,原蒙版已保留";}else message=@"目标工具或蒙版已更改,已丢弃过期跟踪结果";}@finally{[a endAction:self];}}}
|
||||
CMTime stepTime=self->_trackingPreviousTime;BOOL advance=self->_trackingSingle&&changed&&!self->_trackingDiscard&&!self->_trackingCancelled.load()&&CMTIME_IS_NUMERIC(stepTime);
|
||||
@synchronized(self->_toolCaptureDevices){for(NSMutableDictionary *entry in self->_toolCaptureDevices.allValues)[entry removeObjectsForKeys:@[@"encoded",@"bytes",@"buffer"]];}
|
||||
self->_trackingActive.store(false);if(advance){id<FxCustomParameterActionAPI_v4>seek=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(seek){[seek startAction:self];@try{id<FxTimingAPI_v4>timing=[self->_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];CMTime timelineTime=kCMTimeInvalid;[timing timelineTime:&timelineTime fromInputTime:stepTime];id<FxCommandAPI_v2>command=[self->_apiManager apiForProtocol:@protocol(FxCommandAPI_v2)];if(CMTIME_IS_NUMERIC(timelineTime)){NSError *seekError=nil;BOOL moved=[command movePlayheadToTime:timelineTime error:&seekError];if(!moved)os_log(OS_LOG_DEFAULT,"dayu_tool_track_seek timeline=%{public}.6f code=%{public}ld",CMTimeGetSeconds(timelineTime),(long)seekError.code);}else message=[message stringByAppendingString:@";宿主未提供有效播放头位置"];}@finally{[seek endAction:self];}}}[self->_toolAnalysisTimer invalidate];[self->_toolAnalysisTimer release];self->_toolAnalysisTimer=nil;[self toolStatus:message];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
@synchronized(self->_toolCaptureDevices){for(NSMutableDictionary *entry in self->_toolCaptureDevices.allValues)[entry removeObjectsForKeys:@[@"encoded",@"bytes",@"buffer",@"previewBuffer"]];}
|
||||
self->_trackingActive.store(false);if(advance){id<FxCustomParameterActionAPI_v4>seek=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(seek){[seek startAction:self];@try{id<FxTimingAPI_v4>timing=[self->_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];CMTime timelineTime=kCMTimeInvalid;[timing timelineTime:&timelineTime fromInputTime:stepTime];id<FxCommandAPI_v2>command=[self->_apiManager apiForProtocol:@protocol(FxCommandAPI_v2)];if(CMTIME_IS_NUMERIC(timelineTime)){NSError *seekError=nil;BOOL moved=[command movePlayheadToTime:timelineTime error:&seekError];if(!moved)os_log(OS_LOG_DEFAULT,"dayu_tool_track_seek timeline=%{public}.6f code=%{public}ld",CMTimeGetSeconds(timelineTime),(long)seekError.code);}else message=[message stringByAppendingString:@";宿主未提供有效播放头位置"];}@finally{[seek endAction:self];}}}[self->_toolAnalysisTimer invalidate];[self->_toolAnalysisTimer release];self->_toolAnalysisTimer=nil;[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
if(self->_trackingSingle)[self toolStatus:message];
|
||||
else [self postTrackingPreview:nil active:NO message:message];
|
||||
});return YES;
|
||||
}
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户