vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / media / media-add-ons / usb_vision / AddOn.h
blobd489d7f26eb931eb2ddf9eb7749fca43af4294d7
1 /*
2 * This file is a part of BeOS USBVision driver project.
3 * Copyright (c) 2003 by Siarzuk Zharski <imker@gmx.li>
5 * This file may be used under the terms of the BSD License
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.
12 #ifndef _USBVISION_ADDON_H
13 #define _USBVISION_ADDON_H
15 #include <media/MediaAddOn.h>
17 #define TOUCH(x) ((void)(x))
19 extern "C" _EXPORT BMediaAddOn *make_media_addon(image_id you);
21 class MediaAddOn : public BMediaAddOn
23 public:
24 MediaAddOn(image_id imid);
25 virtual ~MediaAddOn();
27 virtual status_t InitCheck(const char **out_failure_text);
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);
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; }
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));
52 private:
53 status_t fInitStatus;
54 flavor_info fFlavorInfo;
55 media_format fMediaFormat;
56 int fDriverFD;
59 #endif /*_USBVISION_ADDON_H*/