[gst-devel] dynamic change element's parameter

Stefan Kost ensonic at hora-obscura.de
Wed Sep 15 17:41:55 CEST 2010


On 14.09.2010 16:37, Chandler Li wrote:
> Thank you,
> I paste the key point code to there,
>
> the old one caps:
>                caps1 = gst_caps_new_simple ("video/x-raw-yuv",
>   	      "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
> 	      "width", G_TYPE_INT, 123,
> 	      "height", G_TYPE_INT, 456,
> 	      "framerate", GST_TYPE_FRACTION, 30, 1,
> 	      NULL);
> the new one caps:
>               caps2 = gst_caps_new_simple ("video/x-raw-yuv",
>   	      "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
> 	      "width", G_TYPE_INT, 456,
> 	      "height", G_TYPE_INT, 789,
> 	      "framerate", GST_TYPE_FRACTION, 30, 1,
> 	      NULL);
> and the folowing code change caps:
>                 gst_pad_set_blocked_async(pad,TRUE,my_blocked_callback,NULL);
> 		gst_element_set_state(GST_ELEMENT(capsfilter2), GST_STATE_NULL);
> 		g_object_set (G_OBJECT (capsfilter2), "caps",caps2,NULL);
> 		gst_element_set_state(GST_ELEMENT(capsfilter2), GST_STATE_PLAYING);
> 		gst_pad_set_blocked_async(pad,FALSE,my_blocked_callback,NULL);
>   
ohh, you can just set the caps. I mean just do:

g_object_set (G_OBJECT (capsfilter2), "caps",caps2,NULL);


Stefan

> First, I block the videoscale's src pad. Then turn the the element
> capsfilter2 to NULL , give it new caps with different width and
> height.
> After that, I turn the element capsfilter2 to PLAYING, and unblock the
> videoscale's src pad.
>
> after doing these, I get wrong message
>                ** ERROR **: Internal data flow error.
>                aborting...
>
> But if I let the caps2's format same with caps1:
>               caps2 = gst_caps_new_simple ("video/x-raw-yuv",
>   	      "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
> 	      "width", G_TYPE_INT, 123,
> 	      "height", G_TYPE_INT, 456,
> 	      "framerate", GST_TYPE_FRACTION, 30, 1,
> 	      NULL);
>
> The streaming still works. It's really strange.
> I think it's because of the videoscale problem.
> Did I lose any detail in the code?
>
> Thank you!
> Best regards,
> Chandler Lee.
>
> 2010/9/14 Stefan Kost <ensonic at hora-obscura.de>:
>   
>> On 14.09.2010 10:48, Chandler Li wrote:
>>     
>>> I have read the mail Nicola and Stefan given, and that really inspired
>>> me a lot.
>>> Thank you!
>>> In the first, I try to replace some elements and encounter some
>>> problem, the following I will show my target first.
>>> Because I want to stream webcam frame on the internet,
>>> and dynamically change the frame size without stopping the pipeline.
>>>
>>> According to my experience, if the v4l2src element opens webcam
>>> device, it only captures one size at one time.
>>> if I want to change the size of webcam, I need to restart it.
>>>
>>>       
>> v4l2src does not support changing the resolution on the fly. This is a
>> v4l2 interface limitation right now - one needs to stop streaming, set
>> new format and restart streaming. So your observation is correct.
>>
>>     
>>> So I try another architecture of gstreamer,
>>>
>>>     v4l2src  ->  capsfilter1  ->  videoscale -> capsfilter2  ->
>>> ffmpegcolorspace ->   .... (to internet)
>>>
>>> videoscale links two filters, the first filter (capsfilter1)
>>> negotiates with v4l2src in a static frame size,
>>> I want to change the size I assigned in the second filter (capsfilter2) ,
>>>
>>> BUT I get an error message after I change the capsfilter2 to the new filter,
>>>
>>>     videoscale can't link to new capsfilter,
>>>
>>>       
>> that should work. Can you paste a few lines of the code here. You should
>> create new caps and just set the new format on capsfilter2.
>>
>> Stefan
>>     
>>> I don't know what's happened? does anyone know that?
>>> Thank you!
>>>
>>> Best regards,
>>> Chandler Lee.
>>>
>>> 2010/9/14 Stefan Kost <ensonic at hora-obscura.de>:
>>>
>>>       
>>>> Am 12.09.2010 09:01, schrieb Chandler Li:
>>>>
>>>>         
>>>>> Hi all,
>>>>>     I'm new to use gstreamer,
>>>>>     and I have a problem don't know how to solve for a long time,
>>>>>
>>>>>     Is there possible to dynamic change the parameter in elements or pads?
>>>>>
>>>>>           
>>>> gobject parameters -> g_object_set or use GstController
>>>>
>>>>
>>>>
>>>>         
>>>>>     For example,
>>>>>     In a playing state streaming,
>>>>>     could I dynamic change the size of video without stop the streaming?
>>>>>
>>>>>           
>>>> yes you can. if you resize the video window for xvimagesink the video adjusts if
>>>> it can. So if you run gst-launch videotestsrc ! xvimagesink, the videotest is
>>>> sending videoframes in the native resolution instead of xvimagesink scaling them.
>>>>
>>>> Stefan
>>>>
>>>>
>>>>         
>>>>>     hopes that's not a stupid question,
>>>>>     and very hopefully for your reply,
>>>>>     Thank you
>>>>>
>>>>>     Chandler Lee
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Start uncovering the many advantages of virtual appliances
>>>>> and start using them to simplify application deployment and
>>>>> accelerate your shift to cloud computing
>>>>> http://p.sf.net/sfu/novell-sfdev2dev
>>>>> _______________________________________________
>>>>> gstreamer-devel mailing list
>>>>> gstreamer-devel at lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>>>
>>>>>           
>>>>
>>>>         
>>
>>     





More information about the gstreamer-devel mailing list