gint main (gint argc, gchar ** argv) { gst_init (&argc, &argv); check_caps ("some/mime, _int = [ 1, 2 ], list = { \"A\", \"B\", \"C\" }", "some/mime, _int = 1, list = \"A\""); check_caps ("some/mime, _double = (double) 1.0; other/mime, _int = { 1, 2 }", "some/mime, _double = (double) 1.0"); return 0; }
int main(int argc, char **argv) { struct netns_entry *root; int netns_ok, err; arg_register_batch(options, ARRAY_SIZE(options)); register_frontends(); register_handlers(); if ((err = arg_parse(argc, argv))) exit(err); if (!check_caps()) { fprintf(stderr, "Must be run under root (or with enough capabilities).\n"); exit(1); } netns_ok = netns_switch_root(); if (netns_ok > 0) { fprintf(stderr, "Cannot change to the root name space: %s\n", strerror(netns_ok)); exit(1); } global_handler_init(); if ((err = netns_list(&root, netns_ok == 0))) { fprintf(stderr, "ERROR: %s\n", strerror(err)); exit(1); } if ((err = frontend_output(root))) { fprintf(stderr, "Invalid output format specified.\n"); exit(1); } global_handler_cleanup(root); netns_list_free(root); return 0; }
static void fakesink_hand_off (GstElement * fakesink, GstBuffer * buf, GstPad * pad, gpointer data) { HandOffData *hod = (HandOffData *) data; check_caps (pad, hod); g_object_set (G_OBJECT (fakesink), "signal-handoffs", FALSE, NULL); g_idle_add (quit_main_loop_idle, hod->loop); }
static void sendrecv_answerer_fakesink_hand_off (GstElement * fakesink, GstBuffer * buf, GstPad * pad, gpointer data) { HandOffData *hod = (HandOffData *) data; GstElement *pipeline; check_caps (pad, hod); pipeline = GST_ELEMENT (gst_element_get_parent (fakesink)); G_LOCK (check_receive_lock); if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pipeline), OFFERER_RECEIVES_VIDEO))) { g_object_set (G_OBJECT (fakesink), "signal-handoffs", FALSE, NULL); g_idle_add (quit_main_loop_idle, hod->loop); } else { g_object_set_data (G_OBJECT (pipeline), ANSWERER_RECEIVES_VIDEO, GINT_TO_POINTER (TRUE)); } G_UNLOCK (check_receive_lock); g_object_unref (pipeline); }
static void test_video_profile (const gchar * profile, gint profile_id, const gchar * input_format) { GstElement *x264enc; GstBuffer *inbuffer, *outbuffer; int i, num_buffers; x264enc = setup_x264enc (profile, "avc", input_format); fail_unless (gst_element_set_state (x264enc, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); /* corresponds to I420 buffer for the size mentioned in the caps */ if (!strcmp (input_format, "I420")) inbuffer = gst_buffer_new_and_alloc (384 * 288 * 3 / 2); else if (!strcmp (input_format, "Y42B")) inbuffer = gst_buffer_new_and_alloc (384 * 288 * 2); else if (!strcmp (input_format, "Y444")) inbuffer = gst_buffer_new_and_alloc (384 * 288 * 3); else g_assert_not_reached (); /* makes valgrind's memcheck happier */ gst_buffer_memset (inbuffer, 0, 0, -1); GST_BUFFER_TIMESTAMP (inbuffer) = 0; ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); /* send eos to have all flushed if needed */ fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE); num_buffers = g_list_length (buffers); fail_unless (num_buffers == 1); /* check output caps */ { GstCaps *outcaps; outcaps = gst_pad_get_current_caps (mysinkpad); check_caps (outcaps, profile, profile_id); gst_caps_unref (outcaps); } /* clean up buffers */ for (i = 0; i < num_buffers; ++i) { outbuffer = GST_BUFFER (buffers->data); fail_if (outbuffer == NULL); switch (i) { case 0: { gint nsize, npos, j, type, next_type; GstMapInfo map; const guint8 *data; gsize size; gst_buffer_map (outbuffer, &map, GST_MAP_READ); data = map.data; size = map.size; npos = 0; j = 0; /* need SPS first */ next_type = 7; /* loop through NALs */ while (npos < size) { fail_unless (size - npos >= 4); nsize = GST_READ_UINT32_BE (data + npos); fail_unless (nsize > 0); fail_unless (npos + 4 + nsize <= size); type = data[npos + 4] & 0x1F; /* check the first NALs, disregard AU (9), SEI (6) */ if (type != 9 && type != 6) { fail_unless (type == next_type); switch (type) { case 7: /* SPS */ next_type = 8; break; case 8: /* PPS */ next_type = 5; break; default: break; } j++; } npos += nsize + 4; } gst_buffer_unmap (outbuffer, &map); /* should have reached the exact end */ fail_unless (npos == size); break; } default: break; } buffers = g_list_remove (buffers, outbuffer); ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1); gst_buffer_unref (outbuffer); outbuffer = NULL; } cleanup_x264enc (x264enc); g_list_free (buffers); buffers = NULL; }
bool may_restore(CredsEntry *creds) { return check_ids(cr_uid, creds->uid, creds->euid, creds->suid) && check_ids(cr_gid, creds->gid, creds->egid, creds->sgid) && check_caps(creds->cap_inh, creds->cap_eff, creds->cap_prm); }
bool may_dump(struct proc_status_creds *creds) { return check_ids(cr_uid, creds->uids[0], creds->uids[1], creds->uids[2]) && check_ids(cr_gid, creds->gids[0], creds->gids[1], creds->gids[2]) && check_caps(creds->cap_inh, creds->cap_eff, creds->cap_prm); }