/** * Generally, prints current value, and possible range of values for each * control then provides option to change the current value of controls. */ int main() { fd = open("/dev/video0", O_RDWR); if(fd < 0){ perror("/dev/video0"); exit (EXIT_FAILURE); } print_input(); read_controls(); disable_autos(); change_input(); print_input(); while(1){ read_controls(); change_controls(); } return 0; }
static GstPadProbeReturn block_agnostic_sink (GstPad * pad, GstPadProbeInfo * info, gpointer data) { static gboolean configuring = FALSE; /* HACK: Ignore caps event and stream start event that causes negotiation * failures.This is a workaround that should be removed */ if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) { GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info); if (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START || GST_EVENT_TYPE (event) == GST_EVENT_CAPS) { return GST_PAD_PROBE_PASS; } } /* HACK: Ignore query accept caps that causes negotiation errors. * This is a workaround that should be removed */ if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM) { GstQuery *query = GST_PAD_PROBE_INFO_QUERY (info); if (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS) { return GST_PAD_PROBE_PASS; } } if (!g_atomic_int_get (&configuring)) { g_atomic_int_set (&configuring, TRUE); change_input (data); g_atomic_int_set (&configuring, FALSE); return GST_PAD_PROBE_REMOVE; } return GST_PAD_PROBE_PASS; }
bool parse_option(std::string const &s, bool embedded) { static bool no_more_options = false; if (s.size() < 2 || s[0] != '-' || (!embedded && no_more_options)) { static bool already_done = false; if (embedded || already_done) return false; change_input(s); already_done = true; return true; } if (!embedded && s == "--") { no_more_options = true; return true; } switch (s[1]) { case 'E': { std::string::size_type p = s.find('='); if (p == std::string::npos) { bool yes = s.size() <= 6 || s.substr(2, 3) != "no-"; std::string o = s.substr(yes ? 2 : 5); if (o == "reverted-fma") parameter_rfma = yes; else return false; } else { std::string o = s.substr(2, p - 2), v = s.substr(p + 1); int *param; if (o == "precision") param = ¶meter_internal_precision; else if (o == "dichotomy") param = ¶meter_dichotomy_depth; else return false; *param = atoi(v.c_str()); } break; } case 'M': { if (embedded) return false; std::string o = s.substr(2); if (o == "unconstrained") parameter_constrained = false; else if (o == "statistics" ) parameter_statistics = true; else if (o.compare(0, 7, "schemes") == 0) { if (o.size() == 7) parameter_schemes = "schemes.dot"; else { if (o[7] != '=') return false; parameter_schemes = o.substr(8); } } else return false; break; } case 'W': { bool yes = s.size() <= 6 || s.substr(2, 3) != "no-"; std::string o = s.substr(yes ? 2 : 5); if (o == "dichotomy-failure") warning_dichotomy_failure = yes; else if (o == "hint-difference" ) warning_hint_difference = yes; else if (o == "null-denominator" ) warning_null_denominator = yes; else if (o == "unbound-variable" ) warning_unbound_variable = yes; else return false; break; } case 'B': { if (embedded) return false; std::string o = s.substr(2); if (o == "null") proof_generator = NULL; else { proof_generator = backend::find(o); if (!proof_generator) return false; } break; } default: return false; } return true; }