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 | |
---|
28 | static int static_counter = 0; |
---|
29 | int nonstatic_counter = 0; |
---|
30 | |
---|
31 | static int global_data_init = 0; |
---|
32 | static int * global_data; |
---|
33 | |
---|
34 | static 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 | |
---|
46 | static 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 = %p\n", para->notifycore); |
---|
79 | roar_vio_printf(roar_stdout, para->container == NULL ? "container = <not set>\n" : "container = %p\n", para->container); |
---|
80 | roar_vio_printf(roar_stdout, para->loader == NULL ? "loader = <not set>\n" : "loader = %p\n", para->loader); |
---|
81 | roar_vio_printf(roar_stdout, para->loader_userdata == NULL ? "loader_userdata = <not set>\n" : "loader_userdata = %p\n", para->loader_userdata); |
---|
82 | } |
---|
83 | |
---|
84 | static void print_notifycore (struct roar_dl_librarypara * para) { |
---|
85 | struct roar_notify_core * tmp; |
---|
86 | |
---|
87 | tmp = roar_notify_core_swap_global(NULL); |
---|
88 | roar_notify_core_swap_global(tmp); |
---|
89 | |
---|
90 | if ( para->notifycore == NULL || para->notifycore == tmp ) { |
---|
91 | roar_vio_printf(roar_stdout, |
---|
92 | tmp == NULL ? "global notify core= <not set> (matching)\n" : "global notify core= %p (matching)\n", |
---|
93 | tmp); |
---|
94 | } else { |
---|
95 | roar_vio_printf(roar_stdout, |
---|
96 | tmp == NULL ? "global notify core= <not set> (not matching)\n" : |
---|
97 | "global notify core= %p (not matching)\n", |
---|
98 | tmp); |
---|
99 | } |
---|
100 | |
---|
101 | roar_notify_core_unref(tmp); |
---|
102 | } |
---|
103 | |
---|
104 | static void print_env(void) { |
---|
105 | const char * server = roar_libroar_get_server(); |
---|
106 | roar_vio_printf(roar_stdout, "Default server: %s%s%s\n", |
---|
107 | server == NULL ? "" : "\"", |
---|
108 | server == NULL ? "<not set>" : server, |
---|
109 | server == NULL ? "" : "\""); |
---|
110 | } |
---|
111 | |
---|
112 | static int init (struct roar_dl_librarypara * para) { |
---|
113 | print_parameter(para); |
---|
114 | print_notifycore(para); |
---|
115 | print_env(); |
---|
116 | print_counter(); |
---|
117 | return 0; |
---|
118 | } |
---|
119 | |
---|
120 | static struct roar_dl_appsched sched = { |
---|
121 | .init = init, |
---|
122 | .free = NULL, |
---|
123 | .update = NULL, |
---|
124 | .tick = NULL, |
---|
125 | .wait = NULL |
---|
126 | }; |
---|
127 | |
---|
128 | ROAR_DL_PLUGIN_START(plugin_info) { |
---|
129 | ROAR_DL_PLUGIN_META_PRODUCT_NIV("plugin-info", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO); |
---|
130 | ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING); |
---|
131 | ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0); |
---|
132 | ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org"); |
---|
133 | ROAR_DL_PLUGIN_META_DESC("Display information about the plugin context"); |
---|
134 | |
---|
135 | ROAR_DL_PLUGIN_REG_GLOBAL_DATA(global_data, global_data_init); |
---|
136 | ROAR_DL_PLUGIN_REG_APPSCHED(&sched); |
---|
137 | } ROAR_DL_PLUGIN_END |
---|
138 | |
---|
139 | //ll |
---|