| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.media; | 6 module mojo.media; |
| 7 | 7 |
| 8 // TimelineQuad | 8 // TimelineQuad |
| 9 // TODO(dalesat): Rename reference -> presentation. | 9 // TODO(dalesat): Rename reference -> presentation. |
| 10 // TODO(dalesat): Rename target -> reference. | 10 // TODO(dalesat): Rename target -> reference. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Given that r and t represent the same instant in time (in a single frame of | 27 // Given that r and t represent the same instant in time (in a single frame of |
| 28 // reference) | 28 // reference) |
| 29 // | 29 // |
| 30 // t = f(r) = (((r - ref_offset) * tgt_delta) / ref_delta) + tgt_offset | 30 // t = f(r) = (((r - ref_offset) * tgt_delta) / ref_delta) + tgt_offset |
| 31 // r = F(t) = (((t - tgt_offset) * ref_delta) / tgt_delta) + ref_offset | 31 // r = F(t) = (((t - tgt_offset) * ref_delta) / tgt_delta) + ref_offset |
| 32 // | 32 // |
| 33 // See also... | 33 // See also... |
| 34 // mojo/services/media/common/linear_transform.h | 34 // mojo/services/media/common/linear_transform.h |
| 35 // | 35 // |
| 36 struct TimelineQuad { | 36 struct TimelineQuad { |
| 37 int64 reference_offset = 0; | 37 int64 reference_offset = 0; |
| 38 int64 target_offset = 0; | 38 int64 target_offset = 0; |
| 39 int32 reference_delta = 0; | 39 int32 reference_delta = 0; |
| 40 uint32 target_delta = 1; | 40 uint32 target_delta = 1; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // TimelineTransform | 43 // TimelineTransform |
| 44 // TODO(dalesat): Rename reference -> presentation. | 44 // TODO(dalesat): Rename reference -> presentation. |
| 45 // TODO(dalesat): Rename target -> reference. | 45 // TODO(dalesat): Rename target -> reference. |
| 46 // | 46 // |
| 47 // A structure which holds both a timeline quad, and a pair of identifiers which | 47 // A structure which holds both a timeline quad, and a pair of identifiers which |
| 48 // define the specific timelines which are the reference and target timelines. | 48 // define the specific timelines which are the reference and target timelines. |
| 49 struct TimelineTransform { | 49 struct TimelineTransform { |
| 50 // TODO: These constants should probably defined by a central time management | 50 // TODO: These constants should probably defined by a central time management |
| 51 // service, not here. | 51 // service, not here. |
| 52 const uint32 kLocalTimeID = 0xFFFFFFFF; | 52 const uint32 kLocalTimeID = 0xFFFFFFFF; |
| 53 const uint32 kContextual = 0xFFFFFFFE; | 53 const uint32 kContextual = 0xFFFFFFFE; |
| 54 | 54 |
| 55 TimelineQuad quad; | 55 TimelineQuad quad; |
| 56 uint32 reference_timeline_id = kContextual; | 56 uint32 reference_timeline_id = kContextual; |
| 57 uint32 target_timeline_id = kLocalTimeID; | 57 uint32 target_timeline_id = kLocalTimeID; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // RateControl | 60 // RateControl |
| 61 // | 61 // |
| 62 // An interface typically exposed by media renderers which allow producers of | 62 // An interface typically exposed by media renderers which allow producers of |
| 63 // media to specify how the presentation time stamps of the media queued to the | 63 // media to specify how the presentation time stamps of the media queued to the |
| 64 // renderer relate to real time. Users may initialize the transformation with a | 64 // renderer relate to real time. Users may initialize the transformation with a |
| 65 // specific Quad, change the rate immediately in a first order contiguous | 65 // specific Quad, change the rate immediately in a first order contiguous |
| 66 // fashion, or schedule ranges in the rate at points in time on either the | 66 // fashion, or schedule ranges in the rate at points in time on either the |
| 67 // reference or target timelines. | 67 // reference or target timelines. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 // Configure the target timeline ID. Note, the reference timeline ID will | 79 // Configure the target timeline ID. Note, the reference timeline ID will |
| 80 // always be contextual. | 80 // always be contextual. |
| 81 SetTargetTimelineID(uint32 id); | 81 SetTargetTimelineID(uint32 id); |
| 82 | 82 |
| 83 // Immediately change the rate of the existing transformation in a fashion | 83 // Immediately change the rate of the existing transformation in a fashion |
| 84 // which is first order continuous with the current transformation. | 84 // which is first order continuous with the current transformation. |
| 85 SetRate(int32 reference_delta, uint32 target_delta); | 85 SetRate(int32 reference_delta, uint32 target_delta); |
| 86 | 86 |
| 87 // Schedule a first order continuous rate change at the specified reference | 87 // Schedule a first order continuous rate change at the specified reference |
| 88 // time. | 88 // time. |
| 89 SetRateAtReferenceTime(int32 reference_delta, | 89 SetRateAtReferenceTime(int32 reference_delta, uint32 target_delta, int64 refer
ence_time); |
| 90 uint32 target_delta, | |
| 91 int64 reference_time); | |
| 92 | 90 |
| 93 // Schedule a first order continuous rate change at the specified target time. | 91 // Schedule a first order continuous rate change at the specified target time. |
| 94 SetRateAtTargetTime(int32 reference_delta, | 92 SetRateAtTargetTime(int32 reference_delta, uint32 target_delta, int64 target_t
ime); |
| 95 uint32 target_delta, | |
| 96 int64 target_time); | |
| 97 | 93 |
| 98 // Cancel any pending rate changes | 94 // Cancel any pending rate changes |
| 99 CancelPendingChanges(); | 95 CancelPendingChanges(); |
| 100 }; | 96 }; |
| OLD | NEW |