4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1990-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _MULTIMEDIA_AUDIOSTREAM_H
28 #define _MULTIMEDIA_AUDIOSTREAM_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <AudioDebug.h>
41 // This is the abstract base class for all audio data sources/sinks.
42 // It is invalid to create an object of type AudioStream.
44 class AudioStream
: public Audio
{
46 AudioHdr hdr
; // data encoding info
47 Double length
; // length of data, in secs
51 Boolean
hdrset() const; // TRUE if header valid
53 // Set header (always)
54 AudioError
updateheader(
55 const AudioHdr
& h
); // header to copy
59 Double len
); // new length, in secs
61 virtual Boolean
opened() const = 0; // TRUE if stream 'open'
64 AudioStream(const char *path
= ""); // Constructor
67 virtual AudioError
SetHeader(
68 const AudioHdr
& h
); // header to copy
71 virtual void SetLength(
72 Double len
); // new length, in secs
74 // XXX - is this needed? do we need time->sample frames?
75 virtual size_t GetByteCount() const; // Get length, in bytes
77 // class Audio methods specialized here
78 virtual AudioHdr
GetHeader(); // Get header
80 virtual Double
GetLength() const; // Get length, in secs
82 // Make sure endian of the data matches the current processor.
83 AudioError
coerceEndian(unsigned char *buf
, size_t len
,
86 virtual Boolean
isEndianSensitive() const;
87 AudioEndian
localByteOrder() const
89 return (hdr
.localByteOrder());
93 #include <AudioStream_inline.h>
99 #endif /* !_MULTIMEDIA_AUDIOSTREAM_H */