static int find_device(struct mp_log *log, const char *name) { int found = paNoDevice; if (!name) return found; int help = strcmp(name, "help") == 0; int count = Pa_GetDeviceCount(); check_pa_ret(log, count); int index = to_int(name, -1); if (help) mp_info(log, "PortAudio devices:\n"); for (int n = 0; n < count; n++) { const PaDeviceInfo* info = Pa_GetDeviceInfo(n); if (help) { if (info->maxOutputChannels < 1) continue; mp_info(log, " %d '%s', %d channels, latency: %.2f " "ms, sample rate: %.0f\n", n, info->name, info->maxOutputChannels, info->defaultHighOutputLatency * 1000, info->defaultSampleRate); } if (strcmp(name, info->name) == 0 || n == index) { found = n; break; } } if (found == paNoDevice && !help) mp_warn(log, "Device '%s' not found!\n", name); return found; }
int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, struct bstr name, struct bstr param) { if (bstr_equals0(param, "help")) { mp_info(log, "OpenGL windowing backends:\n"); mp_info(log, " auto (autodetect)\n"); for (int n = 0; n < MP_ARRAY_SIZE(backends); n++) mp_info(log, " %s\n", backends[n]->name); return M_OPT_EXIT; } char s[20]; snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); return mpgl_find_backend(s) >= -1 ? 1 : M_OPT_INVALID; }
static int validate_device_opt(struct mp_log *log, const m_option_t *opt, struct bstr name, struct bstr param) { if (bstr_equals0(param, "help")) { if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_TRUE) { mp_fatal(log, "Device listing not supported.\n"); return M_OPT_EXIT; } const char *list = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); mp_info(log, "OpenAL devices:\n"); while (list && *list) { mp_info(log, " '%s'\n", list); list = list + strlen(list) + 1; } return M_OPT_EXIT - 1; } return 0; }
static tvi_handle_t *tv_begin(tv_param_t* tv_param, struct mp_log *log) { int i; tvi_handle_t* h; if(tv_param->driver && !strcmp(tv_param->driver,"help")){ mp_info(log, "Available drivers:\n"); for(i=0;tvi_driver_list[i];i++){ mp_info(log, " %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name); if(tvi_driver_list[i]->comment) mp_info(log, " (%s)",tvi_driver_list[i]->comment); mp_info(log, "\n"); } return NULL; } for(i=0;tvi_driver_list[i];i++){ if (!tv_param->driver || !strcmp(tvi_driver_list[i]->short_name, tv_param->driver)){ h=tvi_driver_list[i]->tvi_init(log, tv_param); //Requested driver initialization failed if (!h && tv_param->driver) return NULL; //Driver initialization failed during autodetection process. if (!h) continue; h->tv_param=tv_param; MP_INFO(h, "Selected driver: %s\n name: %s\n author: %s\n comment: %s\n", tvi_driver_list[i]->short_name, tvi_driver_list[i]->name, tvi_driver_list[i]->author, tvi_driver_list[i]->comment?tvi_driver_list[i]->comment:""); tv_param->driver=strdup(tvi_driver_list[i]->short_name); return h; } } if(tv_param->driver) mp_err(log, "No such driver: %s\n", tv_param->driver); else mp_err(log, "TV driver autodetection failed.\n"); return NULL; }
static void print_help(struct mp_log *log) { mp_info(log, "%s", mp_help_text); }
static void print_help(struct mp_log *log) { mp_info(log, "%s", pp_help); mp_info(log, "Don't forget to quote the filter list, e.g.: '--vf=pp=[tn:64:128:256]'\n\n"); }
static mf_t *open_mf_pattern(void *talloc_ctx, struct mp_log *log, char *filename) { int error_count = 0; int count = 0; mf_t *mf = talloc_zero(talloc_ctx, mf_t); mf->log = log; if (filename[0] == '@') { FILE *lst_f = fopen(filename + 1, "r"); if (lst_f) { char *fname = talloc_size(mf, 512); while (fgets(fname, 512, lst_f)) { /* remove spaces from end of fname */ char *t = fname + strlen(fname) - 1; while (t > fname && mp_isspace(*t)) *(t--) = 0; if (!mp_path_exists(fname)) { mp_verbose(log, "file not found: '%s'\n", fname); } else { mf_add(mf, fname); } } fclose(lst_f); mp_info(log, "number of files: %d\n", mf->nr_of_files); goto exit_mf; } mp_info(log, "%s is not indirect filelist\n", filename + 1); } if (strchr(filename, ',')) { mp_info(log, "filelist: %s\n", filename); bstr bfilename = bstr0(filename); while (bfilename.len) { bstr bfname; bstr_split_tok(bfilename, ",", &bfname, &bfilename); char *fname2 = bstrdup0(mf, bfname); if (!mp_path_exists(fname2)) mp_verbose(log, "file not found: '%s'\n", fname2); else { mf_add(mf, fname2); } talloc_free(fname2); } mp_info(log, "number of files: %d\n", mf->nr_of_files); goto exit_mf; } char *fname = talloc_size(mf, strlen(filename) + 32); if (!strchr(filename, '%')) { strcpy(fname, filename); if (!strchr(filename, '*')) strcat(fname, "*"); mp_info(log, "search expr: %s\n", fname); glob_t gg; if (glob(fname, 0, NULL, &gg)) { talloc_free(mf); return NULL; } for (int i = 0; i < gg.gl_pathc; i++) { if (mp_path_isdir(gg.gl_pathv[i])) continue; mf_add(mf, gg.gl_pathv[i]); } mp_info(log, "number of files: %d\n", mf->nr_of_files); globfree(&gg); goto exit_mf; } mp_info(log, "search expr: %s\n", filename); while (error_count < 5) { sprintf(fname, filename, count++); if (!mp_path_exists(fname)) { error_count++; mp_verbose(log, "file not found: '%s'\n", fname); } else { mf_add(mf, fname); } } mp_info(log, "number of files: %d\n", mf->nr_of_files); exit_mf: return mf; }