xref: /haiku/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h (revision 3dfd9cb95ce45f59160d50975210bc55e3fc0709)
1 /*
2  * Copyright 2011, Jérôme Duval, korli@users.berlios.de.
3  * Copyright 2009, Ithamar Adema, <ithamar.adema@team-embedded.nl>.
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef _UVC_CAM_DEVICE_H
7 #define _UVC_CAM_DEVICE_H
8 
9 
10 #include "CamDevice.h"
11 #include "USB_video.h"
12 
13 
14 class UVCCamDevice : public CamDevice {
15 public:
16 								UVCCamDevice(CamDeviceAddon &_addon,
17 									BUSBDevice* _device);
18 	virtual						~UVCCamDevice();
19 
20 	virtual bool				SupportsIsochronous();
21 	virtual status_t			StartTransfer();
22 	virtual status_t			StopTransfer();
23 	virtual status_t			SuggestVideoFrame(uint32 &width,
24 									uint32 &height);
25 	virtual status_t			AcceptVideoFrame(uint32 &width,
26 									uint32 &height);
27 
28 private:
29 			void				_ParseVideoControl(
30 									const usbvc_class_descriptor* descriptor,
31 									size_t len);
32 			void				_ParseVideoStreaming(
33 									const usbvc_class_descriptor* descriptor,
34 									size_t len);
35 			status_t			_ProbeCommitFormat();
36 			status_t			_SelectBestAlternate();
37 			status_t			_SelectIdleAlternate();
38 
39 			usbvc_interface_header_descriptor *fHeaderDescriptor;
40 
41 			const BUSBEndpoint*	fInterruptIn;
42 			uint32				fControlIndex;
43 			uint32				fStreamingIndex;
44 			uint32				fMaxVideoFrameSize;
45 			uint32				fMaxPayloadTransferSize;
46 };
47 
48 
49 class UVCCamDeviceAddon : public CamDeviceAddon {
50 public:
51 								UVCCamDeviceAddon(WebCamMediaAddOn* webcam);
52 	virtual 					~UVCCamDeviceAddon();
53 
54 	virtual const char*			BrandName();
55 	virtual UVCCamDevice*		Instantiate(CamRoster &roster,
56 									BUSBDevice *from);
57 };
58 
59 #endif /* _UVC_CAM_DEVICE_H */
60 
61