2 * ESounD media addon for BeOS
4 * Copyright (c) 2006 François Revol (revol@free.fr)
6 * Based on Multi Audio addon for Haiku,
7 * Copyright (c) 2002, 2003 Jerome Duval (jerome.duval@free.fr)
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
13 * - Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * - Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 class ESDEndpoint
: public BDataIO
{
47 status_t
InitCheck() const;
49 status_t
SendAuthKey();
51 bool Connected() const;
52 status_t
Connect(const char *host
, uint16 port
=ESD_DEFAULT_PORT
);
53 status_t
WaitForConnect();
54 status_t
Disconnect();
56 /* set the default command and format for BDataIO interface */
57 status_t
SetCommand(esd_command_t cmd
=ESD_PROTO_STREAM_PLAY
);
58 status_t
SetFormat(int bits
, int channels
, float rate
=ESD_DEFAULT_RATE
);
60 status_t
GetServerInfo();
64 bigtime_t
Latency() const { return fLatency
; };
65 const char *Host() const { return fHost
.String(); };
66 uint16
Port() const { return fPort
; };
67 void GetFriendlyName(BString
&name
);
73 virtual ssize_t
Read(void *buffer
, size_t size
);
74 virtual ssize_t
Write(const void *buffer
, size_t size
);
76 status_t
SendCommand(esd_command_t cmd
, const uint8
*obuf
, size_t olen
, uint8
*ibuf
, size_t ilen
);
77 status_t
SendDefaultCommand();
80 static int32
_ConnectThread(void *_arg
);
81 int32
ConnectThread(void);
84 thread_id fConnectThread
;
89 esd_command_t fDefaultCommand
;
90 bool fDefaultCommandSent
;
91 esd_format_t fDefaultFormat
;
92 esd_rate_t fDefaultRate
;
97 #endif /* ESDENDPOINT_H */