Emery Hemingway
5e8bc9ef51
Define a unified packet-buffer format for both Audio_out and Audio_in sessions. This allows an Audio_out and an Audio_in client to exchange packets with a common buffer and lexicon. The sessions have also been stripped down to a minimum. The 'progress' and 'data_avail' signal handlers have been replaced with a single 'progress' signal sent by Audio_in and received by Audio_in. The Audio_in session has a reset signal delivered to the client to indicate that the progress signal handler has been replaced (dubious). These changes reflect a different relationship between the two sessions. Drivers that play audio are now Audio_in clients and drive the rate that packets can be consumed by sending progress signals. Ref #2858
39 lines
951 B
C++
39 lines
951 B
C++
/*
|
|
* \brief Server-side audio packet packet buffer
|
|
* \author Emery Hemingway
|
|
* \date 2018-06-05
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2018 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef _INCLUDE__AUDIO__BUFFER_H_
|
|
#define _INCLUDE__AUDIO__BUFFER_H_
|
|
|
|
#include <audio/stream.h>
|
|
#include <base/attached_ram_dataspace.h>
|
|
|
|
namespace Audio { struct Stream_buffer; }
|
|
|
|
struct Audio::Stream_buffer
|
|
{
|
|
Genode::Attached_ram_dataspace _shared_ds;
|
|
|
|
Stream_buffer(Genode::Ram_allocator &ram, Genode::Region_map &rm)
|
|
: _shared_ds(ram, rm, sizeof(Audio::Stream)) { }
|
|
|
|
Stream_sink &stream_sink() {
|
|
return *_shared_ds.local_addr<Stream_sink>(); }
|
|
|
|
Stream_source &stream_source() {
|
|
return *_shared_ds.local_addr<Stream_source>(); }
|
|
|
|
Genode::Dataspace_capability cap() {
|
|
return _shared_ds.cap(); }
|
|
};
|
|
|
|
#endif /* _INCLUDE__AUDIO__BUFFER_H_ */ |