=== modified file 'debian/changelog' --- debian/changelog 2010-09-27 11:26:08 +0000 +++ debian/changelog 2010-11-02 12:07:00 +0000 @@ -1,3 +1,12 @@ +rhythmbox (0.13.1-0ubuntu6) maverick-proposed; urgency=low + + * debian/patches/92_git_add_hardcoded_extensions_for_common_media_types.patch: + backport from upstream, add a fallback system to rename files accordingly to + what the device is expecting even if the right encoder isn't installed + (LP: #659244) + + -- Didier Roche Tue, 02 Nov 2010 13:05:02 +0100 + rhythmbox (0.13.1-0ubuntu5) maverick; urgency=low * debian/patches/22_impl-add-uri-hack.patch: === added file 'debian/patches/92_git_add_hardcoded_extensions_for_common_media_types.patch' --- debian/patches/92_git_add_hardcoded_extensions_for_common_media_types.patch 1970-01-01 00:00:00 +0000 +++ debian/patches/92_git_add_hardcoded_extensions_for_common_media_types.patch 2010-11-02 12:04:43 +0000 @@ -0,0 +1,129 @@ +From 65f1adbce1bee06edb57dc1960f4a7e2e05fad0e Mon Sep 17 00:00:00 2001 +From: Jonathan Matthew +Date: Wed, 08 Sep 2010 12:49:24 +0000 +Subject: encoder: add hardcoded extensions for common media types (bug #625054) + +Previously we relied on the audio encoding profiles to provide extension +information, but of course that only works if the encoder elements for the +profile are available. You shouldn't need to install an MP3 encoder to copy +MP3 files to a device, so now we have a fallback for the most common types. +--- +diff --git a/backends/gstreamer/rb-encoder-gst.c b/backends/gstreamer/rb-encoder-gst.c +index 4bac0df..7c49878 100644 +--- a/backends/gstreamer/rb-encoder-gst.c ++++ b/backends/gstreamer/rb-encoder-gst.c +@@ -138,11 +138,12 @@ rb_encoder_gst_class_init (RBEncoderGstClass *klass) + NULL, + (GDestroyNotify)gst_caps_unref); + +- /* AAC */ ++ /* M4A/AAC */ + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 4, + NULL); + g_hash_table_insert (klass->media_caps_table, "audio/aac", caps); ++ g_hash_table_insert (klass->media_caps_table, "audio/x-m4a", caps); + + /* MP3 */ + caps = gst_caps_new_simple ("audio/mpeg", +@@ -159,6 +160,13 @@ rb_encoder_gst_class_init (RBEncoderGstClass *klass) + /* FLAC */ + caps = gst_caps_new_simple ("audio/x-flac", NULL); + g_hash_table_insert (klass->media_caps_table, "audio/flac", caps); ++ ++ /* create the media type -> extension fallback mapping table */ ++ klass->media_extension_table = g_hash_table_new (g_str_hash, g_str_equal); ++ g_hash_table_insert (klass->media_extension_table, "audio/mpeg", "mp3"); ++ g_hash_table_insert (klass->media_extension_table, "audio/x-vorbis", "ogg"); ++ g_hash_table_insert (klass->media_extension_table, "audio/x-flac", "flac"); ++ g_hash_table_insert (klass->media_extension_table, "audio/x-m4a", "m4a"); + } + + static void +@@ -1126,6 +1134,26 @@ rb_encoder_gst_encode (RBEncoder *bencoder, + } + } + ++static char * ++get_extension_for_media_type (RBEncoder *encoder, const char *media_type) ++{ ++ char *ext; ++ GMAudioProfile *profile; ++ ++ profile = get_profile_from_media_type (RB_ENCODER_GST (encoder), media_type); ++ if (profile) { ++ ext = g_strdup (gm_audio_profile_get_extension (profile)); ++ rb_debug ("got extension %s from profile", ext); ++ g_object_unref (profile); ++ } else { ++ GHashTable *map = RB_ENCODER_GST_GET_CLASS (encoder)->media_extension_table; ++ ext = g_strdup (g_hash_table_lookup (map, media_type)); ++ rb_debug ("got extension %s from fallback extension map", ext); ++ } ++ ++ return ext; ++} ++ + static gboolean + rb_encoder_gst_get_media_type (RBEncoder *encoder, + RhythmDBEntry *entry, +@@ -1160,6 +1188,9 @@ rb_encoder_gst_get_media_type (RBEncoder *encoder, + /* ugh */ + return FALSE; + } ++ rb_debug ("selected preferred media type %s (extension %s)", ++ mt, ++ gm_audio_profile_get_extension (profile)); + if (media_type != NULL) + *media_type = g_strdup (mt); + if (extension != NULL) +@@ -1167,6 +1198,9 @@ rb_encoder_gst_get_media_type (RBEncoder *encoder, + } else { + if (media_type != NULL) + *media_type = g_strdup (src_media_type); ++ ++ if (extension != NULL) ++ *extension = get_extension_for_media_type (encoder, src_media_type); + } + return TRUE; + } +@@ -1176,12 +1210,8 @@ rb_encoder_gst_get_media_type (RBEncoder *encoder, + rb_debug ("found source media type %s in destination type list", src_media_type); + if (media_type != NULL) + *media_type = g_strdup (src_media_type); +- profile = get_profile_from_media_type (RB_ENCODER_GST (encoder), src_media_type); +- if (profile) { +- if (extension != NULL) +- *extension = g_strdup (gm_audio_profile_get_extension (profile)); +- g_object_unref (profile); +- } ++ if (extension != NULL) ++ *extension = get_extension_for_media_type (encoder, src_media_type); + return TRUE; + } + +@@ -1195,7 +1225,9 @@ rb_encoder_gst_get_media_type (RBEncoder *encoder, + mt = (const char *)l->data; + profile = get_profile_from_media_type (RB_ENCODER_GST (encoder), mt); + if (profile) { +- rb_debug ("selected destination media type %s", mt); ++ rb_debug ("selected destination media type %s (extension %s)", ++ mt, ++ gm_audio_profile_get_extension (profile)); + if (extension != NULL) + *extension = g_strdup (gm_audio_profile_get_extension (profile)); + +diff --git a/backends/gstreamer/rb-encoder-gst.h b/backends/gstreamer/rb-encoder-gst.h +index 985b730..749920d 100644 +--- a/backends/gstreamer/rb-encoder-gst.h ++++ b/backends/gstreamer/rb-encoder-gst.h +@@ -49,6 +49,7 @@ typedef struct + GObjectClass obj_class; + + GHashTable *media_caps_table; ++ GHashTable *media_extension_table; + } RBEncoderGstClass; + + typedef struct +-- +cgit v0.8.3.1 === modified file 'debian/patches/series' --- debian/patches/series 2010-09-27 11:26:08 +0000 +++ debian/patches/series 2010-11-02 12:04:58 +0000 @@ -9,4 +9,4 @@ 22_hide_on_quit.patch 22_impl-add-uri-hack.patch 91_git_fix_upnp_support.patch - +92_git_add_hardcoded_extensions_for_common_media_types.patch