Flutter macOS Embedder
FlutterTimeConverter Class Reference

Converts between the time representation used by Flutter Engine and CAMediaTime. More...

#import <FlutterTimeConverter.h>

Inheritance diagram for FlutterTimeConverter:

Instance Methods

(instancetype) - initWithEngine:
 
(uint64_t) - CAMediaTimeToEngineTime:
 
(CFTimeInterval) - engineTimeToCAMediaTime:
 

Detailed Description

Converts between the time representation used by Flutter Engine and CAMediaTime.

Definition at line 13 of file FlutterTimeConverter.h.

Method Documentation

◆ CAMediaTimeToEngineTime:

- (uint64_t) CAMediaTimeToEngineTime: (CFTimeInterval)  time

Definition at line 26 of file FlutterTimeConverter.mm.

26  :(CFTimeInterval)time {
27  FlutterEngine* engine = _engine;
28  if (!engine) {
29  return 0;
30  }
31  return (time - CACurrentMediaTime()) * NSEC_PER_SEC + engine.embedderAPI.GetCurrentTime();
32 }

◆ engineTimeToCAMediaTime:

- (CFTimeInterval) engineTimeToCAMediaTime: (uint64_t)  time

Definition at line 34 of file FlutterTimeConverter.mm.

34  :(uint64_t)time {
35  FlutterEngine* engine = _engine;
36  if (!engine) {
37  return 0;
38  }
39  return (static_cast<int64_t>(time) - static_cast<int64_t>(engine.embedderAPI.GetCurrentTime())) /
40  static_cast<double>(NSEC_PER_SEC) +
41  CACurrentMediaTime();
42 }

◆ initWithEngine:

- (instancetype) initWithEngine: (FlutterEngine*)  engine

Definition at line 18 of file FlutterTimeConverter.mm.

18  :(FlutterEngine*)engine {
19  self = [super init];
20  if (self) {
21  _engine = engine;
22  }
23  return self;
24 }

The documentation for this class was generated from the following files:
FlutterEngine
Definition: FlutterEngine.h:31