xref: /haiku/src/add-ons/media/media-add-ons/usb_webcam/AddOn.h (revision 02af02f93ae67777d65cce1eda1c5f21aaed3446)
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 public:
19 						WebCamMediaAddOn(image_id imid);
20 	virtual 			~WebCamMediaAddOn();
21 
22 	virtual	status_t	InitCheck(const char **out_failure_text);
23 
24 	virtual	int32		CountFlavors();
25 	virtual	status_t	GetFlavorAt(int32 n, const flavor_info ** out_info);
26 	virtual	BMediaNode	*InstantiateNodeFor(
27 							const flavor_info * info,
28 							BMessage * config,
29 							status_t * out_error);
30 
GetConfigurationFor(BMediaNode * node,BMessage * message)31 	virtual	status_t	GetConfigurationFor(BMediaNode *node, BMessage *message)
32 								{ TOUCH(node); TOUCH(message); return B_OK; }
SaveConfigInfo(BMediaNode * node,BMessage * message)33 	virtual	status_t	SaveConfigInfo(BMediaNode *node, BMessage *message)
34 								{ TOUCH(node); TOUCH(message); return B_OK; }
35 
WantsAutoStart()36 	virtual	bool		WantsAutoStart() { return false; }
AutoStart(int in_count,BMediaNode ** out_node,int32 * out_internal_id,bool * out_has_more)37 	virtual	status_t	AutoStart(int in_count, BMediaNode **out_node,
38 								int32 *out_internal_id, bool *out_has_more)
39 								{	TOUCH(in_count); TOUCH(out_node);
40 									TOUCH(out_internal_id); TOUCH(out_has_more);
41 									return B_ERROR; }
42 		// those are for use by CamDevices
43 		status_t		CameraAdded(CamDevice* device);
44 		status_t		CameraRemoved(CamDevice* device);
45 		void			FillDefaultFlavorInfo(flavor_info* info);
46 
47 private:
48 	uint32				fInternalIDCounter;
49 	status_t			fInitStatus;
50 	flavor_info			fDefaultFlavorInfo;
51 	media_format		fMediaFormat;
52 	CamRoster*			fRoster;
53 };
54 
55 #endif
56