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_AUDIOLIST_H 28 #define _MULTIMEDIA_AUDIOLIST_H 29 30 #include <Audio.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 // This is the 'base' class for a list of extents of audio objects 37 class AudioList : public Audio { 38 39 // Define a linked list nested class 40 class AudioListEntry { 41 private: 42 void operator=(AudioListEntry); // Assignment is illegal 43 public: 44 Audio* aptr; // pointer to audio object 45 AudioListEntry* next; // pointer to next in list 46 AudioListEntry* prev; // pointer to previous 47 48 // Constructor w/obj 49 AudioListEntry( 50 Audio* obj); // referenced audio object 51 ~AudioListEntry(); // Destructor 52 53 void newptr(Audio* newa); // Reset extent 54 55 // Link in new extent 56 void link( 57 AudioListEntry* after); // link after this one 58 59 // Split an extent 60 void split( 61 Double pos); // split at offset 62 }; 63 64 private: 65 AudioListEntry head; // list head 66 67 AudioListEntry* first() const; // Return first extent 68 69 // Locate extent/offset 70 virtual Boolean getposition( 71 Double& pos, // target position (updated) 72 AudioListEntry*& ep) const; // returned entry pointer 73 74 AudioList operator=(AudioList); // Assignment is illegal 75 76 public: 77 AudioList(const char *name = "[list]"); // Constructor 78 virtual ~AudioList(); // Destructor 79 80 // class Audio methods specialized here 81 virtual Double GetLength() const; // Get length, in secs 82 virtual char *GetName() const; // Get name string 83 virtual AudioHdr GetHeader(); // Get header 84 virtual AudioHdr GetHeader(Double pos); // Get header at pos 85 86 // Read from position 87 virtual AudioError ReadData( 88 void* buf, // buffer to fill 89 size_t& len, // buffer length (updated) 90 Double& pos); // start position (updated) 91 92 // Write is prohibited 93 virtual AudioError WriteData( 94 void* buf, // buffer to copy 95 size_t& len, // buffer length (updated) 96 Double& pos); // start position (updated) 97 98 virtual Boolean isList() const { return (TRUE); } 99 100 // list manipulation methods 101 // Insert an entry 102 virtual AudioError Insert( 103 Audio* obj); // object to insert 104 105 // Insert an entry 106 virtual AudioError Insert( 107 Audio* obj, // object to insert 108 Double pos); // insertion offset, in seconds 109 110 // Append an entry 111 virtual AudioError Append( 112 Audio* obj); // object to append 113 114 // copy to another audio obj. 115 virtual AudioError AsyncCopy( 116 Audio* ap, // dest audio object 117 Double& frompos, 118 Double& topos, 119 Double& limit); 120 }; 121 122 #ifdef __cplusplus 123 } 124 #endif 125 126 #endif /* !_MULTIMEDIA_AUDIOLIST_H */ 127