From: Thijs Vermeir Date: Tue, 18 Aug 2009 03:04:30 +0000 (+0200) Subject: test: create the pipeline in a more simple way X-Git-Tag: RYGEL_0_4~142 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=887875ee7dbffa3c9aa40e3c9ffcdcfd70e7fc5b;p=profile%2Fivi%2Frygel.git test: create the pipeline in a more simple way --- diff --git a/src/plugins/test/rygel-test-audio-item.vala b/src/plugins/test/rygel-test-audio-item.vala index 7f3a19f..27d6ecb 100644 --- a/src/plugins/test/rygel-test-audio-item.vala +++ b/src/plugins/test/rygel-test-audio-item.vala @@ -43,31 +43,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 21ff907..d2b3f46 100644 --- a/src/plugins/test/rygel-test-video-item.vala +++ b/src/plugins/test/rygel-test-video-item.vala @@ -43,32 +43,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; } }