[rhythmbox] track-transfer-batch: add a signal to use to configure the profile



commit cf51e0b4f50d284b48c503ced29cdd4cf257de01
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon Apr 23 08:39:02 2012 +1000

    track-transfer-batch: add a signal to use to configure the profile
    
    This allows the creator of the batch to configure the encoding
    profile before encoding begins.  The only thing that's likely to
    be useful to do here is applying a preset to the audio encoding
    profile.

 shell/rb-track-transfer-batch.c |   23 +++++++++++++++++++++++
 shell/rb-track-transfer-batch.h |    3 +++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/shell/rb-track-transfer-batch.c b/shell/rb-track-transfer-batch.c
index ecc09ff..64f2f9c 100644
--- a/shell/rb-track-transfer-batch.c
+++ b/shell/rb-track-transfer-batch.c
@@ -51,6 +51,7 @@ enum
 	TRACK_STARTED,
 	TRACK_PROGRESS,
 	TRACK_DONE,
+	CONFIGURE_PROFILE,
 	LAST_SIGNAL
 };
 
@@ -625,6 +626,9 @@ start_next (RBTrackTransferBatch *batch)
 		if (profile != NULL) {
 			media_type = rb_gst_encoding_profile_get_media_type (profile);
 			extension = g_strdup (rb_gst_media_type_to_extension (media_type));
+
+			rb_gst_encoding_profile_set_preset (profile, NULL);
+			g_signal_emit (batch, signals[CONFIGURE_PROFILE], 0, media_type, profile);
 		} else {
 			media_type = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_MEDIA_TYPE);
 			extension = g_strdup (rb_gst_media_type_to_extension (media_type));
@@ -1052,6 +1056,25 @@ rb_track_transfer_batch_class_init (RBTrackTransferBatchClass *klass)
 			      G_TYPE_NONE,
 			      5, RHYTHMDB_TYPE_ENTRY, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_STRING, G_TYPE_POINTER);
 
+	/**
+	 * RBTrackTransferBatch::configure-profile:
+	 * @batch: the #RBTrackTransferBatch
+	 * @mediatype: the target media type
+	 * @profile: the #GstEncodingProfile
+	 *
+	 * Emitted to allow configuration of encoding profile settings
+	 * (mostly by setting presets on sub-profiles).
+	 */
+	signals [CONFIGURE_PROFILE] =
+		g_signal_new ("configure-profile",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (RBTrackTransferBatchClass, configure_profile),
+			      NULL, NULL,
+			      rb_marshal_VOID__STRING_POINTER,
+			      G_TYPE_NONE,
+			      2, G_TYPE_STRING, GST_TYPE_ENCODING_PROFILE);
+
 	g_type_class_add_private (klass, sizeof (RBTrackTransferBatchPrivate));
 }
 
diff --git a/shell/rb-track-transfer-batch.h b/shell/rb-track-transfer-batch.h
index f748e94..0a66d61 100644
--- a/shell/rb-track-transfer-batch.h
+++ b/shell/rb-track-transfer-batch.h
@@ -60,6 +60,9 @@ struct _RBTrackTransferBatchClass
 	void	(*cancelled)		(RBTrackTransferBatch *batch);
 	void	(*complete)		(RBTrackTransferBatch *batch);
 
+	char *	(*configure_profile)	(RBTrackTransferBatch *batch,
+					 const char *mediatype,
+					 GstEncodingProfile *profile);
 	char *  (*get_dest_uri)		(RBTrackTransferBatch *batch,
 					 RhythmDBEntry *entry,
 					 const char *mediatype,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]