| // Copyright 2021 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.mediastreams; |
| |
| /// Describes a format used for audio elementary streams without |
| /// reference to compression. Where compression is supported, this |
| /// type should be combined with a `Compression` struct. |
| type AudioFormat = struct { |
| /// The type of individual samples. |
| sample_format AudioSampleFormat; |
| |
| /// The number of samples per frame. |
| channel_count uint32; |
| |
| /// The number of frames per second. |
| frames_per_second uint32; |
| |
| /// The spatial assignment of each channel. |
| channel_layout AudioChannelLayout; |
| |
| // TODO: Maybe add bytes_per_frame for convenience. It’s |
| // a function of sample_format and channel_count. |
| }; |
| |
| /// Expresses the format of individual audio samples. |
| type AudioSampleFormat = strict enum { |
| UNSIGNED_8 = 1; |
| SIGNED_16 = 2; |
| SIGNED_24_IN_32 = 3; |
| SIGNED_32 = 4; |
| FLOAT = 5; |
| }; |
| |
| type AudioChannelLayout = strict union { |
| 1: placeholder uint8; |
| }; |
| |
| // TODO: Define AudioChannelLayout |
| // There are essentially four ways to do this: |
| // 1) an enum of layouts, which restricts layouts to those represented |
| // in the enum, |
| // 2) a ‘bits’ type of individual channel assignments, which allows |
| // any combination of the represented channel assignments but |
| // restricts their permutation, |
| // 3) a vector of enum values of individual channel assignments, which |
| // allows any permutation of the represented channel assignments, |
| // or |
| // 4) a collection of fold-down tables that indicate how the channels |
| // should be mixed to produce other channel configurations. |
| // These are listed in increasing order of expressiveness and |
| // decreasing order of ergonomics. We need to decide which |
| // representation(s) we want to support. |