]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | ||
23 | #include <IOKit/storage/IOCDAudioControl.h> | |
24 | #include <IOKit/storage/IOCDAudioControlUserClient.h> | |
25 | #include <IOKit/storage/IOCDBlockStorageDriver.h> | |
26 | ||
27 | #define super IOService | |
28 | OSDefineMetaClassAndStructors(IOCDAudioControl, IOService) | |
29 | ||
30 | IOCDBlockStorageDriver * | |
31 | IOCDAudioControl::getProvider() const | |
32 | { | |
33 | return (IOCDBlockStorageDriver *) IOService::getProvider(); | |
34 | } | |
35 | ||
36 | IOReturn | |
37 | IOCDAudioControl::getStatus(CDAudioStatus *status) | |
38 | { | |
39 | return(getProvider()->getAudioStatus(status)); | |
40 | } | |
41 | ||
42 | CDTOC * | |
43 | IOCDAudioControl::getTOC(void) | |
44 | { | |
45 | return(getProvider()->getTOC()); | |
46 | } | |
47 | ||
48 | IOReturn | |
49 | IOCDAudioControl::getVolume(UInt8 *left,UInt8 *right) | |
50 | { | |
51 | return(getProvider()->getAudioVolume(left,right)); | |
52 | } | |
53 | ||
54 | IOReturn | |
55 | IOCDAudioControl::newUserClient(task_t task, | |
56 | void * /* security */, | |
57 | UInt32 /* type */, | |
58 | IOUserClient ** object ) | |
59 | ||
60 | { | |
61 | IOReturn err = kIOReturnSuccess; | |
62 | IOCDAudioControlUserClient * client; | |
63 | ||
64 | client = IOCDAudioControlUserClient::withTask(task); | |
65 | ||
66 | if( !client || (false == client->attach( this )) || | |
67 | (false == client->start( this )) ) { | |
68 | if(client) { | |
69 | client->detach( this ); | |
70 | client->release(); | |
71 | } | |
72 | err = kIOReturnNoMemory; | |
73 | } | |
74 | ||
75 | *object = client; | |
76 | return( err ); | |
77 | } | |
78 | ||
79 | IOReturn | |
80 | IOCDAudioControl::pause(bool pause) | |
81 | { | |
82 | return(getProvider()->audioPause(pause)); | |
83 | } | |
84 | ||
85 | IOReturn | |
86 | IOCDAudioControl::play(CDMSF timeStart,CDMSF timeStop) | |
87 | { | |
88 | return(getProvider()->audioPlay(timeStart,timeStop)); | |
89 | } | |
90 | ||
91 | IOReturn | |
92 | IOCDAudioControl::scan(CDMSF timeStart,bool reverse) | |
93 | { | |
94 | return(getProvider()->audioScan(timeStart,reverse)); | |
95 | } | |
96 | ||
97 | IOReturn | |
98 | IOCDAudioControl::stop() | |
99 | { | |
100 | return(getProvider()->audioStop()); | |
101 | } | |
102 | ||
103 | IOReturn | |
104 | IOCDAudioControl::setVolume(UInt8 left,UInt8 right) | |
105 | { | |
106 | return(getProvider()->setAudioVolume(left,right)); | |
107 | } | |
108 | ||
109 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 0); | |
110 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 1); | |
111 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 2); | |
112 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 3); | |
113 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 4); | |
114 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 5); | |
115 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 6); | |
116 | OSMetaClassDefineReservedUnused(IOCDAudioControl, 7); |