rygel r651 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r651 - trunk/src/rygel
- Date: Sun, 15 Mar 2009 19:00:34 +0000 (UTC)
Author: zeeshanak
Date: Sun Mar 15 19:00:34 2009
New Revision: 651
URL: http://svn.gnome.org/viewvc/rygel?rev=651&view=rev
Log:
MediaItem creates res for itself for a given URI.
Modified:
trunk/src/rygel/rygel-didl-lite-writer.vala
trunk/src/rygel/rygel-media-item.vala
Modified: trunk/src/rygel/rygel-didl-lite-writer.vala
==============================================================================
--- trunk/src/rygel/rygel-didl-lite-writer.vala (original)
+++ trunk/src/rygel/rygel-didl-lite-writer.vala Sun Mar 15 19:00:34 2009
@@ -212,55 +212,11 @@
var resources = new ArrayList<DIDLLiteResource?> ();
foreach (var uri in item.uris) {
- DIDLLiteResource res = create_res (item, uri);
+ DIDLLiteResource res = item.create_res (uri);
resources.add (res);
}
return resources;
}
-
- private DIDLLiteResource create_res (MediaItem item,
- string uri)
- throws Error {
- DIDLLiteResource res = DIDLLiteResource ();
- res.reset ();
-
- res.uri = uri;
- res.mime_type = item.mime_type;
-
- res.size = item.size;
- res.duration = item.duration;
- res.bitrate = item.bitrate;
-
- res.sample_freq = item.sample_freq;
- res.bits_per_sample = item.bits_per_sample;
- res.n_audio_channels = item.n_audio_channels;
-
- res.width = item.width;
- res.height = item.height;
- res.color_depth = item.color_depth;
-
- /* Protocol info */
- if (res.uri != null) {
- string protocol = get_protocol_for_uri (res.uri);
- res.protocol = protocol;
- }
-
- /* DLNA related fields */
- res.dlna_profile = "MP3"; /* FIXME */
-
- if (item.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
- res.dlna_flags |= DLNAFlags.INTERACTIVE_TRANSFER_MODE;
- } else {
- res.dlna_flags |= DLNAFlags.STREAMING_TRANSFER_MODE;
- }
-
- if (res.size > 0) {
- res.dlna_operation = DLNAOperation.RANGE;
- res.dlna_flags |= DLNAFlags.BACKGROUND_TRANSFER_MODE;
- }
-
- return res;
- }
}
Modified: trunk/src/rygel/rygel-media-item.vala
==============================================================================
--- trunk/src/rygel/rygel-media-item.vala (original)
+++ trunk/src/rygel/rygel-media-item.vala Sun Mar 15 19:00:34 2009
@@ -73,4 +73,60 @@
public virtual Gst.Element? create_stream_source () {
return null;
}
+
+ internal DIDLLiteResource create_res (string uri) throws Error {
+ DIDLLiteResource res = DIDLLiteResource ();
+ res.reset ();
+
+ res.uri = uri;
+ res.mime_type = this.mime_type;
+
+ res.size = this.size;
+ res.duration = this.duration;
+ res.bitrate = this.bitrate;
+
+ res.sample_freq = this.sample_freq;
+ res.bits_per_sample = this.bits_per_sample;
+ res.n_audio_channels = this.n_audio_channels;
+
+ res.width = this.width;
+ res.height = this.height;
+ res.color_depth = this.color_depth;
+
+ /* Protocol info */
+ if (res.uri != null) {
+ string protocol = get_protocol_for_uri (res.uri);
+ res.protocol = protocol;
+ }
+
+ /* DLNA related fields */
+ res.dlna_profile = "MP3"; /* FIXME */
+
+ if (this.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
+ res.dlna_flags |= DLNAFlags.INTERACTIVE_TRANSFER_MODE;
+ } else {
+ res.dlna_flags |= DLNAFlags.STREAMING_TRANSFER_MODE;
+ }
+
+ if (res.size > 0) {
+ res.dlna_operation = DLNAOperation.RANGE;
+ res.dlna_flags |= DLNAFlags.BACKGROUND_TRANSFER_MODE;
+ }
+
+ return res;
+ }
+
+ private string get_protocol_for_uri (string uri) throws Error {
+ if (uri.has_prefix ("http")) {
+ return "http-get";
+ } else if (uri.has_prefix ("file")) {
+ return "internal";
+ } else if (uri.has_prefix ("rtsp")) {
+ // FIXME: Assuming that RTSP is always accompanied with RTP over UDP
+ return "rtsp-rtp-udp";
+ } else {
+ throw new DIDLLiteWriterError.UNKNOWN_URI_TYPE
+ ("Failed to probe protocol for URI %s", uri);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]