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