annotate src/icecast/icecast.c @ 2767:fa4b58a08f4c

started icecast plugin (derived from filewriter)
author Andrew O. Shadoura <bugzilla@tut.by>
date Mon, 09 Jun 2008 19:48:19 +0300
parents
children 88180bc8c40c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
1 /* Icecast-Plugin
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
2 * (C) copyright 2008 based of FileWriter-plugin
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
3 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
4 * Original Out-Lame-Plugin:
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
5 * (C) copyright 2002 Lars Siebold <khandha5@gmx.net>
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
6 * (C) copyright 2006-2007 porting to audacious by Yoshiki Yazawa <yaz@cc.rim.or.jp>
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
7 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
11 * (at your option) any later version.
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
12 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
16 * GNU General Public License for more details.
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
17 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
21 */
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
22
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
23 #include "../filewriter/filewriter.h"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
24 #include "../filewriter/plugins.h"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
25
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
26 struct format_info input;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
27
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
28 static GtkWidget *configure_win = NULL, *configure_vbox;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
29 static GtkWidget *addr_hbox, *addr_label, *addr_entry;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
30 static GtkWidget *configure_bbox, *configure_ok, *configure_cancel;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
31
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
32 static GtkWidget *streamformat_hbox, *streamformat_label, *streamformat_combo, *plugin_button;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
33
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
34 enum streamformat_t
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
35 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
36 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
37 MP3,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
38 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
39 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
40 VORBIS,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
41 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
42 streamformat_MAX
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
43 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
44
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
45 static gint streamformat = VORBIS;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
46
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
47 static FileWriter plugin;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
48
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
49 static gchar *server_address = NULL;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
50
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
51 VFSFile *output_file = NULL;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
52 guint64 written = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
53 guint64 offset = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
54 Tuple *tuple = NULL;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
55
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
56 static void ice_init(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
57 static void ice_about(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
58 static gint ice_open(AFormat fmt, gint rate, gint nch);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
59 static void ice_write(void *ptr, gint length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
60 static gint ice_write_output(void *ptr, gint length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
61 static void ice_close(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
62 static void ice_flush(gint time);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
63 static void ice_pause(short p);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
64 static gint ice_free(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
65 static gint ice_playing(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
66 static gint ice_get_written_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
67 static gint ice_get_output_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
68 static void ice_configure(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
69 /*static int ice_mod_samples(gpointer * d, gint length, AFormat afmt, gint srate, gint nch);*/
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
70
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
71 OutputPlugin ice_op =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
72 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
73 .description = "Icecast Plugin",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
74 .init = ice_init,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
75 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
76 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
77 .open_audio = ice_open,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
78 .write_audio = ice_write,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
79 .close_audio = ice_close,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
80 .flush = ice_flush,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
81 .pause = ice_pause,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
82 .buffer_free = ice_free,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
83 .buffer_playing = ice_playing,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
84 .output_time = ice_get_output_time,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
85 .written_time = ice_get_written_time
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
86 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
87 /*
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
88 EffectPlugin ice_ep =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
89 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
90 .description = "Icecast Plugin",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
91 .init = ice_init,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
92 .cleanup = ice_cleanup,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
93 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
94 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
95 .mod_samples = ice_mod_samples,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
96 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
97 */
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
98 OutputPlugin *ice_oplist[] = { &ice_op, NULL };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
99
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
100 SIMPLE_OUTPUT_PLUGIN(icecast, ice_oplist);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
101
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
102 static void set_plugin(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
103 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
104 if (streamformat < 0 || streamformat >= streamformat_MAX)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
105 streamformat = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
106
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
107 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
108 if (streamformat == MP3)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
109 plugin = mp3_plugin;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
110 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
111 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
112 if (streamformat == VORBIS)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
113 plugin = vorbis_plugin;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
114 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
115 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
116
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
117 static void ice_init(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
118 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
119 ConfigDb *db;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
120 puts("ICE_INIT");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
121
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
122 db = aud_cfg_db_open();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
123 aud_cfg_db_get_int(db, "icecast", "streamformat", &streamformat);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
124 aud_cfg_db_get_string(db, "icecast", "server_address", &server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
125 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
126
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
127 set_plugin();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
128 if (plugin.init)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
129 plugin.init(&ice_write_output);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
130 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
131
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
132 void ice_about(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
133 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
134 static GtkWidget *dialog;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
135
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
136 if (dialog != NULL)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
137 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
138
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
139 dialog = audacious_info_dialog(_("About Icecast-Plugin"),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
140 _("Icecast-Plugin\n\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
141 "This program is free software; you can redistribute it and/or modify\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
142 "it under the terms of the GNU General Public License as published by\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
143 "the Free Software Foundation; either version 2 of the License, or\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
144 "(at your option) any later version.\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
145 "\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
146 "This program is distributed in the hope that it will be useful,\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
147 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
148 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
149 "GNU General Public License for more details.\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
150 "\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
151 "You should have received a copy of the GNU General Public License\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
152 "along with this program; if not, write to the Free Software\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
153 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
154 "USA."), _("Ok"), FALSE, NULL, NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
155 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
156 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
157 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
158
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
159 static gint ice_open(AFormat fmt, gint rate, gint nch)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
160 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
161 gint rv;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
162
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
163 input.format = fmt;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
164 input.frequency = rate;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
165 input.channels = nch;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
166
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
167 rv = (plugin.open)();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
168
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
169 puts("ICE_OPEN");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
170 return rv;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
171 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
172
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
173 static void convert_buffer(gpointer buffer, gint length)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
174 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
175 gint i;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
176
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
177 if (input.format == FMT_S8)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
178 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
179 guint8 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
180 gint8 *ptr2 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
181
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
182 for (i = 0; i < length; i++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
183 *(ptr1++) = *(ptr2++) ^ 128;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
184 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
185 if (input.format == FMT_S16_BE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
186 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
187 gint16 *ptr = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
188
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
189 for (i = 0; i < length >> 1; i++, ptr++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
190 *ptr = GUINT16_SWAP_LE_BE(*ptr);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
191 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
192 if (input.format == FMT_S16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
193 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
194 gint16 *ptr = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
195
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
196 for (i = 0; i < length >> 1; i++, ptr++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
197 *ptr = GINT16_TO_LE(*ptr);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
198 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
199 if (input.format == FMT_U16_BE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
200 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
201 gint16 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
202 guint16 *ptr2 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
203
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
204 for (i = 0; i < length >> 1; i++, ptr2++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
205 *(ptr1++) = GINT16_TO_LE(GUINT16_FROM_BE(*ptr2) ^ 32768);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
206 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
207 if (input.format == FMT_U16_LE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
208 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
209 gint16 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
210 guint16 *ptr2 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
211
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
212 for (i = 0; i < length >> 1; i++, ptr2++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
213 *(ptr1++) = GINT16_TO_LE(GUINT16_FROM_LE(*ptr2) ^ 32768);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
214 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
215 if (input.format == FMT_U16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
216 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
217 gint16 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
218 guint16 *ptr2 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
219
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
220 for (i = 0; i < length >> 1; i++, ptr2++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
221 *(ptr1++) = GINT16_TO_LE((*ptr2) ^ 32768);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
222 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
223 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
224
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
225 static void ice_write(void *ptr, gint length)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
226 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
227 if (input.format == FMT_S8 || input.format == FMT_S16_BE ||
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
228 input.format == FMT_U16_LE || input.format == FMT_U16_BE ||
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
229 input.format == FMT_U16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
230 convert_buffer(ptr, length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
231 #ifdef WORDS_BIGENDIAN
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
232 if (input.format == FMT_S16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
233 convert_buffer(ptr, length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
234 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
235
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
236 plugin.write(ptr, length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
237 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
238
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
239 static gint ice_write_output(void *ptr, gint length)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
240 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
241 int i;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
242 printf("ice_write(");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
243 for (i=0;(i<length)&&(i<16);i++) printf("%.2x",((char*)ptr)[i]);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
244 printf(")\n");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
245 return length;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
246 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
247
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
248 static void ice_close(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
249 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
250 plugin.close();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
251
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
252 if (output_file)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
253 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
254 written = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
255 aud_vfs_fclose(output_file);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
256 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
257 output_file = NULL;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
258 puts("ICE_CLOSE");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
259 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
260
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
261 static void ice_flush(gint time)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
262 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
263 if (time < 0)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
264 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
265
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
266 ice_close();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
267 ice_open(input.format, input.frequency, input.channels);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
268
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
269 offset = time;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
270 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
271
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
272 static void ice_pause(short p)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
273 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
274 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
275
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
276 static gint ice_free(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
277 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
278 return plugin.free();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
279 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
280
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
281 static gint ice_playing(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
282 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
283 return plugin.playing();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
284 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
285
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
286 static gint ice_get_written_time(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
287 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
288 return plugin.get_written_time();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
289 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
290
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
291 static gint ice_get_output_time(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
292 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
293 return ice_get_written_time();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
294 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
295
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
296 static void configure_ok_cb(gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
297 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
298 ConfigDb *db;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
299
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
300 streamformat = gtk_combo_box_get_active(GTK_COMBO_BOX(streamformat_combo));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
301
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
302 g_free(server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
303 server_address = g_strdup(gtk_entry_get_text(GTK_ENTRY(addr_entry)));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
304
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
305 db = aud_cfg_db_open();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
306 aud_cfg_db_set_int(db, "icecast", "streamformat", streamformat);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
307 aud_cfg_db_set_string(db, "icecast", "server_address", server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
308
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
309 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
310
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
311 gtk_widget_destroy(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
312 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
313
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
314 static void streamformat_cb(GtkWidget *combo, gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
315 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
316 streamformat = gtk_combo_box_get_active(GTK_COMBO_BOX(streamformat_combo));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
317 set_plugin();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
318 if (plugin.init)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
319 plugin.init(&ice_write_output);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
320
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
321 gtk_widget_set_sensitive(plugin_button, plugin.configure != NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
322 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
323
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
324 static void plugin_configure_cb(GtkWidget *button, gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
325 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
326 if (plugin.configure)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
327 plugin.configure();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
328 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
329
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
330 static void configure_destroy(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
331 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
332 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
333
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
334 static void ice_configure(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
335 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
336 if (!configure_win)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
337 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
338 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
339
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
340 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
341 GTK_SIGNAL_FUNC(configure_destroy), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
342 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
343 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
344 &configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
345
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
346 gtk_window_set_title(GTK_WINDOW(configure_win),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
347 _("Icecast Configuration"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
348 gtk_window_set_position(GTK_WINDOW(configure_win), GTK_WIN_POS_MOUSE);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
349
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
350 gtk_container_set_border_width(GTK_CONTAINER(configure_win), 10);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
351
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
352 configure_vbox = gtk_vbox_new(FALSE, 10);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
353 gtk_container_add(GTK_CONTAINER(configure_win), configure_vbox);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
354
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
355
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
356 streamformat_hbox = gtk_hbox_new(FALSE, 5);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
357 gtk_box_pack_start(GTK_BOX(configure_vbox), streamformat_hbox, FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
358
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
359 streamformat_label = gtk_label_new(_("Output stream format:"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
360 gtk_box_pack_start(GTK_BOX(streamformat_hbox), streamformat_label, FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
361
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
362 streamformat_combo = gtk_combo_box_new_text();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
363 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
364 gtk_combo_box_append_text(GTK_COMBO_BOX(streamformat_combo), "MP3");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
365 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
366 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
367 gtk_combo_box_append_text(GTK_COMBO_BOX(streamformat_combo), "Vorbis");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
368 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
369 gtk_box_pack_start(GTK_BOX(streamformat_hbox), streamformat_combo, FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
370 gtk_combo_box_set_active(GTK_COMBO_BOX(streamformat_combo), streamformat);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
371 g_signal_connect(G_OBJECT(streamformat_combo), "changed", G_CALLBACK(streamformat_cb), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
372
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
373 plugin_button = gtk_button_new_with_label(_("Configure"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
374 gtk_widget_set_sensitive(plugin_button, plugin.configure != NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
375 g_signal_connect(G_OBJECT(plugin_button), "clicked", G_CALLBACK(plugin_configure_cb), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
376 gtk_box_pack_end(GTK_BOX(streamformat_hbox), plugin_button, FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
377
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
378
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
379
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
380
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
381 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
382
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
383 addr_hbox = gtk_hbox_new(FALSE, 5);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
384 gtk_box_pack_start(GTK_BOX(configure_vbox), addr_hbox, FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
385
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
386 addr_label = gtk_label_new(_("Server address:"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
387 gtk_box_pack_start(GTK_BOX(addr_hbox), addr_label, FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
388
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
389 addr_entry = gtk_entry_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
390
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
391 gtk_entry_set_text(GTK_ENTRY(addr_entry), server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
392
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
393 gtk_box_pack_start(GTK_BOX(addr_hbox), addr_entry, TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
394
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
395 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
396
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
397 configure_bbox = gtk_hbutton_box_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
398 gtk_button_box_set_layout(GTK_BUTTON_BOX(configure_bbox),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
399 GTK_BUTTONBOX_END);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
400 gtk_button_box_set_spacing(GTK_BUTTON_BOX(configure_bbox), 5);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
401 gtk_box_pack_start(GTK_BOX(configure_vbox), configure_bbox,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
402 FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
403
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
404 configure_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
405 gtk_signal_connect_object(GTK_OBJECT(configure_cancel), "clicked",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
406 GTK_SIGNAL_FUNC(gtk_widget_destroy),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
407 GTK_OBJECT(configure_win));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
408 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_cancel,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
409 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
410
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
411 configure_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
412 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
413 GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
414 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_ok,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
415 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
416
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
417 gtk_widget_show_all(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
418 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
419 }