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 #include <limits> |
| 6 #include <utility> |
| 7 |
| 8 #include "mojo/public/cpp/environment/logging.h" |
| 9 #include "mojo/services/media/common/cpp/timeline_function.h" |
| 10 |
| 11 namespace mojo { |
| 12 namespace media { |
| 13 |
| 14 // static |
| 15 int64_t TimelineFunction::Apply( |
| 16 int64_t reference_time, |
| 17 int64_t subject_time, |
| 18 const TimelineRate& rate, // subject_delta / reference_delta |
| 19 int64_t reference_input) { |
| 20 return rate.Scale(reference_input - reference_time) + subject_time; |
| 21 } |
| 22 |
| 23 // static |
| 24 TimelineFunction TimelineFunction::Compose(const TimelineFunction& bc, |
| 25 const TimelineFunction& ab, |
| 26 bool exact) { |
| 27 return TimelineFunction(ab.reference_time(), bc.Apply(ab.subject_time()), |
| 28 TimelineRate::Product(ab.rate(), bc.rate(), exact)); |
| 29 } |
| 30 |
| 31 } // namespace media |
| 32 } // namespace mojo |
OLD | NEW |