Channing dimensions of source element

Maurice Ackel maurice.ackel at students.uni-mannheim.de
Tue Aug 3 15:19:14 UTC 2021


Hi there,

I am currently developing a source element for gstreamer that is supposed to capture a specific window of the screen. I extend the GstPushSrc class. My testing pipeline looks like this: mycustomsrc ! autovideosink.

Currently, I get the initial dimensions of the captured window in the „start“ virtual function and return caps in the „get_caps“ function according to those dimensions. From my testing, it seems as if this causes the autovideosink to allocate a buffer pool. I access the buffer pool using gst_base_src_get_buffer_pool which I use in my „create“ function to get new buffers and write the captured image to the associated memory.

Now, if I resize the captured window, I need this buffer pool to be reconfigured, as otherwise the memory might be too small or the stride is not matching anymore, etc. However, I don’t seem to be able to figure out how exactly I can do this. What I am currently trying is to detect a change of dimension in my capture function. Then, I am calling “gst_base_src_set_caps“ with updated width and height. I hoped that this would cause the autovideosink to reconfigure the buffer so that it allows for frames of the new dimensions, but this does not seem to work, as the size of the buffer pool stays constant, even though I see in the logs that the caps are communicated between my source and the sink.

I am fairly new to gstreamer so I am happy for any advice that pushes me into the right direction! I have studied a lot of other source plugins but so far I have not found any other plugin that seems to do exactly what I need.

Thank you very much for your help,
Maurice



More information about the gstreamer-devel mailing list