A node that can read and write data to a file on disk. More...
Inherits BMediaNode.
Protected Member Functions | |
BFileInterface () | |
Constructor. | |
virtual | ~BFileInterface () |
Destructor. | |
virtual void | DisposeFileFormatCookie (int32 cookie)=0 |
Implement this method to dispose of a file format supported by your node indexed by cookie. | |
virtual status_t | GetDuration (bigtime_t *_time)=0 |
Implement this method to fill out the duration in microseconds of the media data contained in the currently referenced file in _time. | |
virtual status_t | GetNextFileFormat (int32 *cookie, media_file_format *_format)=0 |
Implement this method to fill out information about a file format indexed by cookie. | |
virtual status_t | GetRef (entry_ref *_ref, char *_mimeType)=0 |
Implement to set the entry_ref and the MIME type of the file referenced by the current node. | |
virtual status_t | HandleMessage (int32 message, const void *data, size_t size) |
Dispatches a message to the appropriate BMediaNode hook method given a message received on the control port. Implement this method to handle messages that arrive on your control port. | |
virtual status_t | SetRef (const entry_ref &file, bool create, bigtime_t *_time)=0 |
Used when an application wants your node to use a specific file. | |
virtual status_t | SniffRef (const entry_ref &file, char *_mimeType, float *_quality)=0 |
Implement this method to allow the Media Roster to identify a file format associated with this node. | |
A node that can read and write data to a file on disk.
You should derive your subclass from BFileInterface so that your application may specify the file that the node will reference. The Media Server will then call upon the node to try to identify and work with files that are hereunto unknown to it.
Your node must also derive from BBufferConsumer or BBufferProducer, in addition to BFileInterface.
|
protectedpure virtual |
Implement this method to dispose of a file format supported by your node indexed by cookie.
You are responsible for freeing any data blocks associated with this cookie before returning.
cookie | Index of the cookie you wish to dispose of. |
Implement this method to fill out the duration in microseconds of the media data contained in the currently referenced file in _time.
_time | The duration parameter to fill out. |
B_OK
on success and B_ERROR
or another error code on error.
|
protectedpure virtual |
Implement this method to fill out information about a file format indexed by cookie.
The first time this method is called cookie will be set to 0. In your implementation you should set information about the first file format you support in _format and set cookie to some meaningful non-zero value to track your positing in the list of supported formats, then return B_OK
.
On successive calls return successive file format information and update cookie to track your position in the list. Each time you return new information about a file format return B_OK
.
Once you run out of formats return B_ERROR
.
cookie | Index of file format to fill out. |
_format | Pointer to a preallocated media_file_format object to fill out. |
B_OK
if a file format was filled out for cookie, B_ERROR
or an appropriate error code otherwise.
|
protectedvirtual |
Dispatches a message to the appropriate BMediaNode hook method given a message received on the control port. Implement this method to handle messages that arrive on your control port.
message | The message identifier. |
data | The message data. |
size | The size of the message data in bytes. |
B_OK | Message was dispatched. |
B_ERROR | There was an error dispatching the message, possibly because it doesn't correspond to a hook function. |
Reimplemented from BMediaNode.
|
protectedpure virtual |
Used when an application wants your node to use a specific file.
The file specified by file may or may not exist.
If create is false
you should try to open the existing file, and if successful you should write the running time of the file into _time. If you the file does not exist you should return B_ENTRY_NOT_FOUND
.
If create is true
you should create a new file, initialize the file for writing, and store 0 in _time. You should overwrite the file if it already exists.
B_OK
on success or an appropriate error code such as B_ERROR
or B_ENTRY_NOT_FOUND
on error.
|
protectedpure virtual |
Implement this method to allow the Media Roster to identify a file format associated with this node.
If you can handle the format, set _mimeType to the MIME type of the file format and set _quality to indicate how well you can process the file.
A _quality of 0.0 means that you can't handle the file format at all and an _quality of 1.0 means you have total control over the file format.
file | The file being sniffed. |
_mimeType | Fill this out with the appropriate MIME type. |
_quality | How well you are able to handle the file format from 0.0 to 1.0. |
B_OK
if you can identify the file's contents, otherwise return an appropriate error code. If you can't handle the file format at all, you should return B_MEDIA_NO_HANDLER
.