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

« back to all changes in this revision

Viewing changes to metadata/rb-metadata-gst-common.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:
129
129
                return RB_METADATA_FIELD_ARTIST_SORTNAME;
130
130
        else if (!strcmp (tag, GST_TAG_ALBUM_SORTNAME))
131
131
                return RB_METADATA_FIELD_ALBUM_SORTNAME;
132
 
#if GST_CHECK_VERSION(0,10,25)
133
132
        else if (!strcmp (tag, GST_TAG_ALBUM_ARTIST))
134
133
                return RB_METADATA_FIELD_ALBUM_ARTIST;
135
134
        else if (!strcmp (tag, GST_TAG_ALBUM_ARTIST_SORTNAME))
136
135
                return RB_METADATA_FIELD_ALBUM_ARTIST_SORTNAME;
137
 
#endif
138
136
        else
139
137
                return -1;
140
138
}
208
206
                return GST_TAG_ARTIST_SORTNAME;
209
207
        case RB_METADATA_FIELD_ALBUM_SORTNAME:
210
208
                return GST_TAG_ALBUM_SORTNAME;
211
 
#if GST_CHECK_VERSION(0,10,25)
212
209
        case RB_METADATA_FIELD_ALBUM_ARTIST:
213
210
                return GST_TAG_ALBUM_ARTIST;
214
211
        case RB_METADATA_FIELD_ALBUM_ARTIST_SORTNAME:
215
212
                return GST_TAG_ALBUM_ARTIST_SORTNAME;
216
 
#endif
217
213
        default:
218
214
                return NULL;
219
215
        }
220
216
}
221
 
 
222
 
 
223
 
/* don't like this much, but it's all we can do for now.
224
 
 * these media types are copied from gst-plugins-base/gst-libs/gst/pbutils/descriptions.c.
225
 
 * these are only the media types that don't start with 'audio/' or 'video/', which are
226
 
 * identified fairly accurately by the filters for those prefixes.
227
 
 */
228
 
static const char *container_formats[] = {
229
 
        "application/ogg",
230
 
        "application/vnd.rn-realmedia",
231
 
        "application/x-id3",
232
 
        "application/x-ape",
233
 
        "application/x-icy"
234
 
};
235
 
 
236
 
 
237
 
RBGstMediaType
238
 
rb_metadata_gst_get_missing_plugin_type (GstMessage *message)
239
 
{
240
 
        const char *media_type;
241
 
        const char *missing_type;
242
 
        const GstStructure *structure;
243
 
        const GstCaps *caps;
244
 
        const GValue *val;
245
 
        int i;
246
 
 
247
 
        structure = gst_message_get_structure (message);
248
 
        missing_type = gst_structure_get_string (structure, "type");
249
 
        if (missing_type == NULL || strcmp (missing_type, "decoder") != 0) {
250
 
                rb_debug ("missing plugin is not a decoder");
251
 
                return MEDIA_TYPE_NONE;
252
 
        }
253
 
 
254
 
        val = gst_structure_get_value (structure, "detail");
255
 
        caps = gst_value_get_caps (val);
256
 
 
257
 
        media_type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
258
 
        for (i = 0; i < G_N_ELEMENTS (container_formats); i++) {
259
 
                if (strcmp (media_type, container_formats[i]) == 0) {
260
 
                        rb_debug ("missing plugin is a container demuxer");
261
 
                        return MEDIA_TYPE_CONTAINER;
262
 
                }
263
 
        }
264
 
 
265
 
        if (g_str_has_prefix (media_type, "audio/")) {
266
 
                rb_debug ("missing plugin is an audio decoder");
267
 
                return MEDIA_TYPE_AUDIO;
268
 
        } else if (g_str_has_prefix (media_type, "video/")) {
269
 
                rb_debug ("missing plugin is (probably) a video decoder");
270
 
                return MEDIA_TYPE_VIDEO;
271
 
        } else {
272
 
                rb_debug ("missing plugin is neither a video nor audio decoder");
273
 
                return MEDIA_TYPE_OTHER;
274
 
        }
275
 
}
276