annotate src/icecast/icecast.c @ 3148:d443c917dab9

Remove stale library variable from Makefile, as pointed out by RafaŠČ MuŤ÷yŠČo on #audacious.
author Tony Vroon <chainsaw@gentoo.org>
date Mon, 11 May 2009 17:32:04 +0100
parents ca7d5de41217
children
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
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
2 * (C) copyright 2008 Andrew O. Shadoura
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
3 * Based on FileWriter-plugin
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
4 * (C) copyright 2007 merging of Disk Writer and Out-Lame by Michael Färber
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
5 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
6 * Original Out-Lame-Plugin:
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
7 * (C) copyright 2002 Lars Siebold <khandha5@gmx.net>
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
8 * (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
9 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
10 * 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
11 * 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
12 * 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
13 * (at your option) any later version.
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
14 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
15 * 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
16 * 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
17 * 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
18 * GNU General Public License for more details.
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
19 *
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
20 * 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
21 * 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
22 * 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
23 */
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
24
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
25 #include "../filewriter/filewriter.h"
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
26 #include "../filewriter/plugins.h"
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
27 #include "../filewriter/convert.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
28 #include <shout/shout.h>
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
29
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
30 struct format_info input;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
31
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
32 static GtkWidget *configure_win = NULL, *configure_vbox;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
33 static GtkWidget *addr_entry, *port_spin, *timeout_spin, *buffersize_spin, *bufferflush_spin;
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
34 static GtkWidget *user_entry, *password_entry, *mount_entry;
2898
471b12137183 fix compile
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2897
diff changeset
35 static GtkWidget *public_check, *name_entry, *url_entry, *genre_entry, *description_entry;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
36 static GtkWidget *configure_bbox, *configure_ok, *configure_cancel;
2945
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
37 static GdkColor disabled_color;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
38 static guint ice_tid = 0;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
39
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
40 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
41
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
42 static GtkWidget *streamformat_combo, *plugin_button;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
43
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
44 enum streamformat_t
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
45 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
46 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
47 MP3,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
48 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
49 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
50 VORBIS,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
51 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
52 streamformat_MAX
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
53 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
54
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
55 static gint streamformat = VORBIS;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
56
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
57 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
58 {
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 #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
60 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
61 #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
62 #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
63 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
64 #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
65 };
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
66
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
67 static FileWriter plugin;
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
68 static FileWriter plugin_new;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
69 static uint8_t *outputbuffer = NULL;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
70 static guint outputlength = 0;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
71 static gint buffersize;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
72 static gint bufferflush;
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
73 static gint buffersize_new;
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
74 static gint bufferflush_new;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
75 static gdouble bufferflushperc;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
76 static gchar *server_address = NULL;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
77 static gint server_port = 8000;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
78
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
79 static gchar *server_user = NULL;
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
80 static gchar *server_password = NULL;
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
81 static gchar *mountpoint = NULL;
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
82
2899
130ab8a76ce6 fix compile again
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2898
diff changeset
83 static gint stream_is_public = 0;
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
84 static gchar *stream_name = NULL;
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
85 static gchar *stream_url = NULL;
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
86 static gchar *stream_genre = NULL;
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
87 static gchar *stream_description = NULL;
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
88
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
89 static gboolean ep_playing = FALSE;
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
90
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
91 VFSFile *output_file = NULL;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
92 guint64 written = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
93 guint64 offset = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
94 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
95 static shout_t *shout = NULL;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
96 static gboolean paused = FALSE;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
97
3046
75cd491339c9 ported icecast plugin,
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2986
diff changeset
98 static OutputPluginInitStatus 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
99 static void ice_cleanup(void);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
100 static void ice_about(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
101 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
102 static void ice_write(void *ptr, gint length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
103 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
104 static void ice_close(void);
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
105 static gboolean ice_real_close(gpointer data);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
106 static void ice_flush(gint time);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
107 static void ice_pause(short p);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
108 static gint ice_free(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
109 static gint ice_playing(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
110 static gint ice_get_written_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
111 static gint ice_get_output_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
112 static void ice_configure(void);
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
113 static int ice_mod_samples(gpointer * d, gint length, AFormat afmt, gint srate, gint nch);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
114
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
115 OutputPlugin ice_op =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
116 {
2906
8220728cc77b Use full DECLARE_PLUGIN definition (no missing initializers); Use NULL
Matti Hamalainen <ccr@tnsp.org>
parents: 2905
diff changeset
117 .description = "Icecast Plugin (output)",
3046
75cd491339c9 ported icecast plugin,
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2986
diff changeset
118 .probe_priority = 0,
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
119 .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
120 .cleanup = ice_cleanup,
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
121 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
122 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
123 .open_audio = ice_open,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
124 .write_audio = ice_write,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
125 .close_audio = ice_close,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
126 .flush = ice_flush,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
127 .pause = ice_pause,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
128 .buffer_free = ice_free,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
129 .buffer_playing = ice_playing,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
130 .output_time = ice_get_output_time,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
131 .written_time = ice_get_written_time
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
132 };
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
133
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
134 EffectPlugin ice_ep =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
135 {
2906
8220728cc77b Use full DECLARE_PLUGIN definition (no missing initializers); Use NULL
Matti Hamalainen <ccr@tnsp.org>
parents: 2905
diff changeset
136 .description = "Icecast Plugin (effect)",
8220728cc77b Use full DECLARE_PLUGIN definition (no missing initializers); Use NULL
Matti Hamalainen <ccr@tnsp.org>
parents: 2905
diff changeset
137 .init = NULL,
8220728cc77b Use full DECLARE_PLUGIN definition (no missing initializers); Use NULL
Matti Hamalainen <ccr@tnsp.org>
parents: 2905
diff changeset
138 .cleanup = NULL,
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
139 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
140 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
141 .mod_samples = ice_mod_samples,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
142 };
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
143
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
144 OutputPlugin *ice_oplist[] = { &ice_op, NULL };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
145
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
146 EffectPlugin *ice_eplist[] = { &ice_ep, NULL };
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
147
2906
8220728cc77b Use full DECLARE_PLUGIN definition (no missing initializers); Use NULL
Matti Hamalainen <ccr@tnsp.org>
parents: 2905
diff changeset
148 DECLARE_PLUGIN(icecast, NULL, NULL, NULL, ice_oplist, ice_eplist, NULL, NULL, NULL, NULL)
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
149
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
150 static void set_plugin(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
151 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
152 if (streamformat < 0 || streamformat >= streamformat_MAX)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
153 streamformat = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
154
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
155 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
156 if (streamformat == MP3)
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
157 plugin_new = mp3_plugin;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
158 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
159 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
160 if (streamformat == VORBIS)
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
161 plugin_new = vorbis_plugin;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
162 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
163 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
164
3046
75cd491339c9 ported icecast plugin,
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2986
diff changeset
165 static OutputPluginInitStatus ice_init(void)
2767
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 ConfigDb *db;
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 shout_init();
2805
2d3594eaa18a don't need newlines with g_debug etc.
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2804
diff changeset
169 g_message("Using libshout %s", shout_version(NULL, NULL, NULL));
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
170
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
171 db = aud_cfg_db_open();
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
172 aud_cfg_db_get_int(db, ICECAST_CFGID, "streamformat", &streamformat);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
173 aud_cfg_db_get_string(db, ICECAST_CFGID, "server_address", &server_address);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
174 aud_cfg_db_get_int(db, ICECAST_CFGID, "server_port", &server_port);
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
175 if (!server_port)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
176 server_port = 8000;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
177 aud_cfg_db_get_int(db, ICECAST_CFGID, "timeout", &ice_close_timeout);
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
178 if (!ice_close_timeout)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
179 ice_close_timeout = 5;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
180 aud_cfg_db_get_int(db, ICECAST_CFGID, "buffersize", &buffersize);
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
181 if (!buffersize)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
182 buffersize = 8192;
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
183 buffersize_new = buffersize;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
184 aud_cfg_db_get_double(db, ICECAST_CFGID, "bufferflush", &bufferflushperc);
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
185 if (!bufferflushperc)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
186 bufferflushperc = 80.0;
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
187 bufferflush = (gint)(buffersize*bufferflushperc);
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
188 bufferflush_new = bufferflush;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
189 aud_cfg_db_get_string(db, ICECAST_CFGID, "server_user", &server_user);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
190 aud_cfg_db_get_string(db, ICECAST_CFGID, "server_password", &server_password);
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
191 aud_cfg_db_get_string(db, ICECAST_CFGID, "mountpoint", &mountpoint);
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
192 aud_cfg_db_get_int(db, ICECAST_CFGID, "stream_is_public", &stream_is_public);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
193 aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_name", &stream_name);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
194 aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_url", &stream_url);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
195 aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_genre", &stream_genre);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
196 aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_description", &stream_description);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
197 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
198
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
199 outputbuffer = g_try_malloc(buffersize);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
200
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
201 set_plugin();
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
202 plugin = plugin_new;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
203 if (plugin.init)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
204 plugin.init(&ice_write_output);
3046
75cd491339c9 ported icecast plugin,
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2986
diff changeset
205
75cd491339c9 ported icecast plugin,
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2986
diff changeset
206 return OUTPUT_PLUGIN_INIT_NO_DEVICES;
2767
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
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
209 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
210 {
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
211 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
212 {
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
213 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
214 }
2834
b61d7e3837a5 don't need these
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2831
diff changeset
215 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
216 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
217 }
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
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
219 void ice_about(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
220 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
221 static GtkWidget *dialog;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
222
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
223 if (dialog != NULL)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
224 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
225
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
226 dialog = audacious_info_dialog(_("About Icecast-Plugin"),
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
227 _("Icecast-Plugin\n\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
228 "This program is free software; you can redistribute it and/or modify\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
229 "it under the terms of the GNU General Public License as published by\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
230 "the Free Software Foundation; either version 2 of the License, or\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
231 "(at your option) any later version.\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
232 "\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
233 "This program is distributed in the hope that it will be useful,\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
234 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
235 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
236 "GNU General Public License for more details.\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
237 "\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
238 "You should have received a copy of the GNU General Public License\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
239 "along with this program; if not, write to the Free Software\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
240 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
241 "USA."), _("Ok"), FALSE, NULL, NULL);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
242 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
243 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
244 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
245
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
246 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
247 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
248 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
249 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
250 Playlist *playlist;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
251
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
252 if (ep_playing == TRUE)
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
253 return 0;
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
254
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
255 if (buffersize != buffersize_new)
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
256 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
257 buffersize = buffersize_new;
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
258 outputbuffer = g_try_realloc(outputbuffer, buffersize);
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
259 }
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
260
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
261 if (bufferflush != bufferflush_new)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
262 bufferflush = bufferflush_new;
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
263
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
264 if (!outputbuffer)
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
265 return 0;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
266
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
267 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
268 {
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
269 g_source_remove(ice_tid);
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
270 ice_tid = 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
271 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
272
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
273 input.format = fmt;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
274 input.frequency = rate;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
275 input.channels = nch;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
276
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
277 playlist = aud_playlist_get_active();
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
278 if (!playlist)
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
279 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
280
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
281 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
282 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
283
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
284 plugin = plugin_new;
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
285
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
286 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
287 {
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
288 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
289 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
290
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 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
292 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
293 g_warning(_("Error setting hostname: %s\n"), shout_get_error(shout));
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
294 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
295 }
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
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 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
298 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
299 g_warning(_("Error setting protocol: %s\n"), shout_get_error(shout));
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
300 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
301 }
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
302
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
303 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
304 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
305 g_warning(_("Error setting port: %s\n"), shout_get_error(shout));
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
306 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
307 }
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
308
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
309 if (shout_set_password(shout, server_password) != 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
310 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
311 g_warning(_("Error setting password: %s\n"), shout_get_error(shout));
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
312 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
313 }
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
314
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
315 if (shout_set_mount(shout, mountpoint) != 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
316 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
317 g_warning(_("Error setting mount: %s\n"), shout_get_error(shout));
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
318 return 0;
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
319 }
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
320
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
321 if (shout_set_public(shout, stream_is_public) != SHOUTERR_SUCCESS)
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
322 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
323 g_warning(_("Error setting stream %s: %s\n"), stream_is_public?_("public"):_("private"), shout_get_error(shout));
2986
947ac5c18ad3 don't fail if non-important settings are not set
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2945
diff changeset
324 /* return 0; */
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
325 }
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
326
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
327 if (shout_set_name(shout, stream_name) != SHOUTERR_SUCCESS)
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
328 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
329 g_warning(_("Error setting stream name: %s\n"), shout_get_error(shout));
2986
947ac5c18ad3 don't fail if non-important settings are not set
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2945
diff changeset
330 /* return 0; */
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
331 }
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
332
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
333 if (shout_set_genre(shout, stream_genre) != SHOUTERR_SUCCESS)
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
334 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
335 g_warning(_("Error setting stream genre: %s\n"), shout_get_error(shout));
2986
947ac5c18ad3 don't fail if non-important settings are not set
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2945
diff changeset
336 /* return 0; */
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
337 }
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
338
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
339 if (shout_set_url(shout, stream_url) != SHOUTERR_SUCCESS)
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
340 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
341 g_warning(_("Error setting stream URL: %s\n"), shout_get_error(shout));
2986
947ac5c18ad3 don't fail if non-important settings are not set
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2945
diff changeset
342 /* return 0; */
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
343 }
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
344
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
345 if (shout_set_description(shout, stream_description) != SHOUTERR_SUCCESS)
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
346 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
347 g_warning(_("Error setting stream description: %s\n"), shout_get_error(shout));
2986
947ac5c18ad3 don't fail if non-important settings are not set
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2945
diff changeset
348 /* return 0; */
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
349 }
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
350
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
351 if (shout_set_user(shout, server_user) != 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
352 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
353 g_warning(_("Error setting user: %s\n"), shout_get_error(shout));
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
354 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
355 }
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
356
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
357 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
358 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
359 g_warning(_("Error setting user: %s\n"), shout_get_error(shout));
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
360 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
361 }
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
362
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
363 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
364 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
365 g_warning(_("Error connecting to server: %s\n"), shout_get_error(shout));
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
366 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
367 }
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
368 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
369 {
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
370 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
371 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
372 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
373 {
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
374 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
375 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
376 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
377 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
378 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
379 }
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
380 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
381
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
382 convert_init(fmt, plugin.format_required, nch);
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
383
2831
8f28fccf2bdd fixed Ogg Vorbis streams!
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2830
diff changeset
384 rv = (plugin.open)();
8f28fccf2bdd fixed Ogg Vorbis streams!
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2830
diff changeset
385
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
386 return rv;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
387 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
388
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
389 static void ice_write(void *ptr, gint length)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
390 {
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
391 int len;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
392
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
393 len = convert_process(ptr, length);
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
394
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
395 plugin.write(convert_output, length);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
396 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
397
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
398 static int ice_mod_samples(gpointer * d, gint length, AFormat afmt, gint srate, gint nch)
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
399 {
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
400 if (ice_tid)
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
401 g_source_remove(ice_tid);
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
402
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
403 if (!shout)
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
404 {
2909
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
405 ice_open(afmt, srate, nch);
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
406 }
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
407 if (shout)
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
408 {
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
409 int len;
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
410 ep_playing = TRUE;
2911
23c437ada180 dereference pointer correctly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2910
diff changeset
411 len = convert_process(*d, length);
2909
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
412 plugin.write(convert_output, length);
639241e725e2 fixed mod_samples when shout==NULL
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2906
diff changeset
413 ice_tid = g_timeout_add_seconds(ice_close_timeout, ice_real_close, NULL);
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
414 }
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
415 return length;
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
416 }
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
417
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
418 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
419 {
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
420 gint ret;
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
421 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
422 ret = shout_send(shout, ptr, length);
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
423 shout_sync(shout);
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
424 return 0;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
425 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
426
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
427 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
428 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
429 if ((!shout) || (!length)) return 0;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
430 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
431 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
432 outputlength = ice_real_write(outputbuffer, outputlength);
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
433 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
434 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
435 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
436 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
437 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
438 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
439 else
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
440 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
441 memcpy(&(outputbuffer[outputlength]), ptr, length);
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
442 outputlength += length;
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
443 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
444 }
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
445 return length;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
446 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
447
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
448 static gboolean ice_real_close(gpointer data)
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
449 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
450 plugin.close();
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
451 convert_free();
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
452
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
453 if (shout)
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
454 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
455 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
456 shout_close(shout);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
457 }
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
458 shout = NULL;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
459 ice_tid = 0;
2910
6c40707ce9d5 remove e.p. lock after timeout
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2909
diff changeset
460 ep_playing = FALSE;
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
461 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
462 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
463
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
464
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
465 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
466 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
467 if (ice_tid)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
468 g_source_remove(ice_tid);
2905
19c696215a73 trying to convert to mixed output-effect plugin (warning: WiP!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2902
diff changeset
469 ice_tid = g_timeout_add_seconds(ice_close_timeout, ice_real_close, NULL);
2767
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
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
472 static void ice_flush(gint time)
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 if (time < 0)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
475 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
476
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
477 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
478 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
479
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
480 offset = time;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
481 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
482
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
483 static void ice_pause(short p)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
484 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
485 paused = p;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
486 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
487
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
488 static gint ice_free(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
489 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
490 return paused ? 0 : plugin.free();
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
491 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
492
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
493 static gint ice_playing(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
494 {
2830
b17cffd47053 fix time display and playback; don't know why, but playing=0 makes it happy
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2829
diff changeset
495 return 0 && !paused;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
496 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
497
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
498 static gint ice_get_written_time(void)
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 return plugin.get_written_time();
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
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
503 static gint ice_get_output_time(void)
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 return ice_get_written_time();
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
2945
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
508 void entry_focus_in(GtkWidget *widget, gpointer data)
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
509 {
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
510 gtk_entry_set_text(GTK_ENTRY(password_entry), "");
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
511 gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
512 gtk_widget_modify_text(password_entry, GTK_STATE_NORMAL, NULL);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
513 }
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
514
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
515 void entry_focus_out(GtkWidget *widget, gpointer data)
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
516 {
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
517 g_free(server_password);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
518 server_password = g_strdup(gtk_entry_get_text(GTK_ENTRY(password_entry)));
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
519 gtk_entry_set_text(GTK_ENTRY(password_entry), _("Change password"));
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
520 gtk_widget_modify_text(password_entry, GTK_STATE_NORMAL, &disabled_color);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
521 gtk_entry_set_visibility(GTK_ENTRY(password_entry), TRUE);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
522 }
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
523
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
524 static void configure_ok_cb(gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
525 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
526 ConfigDb *db;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
527
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
528 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
529
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
530 g_free(server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
531 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
532
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
533 g_free(server_user);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
534 server_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_entry)));
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
535
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
536 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
537
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
538 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
539
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
540 buffersize_new = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffersize_spin));
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
541
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
542 bufferflushperc = gtk_spin_button_get_value(GTK_SPIN_BUTTON(bufferflush_spin));
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
543 bufferflush_new = (gint)(buffersize*bufferflushperc);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
544
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
545 g_free(mountpoint);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
546 mountpoint = g_strdup(gtk_entry_get_text(GTK_ENTRY(mount_entry)));
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
547
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
548 g_free(stream_name);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
549 stream_name = g_strdup(gtk_entry_get_text(GTK_ENTRY(name_entry)));
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
550
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
551 g_free(stream_url);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
552 stream_url = g_strdup(gtk_entry_get_text(GTK_ENTRY(url_entry)));
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
553
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
554 g_free(stream_genre);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
555 stream_genre = g_strdup(gtk_entry_get_text(GTK_ENTRY(genre_entry)));
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
556
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
557 g_free(stream_description);
2900
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
558 stream_description = g_strdup(gtk_entry_get_text(GTK_ENTRY(description_entry)));
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
559
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
560 db = aud_cfg_db_open();
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
561 aud_cfg_db_set_int(db, ICECAST_CFGID, "streamformat", streamformat);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
562 aud_cfg_db_set_string(db, ICECAST_CFGID, "server_address", server_address);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
563 aud_cfg_db_set_string(db, ICECAST_CFGID, "server_user", server_user);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
564 aud_cfg_db_set_string(db, ICECAST_CFGID, "server_password", server_password);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
565 aud_cfg_db_set_int(db, ICECAST_CFGID, "server_port", server_port);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
566 aud_cfg_db_set_int(db, ICECAST_CFGID, "timeout", ice_close_timeout);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
567 aud_cfg_db_set_int(db, ICECAST_CFGID, "buffersize", buffersize_new);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
568 aud_cfg_db_set_double(db, ICECAST_CFGID, "bufferflush", bufferflushperc);
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
569 aud_cfg_db_set_string(db, ICECAST_CFGID, "mountpoint", mountpoint);
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
570 aud_cfg_db_get_int(db, ICECAST_CFGID, "stream_is_public", &stream_is_public);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
571 aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_name", stream_name);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
572 aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_url", stream_url);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
573 aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_genre", stream_genre);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
574 aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_description", stream_description);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
575
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
576 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
577
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
578 gtk_widget_destroy(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
579 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
580
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
581 static void streamformat_cb(GtkWidget *combo, gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
582 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
583 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
584 set_plugin();
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
585 if (plugin_new.init)
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
586 plugin_new.init(&ice_write_output);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
587
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
588 gtk_widget_set_sensitive(plugin_button, plugin_new.configure != NULL);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
589 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
590
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
591 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
592 {
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
593 if (plugin_new.configure)
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
594 plugin_new.configure();
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
595 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
596
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
597 static void configure_destroy(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
598 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
599 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
600
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
601 static void ice_configure(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
602 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
603 if (!configure_win)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
604 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
605 GtkWidget * hbox;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
606 GtkWidget * label;
2945
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
607 GtkStyle * style;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
608
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
609 plugin_new = plugin;
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
610
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
611 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
612
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
613 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
614 GTK_SIGNAL_FUNC(configure_destroy), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
615 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
616 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
617 &configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
618
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
619 gtk_window_set_title(GTK_WINDOW(configure_win),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
620 _("Icecast Configuration"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
621 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
622
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
623 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
624
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
625 configure_vbox = gtk_vbox_new(FALSE, 10);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
626 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
627
2780
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);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
630
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
631 label = gtk_label_new(_("Output stream format:"));
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);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
633
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
634 streamformat_combo = gtk_combo_box_new_text();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
635 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
636 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
637 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
638 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
639 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
640 #endif
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
641 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
642 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
643 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
644
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
645 plugin_button = gtk_button_new_with_label(_("Configure"));
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
646 gtk_widget_set_sensitive(plugin_button, plugin_new.configure != NULL);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
647 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
648 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
649
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
650 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
651
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
652 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
653 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
654
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
655 label = gtk_label_new(_("Server address:"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
656 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
657
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
658 addr_entry = gtk_entry_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
659
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
660 gtk_entry_set_text(GTK_ENTRY(addr_entry), server_address);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
661 gtk_widget_set_tooltip_text(addr_entry, _("Server hostname or IP address"));
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
662
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
663 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
664
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
665 port_spin = gtk_spin_button_new_with_range(0.0, 65535.0, 1.0);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
666 gtk_widget_set_tooltip_text(port_spin, _("Server port number"));
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
667
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
668 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
669
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
670 gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_spin), (gdouble)server_port);
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
671
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
672 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
673
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
674 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
675
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
676 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
677 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
678
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
679 label = gtk_label_new(_("Mount point:"));
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
680 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
681
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
682 mount_entry = gtk_entry_new();
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
683
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
684 gtk_entry_set_text(GTK_ENTRY(mount_entry), mountpoint);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
685 gtk_widget_set_tooltip_text(mount_entry, _("Mount point for the stream"));
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
686
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
687 gtk_box_pack_start(GTK_BOX(hbox), mount_entry, TRUE, TRUE, 0);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
688
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
689 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
690
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
691 hbox = gtk_hbox_new(FALSE, 5);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
692 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
693
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
694 label = gtk_label_new(_("User name:"));
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
695 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
696
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
697 user_entry = gtk_entry_new();
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
698
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
699 gtk_entry_set_text(GTK_ENTRY(user_entry), server_user);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
700 gtk_widget_set_tooltip_text(user_entry, _("Icecast source user name for the stream; depends on your server settings.\nThe default value is \"source\""));
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
701
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
702 gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 0);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
703
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
704 label = gtk_label_new(_("Password:"));
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
705 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
706
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
707 password_entry = gtk_entry_new();
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
708
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
709 gtk_widget_set_tooltip_text(password_entry, _("Icecast source user password"));
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
710
2945
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
711 style = gtk_widget_get_style(password_entry);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
712 memcpy(&disabled_color, &(style->text[GTK_STATE_INSENSITIVE]), sizeof(GdkColor));
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
713 gtk_widget_modify_text(password_entry, GTK_STATE_NORMAL, &disabled_color);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
714
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
715 gtk_entry_set_text(GTK_ENTRY(password_entry), _("Change password"));
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
716 g_signal_connect(G_OBJECT(password_entry), "focus-in-event",
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
717 G_CALLBACK(entry_focus_in),
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
718 NULL);
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
719 g_signal_connect(G_OBJECT(password_entry), "focus-out-event",
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
720 G_CALLBACK(entry_focus_out),
f390f4a68a2d add password prompt to icecast too
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2920
diff changeset
721 NULL);
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
722
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
723 gtk_box_pack_start(GTK_BOX(hbox), password_entry, TRUE, TRUE, 0);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
724
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
725 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
726
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
727 hbox = gtk_hbox_new(FALSE, 5);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
728 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
729
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
730 label = gtk_label_new(_("Connection timeout (seconds):"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
731 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
732
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
733 timeout_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
734 gtk_widget_set_tooltip_text(timeout_spin, _("Amount of time before plugin closes connection to server when no audio data available"));
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
735
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
736 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
737
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
738 gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spin), (gdouble)ice_close_timeout);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
739
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
740 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
741
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
742 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
743
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
744 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
745 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
746
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
747 label = gtk_label_new(_("Buffer size (bytes):"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
748 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
749
3071
ca7d5de41217 Allow much larger buffer in the config GUI.
William Pitcock <nenolod@atheme.org>
parents: 3046
diff changeset
750 buffersize_spin = gtk_spin_button_new_with_range(1.0, 256000.0, 1.0);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
751 gtk_widget_set_tooltip_text(buffersize_spin, _("Internal buffer size\nTry to increase this if you are experiencing audio skipping on client side"));
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
752
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
753 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
754
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
755 gtk_spin_button_set_value(GTK_SPIN_BUTTON(buffersize_spin), (gdouble)buffersize);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
756
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
757 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
758
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
759 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
760 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
761
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
762 label = gtk_label_new(_("Flush buffer if "));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
763 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
764
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
765 bufferflush_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
766 gtk_widget_set_tooltip_text(bufferflush_spin, _("Determines when to flush internal buffer to prevent its overflow"));
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
767
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
768 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
769
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
770 gtk_spin_button_set_value(GTK_SPIN_BUTTON(bufferflush_spin), bufferflushperc);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
771
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
772 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
773
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
774 label = gtk_label_new(_("percents are filled"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
775 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
776
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
777 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
778
2900
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
779 hbox = gtk_hbox_new(FALSE, 5);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
780 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
781
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
782 public_check = gtk_check_button_new_with_label(_("Stream is public"));
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
783 gtk_widget_set_tooltip_text(public_check, _("Setting this asks the server to list the stream in any directories it knows about"));
2900
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
784
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
785 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(public_check), stream_is_public?TRUE:FALSE);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
786
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
787 gtk_box_pack_start(GTK_BOX(hbox), public_check, TRUE, TRUE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
788
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
789 hbox = gtk_hbox_new(FALSE, 5);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
790 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
791
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
792 label = gtk_label_new(_("Stream name:"));
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
793 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
794
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
795 name_entry = gtk_entry_new();
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
796
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
797 gtk_entry_set_text(GTK_ENTRY(name_entry), stream_name);
2900
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
798
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
799 gtk_box_pack_start(GTK_BOX(hbox), name_entry, TRUE, TRUE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
800
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
801 hbox = gtk_hbox_new(FALSE, 5);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
802 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
803
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
804 label = gtk_label_new(_("Stream URL:"));
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
805 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
806
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
807 url_entry = gtk_entry_new();
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
808
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
809 gtk_entry_set_text(GTK_ENTRY(url_entry), stream_url);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
810 gtk_widget_set_tooltip_text(url_entry, _("The URL of a site about this stream"));
2900
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
811
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
812 gtk_box_pack_start(GTK_BOX(hbox), url_entry, TRUE, TRUE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
813
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
814 hbox = gtk_hbox_new(FALSE, 5);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
815 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
816
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
817 label = gtk_label_new(_("Stream genre:"));
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
818 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
819
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
820 genre_entry = gtk_entry_new();
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
821
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
822 gtk_entry_set_text(GTK_ENTRY(genre_entry), stream_genre);
2901
167606c02d76 added tooltips to configuration widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2900
diff changeset
823 gtk_widget_set_tooltip_text(genre_entry, _("The genre (or genres) of the stream. This is usually a keyword list, eg \"pop rock rap\""));
2900
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
824
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
825 gtk_box_pack_start(GTK_BOX(hbox), genre_entry, TRUE, TRUE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
826
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
827 hbox = gtk_hbox_new(FALSE, 5);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
828 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
829
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
830 label = gtk_label_new(_("Stream description:"));
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
831 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
832
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
833 description_entry = gtk_entry_new();
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
834
2902
5e0d42b0f690 fix indentation (say NO to tabs!)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2901
diff changeset
835 gtk_entry_set_text(GTK_ENTRY(description_entry), stream_description);
2900
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
836
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
837 gtk_box_pack_start(GTK_BOX(hbox), description_entry, TRUE, TRUE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
838
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
839 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
36b68e7ad725 added stream parameters widgets
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2899
diff changeset
840
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
841 configure_bbox = gtk_hbutton_box_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
842 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
843 GTK_BUTTONBOX_END);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
844 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
845 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
846 FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
847
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
848 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
849 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
850 GTK_SIGNAL_FUNC(gtk_widget_destroy),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
851 GTK_OBJECT(configure_win));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
852 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
853 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
854
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
855 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
856 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
857 GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
858 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
859 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
860
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
861 gtk_widget_show_all(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
862 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
863 }