[gst-devel] How to set capture size for a v4lsrc element?

ye nan bucketxp at hotmail.com
Thu Mar 30 03:59:09 CEST 2006


Great, It works now.
Create filter cap and then link source and convert element with it.

caps = gst_caps_new_simple("video/x-raw-yuv", "width", G_TYPE_INT, 320, 
"height", G_TYPE_INT, 240, NULL);
gst_element_link_filtered(videosource, videoconv, caps);
gst_element_link_many(videoconv, videosink, NULL);

Thanks a lot.^_^


>From: Loïc Molinari <loic.molinari at gmail.com>
>To: ye nan <bucketxp at hotmail.com>
>CC: gstreamer-devel at lists.sourceforge.net
>Subject: Re: [gst-devel] How to set capture size for a v4lsrc element?
>Date: Thu, 30 Mar 2006 13:03:17 +0200
>
>Hi Ye,
>
>Le jeudi 30 mars 2006 à 18:27 +0800, ye nan a écrit :
> > Hi,
> >   I can do it in the command line, just run the gst-lunch like this:
> >   gst-launch-0.10 v4lsrc ! video/x-raw-yuv, width = 320, height = 240 !
> > ffmpegcolorspace !  ximagesink
> >   But how can I implement this in my own programme?
> >
> >   I created some elements, including v4lsrc, ffmpegcolorspace, and 
ximage:
> >   videosource  = gst_element_factory_make("v4lsrc", "video_source");
> >   videosink    = gst_element_factory_make("ximagesink", "video_sink");
> >   videoencconv = gst_element_factory_make("ffmpegcolorspace",
> > "video_convert");
> >   I also create a caps for the v4lsrc, and set format with 
video/x-raw-yuv,
> > width = 320, height = 240:
> >   caps = gst_caps_new_simple("video/x-raw-yuv", "width", G_TYPE_INT, 
320,
> > "height", G_TYPE_INT, 240, NULL);
> >   sinkpad = gst_element_get_pad(videosource  , "sink");
> >   gst_pad_set_caps(sinkpad, caps);
>
>You're using a source element, so I guess you don't want to get the sink
>but the source pad of v4lsrc.
>
> >   But these can make effect on the capture size of v4l streaming like 
the
> > command line, it still a extremely small window, maybe only 80x60. Why?
>
>You shouldn't affect the pad anymore and try to link the elements with
>your filtering caps using the gst_element_link_filtered function.
>
>Loïc.
>
>--
>Loïc Molinari <loic.molinari at gmail.com>

_________________________________________________________________
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger:  http://messenger.msn.com/cn  





More information about the gstreamer-devel mailing list