blob: 1fd7a8a5d4d7fa2bfe4d5a6ba310f6635466e7e0 [file] [log] [blame]
Dale Sather9a37a572021-10-14 00:47:37 +00001// 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.
4library fuchsia.media2;
5
6using 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.
11type PresentationTimeline = struct {
12 /// Initial presentation time of this piece of the piecewise-
13 /// linear presentation timeline.
Benjamin Prosnitzfcd760a2022-05-27 23:34:02 +000014 @allow_deprecated_struct_defaults
Dale Sather9a37a572021-10-14 00:47:37 +000015 initial_presentation_time zx.duration = 0;
16
17 /// Initial reference time of this piece of the piecewise-
18 /// linear presentation timeline.
Benjamin Prosnitzfcd760a2022-05-27 23:34:02 +000019 @allow_deprecated_struct_defaults
Dale Sather9a37a572021-10-14 00:47:37 +000020 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 Prosnitzfcd760a2022-05-27 23:34:02 +000028 @allow_deprecated_struct_defaults
Dale Sather9a37a572021-10-14 00:47:37 +000029 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 Prosnitzfcd760a2022-05-27 23:34:02 +000035 @allow_deprecated_struct_defaults
Dale Sather9a37a572021-10-14 00:47:37 +000036 progressing bool = false;
37};
38
Dale Sather9a37a572021-10-14 00:47:37 +000039/// Describes units used in packet timestamps.
40///
Dale Sather769df1b2021-10-15 17:54:03 +000041/// The `packet_timestamp_interval` and `presentation_interval` establish the
Dale Sather9a37a572021-10-14 00:47:37 +000042/// 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 Sather769df1b2021-10-15 17:54:03 +000045/// 44.1k frames/second audio stream, `packet_timestamp_interval` would be
Dale Sather9a37a572021-10-14 00:47:37 +000046/// 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 Sather9a37a572021-10-14 00:47:37 +000049type PacketTimestampUnits = struct {
Dale Sather769df1b2021-10-15 17:54:03 +000050 /// Timestamp interval corresponding to `presentation_interval`.
Benjamin Prosnitzfcd760a2022-05-27 23:34:02 +000051 @allow_deprecated_struct_defaults
Dale Sather9a37a572021-10-14 00:47:37 +000052 packet_timestamp_interval int64 = 1000000000;
53
54 /// Duration in the presentation timeline corresponding to
Dale Sather769df1b2021-10-15 17:54:03 +000055 /// `packet_timestamp_interval`.
Benjamin Prosnitzfcd760a2022-05-27 23:34:02 +000056 @allow_deprecated_struct_defaults
Dale Sather9a37a572021-10-14 00:47:37 +000057 presentation_interval zx.duration = 1000000000;
58};