rygel r396 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r396 - trunk/src/rygel
- Date: Thu, 25 Dec 2008 12:02:09 +0000 (UTC)
Author: zeeshanak
Date: Thu Dec 25 12:02:08 2008
New Revision: 396
URL: http://svn.gnome.org/viewvc/rygel?rev=396&view=rev
Log:
Refactor Streamer.handle_item_request().
Modified:
trunk/src/rygel/rygel-streamer.vala
Modified: trunk/src/rygel/rygel-streamer.vala
==============================================================================
--- trunk/src/rygel/rygel-streamer.vala (original)
+++ trunk/src/rygel/rygel-streamer.vala Thu Dec 25 12:02:08 2008
@@ -122,8 +122,7 @@
return;
}
- string uri = item.res.uri;
- if (uri == null) {
+ if (item.res.uri == null) {
warning ("Requested item '%s' didn't provide a URI\n", item_id);
msg.set_status (Soup.KnownStatusCode.NOT_FOUND);
return;
@@ -138,24 +137,7 @@
return;
}
- // Create to Gst source that can handle the URI
- var src = Element.make_from_uri (URIType.SRC, uri, null);
- if (src == null) {
- warning ("Failed to create source element for URI: %s\n", uri);
- msg.set_status (Soup.KnownStatusCode.NOT_FOUND);
- return;
- }
-
- // create a stream for it
- var stream = new Stream (this.context.server, msg);
- try {
- // Then attach the gst source to stream we are good to go
- this.stream_from_gst_source (src, stream);
- } catch (Error error) {
- critical ("Error in attempting to start streaming %s: %s",
- uri,
- error.message);
- }
+ this.handle_item_stream (msg, item);
}
private void handle_path_request (Soup.Message msg,
@@ -189,5 +171,29 @@
item.res.size.to_string ());
}
}
+
+ private void handle_item_stream (Soup.Message msg,
+ MediaItem item) {
+ string uri = item.res.uri;
+
+ // Create to Gst source that can handle the URI
+ var src = Element.make_from_uri (URIType.SRC, uri, null);
+ if (src == null) {
+ warning ("Failed to create source element for URI: %s\n", uri);
+ msg.set_status (Soup.KnownStatusCode.NOT_FOUND);
+ return;
+ }
+
+ // create a stream for it
+ var stream = new Stream (this.context.server, msg);
+ try {
+ // Then attach the gst source to stream we are good to go
+ this.stream_from_gst_source (src, stream);
+ } catch (Error error) {
+ critical ("Error in attempting to start streaming %s: %s",
+ uri,
+ error.message);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]