xref: /titanic_44/usr/src/cmd/audio/include/AudioPipe.h (revision 2b4a78020b9c38d1b95e2f3fefa6d6e4be382d1f)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1990-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _MULTIMEDIA_AUDIOPIPE_H
28 #define	_MULTIMEDIA_AUDIOPIPE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <AudioUnixfile.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 // This is the 'base' class for pipes (such as stdin) containing audio data
39 class AudioPipe : public AudioUnixfile {
40 private:
41 	AudioPipe();					// Constructor w/no args
42 	AudioPipe operator=(AudioPipe);			// Assignment is illegal
43 
44 public:
45 	// Constructor with path
46 	AudioPipe(
47 	    const int		desc,		// file descriptor
48 	    const FileAccess	acc,		// access mode
49 	    const char		*name = "(pipe)");	// name
50 
51 	// class AudioUnixfile methods specialized here
52 	virtual AudioError Create();			// Create file
53 	virtual AudioError Open();			// Open file
54 
55 	// Read from position
56 	virtual AudioError ReadData(
57 	    void* buf,				// buffer to fill
58 	    size_t& len,			// buffer length (updated)
59 	    Double& pos);			// start position (updated)
60 
61 	// Write at position
62 	virtual AudioError WriteData(
63 	    void* buf,				// buffer to copy
64 	    size_t& len,			// buffer length (updated)
65 	    Double& pos);			// start position (updated)
66 
67 	// class Audio methods specialized here
68 	virtual Boolean isPipe() const { return (TRUE); }
69 };
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* !_MULTIMEDIA_AUDIOPIPE_H */
76