Is caps neogtiation possible to negotiate a "better/correct caps" with gst-launch?

jy jyaccess at yahoo.com
Sat Sep 14 21:12:42 UTC 2019


If gst-launch-1.0 command specifies a "wrong/unsupported" caps, is it
possible for the plugins to negotiate a correct/working/better caps, instead
of just declaring failure?

for the 2 gst-launch commands that follow,

   on Windows
   gst-launch-1.0 -vm \
       ksvideosrc device-name=some_device ! \
       "video/x-raw,format=(string)BGR,width=1279, height=720, \
       framerate=5/1" ! \
       videoconvert ! \
       glimagesink sync=true

   on Linux ( I don't have Linux machine, but I assume it has similar
problem)
   gst-launch-1.0 -vm \
       v4l2src device-name=some_device ! \
       "video/x-raw,format=(string)BGR,width=1279, height=720, \
       framerate=5/1" ! \
       videoconvert ! \
       xvimagesink sync=true


Both would fail because the "width=1279" is not part of the supported caps
of ksvideosrc/v4l2src hardware devices.

even though videoconvert can support "width=1279" and it would try to
negotiate with ksvideosrc/v4l2src by calling

    gst_ks_video_src_query() w/ GST_QUERY_CAPS

    which only could provide the list of supported caps

    and

    gst_ks_video_src_negotiate(), (I added it for trial) which would do,
like

    caps = gst_caps_intersect_full (peerCaps, myCaps,
GST_CAPS_INTERSECT_FIRST);

    but the peerCaps from videoconvert is already set as "width=1279". So,
it only results in NULL, common denominator, caps.

and there is no way to negotiate, e.g. width=1279 -> width=1280, between the
2 elements/pad/caps. I found no suitable gst_pad_xxxx() gst_pad_peer_xxxx()
types of interface to push a good caps, width=1280, back to the other end of
pad.

So eventual error message is:
WARNING: erroneous pipeline: could not link ksvideosrc0 to videoconvert0,
ksvideosrc0 can't handle caps video/x-raw, format=(string)BGR,
width=(int)1279, height=(int)720, framerate=(fraction)5/1

or

../libs/gst/base/gstbasesrc.c(3073): gst_base_src_loop ():
/GstPipeline:pipeline/GstKsVideoSrc:ksvideosrc0:streaming stopped, reason
not-negotiated (-4)



So, question???: 
"is it possible to negotiate/change the given wrong caps to a working caps,
e.g. 1279 -> 1280, between the 2 elements without just being a gst-launch
failure"?

Or, do I need to modify source codes of gst-launch to figure out, i.e.
pre-fetch the common denominator caps, "correct" or "better" caps supported
by both elements before linking the 2 elements?

Note that I gave special width=1279 as example, but it could happen with any
other unsupported parameters, unless user already knew what are supported!!
or an app programmer has to know the caps of all active devices in the field
before starting gst-launch in his/her applications.

Please comment,





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list