OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
6 module mojo; | 6 module mojo; |
7 | 7 |
8 // TODO(dalesat): Move out of media to somewhere more generic. | 8 // TODO(dalesat): Move out of media to somewhere more generic. |
9 | 9 |
| 10 // Used as a placefolder for unspecified time values. |
| 11 const int64 kUnspecifiedTime = 0x7fffffffffffffff; |
| 12 |
10 // Represents the relationship between and subject timeline and a reference | 13 // Represents the relationship between and subject timeline and a reference |
11 // timeline. | 14 // timeline. |
12 // | 15 // |
13 // To translate a reference timeline value r to the subject timeline, apply | 16 // To translate a reference timeline value r to the subject timeline, apply |
14 // the following formula: | 17 // the following formula: |
15 // | 18 // |
16 // (r - reference_time) * subject_delta / reference_delta + subject_time | 19 // (r - reference_time) * subject_delta / reference_delta + subject_time |
17 // | 20 // |
18 // To translate a subject timeline value s to the reference timeline, apply | 21 // To translate a subject timeline value s to the reference timeline, apply |
19 // this formula provided subject_delta isn't zero: | 22 // this formula provided subject_delta isn't zero: |
(...skipping 10 matching lines...) Expand all Loading... |
30 // The change in the reference timeline corresponding to subject_delta. | 33 // The change in the reference timeline corresponding to subject_delta. |
31 // Cannnot be zero. | 34 // Cannnot be zero. |
32 uint32 reference_delta = 1; | 35 uint32 reference_delta = 1; |
33 | 36 |
34 // The change in the subject timeline corresponding to reference_delta. | 37 // The change in the subject timeline corresponding to reference_delta. |
35 uint32 subject_delta = 0; | 38 uint32 subject_delta = 0; |
36 }; | 39 }; |
37 | 40 |
38 // A push-mode consumer of timeline updates. | 41 // A push-mode consumer of timeline updates. |
39 interface TimelineConsumer { | 42 interface TimelineConsumer { |
40 const int64 kUnspecifiedTime = 0x7fffffffffffffff; | |
41 | |
42 // Sets the timeline transform at the indicated effective time. Exactly one | 43 // Sets the timeline transform at the indicated effective time. Exactly one |
43 // of the effective_*_time values must be kUnspecifiedTime. | 44 // of the effective_*_time values must be kUnspecifiedTime. |
44 // effective_subject_time can only be specified if the current subject_delta | 45 // effective_subject_time can only be specified if the current subject_delta |
45 // isn’t zero. reference_delta may not be zero. subject_time may be | 46 // isn’t zero. reference_delta may not be zero. subject_time may be |
46 // kUnspecifiedTime to indicate that the new transform subject_time should | 47 // kUnspecifiedTime to indicate that the new transform subject_time should |
47 // be inferred from the effective time. The new transform reference_time is | 48 // be inferred from the effective time. The new transform reference_time is |
48 // always inferred from the effective time. The callback is called at the | 49 // always inferred from the effective time. The callback is called at the |
49 // effective time or when a pending operation is cancelled due to a | 50 // effective time or when a pending operation is cancelled due to a |
50 // subsequent call, in which case the 'completed' value is false. | 51 // subsequent call, in which case the 'completed' value is false. |
51 SetTimelineTransform( | 52 SetTimelineTransform( |
52 int64 subject_time, | 53 int64 subject_time, |
53 uint32 reference_delta, | 54 uint32 reference_delta, |
54 uint32 subject_delta, | 55 uint32 subject_delta, |
55 int64 effective_reference_time, | 56 int64 effective_reference_time, |
56 int64 effective_subject_time) => (bool completed); | 57 int64 effective_subject_time) => (bool completed); |
57 }; | 58 }; |
OLD | NEW |