![]() |
![]() |
![]() |
Rhythmbox Development Reference Manual | ![]() |
---|---|---|---|---|
RBEncoder; RBEncoder* rb_encoder_new (void); gboolean rb_encoder_encode (RBEncoder *encoder, RhythmDBEntry *entry, const char *dest, GList *mime_types); void rb_encoder_cancel (RBEncoder *encoder); gboolean rb_encoder_get_preferred_mimetype (RBEncoder *encoder, GList *mime_types, char **mime, char **extension);
The RBEncoder interface provides transcoding between audio formats based on MIME types.
The encoder picks the output format from a list provided by the caller, limited by the available codecs. It operatees asynchronously and provides status updates in the form of signals.
A new encoder instance should be created for each file that is transcoded.
RBEncoder* rb_encoder_new (void);
Creates a new RBEncoder instance.
Returns : |
the new RBEncoder |
gboolean rb_encoder_encode (RBEncoder *encoder, RhythmDBEntry *entry, const char *dest, GList *mime_types);
Initiates encoding. A target MIME type will be selected from the list given. If the source format is in the list, that will be chosen regardless of order. Otherwise, the first type in the list that the encoder can produce will be selected.
Encoding takes places asynchronously. If the return value is TRUE, the caller should wait for a 'completed' or 'error' signal to indicate that it has finished.
|
the RBEncoder |
|
the RhythmDBEntry to transcode |
|
destination file URI |
|
a GList of target MIME types in order of preference |
Returns : |
TRUE if encoding has started |
void rb_encoder_cancel (RBEncoder *encoder);
Attempts to cancel any in progress encoding. The encoder should delete the destination file, if it created one.
|
a RBEncoder |
gboolean rb_encoder_get_preferred_mimetype (RBEncoder *encoder, GList *mime_types, char **mime, char **extension);
Identifies the first MIME type in the list that the encoder can actually encode to. The file extension (eg. '.mp3' for audio/mpeg) associated with the selected type is also returned.
"completed"
signalvoid user_function (RBEncoder *encoder, guint64 arg1, gpointer user_data) : Run Last
Emitted when the encoding process is complete. The destination file will be closed and flushed to disk when this occurs.
|
the RBEncoder instance |
|
user data set when the signal handler was connected. |
"error"
signalvoid user_function (RBEncoder *encoder, gpointer error, gpointer user_data) : Run Last
Emitted when an error occurs during encoding.
"progress"
signalvoid user_function (RBEncoder *encoder, gdouble fraction, gpointer user_data) : Run Last
Emitted regularly during the encoding process to provide progress updates.
|
the RBEncoder instance |
|
progress as a fraction (0..1) |
|
user data set when the signal handler was connected. |