rygel r537 - in trunk/src: plugins/test rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r537 - in trunk/src: plugins/test rygel
- Date: Mon, 9 Feb 2009 22:27:32 +0000 (UTC)
Author: zeeshanak
Date: Mon Feb 9 22:27:32 2009
New Revision: 537
URL: http://svn.gnome.org/viewvc/rygel?rev=537&view=rev
Log:
Live items provide gst source element creation method.
HTTPServer doesn't need to emit any signals anymore as it can now
just ask the MediaItem to create the gst source element for it.
Modified:
trunk/src/plugins/test/rygel-test-audio-item.vala
trunk/src/plugins/test/rygel-test-item.vala
trunk/src/plugins/test/rygel-test-root-container.vala
trunk/src/plugins/test/rygel-test-video-item.vala
trunk/src/rygel/rygel-http-server.vala
trunk/src/rygel/rygel-media-item.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 Mon Feb 9 22:27:32 2009
@@ -45,15 +45,16 @@
http_server);
}
- public override Element create_gst_source () throws Error {
+ public override Element? create_stream_source () {
Bin bin = new Bin (this.title);
dynamic Element src = ElementFactory.make ("audiotestsrc", null);
Element encoder = ElementFactory.make ("wavenc", null);
if (src == null || encoder == null) {
- throw new LiveResponseError.MISSING_PLUGIN (
- "Required plugin missing");
+ warning ("Required plugin missing");
+
+ return null;
}
// Tell the source to behave like a live source
Modified: trunk/src/plugins/test/rygel-test-item.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-item.vala (original)
+++ trunk/src/plugins/test/rygel-test-item.vala Mon Feb 9 22:27:32 2009
@@ -43,7 +43,5 @@
this.mime_type = mime;
this.author = TEST_AUTHOR;
}
-
- public abstract Element create_gst_source () throws Error;
}
Modified: trunk/src/plugins/test/rygel-test-root-container.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-root-container.vala (original)
+++ trunk/src/plugins/test/rygel-test-root-container.vala Mon Feb 9 22:27:32 2009
@@ -40,7 +40,6 @@
base.root (title, 0);
this.http_server = http_server;
- this.http_server.need_stream_source += this.on_need_stream_source;
this.items = new ArrayList<MediaItem> ();
this.items.add (new TestAudioItem ("sinewave",
@@ -79,20 +78,5 @@
return item;
}
-
- /* Private methods */
- private void on_need_stream_source (HTTPServer http_server,
- MediaItem item,
- out Element src) {
- try {
- src = ((TestItem) item).create_gst_source ();
- } catch (Error error) {
- critical ("Error creating Gst source element for item %s: %s",
- item.id,
- error.message);
-
- return;
- }
- }
}
Modified: trunk/src/plugins/test/rygel-test-video-item.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-video-item.vala (original)
+++ trunk/src/plugins/test/rygel-test-video-item.vala Mon Feb 9 22:27:32 2009
@@ -45,7 +45,7 @@
http_server);
}
- public override Element create_gst_source () throws Error {
+ public override Element? create_stream_source () {
Bin bin = new Bin (this.title);
dynamic Element src = ElementFactory.make ("videotestsrc", null);
@@ -53,8 +53,9 @@
Element muxer = ElementFactory.make ("mpegtsmux", null);
if (src == null || muxer == null || encoder == null) {
- throw new LiveResponseError.MISSING_PLUGIN (
- "Required plugin missing");
+ warning ("Required plugin missing");
+
+ return null;
}
// Tell the source to behave like a live source
Modified: trunk/src/rygel/rygel-http-server.vala
==============================================================================
--- trunk/src/rygel/rygel-http-server.vala (original)
+++ trunk/src/rygel/rygel-http-server.vala Mon Feb 9 22:27:32 2009
@@ -43,9 +43,6 @@
private GUPnP.Context context;
private ArrayList<HTTPResponse> responses;
- public signal void need_stream_source (MediaItem item,
- out Element src);
-
public HTTPServer (ContentDirectory content_dir,
string name) {
this.content_dir = content_dir;
@@ -210,8 +207,8 @@
// URI provided, try to create source element from it
src = Element.make_from_uri (URIType.SRC, uri, null);
} else {
- // No URI provided, ask for source element directly
- this.need_stream_source (item, out src);
+ // No URI provided, ask for source element
+ src = item.create_stream_source ();
}
if (src == null) {
Modified: trunk/src/rygel/rygel-media-item.vala
==============================================================================
--- trunk/src/rygel/rygel-media-item.vala (original)
+++ trunk/src/rygel/rygel-media-item.vala Mon Feb 9 22:27:32 2009
@@ -150,6 +150,12 @@
didl_writer.end_item ();
}
+ // Live media items need to provide a nice working implementation of this
+ // method if they can/do no provide a valid URI
+ public virtual Gst.Element? create_stream_source () {
+ return null;
+ }
+
private string get_protocol_for_uri (string uri) throws Error {
if (uri.has_prefix ("http")) {
return "http-get";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]