1 // AbstractFileInterfaceAddOn.cpp
3 // Andrew Bachmann, 2002
5 // AbstractFileInterfaceAddOn is an add-on
6 // that can make instances of AbstractFileInterfaceNode
8 // AbstractFileInterfaceNode handles a file and a multistream
11 #include "AbstractFileInterfaceNode.h"
12 #include "AbstractFileInterfaceAddOn.h"
16 #include <MediaDefs.h>
17 #include <MediaAddOn.h>
20 #include <StorageDefs.h>
28 AbstractFileInterfaceAddOn::~AbstractFileInterfaceAddOn()
33 AbstractFileInterfaceAddOn::AbstractFileInterfaceAddOn(image_id image
) :
41 // -------------------------------------------------------- //
43 // -------------------------------------------------------- //
44 status_t
AbstractFileInterfaceAddOn::InitCheck(
45 const char ** out_failure_text
)
51 int32
AbstractFileInterfaceAddOn::CountFlavors()
57 status_t
AbstractFileInterfaceAddOn::GetFlavorAt(
59 const flavor_info
** out_info
)
64 PRINT("\t<- B_BAD_INDEX\n");
68 flavor_info
* infos
= new flavor_info
[1];
69 AbstractFileInterfaceNode::GetFlavor(&infos
[0],n
);
75 status_t
AbstractFileInterfaceAddOn::GetConfigurationFor(
76 BMediaNode
* your_node
,
77 BMessage
* into_message
)
80 AbstractFileInterfaceNode
* node
81 = dynamic_cast<AbstractFileInterfaceNode
*>(your_node
);
83 PRINT("\t<- B_BAD_TYPE\n");
86 return node
->GetConfigurationFor(into_message
);
90 bool AbstractFileInterfaceAddOn::WantsAutoStart()
97 status_t
AbstractFileInterfaceAddOn::AutoStart(
99 BMediaNode
** out_node
,
100 int32
* out_internal_id
,
108 // -------------------------------------------------------- //
109 // BMediaAddOn impl for B_FILE_INTERFACE nodes
110 // -------------------------------------------------------- //
111 status_t
AbstractFileInterfaceAddOn::SniffRef(
112 const entry_ref
& file
,
113 BMimeType
* io_mime_type
,
115 int32
* out_internal_id
)
119 *out_internal_id
= 0; // only one flavor
120 char mime_string
[B_MIME_TYPE_LENGTH
+1];
121 status_t status
= AbstractFileInterfaceNode::StaticSniffRef(file
,mime_string
,out_quality
);
122 io_mime_type
->SetTo(mime_string
);
127 // even though I implemented SniffTypeKind below and this shouldn't get called,
128 // I am going to implement it anyway. I'll use it later anyhow.
129 status_t
AbstractFileInterfaceAddOn::SniffType(
130 const BMimeType
& type
,
132 int32
* out_internal_id
)
137 *out_internal_id
= 0;
142 status_t
AbstractFileInterfaceAddOn::GetFileFormatList(
144 media_file_format
* out_writable_formats
,
145 int32 in_write_items
,
146 int32
* out_write_items
,
147 media_file_format
* out_readable_formats
,
149 int32
* out_read_items
,
154 if (flavor_id
!= 0) {
155 // this is a sanity check for now
156 PRINT("\t<- B_BAD_INDEX\n");
160 *out_write_items
= 0;
167 status_t
AbstractFileInterfaceAddOn::SniffTypeKind(
168 const BMimeType
& type
,
172 int32
* out_internal_id
,
177 if (in_kinds
& (io_kind
| B_FILE_INTERFACE
| B_CONTROLLABLE
)) {
178 return SniffType(type
,out_quality
,out_internal_id
);
180 // They asked for some kind we don't supply. We set the output
181 // just in case they try to do something with it anyway (!)
183 *out_internal_id
= -1;
184 PRINT("\t<- B_BAD_TYPE\n");
190 // -------------------------------------------------------- //
192 // -------------------------------------------------------- //
194 // int main(int argc, char *argv[])
198 // -------------------------------------------------------- //
200 // -------------------------------------------------------- //
202 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_0(void *) {return B_ERROR
;};
203 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_1(void *) {return B_ERROR
;};
204 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_2(void *) {return B_ERROR
;};
205 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_3(void *) {return B_ERROR
;};
206 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_4(void *) {return B_ERROR
;};
207 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_5(void *) {return B_ERROR
;};
208 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_6(void *) {return B_ERROR
;};
209 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_7(void *) {return B_ERROR
;};
210 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_8(void *) {return B_ERROR
;};
211 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_9(void *) {return B_ERROR
;};
212 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_10(void *) {return B_ERROR
;};
213 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_11(void *) {return B_ERROR
;};
214 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_12(void *) {return B_ERROR
;};
215 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_13(void *) {return B_ERROR
;};
216 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_14(void *) {return B_ERROR
;};
217 status_t
AbstractFileInterfaceAddOn::_Reserved_AbstractFileInterfaceAddOn_15(void *) {return B_ERROR
;};