~ubuntu-branches/ubuntu/oneiric/rhythmbox/oneiric

« back to all changes in this revision

Viewing changes to backends/rb-encoder.c

  • Committer: Bazaar Package Importer
  • Author(s): Rico Tzschichholz
  • Date: 2011-07-29 16:41:38 UTC
  • mto: This revision was merged to the branch mainline in revision 191.
  • Revision ID: james.westby@ubuntu.com-20110729164138-wwicy8nqalm18ck7
Tags: upstream-2.90.1~20110802
ImportĀ upstreamĀ versionĀ 2.90.1~20110802

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 * @short_description: audio transcoder interface
38
38
 *
39
39
 * The RBEncoder interface provides transcoding between audio formats based on
40
 
 * media types.  Media types are conceptually similar to MIME types, and overlap
41
 
 * in many cases, but the media type for an encoding is not always the same as the
42
 
 * MIME type for files using that encoding.
43
 
 *
44
 
 * The encoder picks the output format from a list provided by the caller,
45
 
 * limited by the available codecs.  It operatees asynchronously and provides
46
 
 * status updates in the form of signals.
47
 
 *
48
 
 * A new encoder instance should be created for each file that is transcoded.
 
40
 * encoding profiles.  The encoder implementation operates asynchronously and
 
41
 * provides status updates in the form of signals emitted on the main thread.
 
42
 * A new encoder instance should be created for each file that is transcoded
 
43
 * or copied.
49
44
 */
50
45
 
51
46
static void rb_encoder_factory_class_init (RBEncoderFactoryClass *klass);
226
221
 * @encoder: the #RBEncoder
227
222
 * @entry: the #RhythmDBEntry to transcode
228
223
 * @dest: destination file URI
229
 
 * @dest_media_type: destination media type, or NULL to just copy it
230
 
 *
231
 
 * Initiates encoding, transcoding to the specified media type if it doesn't match
232
 
 * the current media type of the entry.  The caller should use rb_encoder_get_media_type
233
 
 * to select a destination media type.
234
 
 *
235
 
 * Encoding and error reporting takes places asynchronously.  The caller should wait
 
224
 * @profile: encoding profile to use, or NULL to just copy
 
225
 *
 
226
 * Initiates encoding, transcoding to the specified profile if specified.
 
227
 *
 
228
 * Encoding and error reporting takes place asynchronously.  The caller should wait
236
229
 * for the 'completed' signal which indicates it has either completed or failed.
237
230
 */
238
231
void
239
232
rb_encoder_encode (RBEncoder *encoder,
240
233
                   RhythmDBEntry *entry,
241
234
                   const char *dest,
242
 
                   const char *dest_media_type)
 
235
                   GstEncodingProfile *profile)
243
236
{
244
237
        RBEncoderIface *iface = RB_ENCODER_GET_IFACE (encoder);
245
238
 
246
 
        iface->encode (encoder, entry, dest, dest_media_type);
 
239
        iface->encode (encoder, entry, dest, profile);
247
240
}
248
241
 
249
242
/**
263
256
}
264
257
 
265
258
/**
266
 
 * rb_encoder_get_media_type:
267
 
 * @encoder: a #RBEncoder
268
 
 * @entry: the source #RhythmDBEntry
269
 
 * @dest_media_types: (element-type utf8): media type strings in order of preference
270
 
 * @media_type: (out callee-allocates) (allow-none): returns the selected media type, if any
271
 
 * @extension: (out callee-allocates) (allow-none): returns the file extension associated with the selected media type, if any
272
 
 *
273
 
 * Identifies the first media type in the list that the encoder can actually encode to.
274
 
 * The file extension (eg. '.mp3' for audio/mpeg) associated with the selected type is
275
 
 * also returned.
276
 
 *
277
 
 * Return value: TRUE if a format was identified
278
 
 */
279
 
gboolean
280
 
rb_encoder_get_media_type (RBEncoder *encoder,
281
 
                           RhythmDBEntry *entry,
282
 
                           GList *dest_media_types,
283
 
                           char **media_type,
284
 
                           char **extension)
285
 
{
286
 
        RBEncoderIface *iface = RB_ENCODER_GET_IFACE (encoder);
287
 
 
288
 
        return iface->get_media_type (encoder, entry, dest_media_types, media_type, extension);
289
 
}
290
 
 
291
 
/**
292
259
 * rb_encoder_get_missing_plugins:
293
260
 * @encoder: a #RBEncoder
294
 
 * @media_type: the media type required
 
261
 * @profile: an encoding profile
295
262
 * @details: (out callee-allocates): returns plugin installer detail strings
 
263
 * @descriptions: (out callee-allocates): returns plugin descriptions
296
264
 *
297
 
 * Retrieves the plugin installer detail strings for any missing plugins
298
 
 * required to encode the specified media type.
 
265
 * Retrieves the plugin installer detail strings and descriptions
 
266
 * for any missing plugins required to use the specified encoding profile.
299
267
 *
300
268
 * Return value: %TRUE if some detail strings are returned, %FALSE otherwise
301
269
 */
302
270
gboolean
303
271
rb_encoder_get_missing_plugins (RBEncoder *encoder,
304
 
                                const char *media_type,
305
 
                                char ***details)
 
272
                                GstEncodingProfile *profile,
 
273
                                char ***details,
 
274
                                char ***descriptions)
306
275
{
307
276
        RBEncoderIface *iface = RB_ENCODER_GET_IFACE (encoder);
308
 
        return iface->get_missing_plugins (encoder, media_type, details);
 
277
        return iface->get_missing_plugins (encoder, profile, details, descriptions);
309
278
}
310
279
 
311
280
/**