Get outgoing caps in bin

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Get outgoing caps in bin

Edgar Thier
Hi,

How can I get the caps for my src pad in a bin so that I am able to modify my internal pipeline
accordingly?

Sample pipelines would look like this:

gst-launch-1.0 mybin ! video/x-raw,format=RGBx,width=1280,height=720,framerate=30/1 ! videoconvert !
xvimagesink sync=false

gst-launch-1.0 mybin ! video/x-raw,format=GRAY8,width=1280,height=720,framerate=30/1 ! videoconvert
! xvimagesink sync=false

gst-launch-1.0 mybin ! video/x-bayer,format=bggr,width=1280,height=720,framerate=30/1 ! videoconvert
! xvimagesink sync=false

Is this possible?
My first thought was to negotiate the caps like a pushsrc but that does not seem possible with bins.


Regards,

Edgar
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get outgoing caps in bin

Sebastian Dröge-3
On Mi, 2016-05-18 at 12:54 +0200, Edgar Thier wrote:

> Hi,
>
> How can I get the caps for my src pad in a bin so that I am able to
> modify my internal pipeline 
> accordingly?
>
> Sample pipelines would look like this:
>
> gst-launch-1.0 mybin ! video/x-
> raw,format=RGBx,width=1280,height=720,framerate=30/1 ! videoconvert
> ! 
> xvimagesink sync=false
>
> gst-launch-1.0 mybin ! video/x-
> raw,format=GRAY8,width=1280,height=720,framerate=30/1 ! videoconvert 
> ! xvimagesink sync=false
>
> gst-launch-1.0 mybin ! video/x-
> bayer,format=bggr,width=1280,height=720,framerate=30/1 !
> videoconvert 
> ! xvimagesink sync=false
>
> Is this possible?
> My first thought was to negotiate the caps like a pushsrc but that
> does not seem possible with bins.
Can you explain in more detail what's inside your bin and what kind of
reconfigurations it should do? Should it also reconfigure on the fly,
or only once at the very beginning?

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Get outgoing caps in bin

Edgar Thier
The bin is intended as a wrapper around a camera and a few other plugins (exposure calculation,
whitebalance, etc.).

I want to use the caps the set width, height and framerate in the camera.
I also want to convert to the given format.
The cameras I work with are able to produce bayer8, gray8, gray16 and sometimes yuv.

So if rgb is wanted I automatically select bayer (assuming it is available) and add bayer2rgb as my
endpoint for the internal pipeline.
If yuv is wanted I convert from bayer to rgb and then to yuv with videoconvert and so on.

I've modified the example pipelines to also show the bin-internal ones.

gst-launch-1.0 mybin (src ! video/x-bayer,width=1280,height=720,framerate=30/1 ! exposure !
whitebalance ! bayer2rgb) ! video/x-raw,format=RGBx,width=1280,height=720,framerate=30/1 !
videoconvert ! xvimagesink sync=false

gst-launch-1.0 mybin (src ! video/x-raw,format=GRAY8,width=1280,height=720,framerate=30/1 ! exposure
) ! video/x-raw,format=GRAY8,width=1280,height=720,framerate=30/1 ! videoconvert! xvimagesink sync=false

gst-launch-1.0 mybin (src ! video/x-bayer,width=1280,height=720,framerate=30/1 ! exposure !
whitebalance)! video/x-bayer,format=bggr,width=1280,height=720,framerate=30/1 !
videoconvert ! xvimagesink sync=false

For personal understanding, such a reconfiguration would always require a full stop of the pipeline,
am I correct?

I hope that clears out all ambiguity.


On 05/18/2016 02:28 PM, Sebastian Dröge wrote:

> On Mi, 2016-05-18 at 12:54 +0200, Edgar Thier wrote:
>> Hi,
>>
>> How can I get the caps for my src pad in a bin so that I am able to
>> modify my internal pipeline
>> accordingly?
>>
>> Sample pipelines would look like this:
>>
>> gst-launch-1.0 mybin ! video/x-
>> raw,format=RGBx,width=1280,height=720,framerate=30/1 ! videoconvert
>> !
>> xvimagesink sync=false
>>
>> gst-launch-1.0 mybin ! video/x-
>> raw,format=GRAY8,width=1280,height=720,framerate=30/1 ! videoconvert
>> ! xvimagesink sync=false
>>
>> gst-launch-1.0 mybin ! video/x-
>> bayer,format=bggr,width=1280,height=720,framerate=30/1 !
>> videoconvert
>> ! xvimagesink sync=false
>>
>> Is this possible?
>> My first thought was to negotiate the caps like a pushsrc but that
>> does not seem possible with bins.
>
> Can you explain in more detail what's inside your bin and what kind of
> reconfigurations it should do? Should it also reconfigure on the fly,
> or only once at the very beginning?
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get outgoing caps in bin

Sebastian Dröge-3
On Do, 2016-05-19 at 06:28 +0200, Edgar Thier wrote:

> For personal understanding, such a reconfiguration would always require a full stop of the pipeline, 
> am I correct?

Yes, in theory it can also reconfigure at runtime but that is rather
tricky because upstream renegotiation/reconfiguration is asynchronous
and mostly a hint. You are not guaranteed to get what you want
downstream, especially not immediately.

> I hope that clears out all ambiguity.

It does, yes :) I think the best for this would be to override the
activatemode or activate function on the srcpad of the bin here, and in
there do a CAPS query downstream to then decide on which internal
elements to build.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Get outgoing caps in bin

Edgar Thier
Thank you for your replies. They are really helpful.

Just to make sure we are on the same page:

It should suffice to call 'gst_pad_set_activate_function()' for the ghostpad to get the correct caps.

Again, your help is very much appreciated. :)

On 05/19/2016 09:07 AM, Sebastian Dröge wrote:

> On Do, 2016-05-19 at 06:28 +0200, Edgar Thier wrote:
>>
>> For personal understanding, such a reconfiguration would always require a full stop of the pipeline,
>> am I correct?
>
> Yes, in theory it can also reconfigure at runtime but that is rather
> tricky because upstream renegotiation/reconfiguration is asynchronous
> and mostly a hint. You are not guaranteed to get what you want
> downstream, especially not immediately.
>
>> I hope that clears out all ambiguity.
>
> It does, yes :) I think the best for this would be to override the
> activatemode or activate function on the srcpad of the bin here, and in
> there do a CAPS query downstream to then decide on which internal
> elements to build.
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get outgoing caps in bin

Sebastian Dröge-3
On Do, 2016-05-19 at 09:13 +0200, Edgar Thier wrote:
> Thank you for your replies. They are really helpful.
>
> Just to make sure we are on the same page:
>
> It should suffice to call 'gst_pad_set_activate_function()' for the
> ghostpad to get the correct caps.
>
> Again, your help is very much appreciated. :)

Yes, and in the callback you give there you would do your stuff and
then call the default activate function.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment