gstreamer link different sink/source caps to plugin

1.1k Views Asked by At

I have plugin that works with raw video and can resize it during work. This plugin have two (compatible) video inputs, and one video output. Caps of input and output may be different

But when I try use different caps at sink and source it couldn't link.

Examples

This works good.

gst-launch-1.0 videotestsrc ! video/x-raw,format=BGR,width=800,height=600 ! my_plugin name=t ! video/x-raw,format=BGR,width=800,height=600 ! fakesink videotestsrc ! video/x-raw,format=BGR,width=800,height=600 ! t.

But this isn't. [WARNING: erroneous pipeline: could not link t to fakesink0]

gst-launch-1.0 videotestsrc ! video/x-raw,format=BGR,width=800,height=600 ! my_plugin make_small=1 name=t ! video/x-raw,format=BGR,width=750,height=600 ! fakesink videotestsrc ! video/x-raw,format=BGR,width=800,height=600 ! t.

I read docs/design/draft-klass.txt and looked to videoscale plugin description and changed my_plugin description like

Factory Details:
  ..
  Klass                    Mixer/Effect/Converter/Video/Scaler
  ..

But it still doesn't work. What i miss?

Edit. My problem occurred because of using GST_PAD_SET_PROXY_CAPS() for all sink/source pads. According to the documentation this function simplify event management and guarantee that those caps is compatible.

1

There are 1 best solutions below

2
On

using GST_PAD_SET_PROXY_CAPS() is an answer.