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
56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
/*
|
|
* \brief Connection to audio service
|
|
* \author Sebastian Sumpf
|
|
* \date 2012-12-20
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2012-2017 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_OUT_SESSION__CONNECTION_H_
|
|
#define _INCLUDE__AUDIO_OUT_SESSION__CONNECTION_H_
|
|
|
|
#include <audio_out_session/client.h>
|
|
#include <base/connection.h>
|
|
#include <base/allocator.h>
|
|
|
|
namespace Audio_out { struct Connection; }
|
|
|
|
|
|
struct Audio_out::Connection : Genode::Connection<Session>, Audio_out::Session_client
|
|
{
|
|
/**
|
|
* Issue session request
|
|
*
|
|
* \noapi
|
|
*/
|
|
Genode::Capability<Audio_out::Session> _session(Genode::Parent &parent, char const *label)
|
|
{
|
|
return session(parent, "ram_quota=%ld, cap_quota=%ld, label=\"%s\"",
|
|
2*4096 + 2048 + sizeof(Stream), CAP_QUOTA, label);
|
|
}
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* \param label channel identifier (e.g., "front left")
|
|
* \param alloc_signal install 'alloc_signal', the client may then use
|
|
* 'wait_for_alloc' when the stream is full
|
|
* \param progress_signal install progress signal, the client may then
|
|
* call 'wait_for_progress', which is sent when the
|
|
* server processed one or more packets
|
|
*/
|
|
Connection(Genode::Env &env,
|
|
char const *label)
|
|
:
|
|
Genode::Connection<Session>(env, _session(env.parent(), label)),
|
|
Session_client(env.rm(), cap())
|
|
{ }
|
|
};
|
|
|
|
#endif /* _INCLUDE__AUDIO_OUT_SESSION__CONNECTION_H_ */
|