1/*
2 * Copyright (c) 2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24	File:		DCFireWireDV.h
25
26	Contains:	The concrete derived class of an IDHDigitizer which digitizes
27				video from a Gossamer source.
28
29
30	Copyright:	� 1997-1999 by Apple Computer, Inc., all rights reserved.
31
32	File Ownership:
33
34		DRI:				Sean Williams
35
36	Writers:
37
38		(jkl)	Jay Lloyd
39		(RS)	Richard Sepulveda
40		(GDW)	George D. Wilson Jr.
41
42	Change History (most recent first):
43
44		 <5>	 7/28/99	jkl		Made sure commandObjectInUse element is long word aligned.
45		 <4>	 7/27/99	jkl		Added object in use flag.
46		 <3>	  7/5/99	RS		Added fCommandObjectID cause we want it to stay allocated over
47									the lifetime of the instance.
48		 <2>	 6/18/99	GDW		Added some new data elements.
49	   <1>	 6/15/99		KW		Created
50*/
51
52
53#ifndef __DCFIREWIREDV__
54#define __DCFIREWIREDV__
55
56// MacOS headers.
57#include <Components.h>
58#include <DeviceControl.h>
59#include <DeviceControlPriv.h>
60#include <FireWire.h>
61
62// Standard C++ Library headers.
63//#include <cstddef>
64typedef unsigned long size_t;
65
66
67//
68// -------- DCFireWireDV --------
69//
70
71class DCFireWireDV
72{
73
74public:
75
76 	DCFireWireDV(ComponentInstance self, Boolean *success);
77	virtual ~DCFireWireDV();
78
79	void* operator new(size_t);
80	void operator delete(void*);
81
82
83
84	// These routines are the analogs to the default component calls.
85	//
86	// *** Important ***
87	// People familiar with other component implementations (both in C and C++) will
88	// notice the lack of the 'storage' and 'componentInstance' parameters.  This is
89	// due to a combination of implementation choices as well as taking advantage of
90	// C++ facilities.
91	//
92	// The 'storage' parameter for each ComponentInstance is set to the corresponding
93	// 'this' pointer of the object that is instansiated for each ComponentInstance.
94	//
95	// Similarly, the 'componentInstance' parameter is passed to the
96	// constructor, which stores it in a private data member for future use.
97
98	static pascal ComponentResult Open(
99			DCFireWireDV* unused,
100			ComponentInstance self);
101
102	static pascal ComponentResult Close(DCFireWireDV* dc, ComponentInstance self);
103	static pascal ComponentResult Version(DCFireWireDV* dc);
104	static pascal ComponentResult Register(DCFireWireDV* dc);
105
106	static pascal ComponentResult Target(
107		DCFireWireDV* dc,
108		ComponentInstance parentComponent);
109
110	static pascal ComponentResult Unregister(DCFireWireDV* dc);
111
112
113	//
114	// Public API Calls
115	//
116
117	static pascal ComponentResult DoAVCTransaction(
118		DCFireWireDV* dc,
119		DVCTransactionParams* inTransaction);
120
121	//
122	// Private API Calls
123	//
124
125	static pascal ComponentResult EnableAVCTransactions(DCFireWireDV* dc);
126	static pascal ComponentResult DisableAVCTransactions(DCFireWireDV* dc);
127
128	static pascal ComponentResult SetDeviceConnectionID(
129			DCFireWireDV* dc,
130			DeviceConnectionID connectionID);
131
132	static pascal ComponentResult GetDeviceConnectionID(
133			DCFireWireDV* dc,
134			DeviceConnectionID* connectionID);
135
136
137
138
139
140
141
142protected :
143
144private :
145
146	//
147	// Static Routines for Callback Functions
148	//
149	// When a member function is declared as 'static' in the class definition, that
150	// means there is no implicit 'this' pointer when the routine is called.  This is
151	// necessary for callbacks, since they use calling conventions, which are
152	// 'this'less.
153	//
154
155
156	//
157	// Routines to implement utility functions
158	//
159
160
161
162
163	//
164	// Data Members
165	//
166
167	ComponentInstance fSelf;		// ComponentInstance for this object
168	ComponentInstance fTarget;		// if Targeted....
169	FWClientID fClientID;			// Firewire client ID used in AVC transcatin
170	FWCommandObjectID fCommandObjectID;	// command object used to send FCP command
171	UInt32 fCommandObjectInUse;		// true during an AVC transaction, must be long word aligned
172	Boolean fRegistered;			// true when component is registered
173	Boolean	fDeviceEnable;			// Allows transactions to be enabled
174};
175
176
177
178#endif // __DCFIREWIREDV__
179