OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 [DartPackage="mojo_services"] |
| 6 module mojo; |
| 7 |
| 8 // TODO(dalesat): Move out of media to somewhere more generic. |
| 9 |
| 10 // Represents the relationship between and subject timeline and a reference |
| 11 // timeline. |
| 12 // |
| 13 // To translate a reference timeline value r to the subject timeline, apply |
| 14 // the following formula: |
| 15 // |
| 16 // (r - reference_time) * subject_delta / reference_delta + subject_time |
| 17 // |
| 18 // To translate a subject timeline value s to the reference timeline, apply |
| 19 // this formula provided subject_delta isn't zero: |
| 20 // |
| 21 // (s - subject_time) * reference_delta / subject_delta + reference_time |
| 22 // |
| 23 struct TimelineTransform { |
| 24 // A value from the reference timeline that correlates to timeline_time. |
| 25 int64 reference_time = 0; |
| 26 |
| 27 // A value from the subject timeline that correlates to reference_time. |
| 28 int64 subject_time = 0; |
| 29 |
| 30 // The change in the reference timeline corresponding to timeline_delta. |
| 31 // Cannnot be zero. |
| 32 uint32 reference_delta = 1; |
| 33 |
| 34 // The change in the subject timeline corresponding to reference_delta. |
| 35 uint32 subject_delta = 0; |
| 36 }; |
| 37 |
| 38 // A push-mode consumer of timeline updates. |
| 39 interface TimelineConsumer { |
| 40 const int64 kUnspecifiedTime = 0x7fffffffffffffff; |
| 41 |
| 42 // Sets the timeline transform at the indicated effective time. Exactly one |
| 43 // of the effective_*_time values must be kUnspecifiedTime. |
| 44 // 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 // kUnspecifiedTime to indicate that the new transform subject_time should |
| 47 // 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 // effective time or when a pending operation is cancelled due to a |
| 50 // subsequent call, in which case the 'completed' value is false. |
| 51 SetTimelineTransform( |
| 52 int64 subject_time, |
| 53 uint32 reference_delta, |
| 54 uint32 subject_delta, |
| 55 int64 effective_reference_time, |
| 56 int64 effective_subject_time) => (bool completed); |
| 57 }; |
OLD | NEW |