rygel r401 - trunk/src/rygel
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r401 - trunk/src/rygel
- Date: Sun, 28 Dec 2008 16:48:07 +0000 (UTC)
Author: zeeshanak
Date: Sun Dec 28 16:48:07 2008
New Revision: 401
URL: http://svn.gnome.org/viewvc/rygel?rev=401&view=rev
Log:
Handle dynamic pads.
If source element doesn't have any pads, wait for a pad to be added to it
before linking it to sink.
Modified:
trunk/src/rygel/rygel-gst-stream.vala
Modified: trunk/src/rygel/rygel-gst-stream.vala
==============================================================================
--- trunk/src/rygel/rygel-gst-stream.vala (original)
+++ trunk/src/rygel/rygel-gst-stream.vala Sun Dec 28 16:48:07 2008
@@ -35,6 +35,8 @@
}
public class Rygel.GstStream : Pipeline {
+ private const string SINK_NAME = "fakesink";
+
public Stream stream;
private AsyncQueue<Buffer> buffers;
@@ -51,7 +53,7 @@
}
private void prepare_pipeline (Element src) throws Error {
- dynamic Element sink = ElementFactory.make ("fakesink", null);
+ dynamic Element sink = ElementFactory.make ("fakesink", SINK_NAME);
if (sink == null) {
throw new GstStreamError.MISSING_PLUGIN ("Required plugin " +
@@ -62,10 +64,17 @@
sink.handoff += this.on_new_buffer;
this.add_many (src, sink);
- if (!src.link (sink)) {
- throw new GstStreamError.LINK ("Failed to link %s to %s",
- src.name,
- sink.name);
+
+ if (src.numpads == 0) {
+ // Seems source uses dynamic pads, link when pad available
+ src.pad_added += this.src_pad_added;
+ } else {
+ // static pads? easy!
+ if (!src.link (sink)) {
+ throw new GstStreamError.LINK ("Failed to link %s to %s",
+ src.name,
+ sink.name);
+ }
}
// Bus handler
@@ -73,6 +82,19 @@
bus.add_watch (bus_handler);
}
+ private void src_pad_added (Element src,
+ Pad src_pad) {
+ var sink = this.get_by_name (SINK_NAME);
+ var sink_pad = sink.get_static_pad ("sink");
+
+ if (src_pad.link (sink_pad) != PadLinkReturn.OK) {
+ critical ("Failed to link pad %s to %s",
+ src_pad.name,
+ sink_pad.name);
+ this.stream.end ();
+ }
+ }
+
private void on_new_buffer (Element sink,
Buffer buffer,
Pad pad) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]