mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Reorganised the source tree. We now have src/ with a couple of subdirs:
* daemon/ - Contains the files specific to the polypaudio daemon. * modules/ - All loadable modules. * polyp/ - Files that are part of the public, application interface or are only used in libpolyp. * polypcore/ - All other shared files. * tests/ - Test programs. * utils/ - Utility programs. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@487 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
5b881e6228
commit
e205b25d65
246 changed files with 724 additions and 689 deletions
99
src/daemon/dumpmodules.c
Normal file
99
src/daemon/dumpmodules.c
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/* $Id$ */
|
||||
|
||||
/***
|
||||
This file is part of polypaudio.
|
||||
|
||||
polypaudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
polypaudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with polypaudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
#include "dumpmodules.h"
|
||||
#include <polypcore/modinfo.h>
|
||||
#include <polypcore/util.h>
|
||||
|
||||
#define PREFIX "module-"
|
||||
|
||||
static void short_info(const char *name, PA_GCC_UNUSED const char *path, pa_modinfo *i) {
|
||||
assert(name && i);
|
||||
printf("%-40s%s\n", name, i->description ? i->description : "n/a");
|
||||
}
|
||||
|
||||
static void long_info(const char *name, const char *path, pa_modinfo *i) {
|
||||
static int nl = 0;
|
||||
assert(name && i);
|
||||
|
||||
if (nl)
|
||||
printf("\n");
|
||||
|
||||
nl = 1;
|
||||
|
||||
printf("Name: %s\n", name);
|
||||
|
||||
if (!i->description && !i->version && !i->author && !i->usage)
|
||||
printf("No module information available\n");
|
||||
else {
|
||||
if (i->version)
|
||||
printf("Version: %s\n", i->version);
|
||||
if (i->description)
|
||||
printf("Description: %s\n", i->description);
|
||||
if (i->author)
|
||||
printf("Author: %s\n", i->author);
|
||||
if (i->usage)
|
||||
printf("Usage: %s\n", i->usage);
|
||||
}
|
||||
|
||||
if (path)
|
||||
printf("Path: %s\n", path);
|
||||
}
|
||||
|
||||
static void show_info(const char *name, const char *path, void (*info)(const char *name, const char *path, pa_modinfo*i)) {
|
||||
pa_modinfo *i;
|
||||
|
||||
if ((i = pa_modinfo_get_by_name(path ? path : name))) {
|
||||
info(name, path, i);
|
||||
pa_modinfo_free(i);
|
||||
}
|
||||
}
|
||||
|
||||
static int callback(const char *path, lt_ptr data) {
|
||||
const char *e;
|
||||
pa_daemon_conf *c = (data);
|
||||
|
||||
e = pa_path_get_filename(path);
|
||||
|
||||
if (strlen(e) > sizeof(PREFIX)-1 && !strncmp(e, PREFIX, sizeof(PREFIX)-1))
|
||||
show_info(e, path, c->log_level >= PA_LOG_INFO ? long_info : short_info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pa_dump_modules(pa_daemon_conf *c, int argc, char * const argv[]) {
|
||||
if (argc > 0) {
|
||||
int i;
|
||||
for (i = 0; i < argc; i++)
|
||||
show_info(argv[i], NULL, long_info);
|
||||
} else
|
||||
lt_dlforeachfile(NULL, callback, c);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue