i'm writing cpp program, , want execute function when 'x'(shut down) button pressed. for example, have infinite loop prints same thing everytime iterates, until 'x' button pressed, , want execute function before process ends. is there kind of listener matter? or other solution maybe (like delaying process shut down few seconds or something)? thanks! if want execute before process ends, can register std::atexit handler. function called before process exits.
i trying share h264 encoded data gstreamer 2 processes(both based on gstreamer).after research way found use shm plugin. trying do gstreamer--->h264 encoder--->shmsink shmrc--->process1 shmrc--->process2 i able raw data videotestsrc , webcam working. h264 encoded data doesn't. test pipeline gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,format=yuy2 ! x264enc ! shmsink socket-path=/tmp/foo sync=true wait-for- connection=false shm-size=10000000 gst-launch-1.0 shmsrc socket-path=/tmp/foo ! avdec_h264 ! video/x- raw,width=640,height=480,framerate=25/1,format=yuy2 ! autovideosink have tried shm plugins h264 encoded data, please help iam not aware of capabilities of sink used in "autovideosink", per knowledge either need use videoconvert if format supported sink (like kmssink or ximagesink) different provided source (in case yuy2) or use videoparse if camera format supported sink. may check using gst-inspect-1...
let's have function creates x number of objects based on length of input variable. want x number of objects used arguments in function supply function. assumign number of arguments variable (based on number of argument names provided), how can this? can via string of argument names perhaps? a non-working example illustrate i'm asking: (in case, using arguments created outside function simplify example): foo <- 1:5 na.rm <- t func <- mean f1 <- function(func,arg.names) { func(get(arg.names)) } f1(func,arg.names = c('foo','na.rm') how do in way get 's arguments list? we can try mget f1 <- function(func,arg.names) { lst <- mget(arg.names, envir = parent.frame()) func(lst[[1]], na.rm = lst[[2]]) } f1(func, arg.names = c('foo', 'na.rm')) #[1] 3 or option do.call (as mentioned in @thelatemail's post) change name of first list element 'x' x 'data' argument ...
Comments
Post a Comment