Mercurial > audlegacy-plugins
annotate src/null/null.c @ 3148:d443c917dab9
Remove stale library variable from Makefile, as pointed out by Rafa Muyo on #audacious.
author | Tony Vroon <chainsaw@gentoo.org> |
---|---|
date | Mon, 11 May 2009 17:32:04 +0100 |
parents | 3f47065d84be |
children |
rev | line source |
---|---|
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
1 /* |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
2 * Copyright 2006 Christian Birchinger <joker@netswarm.net> |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
3 * |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
4 * Based on the XMMS plugin: |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
5 * Copyright 2000 H�vard Kv�len <havardk@sol.no> |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
6 * |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
7 * |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
11 * (at your option) any later version. |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
12 * |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
17 * |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
2835 | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
21 */ |
2500
41c619e96a17
Include cleanups, part #5.
Matti Hamalainen <ccr@tnsp.org>
parents:
2124
diff
changeset
|
22 #include "config.h" |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
23 #include <glib.h> |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
24 #include <gtk/gtk.h> |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2835
diff
changeset
|
25 #include <audlegacy/plugin.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2835
diff
changeset
|
26 #include <audlegacy/i18n.h> |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
27 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
28 static GTimer *timer; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
29 static gulong offset_time, written; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
30 static gint bps; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
31 static gboolean real_time = TRUE; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
32 static gboolean paused, started; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
33 static GtkWidget *configurewin; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
34 static struct { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
35 AFormat format; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
36 gint frequency; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
37 gint channels; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
38 } input_format; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
39 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
40 #define ELAPSED_TIME (offset_time + g_timer_elapsed(timer, NULL) * 1000) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
41 |
3019
3f47065d84be
Convert null output plugin to new API, lowest priority and reporting no devices so it is never auto-selected.
Tony Vroon <chainsaw@gentoo.org>
parents:
2971
diff
changeset
|
42 static OutputPluginInitStatus null_init(void) |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
43 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2500
diff
changeset
|
44 mcs_handle_t *db; |
2124 | 45 db = aud_cfg_db_open(); |
46 aud_cfg_db_get_bool(db, "null", "real_time", &real_time); | |
47 aud_cfg_db_close(db); | |
3019
3f47065d84be
Convert null output plugin to new API, lowest priority and reporting no devices so it is never auto-selected.
Tony Vroon <chainsaw@gentoo.org>
parents:
2971
diff
changeset
|
48 return OUTPUT_PLUGIN_INIT_NO_DEVICES; |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
49 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
50 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
51 static void null_about(void) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
52 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
53 static GtkWidget *about; |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
54 gchar *about_text; |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
55 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
56 if (about) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
57 return; |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
58 |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
59 about_text = g_strjoin("", _("Null output plugin "), VERSION, |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
60 _(" by Christian Birchinger <joker@netswarm.net>\n" |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
61 "based on the XMMS plugin by Håvard Kvål <havardk@xmms.org>"), NULL); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
62 |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1628
diff
changeset
|
63 about = audacious_info_dialog(_("About Null Output"), |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
64 about_text, |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
65 _("Ok"), FALSE, NULL, NULL); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
66 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
67 g_signal_connect(G_OBJECT(about), "destroy", |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
68 G_CALLBACK(gtk_widget_destroyed), &about); |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1304
diff
changeset
|
69 g_free(about_text); |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
70 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
71 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
72 static void null_configure_ok_cb(GtkButton *w, gpointer data) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
73 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2500
diff
changeset
|
74 mcs_handle_t *db; |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
75 |
2124 | 76 db = aud_cfg_db_open(); |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
77 real_time = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data)); |
2124 | 78 aud_cfg_db_set_bool(db, "null", "real_time", real_time); |
79 aud_cfg_db_close(db); | |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
80 gtk_widget_destroy(configurewin); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
81 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
82 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
83 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
84 static void null_configure(void) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
85 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
86 GtkWidget *rt_btn, *ok_button, *cancel_button, *vbox, *bbox; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
87 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
88 if (configurewin) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
89 return; |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
90 |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
91 configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
92 gtk_window_set_title(GTK_WINDOW(configurewin), _("Null output preferences")); |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
93 gtk_window_set_policy(GTK_WINDOW(configurewin), FALSE, FALSE, FALSE); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
94 gtk_container_set_border_width(GTK_CONTAINER(configurewin), 10); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
95 gtk_signal_connect(GTK_OBJECT(configurewin), "destroy", |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
96 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &configurewin); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
97 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
98 vbox = gtk_vbox_new(FALSE, 10); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
99 gtk_container_add(GTK_CONTAINER(configurewin), vbox); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
100 |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
101 rt_btn = gtk_check_button_new_with_label(_("Run in real time")); |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
102 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rt_btn), real_time); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
103 gtk_box_pack_start(GTK_BOX(vbox), rt_btn, FALSE, FALSE, 0); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
104 bbox = gtk_hbutton_box_new(); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
105 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
106 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
107 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
108 ok_button = gtk_button_new_with_label(_("Ok")); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
109 cancel_button = gtk_button_new_with_label(_("Cancel")); |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
110 GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
111 GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
112 gtk_widget_grab_default(ok_button); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
113 gtk_signal_connect_object(GTK_OBJECT(cancel_button), "clicked", |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
114 GTK_SIGNAL_FUNC(gtk_widget_destroy), |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
115 GTK_OBJECT(configurewin)); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
116 gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
117 GTK_SIGNAL_FUNC(null_configure_ok_cb), rt_btn); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
118 gtk_box_pack_start_defaults(GTK_BOX(bbox), ok_button); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
119 gtk_box_pack_start_defaults(GTK_BOX(bbox), cancel_button); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
120 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
121 gtk_widget_show_all(configurewin); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
122 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
123 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
124 static int null_open(AFormat fmt, int rate, int nch) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
125 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
126 offset_time = 0; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
127 written = 0; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
128 started = FALSE; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
129 paused = FALSE; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
130 input_format.format = fmt; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
131 input_format.frequency = rate; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
132 input_format.channels = nch; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
133 bps = rate * nch; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
134 switch (fmt) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
135 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
136 case FMT_U8: |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
137 case FMT_S8: |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
138 break; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
139 default: |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
140 bps <<= 1; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
141 break; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
142 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
143 if (real_time) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
144 timer = g_timer_new(); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
145 return 1; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
146 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
147 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
148 static void null_write(void *ptr, int length) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
149 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
150 if (timer && !started) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
151 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
152 g_timer_start(timer); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
153 started = TRUE; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
154 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
155 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
156 written += length; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
157 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
158 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
159 static void null_close(void) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
160 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
161 if (timer) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
162 g_timer_destroy(timer); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
163 timer = NULL; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
164 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
165 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
166 static void null_flush(int time) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
167 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
168 offset_time = time; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
169 written = ((double)time * bps) / 1000; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
170 if (timer) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
171 g_timer_reset(timer); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
172 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
173 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
174 static void null_pause(short p) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
175 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
176 paused = p; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
177 if (!timer) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
178 return; |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
179 |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
180 if (paused) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
181 g_timer_stop(timer); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
182 else |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
183 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
184 offset_time += g_timer_elapsed(timer, NULL) * 1000; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
185 g_timer_start(timer); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
186 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
187 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
188 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
189 static int null_buffer_free(void) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
190 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
191 if (timer) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
192 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
193 return 10240 - (written - (ELAPSED_TIME * bps) / 1000); |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
194 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
195 else |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
196 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
197 if (!paused) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
198 return 10000; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
199 else |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
200 return 0; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
201 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
202 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
203 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
204 static int null_playing(void) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
205 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
206 if (!timer) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
207 return FALSE; |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
208 |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
209 if ((gdouble)(written * 1000) / bps > ELAPSED_TIME) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
210 return TRUE; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
211 return FALSE; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
212 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
213 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
214 static int null_get_written_time(void) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
215 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
216 if (!bps) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
217 return 0; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
218 return ((gint64)written * 1000) / bps; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
219 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
220 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
221 static int null_get_output_time(void) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
222 { |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
223 if (!timer) |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
224 return null_get_written_time(); |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1190
diff
changeset
|
225 |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
226 return ELAPSED_TIME; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
227 } |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
228 |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
229 OutputPlugin null_op = |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
230 { |
1628
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
231 .description = "Null Output Plugin", |
3019
3f47065d84be
Convert null output plugin to new API, lowest priority and reporting no devices so it is never auto-selected.
Tony Vroon <chainsaw@gentoo.org>
parents:
2971
diff
changeset
|
232 .probe_priority = 0, |
1628
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
233 .init = null_init, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
234 .about = null_about, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
235 .configure = null_configure, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
236 .open_audio = null_open, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
237 .write_audio = null_write, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
238 .close_audio = null_close, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
239 .flush = null_flush, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
240 .pause = null_pause, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
241 .buffer_free = null_buffer_free, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
242 .buffer_playing = null_playing, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
243 .output_time = null_get_output_time, |
0a3b3b6430b1
null: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1395
diff
changeset
|
244 .written_time = null_get_written_time, |
144
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
245 }; |
5dfc0e491ad3
[svn] Null output plugin added; original code by Christian Birchinger <joker -at- gentoo.org>
kiyoshi
parents:
diff
changeset
|
246 |
1100 | 247 OutputPlugin *null_oplist[] = { &null_op, NULL }; |
248 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1325
diff
changeset
|
249 DECLARE_PLUGIN(null, NULL, NULL, NULL, null_oplist, NULL, NULL, NULL, NULL); |