[rygel/gstlaunch_plugin: 1/3] test: create the pipeline in a more simple way
- From: Thijs Vermeir <tvermeir src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel/gstlaunch_plugin: 1/3] test: create the pipeline in a more simple way
- Date: Sun, 30 Aug 2009 11:17:29 +0000 (UTC)
commit a7b5d567084534f26f29407f48a48e47871f5b92
Author: Thijs Vermeir <thijsvermeir gmail com>
Date: Tue Aug 18 05:04:30 2009 +0200
test: create the pipeline in a more simple way
src/plugins/test/rygel-test-audio-item.vala | 29 ++++---------------------
src/plugins/test/rygel-test-video-item.vala | 30 ++++----------------------
2 files changed, 10 insertions(+), 49 deletions(-)
---
diff --git a/src/plugins/test/rygel-test-audio-item.vala b/src/plugins/test/rygel-test-audio-item.vala
index a6beb6e..5c8240e 100644
--- a/src/plugins/test/rygel-test-audio-item.vala
+++ b/src/plugins/test/rygel-test-audio-item.vala
@@ -44,31 +44,12 @@ public class Rygel.TestAudioItem : Rygel.TestItem {
}
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) {
- warning ("Required plugin missing");
-
- return null;
+ try {
+ return Gst.parse_bin_from_description ("audiotestsrc is-live=1 ! wavenc", true);
+ } catch (Error err) {
+ warning ("Required plugin missing (%s)", err.message);
+ return null;
}
-
- // Tell the source to behave like a live source
- src.is_live = true;
-
- // Add elements to our source bin
- bin.add_many (src, encoder);
- // Link them
- src.link (encoder);
-
- // Now add the encoder's src pad to the bin
- Pad pad = encoder.get_static_pad ("src");
- var ghost = new GhostPad (bin.name + "." + pad.name, pad);
- bin.add_pad (ghost);
-
- return bin;
}
}
diff --git a/src/plugins/test/rygel-test-video-item.vala b/src/plugins/test/rygel-test-video-item.vala
index 6ac4ab6..db04a75 100644
--- a/src/plugins/test/rygel-test-video-item.vala
+++ b/src/plugins/test/rygel-test-video-item.vala
@@ -44,32 +44,12 @@ public class Rygel.TestVideoItem : Rygel.TestItem {
}
public override Element? create_stream_source () {
- Bin bin = new Bin (this.title);
-
- dynamic Element src = ElementFactory.make ("videotestsrc", null);
- Element encoder = ElementFactory.make ("ffenc_mpeg2video", null);
- Element muxer = ElementFactory.make ("mpegtsmux", null);
-
- if (src == null || muxer == null || encoder == null) {
- warning ("Required plugin missing");
-
- return null;
+ try {
+ return Gst.parse_bin_from_description ("videotestsrc is-live=1 ! ffenc_mpeg2video ! mpegtsmux", true);
+ } catch (Error err) {
+ warning ("Required plugin missing (%s)", err.message);
+ return null;
}
-
- // Tell the source to behave like a live source
- src.is_live = true;
-
- // Add elements to our source bin
- bin.add_many (src, encoder, muxer);
- // Link them
- src.link_many (encoder, muxer);
-
- // Now add the encoder's src pad to the bin
- Pad pad = muxer.get_static_pad ("src");
- var ghost = new GhostPad (bin.name + "." + pad.name, pad);
- bin.add_pad (ghost);
-
- return bin;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]