1 /***********************************************************************
2 * AUTHOR: Marcus Overhagen
3 * FILE: FileInterface.cpp
5 ***********************************************************************/
7 * Copyright 2008 Maurice Kalinowski, haiku@kaldience.com
9 * All rights reserved. Distributed under the terms of the MIT License.
14 #include "DataExchange.h"
16 #include <FileInterface.h>
20 /*************************************************************
21 * protected BFileInterface
22 *************************************************************/
24 BFileInterface::~BFileInterface()
28 /*************************************************************
29 * public BFileInterface
30 *************************************************************/
34 /*************************************************************
35 * protected BFileInterface
36 *************************************************************/
38 BFileInterface::BFileInterface()
39 : BMediaNode("called by FileInterface")
43 AddNodeKind(B_FILE_INTERFACE
);
48 BFileInterface::HandleMessage(int32 message
,
57 case FILEINTERFACE_SET_REF
:
59 const fileinterface_set_ref_request
*request
=
60 (const fileinterface_set_ref_request
*) data
;
61 fileinterface_set_ref_reply reply
;
62 entry_ref
ref(request
->device
, request
->directory
,
64 reply
.duration
= request
->duration
;
66 rv
= SetRef(ref
, request
->create
, &reply
.duration
);
68 request
->SendReply(rv
, &reply
, sizeof(reply
));
71 case FILEINTERFACE_GET_REF
:
73 const fileinterface_get_ref_request
*request
=
74 (const fileinterface_get_ref_request
*) data
;
75 fileinterface_get_ref_reply reply
;
77 rv
= GetRef(&resultRef
, reply
.mimetype
);
79 reply
.device
= resultRef
.device
;
80 reply
.directory
= resultRef
.directory
;
81 strcpy(reply
.name
, resultRef
.name
);
83 request
->SendReply(rv
, &reply
, sizeof(reply
));
86 case FILEINTERFACE_SNIFF_REF
:
88 const fileinterface_sniff_ref_request
*request
=
89 (const fileinterface_sniff_ref_request
*) data
;
90 fileinterface_sniff_ref_reply reply
;
92 entry_ref
ref(request
->device
, request
->directory
,
95 rv
= SniffRef(ref
, reply
.mimetype
, &reply
.capability
);
96 request
->SendReply(rv
, &reply
, sizeof(reply
));
100 case FILEINTERFACE_GET_FORMATS
:
102 const fileinterface_get_formats_request
*request
=
103 (const fileinterface_get_formats_request
*) data
;
104 fileinterface_get_formats_reply reply
;
106 media_file_format
* formats
;
107 area_id area
= clone_area("client formats area",
108 (void**)&formats
, B_ANY_ADDRESS
, B_WRITE_AREA
,
112 ERROR("BBufferConsumer::FILEINTERFACE_GET_FORMATS:"
113 " can't clone area\n");
118 while (GetNextFileFormat(&cookie
, formats
) == B_OK
) {
119 if (cookie
>= request
->num_formats
)
121 formats
+= sizeof(media_format
);
123 reply
.filled_slots
= cookie
;
124 request
->SendReply(B_OK
, &reply
, sizeof(reply
));
135 /*************************************************************
136 * private BFileInterface
137 *************************************************************/
140 private unimplemented
141 BFileInterface::BFileInterface(const BFileInterface &clone)
142 FileInterface & BFileInterface::operator=(const BFileInterface &clone)
145 status_t
BFileInterface::_Reserved_FileInterface_0(void *) { return B_ERROR
; }
146 status_t
BFileInterface::_Reserved_FileInterface_1(void *) { return B_ERROR
; }
147 status_t
BFileInterface::_Reserved_FileInterface_2(void *) { return B_ERROR
; }
148 status_t
BFileInterface::_Reserved_FileInterface_3(void *) { return B_ERROR
; }
149 status_t
BFileInterface::_Reserved_FileInterface_4(void *) { return B_ERROR
; }
150 status_t
BFileInterface::_Reserved_FileInterface_5(void *) { return B_ERROR
; }
151 status_t
BFileInterface::_Reserved_FileInterface_6(void *) { return B_ERROR
; }
152 status_t
BFileInterface::_Reserved_FileInterface_7(void *) { return B_ERROR
; }
153 status_t
BFileInterface::_Reserved_FileInterface_8(void *) { return B_ERROR
; }
154 status_t
BFileInterface::_Reserved_FileInterface_9(void *) { return B_ERROR
; }
155 status_t
BFileInterface::_Reserved_FileInterface_10(void *) { return B_ERROR
; }
156 status_t
BFileInterface::_Reserved_FileInterface_11(void *) { return B_ERROR
; }
157 status_t
BFileInterface::_Reserved_FileInterface_12(void *) { return B_ERROR
; }
158 status_t
BFileInterface::_Reserved_FileInterface_13(void *) { return B_ERROR
; }
159 status_t
BFileInterface::_Reserved_FileInterface_14(void *) { return B_ERROR
; }
160 status_t
BFileInterface::_Reserved_FileInterface_15(void *) { return B_ERROR
; }