vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / media / media-add-ons / AbstractFileInterfaceAddOn.h
bloba667050dde8540212d5bbd8930351e7ffaf22f27
1 // AbstractFileInterfaceAddOn.h
2 //
3 // Andrew Bachmann, 2002
4 //
5 // AbstractFileInterfaceAddOn is an add-on
6 // that can make instances of AbstractFileInterfaceNode
7 //
8 // AbstractFileInterfaceNode handles a file and a multistream
10 #if !defined(_ABSTRACT_FILE_INTERFACE_ADD_ON_H)
11 #define _ABSTRACT_FILE_INTERFACE_ADD_ON_H
13 #include <MediaDefs.h>
14 #include <MediaAddOn.h>
16 class AbstractFileInterfaceAddOn :
17 public BMediaAddOn
19 public:
20 virtual ~AbstractFileInterfaceAddOn(void);
21 explicit AbstractFileInterfaceAddOn(image_id image);
23 /**************************/
24 /* begin from BMediaAddOn */
25 public:
26 virtual status_t InitCheck(
27 const char ** out_failure_text);
28 virtual int32 CountFlavors(void);
29 virtual status_t GetFlavorAt(
30 int32 n,
31 const flavor_info ** out_info);
32 virtual BMediaNode * InstantiateNodeFor(
33 const flavor_info * info,
34 BMessage * config,
35 status_t * out_error) = 0;
36 virtual status_t GetConfigurationFor(
37 BMediaNode * your_node,
38 BMessage * into_message);
39 virtual bool WantsAutoStart(void);
40 virtual status_t AutoStart(
41 int in_count,
42 BMediaNode ** out_node,
43 int32 * out_internal_id,
44 bool * out_has_more);
46 /* only implement if you have a B_FILE_INTERFACE node */
47 virtual status_t SniffRef(
48 const entry_ref & file,
49 BMimeType * io_mime_type,
50 float * out_quality,
51 int32 * out_internal_id);
52 virtual status_t SniffType( // This is broken if you deal with producers
53 const BMimeType & type, // and consumers both. Use SniffTypeKind instead.
54 float * out_quality, // If you implement SniffTypeKind, this doesn't
55 int32 * out_internal_id); // get called.
56 virtual status_t GetFileFormatList(
57 int32 flavor_id, // for this node flavor (if it matters)
58 media_file_format * out_writable_formats, // don't write here if NULL
59 int32 in_write_items, // this many slots in out_writable_formats
60 int32 * out_write_items, // set this to actual # available, even if bigger than in count
61 media_file_format * out_readable_formats, // don't write here if NULL
62 int32 in_read_items, // this many slots in out_readable_formats
63 int32 * out_read_items, // set this to actual # available, even if bigger than in count
64 void * _reserved); // ignore until further notice
65 virtual status_t SniffTypeKind( // Like SniffType, but for the specific kind(s)
66 const BMimeType & type,
67 uint64 in_kinds,
68 float * out_quality,
69 int32 * out_internal_id,
70 void * _reserved) = 0;
71 virtual status_t SniffTypeKind( // Like SniffType, but for the specific kind(s)
72 const BMimeType & type,
73 uint64 in_kinds,
74 uint64 io_kind,
75 float * out_quality,
76 int32 * out_internal_id,
77 void * _reserved);
80 /* end from BMediaAddOn */
81 /************************/
83 private:
85 AbstractFileInterfaceAddOn( /* private unimplemented */
86 const AbstractFileInterfaceAddOn & clone);
87 AbstractFileInterfaceAddOn & operator=(
88 const AbstractFileInterfaceAddOn & clone);
90 int32 refCount;
92 /* Mmmh, stuffing! */
93 virtual status_t _Reserved_AbstractFileInterfaceAddOn_0(void *);
94 virtual status_t _Reserved_AbstractFileInterfaceAddOn_1(void *);
95 virtual status_t _Reserved_AbstractFileInterfaceAddOn_2(void *);
96 virtual status_t _Reserved_AbstractFileInterfaceAddOn_3(void *);
97 virtual status_t _Reserved_AbstractFileInterfaceAddOn_4(void *);
98 virtual status_t _Reserved_AbstractFileInterfaceAddOn_5(void *);
99 virtual status_t _Reserved_AbstractFileInterfaceAddOn_6(void *);
100 virtual status_t _Reserved_AbstractFileInterfaceAddOn_7(void *);
101 virtual status_t _Reserved_AbstractFileInterfaceAddOn_8(void *);
102 virtual status_t _Reserved_AbstractFileInterfaceAddOn_9(void *);
103 virtual status_t _Reserved_AbstractFileInterfaceAddOn_10(void *);
104 virtual status_t _Reserved_AbstractFileInterfaceAddOn_11(void *);
105 virtual status_t _Reserved_AbstractFileInterfaceAddOn_12(void *);
106 virtual status_t _Reserved_AbstractFileInterfaceAddOn_13(void *);
107 virtual status_t _Reserved_AbstractFileInterfaceAddOn_14(void *);
108 virtual status_t _Reserved_AbstractFileInterfaceAddOn_15(void *);
110 uint32 _reserved_abstract_file_interface_add_on_[16];
114 #if BUILDING_ABSTRACT_FILE_INTERFACE__ADD_ON
115 extern "C" _EXPORT BMediaAddOn * make_abstract_file_interface_add_on(image_id you);
116 #endif
118 #endif /* _ABSTRACT_FILE_INTERFACE_ADD_ON_H */