source: roaraudio/plugins/universal/plugin-info.c @ 5434:1bbcec2d01e9

Last change on this file since 5434:1bbcec2d01e9 was 5381:430b1d26e12d, checked in by phi, 12 years ago

updated copyright years

File size: 4.8 KB
Line 
1//plugin-info.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2012
5 *
6 *  This file is part of roard a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 */
25
26#include <roard/include/roard.h>
27
28static int static_counter = 0;
29int nonstatic_counter = 0;
30
31static int global_data_init = 0;
32static int * global_data;
33
34static void print_counter  (void) {
35 static int static_func_counter = 0;
36
37 printf("static_counter=%i, nonstatic_counter=%i, static_func_counter=%i, *global_data=%i\n",
38        static_counter, nonstatic_counter, static_func_counter, *global_data);
39
40 static_counter++;
41 nonstatic_counter++;
42 static_func_counter++;
43 (*global_data)++;
44}
45
46static void print_parameter(struct roar_dl_librarypara * para) {
47 size_t i;
48 char c;
49
50 roar_vio_printf(roar_stdout, "version    = %i (%smatching)\n",
51                 para->version, para->version == ROAR_DL_LIBPARA_VERSION ? "" : "not ");
52 roar_vio_printf(roar_stdout, "length     = %zu (%smatching)\n",
53                 para->len, para->len == sizeof(*para) ? "" : "not ");
54
55 if ( para->version != ROAR_DL_LIBPARA_VERSION || para->len != sizeof(*para) ) {
56  roar_vio_printf(roar_stdout, "Warning: Unsupported para block. Version or length missmatch.\n");
57  return;
58 }
59
60 roar_vio_printf(roar_stdout, "refc       = %zu\n", para->refc);
61 if ( para->argv == NULL ) {
62  roar_vio_printf(roar_stdout, "argv[]     = <not set>\n");
63 } else {
64  roar_vio_printf(roar_stdout, "argv[]     = <kv array>\n");
65  for (i = 0; i < para->argc; i++) {
66   c = i == (para->argc - 1) ? '\\' : '|';
67   if ( para->argv[i].value == NULL ) {
68    roar_vio_printf(roar_stdout, " %c- \"%s\" has no value.\n", c, para->argv[i].key);
69   } else {
70    roar_vio_printf(roar_stdout, " %c- \"%s\" has value \"%s\".\n", c, para->argv[i].key, para->argv[i].value);
71   }
72  }
73 }
74
75 roar_vio_printf(roar_stdout, para->binargv    == NULL ? "binargv    = <not set>\n" : "binargv    = %p\n", para->binargv);
76 roar_vio_printf(roar_stdout, para->appname    == NULL ? "appname    = <not set>\n" : "appname    = \"%s\"\n", para->appname);
77 roar_vio_printf(roar_stdout, para->abiversion == NULL ? "abiversion = <not set>\n" : "abiversion = \"%s\"\n", para->abiversion);
78 roar_vio_printf(roar_stdout, para->notifycore == NULL ? "notifycore = <not set>\n" : "notifycore = \"%s\"\n", para->notifycore);
79}
80
81static void print_notifycore (struct roar_dl_librarypara * para) {
82 struct roar_notify_core * tmp;
83
84 tmp = roar_notify_core_swap_global(NULL);
85 roar_notify_core_swap_global(tmp);
86
87 if ( para->notifycore == NULL || para->notifycore == tmp ) {
88  roar_vio_printf(roar_stdout,
89                 tmp == NULL ? "global notify core= <not set> (matching)\n" : "global notify core= %p (matching)\n",
90                 tmp);
91 } else {
92  roar_vio_printf(roar_stdout,
93                  tmp == NULL ? "global notify core= <not set> (not matching)\n" :
94                                "global notify core= %p (not matching)\n",
95                  tmp);
96 }
97
98 roar_notify_core_unref(tmp);
99}
100
101static void print_env(void) {
102 const char * server = roar_libroar_get_server();
103 roar_vio_printf(roar_stdout, "Default server: %s%s%s\n",
104                              server == NULL ? "" : "\"",
105                              server == NULL ? "<not set>" : server,
106                              server == NULL ? "" : "\"");
107}
108
109static int init  (struct roar_dl_librarypara * para) {
110 print_parameter(para);
111 print_notifycore(para);
112 print_env();
113 print_counter();
114 return 0;
115}
116
117static struct roar_dl_appsched sched = {
118 .init   = init,
119 .free   = NULL,
120 .update = NULL,
121 .tick   = NULL,
122 .wait   = NULL
123};
124
125ROAR_DL_PLUGIN_START(plugin_info) {
126 ROAR_DL_PLUGIN_META_PRODUCT_NIV("plugin-info", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
127 ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
128 ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
129 ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
130 ROAR_DL_PLUGIN_META_DESC("Display information about the plugin context");
131
132 ROAR_DL_PLUGIN_REG_GLOBAL_DATA(global_data, global_data_init);
133 ROAR_DL_PLUGIN_REG_APPSCHED(&sched);
134} ROAR_DL_PLUGIN_END
135
136//ll
Note: See TracBrowser for help on using the repository browser.