Re: [Vala] [Gst] Adding capabilities to the Elements



On Fri, Jan 27, 2012 at 12:15 PM, Alberto Lepe <dev alepe com> wrote:
Hello, I'm trying to accomplish this with Vala:

gst-launch -v gnomevfssrc
location="http://admin:12345 192 168 1 100/nphMotionJpeg?Resolution=320x240&Quality=Standard&Framerate=1"
do-timestamp=true ! multipartdemux !
image/jpeg,width=320,height=240,framerate=1/1 ! jpegdec !
video/x-raw-yuv,framerate=1/1 ! xvimagesink

(it is displayed correctly using gst-launch)

So far I have: (using the gst-videotest.vala example at:
http://live.gnome.org/Vala/GStreamerSample)

   private void setup_gst_pipeline () {
       this.pipeline = new Pipeline ("mypipeline");
       this.src = ElementFactory.make ("gnomevfssrc", "video");
       this.src.set_property("location","http://admin:12345 192 168 1 
100/nphMotionJpeg?Resolution=320x240&Quality=Standard&Framerate=1");
       this.src.set_property("do-timestamp",true);
       this.filter1 = ElementFactory.make ("multipartdemux","demuxer");
       this.filter2 = ElementFactory.make ("jpegdec","jpg");
       this.sink = ElementFactory.make ("xvimagesink", "sink");

       //These lines should be wrong:
       this.filter2.set_property("caps",Caps.from_string("image/jpeg,width=320,height=240,framerate=1/1"));
       this.sink.set_property("caps",Caps.from_string("video/x-raw-yuv,framerate=1/1"));

       this.pipeline.add_many (this.src, this.filter1, this.filter2,
this.sink);
       this.src.link (this.filter1);
       this.filter1.link (this.filter2);
       this.filter2.link (this.sink);
   }

I'm also using the following link as reference (in pyGst), that is
where the << set_property("caps") >> idea came from:
http://pygstdocs.berlios.de/pygst-tutorial/capabilities.html  (example 6.1)

However, when I compile it shows me this error:
gst-videotest.vala.c:(.text+0x77d): undefined reference to
`gst_value_take_caps'

Which tells me that is not the correct way to set the Capabilities in Vala.
I have read the valadocs
(http://www.valadoc.org/gstreamer-0.10/index.htm), but I can't
understand how it works.
Neither the Gst examples at the gnome.org website shows how to add
those capabilities.

Anyone knows how to achieve that?

Thanks!

A. Lepe

The problem was with the demux, that it can not be linked directly to
the pipeline.

This was the missing part:
        demux.pad_added.connect((ev, pad) => {
           pad.link(decoder.get_pad("sink"));
        });
       //do not link the demux here:
        src.link (demux);
        decoder.link (sink);

This is the complete fixed code:  http://pastebin.com/ZvbC4Giw

About the "caps" problem, I think that the way to do it is creating an
element "capsfilter",
which has the "caps" property and thus can be used just like that.
However It wasn't required in this example, so I'm not sure about it.

A.Lepe



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]