blob: 9c9ffac25ed8cdc72a25371ef6995f109cbc6e90 [file] [log] [blame]
// 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.
struct AudioFormat {
/// The type of individual samples.
AudioSampleFormat sample_format;
/// The number of samples per frame.
uint32 channel_count;
/// The number of frames per second.
uint32 frames_per_second;
/// The spatial assignment of each channel.
AudioChannelLayout channel_layout;
// 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.
enum AudioSampleFormat {
UNSIGNED_8 = 1;
SIGNED_16 = 2;
SIGNED_24_IN_32 = 3;
FLOAT = 4;
};
union AudioChannelLayout {
1: uint8 placeholder;
};
// 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.