From: Zeeshan Ali (Khattak) Date: Tue, 5 Aug 2008 15:49:24 +0000 (+0000) Subject: Extract the mime-type using GIO. X-Git-Tag: RYGEL_0_2~249 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f875565c8fbd2a89445cee7253e121ae11bd0a9;p=profile%2Fivi%2Frygel.git Extract the mime-type using GIO. svn path=/trunk/; revision=224 --- diff --git a/ChangeLog b/ChangeLog index fb5b7b0..8123c48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -148,6 +148,12 @@ 2008-06-27 Zeeshan Ali Khattak + * src/gupnp-metadata-extractor.vala: + + Extract the mime-type using GIO. + +2008-06-27 Zeeshan Ali Khattak + * configure.ac: * src/Makefile.am: diff --git a/src/gupnp-metadata-extractor.vala b/src/gupnp-metadata-extractor.vala index 3c43a2b..377a3c6 100644 --- a/src/gupnp-metadata-extractor.vala +++ b/src/gupnp-metadata-extractor.vala @@ -54,6 +54,7 @@ public class GUPnP.MetadataExtractor: GLib.Object { this.playbin.uri = value; if (this.playbin.uri != null) { + extract_mime (); /* Start the extaction when we get a new URI */ this.playbin.set_state (State.PAUSED); } @@ -93,6 +94,34 @@ public class GUPnP.MetadataExtractor: GLib.Object { } } + private void extract_mime () { + File file = File.new_for_uri (this.uri); + + weak FileInfo file_info; + + try { + file_info = file.query_info (FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, + FileQueryInfoFlags.NONE, + null); + } catch (Error error) { + critical ("Failed to query content type for '%s'\n", this.uri); + + return; + } + + weak string content_type = file_info.get_content_type (); + weak string mime = g_content_type_get_mime_type (content_type); + if (mime != null) { + GLib.Value value; + + value.init (typeof (string)); + value.set_string (mime); + + /* signal the availability of new tag */ + this.metadata_available (this.playbin.uri, "mime-type", ref value); + } + } + private void tag_cb (Gst.Bus bus, Gst.Message message) { TagList tag_list;