blob: 8ec2395167c455498eae849639eb8d989fddc278 [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.audio;
using fuchsia.media2;
using fuchsia.mediastreams;
using zx;
/// Represents an audio producer.
@discoverable
protocol Producer {
compose fuchsia.media2.ActiveProducer;
compose fuchsia.media2.ActiveProducerStream;
/// Connects a stream sink for the producer with the indicated properties.
///
/// + request `buffer_collection_token` a participant token for the buffer collection to be
/// used for this connection.
/// + request `format` the format to be used for the is connection.
/// + request `timestamp_units` the units used for timestamps on packets in this stream.
/// + request `stream_sink` the client end of the `StreamSink` channel for this connection.
/// * error reason for connection failiure.
///
/// Multiple stream sinks may be used sequentially for a given consumer. This method responds
/// when the connection is ready or the connect attempt fails.
ConnectOutputStream(resource struct {
buffer_collection_token zx.handle:EVENTPAIR;
format fuchsia.mediastreams.AudioFormat;
timestamp_units fuchsia.media2.PacketTimestampUnits;
stream_sink client_end:fuchsia.media2.StreamSink;
}) -> (struct {}) error fuchsia.media2.ConnectionError;
/// Disconnects the output stream.
DisconnectOutputStream();
/// Indicates that the current output stream has been disconnected unexpectedly.
-> OnOutputStreamDisconnected(struct {
status zx.status;
});
/// Indicates that the stream sink previously created is invalid,
/// and the client should create another one if it wishes to
/// continue sending packets.
-> OnOutputStreamSinkInvalid();
};