xref: /haiku/src/add-ons/media/media-add-ons/usb_webcam/AddOn.h (revision 4f2fd49bdc6078128b1391191e4edac647044c3d)
1 /*
2  * Copyright 2004-2008, François Revol, <revol@free.fr>.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _VIDEO_ADDON_H
6 #define _VIDEO_ADDON_H
7 
8 #include <media/MediaAddOn.h>
9 
10 #define TOUCH(x) ((void)(x))
11 
12 extern "C" _EXPORT BMediaAddOn *make_media_addon(image_id you);
13 
14 class CamRoster;
15 class CamDevice;
16 
17 class WebCamMediaAddOn : public BMediaAddOn
18 {
19 public:
20 						WebCamMediaAddOn(image_id imid);
21 	virtual 			~WebCamMediaAddOn();
22 
23 	virtual	status_t	InitCheck(const char **out_failure_text);
24 
25 	virtual	int32		CountFlavors();
26 	virtual	status_t	GetFlavorAt(int32 n, const flavor_info ** out_info);
27 	virtual	BMediaNode	*InstantiateNodeFor(
28 							const flavor_info * info,
29 							BMessage * config,
30 							status_t * out_error);
31 
32 	virtual	status_t	GetConfigurationFor(BMediaNode *node, BMessage *message)
33 								{ TOUCH(node); TOUCH(message); return B_OK; }
34 	virtual	status_t	SaveConfigInfo(BMediaNode *node, BMessage *message)
35 								{ TOUCH(node); TOUCH(message); return B_OK; }
36 
37 	virtual	bool		WantsAutoStart() { return false; }
38 	virtual	status_t	AutoStart(int in_count, BMediaNode **out_node,
39 								int32 *out_internal_id, bool *out_has_more)
40 								{	TOUCH(in_count); TOUCH(out_node);
41 									TOUCH(out_internal_id); TOUCH(out_has_more);
42 									return B_ERROR; }
43 		// those are for use by CamDevices
44 		status_t		CameraAdded(CamDevice* device);
45 		status_t		CameraRemoved(CamDevice* device);
46 		void			FillDefaultFlavorInfo(flavor_info* info);
47 
48 private:
49 	uint32				fInternalIDCounter;
50 	status_t			fInitStatus;
51 	flavor_info			fDefaultFlavorInfo;
52 	media_format		fMediaFormat;
53 	CamRoster*			fRoster;
54 };
55 
56 #endif
57