Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 1 | // Copyright 2021 The Fuchsia 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 | library fuchsia.media2; |
| 5 | |
| 6 | using zx; |
| 7 | |
| 8 | /// Expresses presentation time as a linear function of reference |
| 9 | /// time. The reference timeline is typically the system monotonic |
| 10 | /// clock, but may be another clock. |
| 11 | type PresentationTimeline = struct { |
| 12 | /// Initial presentation time of this piece of the piecewise- |
| 13 | /// linear presentation timeline. |
Benjamin Prosnitz | fcd760a | 2022-05-27 23:34:02 +0000 | [diff] [blame] | 14 | @allow_deprecated_struct_defaults |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 15 | initial_presentation_time zx.duration = 0; |
| 16 | |
| 17 | /// Initial reference time of this piece of the piecewise- |
| 18 | /// linear presentation timeline. |
Benjamin Prosnitz | fcd760a | 2022-05-27 23:34:02 +0000 | [diff] [blame] | 19 | @allow_deprecated_struct_defaults |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 20 | initial_reference_time zx.time = 0; |
| 21 | |
| 22 | /// Presentation rate, typically 1.0. Non-positive values are |
| 23 | /// not permitted. This field gives the rate at which the |
| 24 | /// presentation progresses if `progressing` is true. If |
| 25 | /// `progressing` is false, the effective rate is zero. |
| 26 | // TODO(dalesat): consider removing this. |
| 27 | // TODO(dalesat): consider use a rational for this. |
Benjamin Prosnitz | fcd760a | 2022-05-27 23:34:02 +0000 | [diff] [blame] | 28 | @allow_deprecated_struct_defaults |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 29 | rate float32 = 1.0; |
| 30 | |
| 31 | /// Indicates whether presentation is progressing. If this |
| 32 | /// value is true, presentation is progressing at the rate |
| 33 | /// given by the `rate` field. If this value is false, the |
| 34 | /// effective presentation rate is zero. |
Benjamin Prosnitz | fcd760a | 2022-05-27 23:34:02 +0000 | [diff] [blame] | 35 | @allow_deprecated_struct_defaults |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 36 | progressing bool = false; |
| 37 | }; |
| 38 | |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 39 | /// Describes units used in packet timestamps. |
| 40 | /// |
Dale Sather | 769df1b | 2021-10-15 17:54:03 +0000 | [diff] [blame] | 41 | /// The `packet_timestamp_interval` and `presentation_interval` establish the |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 42 | /// units of the `Timestamp` values in packets in a stream. For |
| 43 | /// example, if the timestamps are in nanosecond units, the two |
| 44 | /// intervals are equal. If the timestamps are frame indices in a |
Dale Sather | 769df1b | 2021-10-15 17:54:03 +0000 | [diff] [blame] | 45 | /// 44.1k frames/second audio stream, `packet_timestamp_interval` would be |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 46 | /// 44,100, and `presentation_interval` would be 1,000,000,000. |
| 47 | /// The intervals constitute a ratio, so the values 441 and |
| 48 | /// 10,000,000 would do just as well for the second example. |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 49 | type PacketTimestampUnits = struct { |
Dale Sather | 769df1b | 2021-10-15 17:54:03 +0000 | [diff] [blame] | 50 | /// Timestamp interval corresponding to `presentation_interval`. |
Benjamin Prosnitz | fcd760a | 2022-05-27 23:34:02 +0000 | [diff] [blame] | 51 | @allow_deprecated_struct_defaults |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 52 | packet_timestamp_interval int64 = 1000000000; |
| 53 | |
| 54 | /// Duration in the presentation timeline corresponding to |
Dale Sather | 769df1b | 2021-10-15 17:54:03 +0000 | [diff] [blame] | 55 | /// `packet_timestamp_interval`. |
Benjamin Prosnitz | fcd760a | 2022-05-27 23:34:02 +0000 | [diff] [blame] | 56 | @allow_deprecated_struct_defaults |
Dale Sather | 9a37a57 | 2021-10-14 00:47:37 +0000 | [diff] [blame] | 57 | presentation_interval zx.duration = 1000000000; |
| 58 | }; |