c++ - How to start gst-launch on a custom xy position -


i'm developing c++ application on embedded-linux , need display video camera in it. i've used gstreamer create window , start video capture (because has hardware support on tegra) command:

system("gst-launch -e v4l2src device=\"/dev/video0\" \               ! \"video/x-raw-yuv,width=320,height=240\" \               ! videoflip method=counterclockwise \               ! nvvidconv \               ! nvxvimagesink &") 

the main application on device running fullscreen, need position window on specific location on screen, user has feeling runs in same "window". i've managed with:

xmovewindow(display, win_video, x, y);  // x, y top left point in landscape mode! 

the problem i'm facing gst-launch first displayed on 0, 0 coordinates (since run command line) , "snaps" on correct location (programmatically) in application. running xquerytree search displayed windows , find 1 gst-launch , move it. takes time , doesn't good, i'm looking better solutions.

i've tried using videobox in gst-launch pipeline position video on screen, problem draws black border 0, 0 video window (border-alpha=0 should solve this, doesn't - think problem somewhere in nvvidconv or nvxvimagesink, have no way know):

gst-launch -e v4l2src device="/dev/video0" ! "video/x-raw-yuv,width=320,height=240" ! videobox border-alpha=0 top=-50 left=-50 ! nvvidconv ! nvxvimagesink 

the second solution set main application window on top, , after find video window, move position, set main app normal , move video window on top. i've tried 2 methods found here set on top both didn't work. first:

status x11_window_set_on_top (display* display, window xid) {   xevent event;   event.xclient.type = clientmessage;   event.xclient.serial = 0;   event.xclient.send_event = true;   event.xclient.display = display;   event.xclient.window  = xid;   event.xclient.message_type = xinternatom (display, "_net_wm_state", false);   event.xclient.format = 32;    event.xclient.data.l[0] = _net_wm_state_add;   event.xclient.data.l[1] = xinternatom (display, "_net_wm_state_above", false);   event.xclient.data.l[2] = 0; //unused.   event.xclient.data.l[3] = 0;   event.xclient.data.l[4] = 0;    return xsendevent (display,                       defaultrootwindow(display),                       false,                       substructureredirectmask | substructurenotifymask,                       &event); } 

second:

void keep_window_always_top(display *dpy, window w) {   atom stateabove;   if (w) {      stateabove = xinternatom(dpy, "_net_wm_state_above", false);      xchangeproperty(dpy, w, xinternatom(dpy, "_net_wm_state", false), xa_atom, 32, propmodereplace, (unsigned char *) &stateabove, 1);     } } 

i don't know why doesn't work should.

the question how position window console command, or intercept window programmatically before displayed , set correct coordinates, or somehow application on top, can rid of snapping effect?

any other suggestions welcome.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -