![]() |
![]() |
![]() |
Buzztard Bt-Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#include <libbtcore/core.h> BtSongIO; BtSongIOClass; BtSongIO * bt_song_io_from_file (const gchar * const file_name
); BtSongIO * bt_song_io_from_data (gpointer *data
,guint len
,const gchar *media_type
); gboolean bt_song_io_load (BtSongIO const *self
,const BtSong * const song
); gboolean bt_song_io_save (BtSongIO const *self
,const BtSong * const song
); const GList * bt_song_io_get_module_info_list (void
); BtSongIOFormatInfo; BtSongIOModuleInfo; #define BT_SONG_IO_MODULE_INFO_MAX_FORMATS gboolean (*bt_song_io_virtual_load) (gconstpointer self
,const BtSong * const song
); gboolean (*bt_song_io_virtual_save) (gconstpointer const self
,const BtSong * const song
);
"data" gpointer : Read "data-len" guint : Read "file-name" gchar* : Read "status" gchar* : Read / Write
A base class for BtSong loader and saver implementations. A BtSongIO module
needs to be installed as a shared library into LIBDIR/songio. It is
recognized, if it exports a BtSongIOModuleInfo structure. At runtime the
detect method of each module is called with the chosen file-name. The module
should return its GType if it can handle the format or NULL
else.
Such a module should overwrite the bt_song_io_load()
and/or bt_song_io_save()
default implementations.
There is an internal subclass of this called BtSongIONative.
This API is not yet fully stable. Please discuss with the deverloper team if you intend to write a io plugin.
typedef struct { const GObjectClass parent; /* class methods */ bt_song_io_virtual_load load; bt_song_io_virtual_save save; } BtSongIOClass;
Base class for song input and output plugins
parent class type | |
bt_song_io_virtual_load |
virtual method for loading a song |
bt_song_io_virtual_save |
virtual method for saving a song |
BtSongIO * bt_song_io_from_file (const gchar * const file_name
);
Create a new instance from the given file_name
. Each installed plugin will
test if it can handle the file type.
|
the file name of the song |
Returns : |
the new instance or NULL in case of an error
|
BtSongIO * bt_song_io_from_data (gpointer *data
,guint len
,const gchar *media_type
);
Create a new instance from the given parameters. Each installed plugin will test if it can handle the file type.
|
in memory data of the song |
|
the siye of the data block
|
|
the media-type of the song, if available |
Returns : |
the new instance or NULL in case of an error
|
gboolean bt_song_io_load (BtSongIO const *self
,const BtSong * const song
);
load the song from a file. The file is set in the constructor
gboolean bt_song_io_save (BtSongIO const *self
,const BtSong * const song
);
save the song to a file. The file is set in the constructor
const GList * bt_song_io_get_module_info_list (void
);
Get read only access to list of BtSongIOModuleInfo entries.
Returns : |
the GList. |
typedef struct { GType type; const gchar *name; const gchar *mime_type; const gchar *extension; } BtSongIOFormatInfo;
Metadata structure for BtSongIO plugins describing one format.
typedef struct { BtSongIOInit init; BtSongIOFormatInfo formats[BT_SONG_IO_MODULE_INFO_MAX_FORMATS]; } BtSongIOModuleInfo;
Metadata structure for BtSongIO plugins.
pointer to init function, can be NULL .
|
|
BtSongIOFormatInfo |
NULL terminated array of formats supported by this plugin
|
#define BT_SONG_IO_MODULE_INFO_MAX_FORMATS 10
Maximum number of BtSongIOFormatInfo per plugin (10).
gboolean (*bt_song_io_virtual_load) (gconstpointer self
,const BtSong * const song
);
Subclasses will override this methods with the loader function.
|
song-io instance |
|
song object to load |
Returns : |
TRUE for success
|
gboolean (*bt_song_io_virtual_save) (gconstpointer const self
,const BtSong * const song
);
Subclasses will override this methods with the saver function.
|
song-io instance |
|
song object to save |
Returns : |
TRUE for success
|