Hi,
Please refer to this topic:
Nvoverlaysink ignores properties when pipeline is restarted
The gstreamer pipeline has to be re-initialized for changing x, y, w, h. The sample is in python and you can refer to C sample like this:
Camera liveview cannot show up again after repeated open/close the liveview for several times - #23 by DaneLLL
And implement the sample logic in C code.