开发者

Movie time from QTVisualContext given CVTimeStamp in CAOpenGLLayer rendering method?

开发者 https://www.devze.com 2022-12-19 09:26 出处:网络
I\'m using the standard CoreVideo Display Link + QTVisualContext to render a QuickTime movie into an NSOpenGLView subclass. I would now like to synchronize a timeline view with movie playback. The tim

I'm using the standard CoreVideo Display Link + QTVisualContext to render a QuickTime movie into an NSOpenGLView subclass. I would now like to synchronize a timeline view with movie playback. The timeline view is implemented as a layer hosting view, hosting a CAOpenGLLayer subclass that renders the timeline. I chose this architecture because the CAOpenGLLayer gets a CVTimeStamp for rendering. I thought that I could use this time stamp to get the current movie time from the QTVisualContext.

The only way I've found to get the movie time from a CVTimeStamp is to copy the QTVisualContext into a CVImageBuffer (using QTVisualContextCopyImageForTime) and then retrieve the movie time from the CVImageBuffer's kCVBufferMovieTimeKey attachment. Obviously, this seems like a little overkill since I don't need the image. Furthermore, the documentation for QTVisualContextCopyImageForTime indicates that asking for a time before the a previous call is not allowed. Since I can't guarantee the order of events between the CoreAnimation thread and the CoreVideo display link thread, I've run into a dead end.

It seems that CVDis开发者_如何学JAVAplayLinkTranslateTime should be able to translate the CVTimeStamp I get in the CAOpenGLLayer rendering method into a movie time and movie time base, but I'm not sure how to relate this (Display Link) time to the QuickTime movie's time. I don't necessarily know when the movie's time 0 is relative to the Display Link movie time.

So, is there a way to get the movie time for a CVTimeStamp directly from the QTVisualContext (or anywhere else in the QTMovie->QTVisualContext->Display Link->...) pathway?

0

精彩评论

暂无评论...
验证码 换一张
取 消