xref: /haiku/src/add-ons/media/media-add-ons/usb_vision/AddOn.h (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
1 /*
2  * This file is a part of BeOS USBVision driver project.
3  * Copyright (c) 2003 by Siarzuk Zharski <imker@gmx.li>
4  *
5  * This file may be used under the terms of the BSD License
6  *
7  * Skeletal part of this code was inherired from original BeOS sample code,
8  * that is distributed under the terms of the Be Sample Code License.
9  *
10  */
11 
12 #ifndef _USBVISION_ADDON_H
13 #define _USBVISION_ADDON_H
14 
15 #include <media/MediaAddOn.h>
16 
17 #define TOUCH(x) ((void)(x))
18 
19 extern "C" _EXPORT BMediaAddOn *make_media_addon(image_id you);
20 
21 class MediaAddOn : public BMediaAddOn
22 {
23 public:
24 						MediaAddOn(image_id imid);
25 	virtual 			~MediaAddOn();
26 
27 	virtual	status_t	InitCheck(const char **out_failure_text);
28 
29 	virtual	int32		CountFlavors();
30 	virtual	status_t	GetFlavorAt(int32 n, const flavor_info ** out_info);
31 	virtual	BMediaNode	*InstantiateNodeFor(
32 							const flavor_info * info,
33 							BMessage * config,
34 							status_t * out_error);
35 
36 	virtual	status_t	GetConfigurationFor(BMediaNode *node, BMessage *message)
37 								{ TOUCH(node); TOUCH(message); return B_OK; }
38 	virtual	status_t	SaveConfigInfo(BMediaNode *node, BMessage *message)
39 								{ TOUCH(node); TOUCH(message); return B_OK; }
40 
41 	virtual	bool		WantsAutoStart() { return false; }
42 	virtual	status_t	AutoStart(int in_count, BMediaNode **out_node,
43 								int32 *out_internal_id, bool *out_has_more)
44 								{	TOUCH(in_count); TOUCH(out_node);
45 									TOUCH(out_internal_id); TOUCH(out_has_more);
46 									return B_ERROR; }
47 			bool		USBVisionInit();
48 			void		USBVisionUninit();
49 			status_t    USBVisionWriteRegister(uint8 reg, uint8 *data, uint8 len = sizeof(uint8));
50 			status_t    USBVisionReadRegister(uint8 reg, uint8 *data, uint8 len = sizeof(uint8));
51 
52 private:
53 	status_t			fInitStatus;
54 	flavor_info			fFlavorInfo;
55 	media_format		fMediaFormat;
56 	int					fDriverFD;
57 };
58 
59 #endif /*_USBVISION_ADDON_H*/
60