Top |
Functions
Description
Sources that can accept track transfers should implement this interface and call the associated functions to perform transfers. The source needs to be able to construct target URIs for transfers, and can optionally perform its own processing after transfers have finished. The source must also provide a GstEncodingTarget that describes the formats it accepts.
Functions
rb_transfer_target_build_dest_uri ()
char * rb_transfer_target_build_dest_uri (RBTransferTarget *target
,RhythmDBEntry *entry
,const char *media_type
,const char *extension
);
Constructs a URI to use as the destination for a transfer or transcoding operation. The URI may be on the device itself, if the device is mounted into the normal filesystem or through gvfs, or it may be a temporary location used to store the file before uploading it to the device.
The destination URI should conform to the device's normal URI format, and should use the provided extension instead of the extension from the source entry.
rb_transfer_target_track_added ()
void rb_transfer_target_track_added (RBTransferTarget *target
,RhythmDBEntry *entry
,const char *uri
,guint64 filesize
,const char *media_type
);
This is called when a transfer to the target has completed.
If the source's track_added
method returns TRUE
, the destination
URI will be added to the database using the entry type for the device.
If the target uses a temporary area as the destination for transfers,
it can instead upload the destination file to the device and create an
entry for it, then return FALSE
.
rb_transfer_target_track_add_error ()
void rb_transfer_target_track_add_error (RBTransferTarget *target
,RhythmDBEntry *entry
,const char *uri
,GError *error
);
This is called when a transfer fails. If the source's
impl_track_add_error implementation returns TRUE
, an error dialog
will be displayed to the user containing the error message, unless
the error indicates that the destination file already exists.
rb_transfer_target_should_transfer ()
gboolean rb_transfer_target_should_transfer (RBTransferTarget *target
,RhythmDBEntry *entry
);
Checks whether entry
should be transferred to the target.
The target can check whether a matching entry already exists on the device,
for instance. rb_transfer_target_check_duplicate
may form part of
an implementation. If this method returns FALSE
, the entry
will be skipped.
rb_transfer_target_get_format_descriptions ()
GList *
rb_transfer_target_get_format_descriptions
(RBTransferTarget *target
);
Returns a GList of allocated media format descriptions for the formats supported by the target. The list and the strings it holds must be freed by the caller.
rb_transfer_target_check_category ()
gboolean rb_transfer_target_check_category (RBTransferTarget *target
,RhythmDBEntry *entry
);
This checks that the entry type of entry
is in a suitable
category for transfer. This can be used to implement
should_transfer
.
rb_transfer_target_check_duplicate ()
gboolean rb_transfer_target_check_duplicate (RBTransferTarget *target
,RhythmDBEntry *entry
);
This checks for an existing entry in the target that matches
the title, album, artist, and track number of the entry being
considered. This can be used to implement should_transfer
.
rb_transfer_target_transfer ()
RBTrackTransferBatch * rb_transfer_target_transfer (RBTransferTarget *target
,GSettings *settings
,GList *entries
,gboolean defer
);
Starts tranferring entries
to the target. This returns the
RBTrackTransferBatch that it starts, so the caller can track
the progress of the transfer, or NULL if the target doesn't
want any of the entries.
Parameters
target |
an RBTransferTarget |
|
settings |
GSettings instance holding encoding settings |
|
entries |
a GList of entries to transfer. |
[element-type RB.RhythmDBEntry] |
defer |
if |
Types and Values
struct RBTransferTargetInterface
struct RBTransferTargetInterface { GTypeInterface g_iface; char* (*build_dest_uri) (RBTransferTarget *target, RhythmDBEntry *entry, const char *media_type, const char *extension); gboolean (*track_added) (RBTransferTarget *target, RhythmDBEntry *entry, const char *uri, guint64 dest_size, const char *media_type); gboolean (*track_add_error) (RBTransferTarget *target, RhythmDBEntry *entry, const char *uri, GError *error); gboolean (*should_transfer) (RBTransferTarget *target, RhythmDBEntry *entry); };