static void
dump_info(GstVaapiDisplay *display)
{
    GArray *profiles, *formats;

    profiles = gst_vaapi_display_get_decode_profiles(display);
    if (!profiles)
        g_error("could not get VA decode profiles");

    print_profiles(profiles, "decoders");
    g_array_unref(profiles);

    profiles = gst_vaapi_display_get_encode_profiles(display);
    if (!profiles)
        g_error("could not get VA encode profiles");

    print_profiles(profiles, "encoders");
    g_array_unref(profiles);

    formats = gst_vaapi_display_get_image_formats(display);
    if (!formats)
        g_error("could not get VA image formats");

    print_formats(formats, "image");
    g_array_unref(formats);

    formats = gst_vaapi_display_get_subpicture_formats(display);
    if (!formats)
        g_error("could not get VA subpicture formats");

    print_formats(formats, "subpicture");
    g_array_unref(formats);

    dump_properties(display);
}
Esempio n. 2
0
bool V4li_camera::set_mode(uint32_t f, uint32_t mem, uint32_t w, uint32_t h)
{
    bool flag = (-1 != device);
    if (flag)
    {
        width = w;
        height = h;
        memory = mem;

        flag = is_supported(f, w, h);

        struct v4l2_format fmt; 
        memset(&fmt, 0, sizeof(fmt));
        fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        fmt.fmt.pix.width = width;
        fmt.fmt.pix.height = height;
        fmt.fmt.pix.pixelformat = f;
        fmt.fmt.pix.field = V4L2_FIELD_NONE;

        flag = flag && ioctl(VIDIOC_S_FMT, &fmt);

        if (false == flag)
        {
            printf("\nInvalid Format or Resolution\nSupported Formats/Resolutions are ...");
            print_formats();
        }
    }
    return flag;
}
Esempio n. 3
0
void print

int main (int argc, char **argv)
{
  unicap_handle_t handle;
  handle = open_imagingsource_camera();
  print_formats(handle);
  unicap_close (handle);
  return 0;
}
Esempio n. 4
0
static void dummy_proc_read(struct snd_info_entry *entry,
			    struct snd_info_buffer *buffer)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(fields); i++) {
		snd_iprintf(buffer, "%s ", fields[i].name);
		if (fields[i].size == sizeof(int))
			snd_iprintf(buffer, fields[i].format,
				    *get_dummy_int_ptr(fields[i].offset));
		else
			snd_iprintf(buffer, fields[i].format,
				    *get_dummy_ll_ptr(fields[i].offset));
		if (!strcmp(fields[i].name, "formats"))
			print_formats(buffer);
		else if (!strcmp(fields[i].name, "rates"))
			print_rates(buffer);
		snd_iprintf(buffer, "\n");
	}
}
Esempio n. 5
0
int nvme_print_info(struct udevice *udev)
{
	struct nvme_ns *ns = dev_get_priv(udev);
	struct nvme_dev *dev = ns->dev;
	struct nvme_id_ns buf_ns, *id = &buf_ns;
	struct nvme_id_ctrl buf_ctrl, *ctrl = &buf_ctrl;

	if (nvme_identify(dev, 0, 1, (dma_addr_t)ctrl))
		return -EIO;

	print_optional_admin_cmd(le16_to_cpu(ctrl->oacs), ns->devnum);
	print_optional_nvm_cmd(le16_to_cpu(ctrl->oncs), ns->devnum);
	print_format_nvme_attributes(ctrl->fna, ns->devnum);

	if (nvme_identify(dev, ns->ns_id, 0, (dma_addr_t)id))
		return -EIO;

	print_formats(id, ns);
	print_data_protect_cap(id->dpc, ns->devnum);
	print_metadata_cap(id->mc, ns->devnum);

	return 0;
}
Esempio n. 6
0
int main(int argc, char **argv)
{
    const AVFilter *filter;
    AVFilterContext *filter_ctx;
    AVFilterGraph *graph_ctx;
    const char *filter_name;
    const char *filter_args = NULL;
    int i;
    int ret = 0;

    av_log_set_level(AV_LOG_DEBUG);

    if (argc < 2) {
        fprintf(stderr, "Missing filter name as argument\n");
        return 1;
    }

    filter_name = argv[1];
    if (argc > 2)
        filter_args = argv[2];

    /* allocate graph */
    graph_ctx = avfilter_graph_alloc();
    if (!graph_ctx)
        return 1;

    avfilter_register_all();

    /* get a corresponding filter and open it */
    if (!(filter = avfilter_get_by_name(filter_name))) {
        fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name);
        return 1;
    }

    /* open filter and add it to the graph */
    if (!(filter_ctx = avfilter_graph_alloc_filter(graph_ctx, filter, filter_name))) {
        fprintf(stderr, "Impossible to open filter with name '%s'\n",
                filter_name);
        return 1;
    }
    if (avfilter_init_str(filter_ctx, filter_args) < 0) {
        fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n",
                filter_name, filter_args);
        return 1;
    }

    /* create a link for each of the input pads */
    for (i = 0; i < filter_ctx->nb_inputs; i++) {
        AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
        if (!link) {
            fprintf(stderr, "Unable to allocate memory for filter input link\n");
            ret = 1;
            goto fail;
        }
        link->type = avfilter_pad_get_type(filter_ctx->input_pads, i);
        filter_ctx->inputs[i] = link;
    }
    for (i = 0; i < filter_ctx->nb_outputs; i++) {
        AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
        if (!link) {
            fprintf(stderr, "Unable to allocate memory for filter output link\n");
            ret = 1;
            goto fail;
        }
        link->type = avfilter_pad_get_type(filter_ctx->output_pads, i);
        filter_ctx->outputs[i] = link;
    }

    if (filter->query_formats)
        filter->query_formats(filter_ctx);
    else
        ff_default_query_formats(filter_ctx);

    print_formats(filter_ctx);

fail:
    avfilter_free(filter_ctx);
    avfilter_graph_free(&graph_ctx);
    fflush(stdout);
    return ret;
}
Esempio n. 7
0
int main(int argc, char **argv)
{
    AVFilter *filter;
    AVFilterContext *filter_ctx;
    const char *filter_name;
    const char *filter_args = NULL;
    int i;

    av_log_set_level(AV_LOG_DEBUG);

    if (!argv[1]) {
        fprintf(stderr, "Missing filter name as argument\n");
        return 1;
    }

    filter_name = argv[1];
    if (argv[2])
        filter_args = argv[2];

    avfilter_register_all();

    /* get a corresponding filter and open it */
    if (!(filter = avfilter_get_by_name(filter_name))) {
        fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name);
        return 1;
    }

    if (avfilter_open(&filter_ctx, filter, NULL) < 0) {
        fprintf(stderr, "Impossible to open filter with name '%s'\n",
                filter_name);
        return 1;
    }
    if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) {
        fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n",
                filter_name, filter_args);
        return 1;
    }

    /* create a link for each of the input pads */
    for (i = 0; i < filter_ctx->input_count; i++) {
        AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
        link->type = filter_ctx->filter->inputs[i].type;
        filter_ctx->inputs[i] = link;
    }
    for (i = 0; i < filter_ctx->output_count; i++) {
        AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
        link->type = filter_ctx->filter->outputs[i].type;
        filter_ctx->outputs[i] = link;
    }

    if (filter->query_formats)
        filter->query_formats(filter_ctx);
    else
        avfilter_default_query_formats(filter_ctx);

    print_formats(filter_ctx);

    avfilter_free(filter_ctx);
    fflush(stdout);
    return 0;
}
Esempio n. 8
0
int main(int argc, char ** argv)
{
    try {
        const std::string description =
                "Parallel Empirical Variogram: A massively parallel solution "
                "for computing empirical variograms of large-scale data.";

        const std::string input_desc = "Path to input file";
        const std::string output_desc = "Path to output file. Defaults to stdout.";
        const std::string timing_desc = "Path to timing file. "
                                        "Defaults to not writing timing information.";
        const std::string repl_desc = "Desired replication factor. Defaults to 1.";
        const std::string bins_desc = "Number of distance bins to use for empirical variogram. "
                                      "Defaults to 15.";
        const std::string format_desc = "Prints information about output formats instead of performing computations.";

        // TODO: Improve input file descriptions to describe output formats
        TCLAP::CmdLine cmd(description, ' ', "0.1");
        TCLAP::ValueArg<std::string> input_file_arg("i", "input", input_desc, true, "", "path");
        TCLAP::ValueArg<std::string> output_file_arg("o", "output", output_desc, false, "", "path");
        TCLAP::ValueArg<std::string> timing_file_arg("t", "timing", timing_desc, false, "", "path");
//        TCLAP::ValueArg<int> repl_factor_arg("c", "replication", repl_desc,
//                                             false, 1, &positive_constraint);
        TCLAP::ValueArg<int> num_bins_arg("b", "bins", bins_desc, false, 15, &positive_constraint);
        TCLAP::SwitchArg format_arg("p", "print-formats", format_desc, false);

        // We only want EITHER input file or format
        cmd.xorAdd(input_file_arg, format_arg);
        cmd.add(output_file_arg);
        cmd.add(timing_file_arg);
//        cmd.add(repl_factor_arg);
        cmd.add(num_bins_arg);
        cmd.parse(argc, argv);

        const int num_bins = num_bins_arg.getValue();
//        const int replication_factor = repl_factor_arg.getValue();
        const std::string input_path = input_file_arg.getValue();
        const std::string output_path = output_file_arg.getValue();
        const std::string timing_path = timing_file_arg.getValue();

        MPI_Init(&argc, &argv);
        int rank, ranks;
        MPI_Comm_rank(MPI_COMM_WORLD, &rank);
        MPI_Comm_size(MPI_COMM_WORLD, &ranks);

        if (format_arg.isSet())
        {
            if (rank == 0)
                print_formats();
            MPI_Finalize();
            return 0;
        }

        pev::parallel_options options(ranks, 1);
        if (rank == 0)
        {
            std::cout << "Using " << options.active_processor_count() << " of "
                      << ranks << " processors with replication factor " << options.replication_factor()
                      << std::endl;
        }

        pev::variogram_data variogram = pev::empirical_variogram_parallel(input_path, num_bins);

        if (rank == 0)
        {
            std::ofstream outfile;
            if (output_file_arg.isSet())
                outfile.open(output_path);

            // Print to stdout if output file not supplied
            std::ostream & out = output_file_arg.isSet()
                    ? outfile
                    : std::cout;

            pev::print_variogram(out, variogram);

            if (timing_file_arg.isSet())
            {
                std::ofstream outfile;

                // Append to timing file if path is given
                if (timing_path != "-")
                    outfile.open(timing_path, std::ios_base::out | std::ios_base::app);

                std::ostream & out = timing_path == "-"
                        ? std::cout
                        : outfile;

                pev::print_timing_info(out, variogram);
            }
        }

        MPI_Finalize();

        return 0;

    } catch (const TCLAP::ArgException & e)
    {
        std::cerr << "ERROR: " << e.what() << " for argument " << e.argId() << std::endl;
        return -1;
    }
}