annotate src/icecast/icecast.c @ 2780:c40585c57877

added dynamic buffer allocation
author Andrew O. Shadoura <bugzilla@tut.by>
date Thu, 03 Jul 2008 17:23:34 +0300
parents ada024f94eb4
children 5a10f297b7d0
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"
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
25 #include <shout/shout.h>
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
26
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
27 struct format_info input;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
28
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
29 static GtkWidget *configure_win = NULL, *configure_vbox;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
30 static GtkWidget *addr_entry, *port_spin, *timeout_spin, *buffersize_spin, *bufferflush_spin;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
31 static GtkWidget *configure_bbox, *configure_ok, *configure_cancel;
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
32 static guint ice_tid=0;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
33
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
34 static gint ice_close_timeout;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
35
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
36 static GtkWidget *streamformat_combo, *plugin_button;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
37
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
38 enum streamformat_t
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
39 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
40 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
41 MP3,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
42 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
43 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
44 VORBIS,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
45 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
46 streamformat_MAX
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
47 };
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 gint streamformat = VORBIS;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
50
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
51 static unsigned int streamformat_shout[] =
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
52 {
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
53 #ifdef FILEWRITER_MP3
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
54 SHOUT_FORMAT_MP3,
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
55 #endif
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
56 #ifdef FILEWRITER_VORBIS
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
57 SHOUT_FORMAT_OGG
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
58 #endif
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
59 };
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
60
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
61 static FileWriter plugin;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
62 static uint8_t *outputbuffer = NULL;
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
63 static guint outputlength=0;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
64 static gint buffersize;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
65 static gint bufferflush;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
66 static gdouble bufferflushperc;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
67 static gchar *server_address = NULL;
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
68 static gint server_port=8000;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
69
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
70 VFSFile *output_file = NULL;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
71 guint64 written = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
72 guint64 offset = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
73 Tuple *tuple = NULL;
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
74 static shout_t *shout = NULL;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
75 gboolean paused = FALSE;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
76
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
77 static void ice_init(void);
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
78 static void ice_cleanup(void);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
79 static void ice_about(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
80 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
81 static void ice_write(void *ptr, gint length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
82 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
83 static void ice_close(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
84 static void ice_flush(gint time);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
85 static void ice_pause(short p);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
86 static gint ice_free(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
87 static gint ice_playing(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
88 static gint ice_get_written_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
89 static gint ice_get_output_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
90 static void ice_configure(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
91 /*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
92
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
93 OutputPlugin ice_op =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
94 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
95 .description = "Icecast Plugin",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
96 .init = ice_init,
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
97 .cleanup = ice_cleanup,
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
98 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
99 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
100 .open_audio = ice_open,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
101 .write_audio = ice_write,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
102 .close_audio = ice_close,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
103 .flush = ice_flush,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
104 .pause = ice_pause,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
105 .buffer_free = ice_free,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
106 .buffer_playing = ice_playing,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
107 .output_time = ice_get_output_time,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
108 .written_time = ice_get_written_time
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
109 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
110 /*
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
111 EffectPlugin ice_ep =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
112 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
113 .description = "Icecast Plugin",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
114 .init = ice_init,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
115 .cleanup = ice_cleanup,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
116 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
117 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
118 .mod_samples = ice_mod_samples,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
119 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
120 */
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
121 OutputPlugin *ice_oplist[] = { &ice_op, NULL };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
122
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
123 SIMPLE_OUTPUT_PLUGIN(icecast, ice_oplist);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
124
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
125 static void set_plugin(void)
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 if (streamformat < 0 || streamformat >= streamformat_MAX)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
128 streamformat = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
129
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
130 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
131 if (streamformat == MP3)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
132 plugin = mp3_plugin;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
133 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
134 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
135 if (streamformat == VORBIS)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
136 plugin = vorbis_plugin;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
137 #endif
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
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
140 static void ice_init(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
141 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
142 ConfigDb *db;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
143 puts("ICE_INIT");
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
144 shout_init();
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
145 printf("Using libshout %s\n", shout_version(NULL, NULL, NULL));
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
146
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
147 db = aud_cfg_db_open();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
148 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
149 aud_cfg_db_get_string(db, "icecast", "server_address", &server_address);
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
150 aud_cfg_db_get_int(db, "icecast", "server_port", &server_port);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
151 if (!server_port) server_port=8000;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
152 aud_cfg_db_get_int(db, "icecast", "timeout", &ice_close_timeout);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
153 if (!ice_close_timeout) ice_close_timeout=5;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
154 aud_cfg_db_get_int(db, "icecast", "buffersize", &buffersize);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
155 if (!buffersize) buffersize=8192;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
156 aud_cfg_db_get_double(db, "icecast", "bufferflush", &bufferflushperc);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
157 if (!bufferflushperc) bufferflushperc=80.0;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
158 bufferflush=(gint)(buffersize*bufferflushperc);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
159 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
160
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
161 outputbuffer=g_try_malloc(buffersize);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
162
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
163 set_plugin();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
164 if (plugin.init)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
165 plugin.init(&ice_write_output);
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
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
168 static void ice_cleanup(void)
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
169 {
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
170 if (shout)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
171 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
172 shout_close(shout);
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
173 }
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
174 if (outputbuffer)
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
175 g_free(outputbuffer);
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
176 shout_shutdown();
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
177 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
178
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
179 void ice_about(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
180 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
181 static GtkWidget *dialog;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
182
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
183 if (dialog != NULL)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
184 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
185
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
186 dialog = audacious_info_dialog(_("About Icecast-Plugin"),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
187 _("Icecast-Plugin\n\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
188 "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
189 "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
190 "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
191 "(at your option) any later version.\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
192 "\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
193 "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
194 "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
195 "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
196 "GNU General Public License for more details.\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
197 "\n"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
198 "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
199 "along with this program; if not, write to the Free Software\n"
2768
88180bc8c40c fixed FSF HQ address
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2767
diff changeset
200 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n"
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
201 "USA."), _("Ok"), FALSE, NULL, NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
202 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
203 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
204 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
205
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
206 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
207 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
208 gint rv;
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
209 gint pos;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
210 Playlist *playlist;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
211
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
212 if (!outputbuffer)
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
213 return 0;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
214
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
215 if (ice_tid)
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
216 {
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
217 g_source_remove(ice_tid);
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
218 ice_tid = 0;
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
219 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
220
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
221 input.format = fmt;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
222 input.frequency = rate;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
223 input.channels = nch;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
224
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
225 playlist = aud_playlist_get_active();
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
226 if(!playlist)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
227 return 0;
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
228
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
229 pos = aud_playlist_get_position(playlist);
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
230 tuple = aud_playlist_get_tuple(playlist, pos);
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
231
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
232 if (!shout)
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
233 {
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
234 rv = (plugin.open)();
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
235
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
236 if (!(shout = shout_new()))
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
237 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
238
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
239 if (shout_set_host(shout, server_address) != SHOUTERR_SUCCESS)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
240 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
241 printf("Error setting hostname: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
242 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
243 }
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
244
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
245 if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
246 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
247 printf("Error setting protocol: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
248 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
249 }
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
250
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
251 if (shout_set_port(shout, server_port) != SHOUTERR_SUCCESS)
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
252 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
253 printf("Error setting port: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
254 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
255 }
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
256
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
257 if (shout_set_password(shout, "password") != SHOUTERR_SUCCESS)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
258 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
259 printf("Error setting password: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
260 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
261 }
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
262
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
263 if (shout_set_mount(shout, "/test") != SHOUTERR_SUCCESS)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
264 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
265 printf("Error setting mount: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
266 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
267 }
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
268
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
269 if (shout_set_user(shout, "source") != SHOUTERR_SUCCESS)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
270 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
271 printf("Error setting user: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
272 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
273 }
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
274
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
275 if (shout_set_format(shout, streamformat_shout[streamformat]) != SHOUTERR_SUCCESS)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
276 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
277 printf("Error setting user: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
278 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
279 }
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
280
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
281 if (shout_open(shout) != SHOUTERR_SUCCESS)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
282 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
283 printf("Error connecting to server: %s\n", shout_get_error(shout));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
284 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
285 }
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
286 }
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
287 else
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
288 rv = 1;
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
289
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
290 {
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
291 shout_metadata_t *sm = NULL;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
292 sm = shout_metadata_new();
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
293 if (sm)
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
294 {
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
295 shout_metadata_add(sm, "charset", "UTF-8");
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
296 shout_metadata_add(sm, "title", aud_tuple_get_string(tuple, FIELD_TITLE, NULL));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
297 shout_metadata_add(sm, "artist", aud_tuple_get_string(tuple, FIELD_ARTIST, NULL));
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
298 shout_set_metadata(shout, sm);
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
299 shout_metadata_free(sm);
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
300 }
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
301 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
302
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
303 puts("ICE_OPEN");
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
304 return rv;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
305 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
306
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
307 static void convert_buffer(gpointer buffer, gint length)
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 gint i;
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 if (input.format == FMT_S8)
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 guint8 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
314 gint8 *ptr2 = buffer;
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 for (i = 0; i < length; i++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
317 *(ptr1++) = *(ptr2++) ^ 128;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
318 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
319 if (input.format == FMT_S16_BE)
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 gint16 *ptr = buffer;
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 for (i = 0; i < length >> 1; i++, ptr++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
324 *ptr = GUINT16_SWAP_LE_BE(*ptr);
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 (input.format == FMT_S16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
327 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
328 gint16 *ptr = buffer;
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 for (i = 0; i < length >> 1; i++, ptr++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
331 *ptr = GINT16_TO_LE(*ptr);
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 if (input.format == FMT_U16_BE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
334 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
335 gint16 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
336 guint16 *ptr2 = buffer;
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 for (i = 0; i < length >> 1; i++, ptr2++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
339 *(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
340 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
341 if (input.format == FMT_U16_LE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
342 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
343 gint16 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
344 guint16 *ptr2 = buffer;
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 for (i = 0; i < length >> 1; i++, ptr2++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
347 *(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
348 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
349 if (input.format == FMT_U16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
350 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
351 gint16 *ptr1 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
352 guint16 *ptr2 = buffer;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
353
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
354 for (i = 0; i < length >> 1; i++, ptr2++)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
355 *(ptr1++) = GINT16_TO_LE((*ptr2) ^ 32768);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
356 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
357 }
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 static void ice_write(void *ptr, gint length)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
360 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
361 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
362 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
363 input.format == FMT_U16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
364 convert_buffer(ptr, length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
365 #ifdef WORDS_BIGENDIAN
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
366 if (input.format == FMT_S16_NE)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
367 convert_buffer(ptr, length);
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
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
370 plugin.write(ptr, length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
371 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
372
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
373 static gint ice_real_write(void* ptr, gint length)
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
374 {
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
375 int ret;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
376 if (!length) return length;
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
377 ret = shout_send(shout, ptr, length);
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
378 //shout_send_raw(shout, ptr, length);
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
379 shout_sync(shout);
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
380 printf("ice_write[%d:%d](", ret, length);
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
381 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
382 int i;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
383 for (i=0;(i<length)&&(i<16);i++) printf("%c",g_ascii_isprint(((char*)ptr)[i])?(((char*)ptr)[i]):'.');
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
384 }
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
385 printf(")\n");
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
386 return 0;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
387 //return ret;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
388 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
389
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
390 static gint ice_write_output(void *ptr, gint length)
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
391 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
392 if ((!shout) || (!length)) return 0;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
393 printf("outputlength=%d, length=%d...",outputlength, length);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
394 if ((outputlength>bufferflush)||((outputlength+length)>buffersize))
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
395 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
396 printf("flushing\n");
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
397 outputlength=ice_real_write(outputbuffer, outputlength);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
398 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
399 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
400 if (length>buffersize)
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
401 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
402 printf("data too long, flushing\n");
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
403 ice_real_write(ptr, length);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
404 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
405 else
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
406 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
407 printf("adding\n");
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
408 memcpy(&(outputbuffer[outputlength]), ptr, length);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
409 outputlength+=length;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
410 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
411 }
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
412 return length;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
413 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
414
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
415 static gboolean ice_real_close(gpointer data)
2767
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 plugin.close();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
418
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
419 if (shout)
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
420 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
421 written = 0;
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
422 shout_close(shout);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
423 }
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
424 shout = NULL;
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
425 ice_tid=0;
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
426 puts("ICE_REAL_CLOSE");
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
427 return FALSE;
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
428 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
429
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
430
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
431 static void ice_close(void)
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
432 {
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
433 if (ice_tid) g_source_remove(ice_tid);
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
434 ice_tid=g_timeout_add_seconds(3, ice_real_close, NULL);
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
435 puts("ICE_CLOSE: starting timer");
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
436 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
437
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
438 static void ice_flush(gint time)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
439 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
440 if (time < 0)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
441 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
442
2774
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
443 plugin.flush();
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
444 ice_open(input.format, input.frequency, input.channels);
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
445
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
446 offset = time;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
447 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
448
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
449 static void ice_pause(short p)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
450 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
451 paused = p;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
452 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
453
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
454 static gint ice_free(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
455 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
456 return paused?0:plugin.free();
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
457 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
458
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
459 static gint ice_playing(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
460 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
461 return plugin.playing() && (!paused);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
462 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
463
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
464 static gint ice_get_written_time(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
465 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
466 return plugin.get_written_time();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
467 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
468
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
469 static gint ice_get_output_time(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
470 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
471 return ice_get_written_time();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
472 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
473
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
474 static void configure_ok_cb(gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
475 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
476 ConfigDb *db;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
477
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
478 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
479
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
480 g_free(server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
481 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
482
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
483 server_port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(port_spin));
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
484
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
485 ice_close_timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(timeout_spin));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
486
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
487 buffersize = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffersize_spin));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
488
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
489 bufferflushperc = gtk_spin_button_get_value(GTK_SPIN_BUTTON(bufferflush_spin));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
490 bufferflush=(gint)(buffersize*bufferflushperc);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
491
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
492 db = aud_cfg_db_open();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
493 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
494 aud_cfg_db_set_string(db, "icecast", "server_address", server_address);
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
495 aud_cfg_db_set_int(db, "icecast", "server_port", server_port);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
496 aud_cfg_db_set_int(db, "icecast", "timeout", ice_close_timeout);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
497 aud_cfg_db_set_int(db, "icecast", "buffersize", buffersize);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
498 aud_cfg_db_set_double(db, "icecast", "bufferflush", bufferflushperc);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
499
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
500 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
501
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
502 gtk_widget_destroy(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
503 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
504
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
505 static void streamformat_cb(GtkWidget *combo, gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
506 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
507 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
508 set_plugin();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
509 if (plugin.init)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
510 plugin.init(&ice_write_output);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
511
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
512 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
513 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
514
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
515 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
516 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
517 if (plugin.configure)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
518 plugin.configure();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
519 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
520
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
521 static void configure_destroy(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
522 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
523 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
524
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
525 static void ice_configure(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
526 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
527 if (!configure_win)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
528 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
529 GtkWidget * hbox;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
530 GtkWidget * label;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
531
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
532 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
533
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
534 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
535 GTK_SIGNAL_FUNC(configure_destroy), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
536 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
537 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
538 &configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
539
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
540 gtk_window_set_title(GTK_WINDOW(configure_win),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
541 _("Icecast Configuration"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
542 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
543
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
544 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
545
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
546 configure_vbox = gtk_vbox_new(FALSE, 10);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
547 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
548
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
549 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
550 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
551
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
552 label = gtk_label_new(_("Output stream format:"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
553 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
554
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
555 streamformat_combo = gtk_combo_box_new_text();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
556 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
557 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
558 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
559 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
560 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
561 #endif
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
562 gtk_box_pack_start(GTK_BOX(hbox), streamformat_combo, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
563 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
564 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
565
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
566 plugin_button = gtk_button_new_with_label(_("Configure"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
567 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
568 g_signal_connect(G_OBJECT(plugin_button), "clicked", G_CALLBACK(plugin_configure_cb), NULL);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
569 gtk_box_pack_end(GTK_BOX(hbox), plugin_button, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
570
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
571
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
572
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
573
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
574 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
575
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
576 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
577 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
578
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
579 label = gtk_label_new(_("Server address:"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
580 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
581
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
582 addr_entry = gtk_entry_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
583
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
584 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
585
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
586 gtk_box_pack_start(GTK_BOX(hbox), addr_entry, TRUE, TRUE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
587
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
588 port_spin = gtk_spin_button_new_with_range(0.0, 65535.0, 1.0);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
589
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
590 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(port_spin), 0);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
591
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
592 gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_spin), (gdouble)server_port);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
593
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
594 gtk_box_pack_start(GTK_BOX(hbox), port_spin, TRUE, TRUE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
595
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
596 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
597
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
598 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
599 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
600
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
601 label = gtk_label_new(_("Connection timeout (seconds):"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
602 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
603
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
604 timeout_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
605
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
606 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(timeout_spin), 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
607
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
608 gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spin), (gdouble)ice_close_timeout);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
609
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
610 gtk_box_pack_start(GTK_BOX(hbox), timeout_spin, TRUE, TRUE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
611
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
612 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
613
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
614 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
615 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
616
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
617 label = gtk_label_new(_("Buffer size (bytes):"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
618 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
619
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
620 buffersize_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
621
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
622 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(buffersize_spin), 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
623
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
624 gtk_spin_button_set_value(GTK_SPIN_BUTTON(buffersize_spin), (gdouble)buffersize);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
625
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
626 gtk_box_pack_start(GTK_BOX(hbox), buffersize_spin, TRUE, TRUE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
627
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
628 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
629 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
630
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
631 label = gtk_label_new(_("Flush buffer if "));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
632 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
633
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
634 bufferflush_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
635
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
636 gtk_spin_button_set_digits(GTK_SPIN_BUTTON(bufferflush_spin), 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
637
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
638 gtk_spin_button_set_value(GTK_SPIN_BUTTON(bufferflush_spin), bufferflushperc);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
639
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
640 gtk_box_pack_start(GTK_BOX(hbox), bufferflush_spin, TRUE, TRUE, 0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
641
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
642 label = gtk_label_new(_("percents are filled"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
643 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
644
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
645 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
646
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
647 configure_bbox = gtk_hbutton_box_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
648 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
649 GTK_BUTTONBOX_END);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
650 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
651 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
652 FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
653
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
654 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
655 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
656 GTK_SIGNAL_FUNC(gtk_widget_destroy),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
657 GTK_OBJECT(configure_win));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
658 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
659 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
660
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
661 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
662 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
663 GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
664 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
665 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
666
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
667 gtk_widget_show_all(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
668 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
669 }