rygel r339 - in trunk/src: plugins/test rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r339 - in trunk/src: plugins/test rygel
- Date: Sun, 14 Dec 2008 20:21:53 +0000 (UTC)
Author: zeeshanak
Date: Sun Dec 14 20:21:52 2008
New Revision: 339
URL: http://svn.gnome.org/viewvc/rygel?rev=339&view=rev
Log:
No need to provide candidates to Streamer anymore.
Instead you get a new stream object for each HTTP request and you can
accept or reject it and start streaming to it in case of former.
Modified:
trunk/src/plugins/test/rygel-test-audio-item.vala
trunk/src/rygel/rygel-stream.vala
trunk/src/rygel/rygel-streamer.vala
Modified: trunk/src/plugins/test/rygel-test-audio-item.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-audio-item.vala (original)
+++ trunk/src/plugins/test/rygel-test-audio-item.vala Sun Dec 14 20:21:52 2008
@@ -53,7 +53,6 @@
this.streamer = streamer;
streamer.stream_available += this.on_stream_available;
- streamer.add_stream_candidate (TEST_PATH, TEST_MIMETYPE);
}
private void on_stream_available (Streamer streamer,
@@ -61,6 +60,7 @@
string path) {
if (path != TEST_PATH) {
/* Not our path and therefore not interesting. */
+ stream.reject ();
return;
}
@@ -104,9 +104,10 @@
string name) throws Error {
this.stream = stream;
this.name = name;
-
this.buffers = new AsyncQueue<Buffer> ();
+ this.stream.accept ();
+ this.stream.set_mime_type (TestAudioItem.TEST_MIMETYPE);
this.prepare_pipeline ();
}
Modified: trunk/src/rygel/rygel-stream.vala
==============================================================================
--- trunk/src/rygel/rygel-stream.vala (original)
+++ trunk/src/rygel/rygel-stream.vala Sun Dec 14 20:21:52 2008
@@ -44,6 +44,18 @@
this.eos ();
}
+ public void accept () {
+ this.msg.set_status (Soup.KnownStatusCode.OK);
+ }
+
+ public void reject () {
+ this.msg.set_status (Soup.KnownStatusCode.NOT_FOUND);
+ }
+
+ public void set_mime_type (string mime_type) {
+ this.msg.response_headers.append ("Content-Type", mime_type);
+ }
+
public void push_data (void *data, size_t length) {
this.msg.response_body.append (Soup.MemoryUse.COPY,
data,
Modified: trunk/src/rygel/rygel-streamer.vala
==============================================================================
--- trunk/src/rygel/rygel-streamer.vala (original)
+++ trunk/src/rygel/rygel-streamer.vala Sun Dec 14 20:21:52 2008
@@ -30,27 +30,17 @@
private GUPnP.Context context;
- /* Mapping of hosted_paths to mimetypes */
- private HashMap<string,string> path_hash;
-
public signal void stream_available (Rygel.Stream stream,
string path);
public Streamer (GUPnP.Context context, string name) {
this.context = context;
- this.path_hash = new HashMap<string,string> (str_hash, str_equal);
-
this.server_path_root = "/" + name;
context.server.add_handler (this.server_path_root, server_handler);
}
- public void add_stream_candidate (string path,
- string mimetype) {
- this.path_hash.set (path, mimetype);
- }
-
public string create_uri_for_path (string path) {
return "http://%s:%u%s%s".printf (this.context.host_ip,
this.context.port,
@@ -70,15 +60,6 @@
}
string stream_path = path_tokens[1];
- string mimetype = this.path_hash.get (stream_path);
- if (mimetype == null) {
- msg.set_status (Soup.KnownStatusCode.NOT_FOUND);
- return;
- }
-
- msg.set_status (Soup.KnownStatusCode.OK);
- msg.response_headers.append ("Content-Type", mimetype);
-
var stream = new Stream (server, msg);
this.stream_available (stream, stream_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]