Nvdrmvideosink layering control and interaction with drmrenderer class

I need to play two videos (picture in picture) on top of the linux desktop. In addition to this have an overlay using the drmrenderer class that should always remain on top of everything else.

  1. How can I control which nvdrmvideosink is drawn on top of the other? I need to change this dynamically while video is playing. I.e. change which of the video is the picture-in-picture.

  2. How can I use drmrenderer class together with drmvideosink such that the overlay used by drmrenderer is always on top of all the other overlays?

The usecase may not work in gstreamer. A possilbe solution is to use jetson_multimedia_api and call NvBufferComposite() to dynamically composite the video planes. There is demonstration in 13_multi_camera sample.