annotate src/icecast/icecast.c @ 2899:130ab8a76ce6

fix compile again
author Andrew O. Shadoura <bugzilla@tut.by>
date Wed, 13 Aug 2008 12:41:36 +0300
parents 471b12137183
children 36b68e7ad725
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;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
37 static guint ice_tid = 0;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
38
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
39 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
40
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
41 static GtkWidget *streamformat_combo, *plugin_button;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
42
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
43 enum streamformat_t
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
44 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
45 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
46 MP3,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
47 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
48 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
49 VORBIS,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
50 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
51 streamformat_MAX
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
52 };
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 static gint streamformat = VORBIS;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
55
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
56 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
57 {
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 #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
59 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
60 #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
61 #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
62 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
63 #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
64 };
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
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
66 static FileWriter plugin;
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
67 static FileWriter plugin_new;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
68 static uint8_t *outputbuffer = NULL;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
69 static guint outputlength = 0;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
70 static gint buffersize;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
71 static gint bufferflush;
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
72 static gint buffersize_new;
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
73 static gint bufferflush_new;
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
74 static gdouble bufferflushperc;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
75 static gchar *server_address = NULL;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
76 static gint server_port = 8000;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
77
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
78 static gchar *server_user = NULL;
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
79 static gchar *server_password = NULL;
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
80 static gchar *mountpoint = NULL;
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
81
2899
130ab8a76ce6 fix compile again
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2898
diff changeset
82 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
83 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
84 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
85 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
86 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
87
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
88 VFSFile *output_file = NULL;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
89 guint64 written = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
90 guint64 offset = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
91 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
92 static shout_t *shout = NULL;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
93 static gboolean paused = FALSE;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
94
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
95 static void ice_init(void);
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
96 static void ice_cleanup(void);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
97 static void ice_about(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
98 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
99 static void ice_write(void *ptr, gint length);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
100 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
101 static void ice_close(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
102 static void ice_flush(gint time);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
103 static void ice_pause(short p);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
104 static gint ice_free(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
105 static gint ice_playing(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
106 static gint ice_get_written_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
107 static gint ice_get_output_time(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
108 static void ice_configure(void);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
109 /*static int ice_mod_samples(gpointer * d, gint length, AFormat afmt, gint srate, gint nch);*/
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
110
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
111 OutputPlugin ice_op =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
112 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
113 .description = "Icecast Plugin",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
114 .init = ice_init,
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
115 .cleanup = ice_cleanup,
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
116 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
117 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
118 .open_audio = ice_open,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
119 .write_audio = ice_write,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
120 .close_audio = ice_close,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
121 .flush = ice_flush,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
122 .pause = ice_pause,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
123 .buffer_free = ice_free,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
124 .buffer_playing = ice_playing,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
125 .output_time = ice_get_output_time,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
126 .written_time = ice_get_written_time
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
127 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
128 /*
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
129 EffectPlugin ice_ep =
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
130 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
131 .description = "Icecast Plugin",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
132 .init = ice_init,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
133 .cleanup = ice_cleanup,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
134 .about = ice_about,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
135 .configure = ice_configure,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
136 .mod_samples = ice_mod_samples,
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
137 };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
138 */
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
139 OutputPlugin *ice_oplist[] = { &ice_op, NULL };
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
140
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
141 SIMPLE_OUTPUT_PLUGIN(icecast, ice_oplist);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
142
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
143 static void set_plugin(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
144 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
145 if (streamformat < 0 || streamformat >= streamformat_MAX)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
146 streamformat = 0;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
147
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
148 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
149 if (streamformat == MP3)
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
150 plugin_new = mp3_plugin;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
151 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
152 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
153 if (streamformat == VORBIS)
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
154 plugin_new = vorbis_plugin;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
155 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
156 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
157
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
158 static void ice_init(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
159 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
160 ConfigDb *db;
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
161 /*g_debug("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
162 shout_init();
2805
2d3594eaa18a don't need newlines with g_debug etc.
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2804
diff changeset
163 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
164
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
165 db = aud_cfg_db_open();
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
166 aud_cfg_db_get_int(db, ICECAST_CFGID, "streamformat", &streamformat);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
167 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
168 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
169 if (!server_port)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
170 server_port = 8000;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
171 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
172 if (!ice_close_timeout)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
173 ice_close_timeout = 5;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
174 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
175 if (!buffersize)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
176 buffersize = 8192;
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
177 buffersize_new = buffersize;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
178 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
179 if (!bufferflushperc)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
180 bufferflushperc = 80.0;
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
181 bufferflush = (gint)(buffersize*bufferflushperc);
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
182 bufferflush_new = bufferflush;
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
183 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
184 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
185 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
186 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
187 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
188 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
189 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
190 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
191 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
192
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
193 outputbuffer = g_try_malloc(buffersize);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
194
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
195 set_plugin();
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
196 plugin = plugin_new;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
197 if (plugin.init)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
198 plugin.init(&ice_write_output);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
199 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
200
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
201 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
202 {
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
203 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
204 {
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
205 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
206 }
2834
b61d7e3837a5 don't need these
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2831
diff changeset
207 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
208 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
209 }
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
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
211 void ice_about(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
212 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
213 static GtkWidget *dialog;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
214
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
215 if (dialog != NULL)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
216 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
217
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
218 dialog = audacious_info_dialog(_("About Icecast-Plugin"),
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
219 _("Icecast-Plugin\n\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
220 "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
221 "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
222 "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
223 "(at your option) any later version.\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
224 "\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
225 "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
226 "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
227 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
228 "GNU General Public License for more details.\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
229 "\n"
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
230 "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
231 "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
232 "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
233 "USA."), _("Ok"), FALSE, NULL, NULL);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
234 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
235 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
236 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
237
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
238 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
239 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
240 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
241 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
242 Playlist *playlist;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
243
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
244 if (buffersize != buffersize_new)
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
245 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
246 buffersize = buffersize_new;
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
247 outputbuffer = g_try_realloc(outputbuffer, buffersize);
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
248 }
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
249
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
250 if (bufferflush != bufferflush_new)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
251 bufferflush = bufferflush_new;
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
252
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
253 if (!outputbuffer)
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
254 return 0;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
255
2773
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
256 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
257 {
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
258 g_source_remove(ice_tid);
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
259 ice_tid = 0;
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
260 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
261
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
262 input.format = fmt;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
263 input.frequency = rate;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
264 input.channels = nch;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
265
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
266 playlist = aud_playlist_get_active();
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
267 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
268 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
269
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
270 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
271 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
272
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
273 plugin = plugin_new;
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
274
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
275 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
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 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
278 return 0;
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
279
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
280 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
281 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
282 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
283 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
284 }
f1f7ee810de8 add metadata to stream + flush() should do a real flush at least with mp3
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2773
diff changeset
285
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_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
287 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
288 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
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
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
292 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
293 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
294 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
295 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
296 }
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
297
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
298 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
299 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
300 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
301 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
302 }
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
303
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
304 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
305 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
306 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
307 return 0;
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
308 }
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
309
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
310 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
311 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
312 g_warning(_("Error setting stream %s: %s\n"), stream_is_public?_("public"):_("private"), shout_get_error(shout));
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
313 return 0;
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
314 }
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
315
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
316 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
317 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
318 g_warning(_("Error setting stream name: %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
319 return 0;
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
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
322 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
323 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
324 g_warning(_("Error setting stream genre: %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
325 return 0;
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
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
328 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
329 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
330 g_warning(_("Error setting stream URL: %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
331 return 0;
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
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
334 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
335 {
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
336 g_warning(_("Error setting stream description: %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
337 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
338 }
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
339
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
340 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
341 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
342 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
343 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
344 }
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
345
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
346 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
347 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
348 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
349 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
350 }
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
351
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 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
353 {
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
354 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
355 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
356 }
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
357 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
358 {
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
359 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
360 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
361 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
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 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
364 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
365 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
366 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
367 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
368 }
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
369 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
370
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
371 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
372
2831
8f28fccf2bdd fixed Ogg Vorbis streams!
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2830
diff changeset
373 rv = (plugin.open)();
8f28fccf2bdd fixed Ogg Vorbis streams!
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2830
diff changeset
374
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
375 /*g_debug("ICE_OPEN");*/
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
376 return rv;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
377 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
378
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
379 static void ice_write(void *ptr, gint length)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
380 {
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
381 int len;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
382
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
383 len = convert_process(ptr, length);
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
384
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
385 plugin.write(convert_output, length);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
386 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
387
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
388 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
389 {
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
390 gint ret;
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
391 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
392 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
393 shout_sync(shout);
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
394 /*g_debug("ice_write[%d:%d]", ret, length);*/
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
395 return 0;
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
396 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
397
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
398 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
399 {
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
400 if ((!shout) || (!length)) return 0;
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
401 /*g_debug("outputlength=%d, length=%d...", outputlength, length);*/
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
402 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
403 {
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
404 /*g_debug("flushing");*/
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
405 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
406 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
407 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
408 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
409 {
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
410 /*g_debug("data too long, flushing");*/
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
411 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
412 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
413 else
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
414 {
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
415 /*g_debug("adding");*/
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
416 memcpy(&(outputbuffer[outputlength]), ptr, length);
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
417 outputlength += length;
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
418 }
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
419 }
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
420 return length;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
421 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
422
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
423 static gboolean ice_real_close(gpointer data)
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
424 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
425 plugin.close();
2875
9d06c6456f98 use libSAD-based converter in icecast plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
426 convert_free();
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
427
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
428 if (shout)
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
429 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
430 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
431 shout_close(shout);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
432 }
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
433 shout = NULL;
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
434 ice_tid = 0;
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
435 /*g_debug("ICE_REAL_CLOSE");*/
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
436 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
437 }
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
438
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
439
624e5ed793a5 added basic libshout functionality; fixed ice_close to close connection after timeout only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2768
diff changeset
440 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
441 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
442 if (ice_tid)
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
443 g_source_remove(ice_tid);
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
444 ice_tid = g_timeout_add_seconds(3, ice_real_close, NULL);
2892
aa6acdb93c1e don't need these debug messages
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2875
diff changeset
445 /*g_debug("ICE_CLOSE: starting timer");*/
2767
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
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
448 static void ice_flush(gint time)
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 if (time < 0)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
451 return;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
452
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
453 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
454 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
455
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
456 offset = time;
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
457 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
458
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
459 static void ice_pause(short p)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
460 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
461 paused = p;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
462 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
463
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
464 static gint ice_free(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
465 {
2829
ae797b0c21fa little code cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2828
diff changeset
466 return paused ? 0 : plugin.free();
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
467 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
468
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
469 static gint ice_playing(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
470 {
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
471 return 0 && !paused;
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
472 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
473
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
474 static gint ice_get_written_time(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
475 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
476 return plugin.get_written_time();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
477 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
478
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
479 static gint ice_get_output_time(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
480 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
481 return ice_get_written_time();
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
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
484 static void configure_ok_cb(gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
485 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
486 ConfigDb *db;
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 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
489
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
490 g_free(server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
491 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
492
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
493 g_free(server_user);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
494 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
495
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
496 g_free(server_password);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
497 server_password = g_strdup(gtk_entry_get_text(GTK_ENTRY(password_entry)));
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
498
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
499 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
500
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
501 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
502
2798
5a10f297b7d0 resize buffer on ice_open() only
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2780
diff changeset
503 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
504
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
505 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
506 bufferflush_new = (gint)(buffersize*bufferflushperc);
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
507
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
508 g_free(mountpoint);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
509 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
510
2897
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
511 g_free(stream_name);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
512 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
513
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
514 g_free(stream_url);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
515 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
516
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
517 g_free(stream_genre);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
518 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
519
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
520 g_free(stream_description);
8eaff6228606 added "directory parameters" for stream, made string constants localizable
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2892
diff changeset
521 stream_description = 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
522
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
523 db = aud_cfg_db_open();
2801
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
524 aud_cfg_db_set_int(db, ICECAST_CFGID, "streamformat", streamformat);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
525 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
526 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
527 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
528 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
529 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
530 aud_cfg_db_set_int(db, ICECAST_CFGID, "buffersize", buffersize_new);
d3c4dd274890 some cleanup
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2799
diff changeset
531 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
532 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
533 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
534 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
535 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
536 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
537 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
538
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
539 aud_cfg_db_close(db);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
540
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
541 gtk_widget_destroy(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
542 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
543
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
544 static void streamformat_cb(GtkWidget *combo, gpointer data)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
545 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
546 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
547 set_plugin();
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
548 if (plugin_new.init)
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
549 plugin_new.init(&ice_write_output);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
550
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
551 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
552 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
553
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
554 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
555 {
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
556 if (plugin_new.configure)
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
557 plugin_new.configure();
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
558 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
559
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
560 static void configure_destroy(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
561 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
562 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
563
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
564 static void ice_configure(void)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
565 {
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
566 if (!configure_win)
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
567 {
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
568 GtkWidget * hbox;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
569 GtkWidget * label;
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
570
2828
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
571 plugin_new = plugin;
f796297a014c prevent crash when user changes selects plugin
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2827
diff changeset
572
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
573 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
574
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
575 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
576 GTK_SIGNAL_FUNC(configure_destroy), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
577 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
578 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
579 &configure_win);
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 gtk_window_set_title(GTK_WINDOW(configure_win),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
582 _("Icecast Configuration"));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
583 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
584
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
585 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
586
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
587 configure_vbox = gtk_vbox_new(FALSE, 10);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
588 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
589
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
590 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
591 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
592
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
593 label = gtk_label_new(_("Output stream format:"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
594 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
595
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
596 streamformat_combo = gtk_combo_box_new_text();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
597 #ifdef FILEWRITER_MP3
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
598 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
599 #endif
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
600 #ifdef FILEWRITER_VORBIS
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
601 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
602 #endif
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
603 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
604 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
605 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
606
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
607 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
608 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
609 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
610 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
611
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
612 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
613
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
614 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
615 gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
616
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
617 label = gtk_label_new(_("Server address:"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
618 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
619
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
620 addr_entry = gtk_entry_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
621
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
622 gtk_entry_set_text(GTK_ENTRY(addr_entry), server_address);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
623
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
624 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
625
2779
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
626 port_spin = gtk_spin_button_new_with_range(0.0, 65535.0, 1.0);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
627
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
628 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
629
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
630 gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_spin), (gdouble)server_port);
ada024f94eb4 added very basic buffering implementation; added server port configuration control
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2774
diff changeset
631
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
632 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
633
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
634 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
635
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
636 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
637 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
638
2827
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
639 label = gtk_label_new(_("Mount point:"));
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
640 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
641
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
642 mount_entry = gtk_entry_new();
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
643
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
644 gtk_entry_set_text(GTK_ENTRY(mount_entry), mountpoint);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
645
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
646 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
647
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
648 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
649
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
650 hbox = gtk_hbox_new(FALSE, 5);
ab41a5a743a0 added mountpoint entrybox
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2805
diff changeset
651 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
652
2799
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
653 label = gtk_label_new(_("User name:"));
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
654 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
655
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
656 user_entry = gtk_entry_new();
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
657
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
658 gtk_entry_set_text(GTK_ENTRY(user_entry), server_user);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
659
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
660 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
661
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
662 label = gtk_label_new(_("Password:"));
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
663 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
664
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
665 password_entry = gtk_entry_new();
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
666
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
667 gtk_entry_set_text(GTK_ENTRY(password_entry), server_password);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
668
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
669 gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
670
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
671 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
672
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
673 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
674
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
675 hbox = gtk_hbox_new(FALSE, 5);
48550fe6723c added user/password entryboxes
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2798
diff changeset
676 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
677
2780
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
678 label = gtk_label_new(_("Connection timeout (seconds):"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
679 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
680
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
681 timeout_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
682
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
683 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
684
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
685 gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spin), (gdouble)ice_close_timeout);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
686
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
687 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
688
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
689 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
690
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
691 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
692 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
693
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
694 label = gtk_label_new(_("Buffer size (bytes):"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
695 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
696
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
697 buffersize_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
698
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
699 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
700
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
701 gtk_spin_button_set_value(GTK_SPIN_BUTTON(buffersize_spin), (gdouble)buffersize);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
702
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
703 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
704
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
705 hbox = gtk_hbox_new(FALSE, 5);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
706 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
707
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
708 label = gtk_label_new(_("Flush buffer if "));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
709 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
710
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
711 bufferflush_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
712
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
713 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
714
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
715 gtk_spin_button_set_value(GTK_SPIN_BUTTON(bufferflush_spin), bufferflushperc);
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
716
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
717 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
718
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
719 label = gtk_label_new(_("percents are filled"));
c40585c57877 added dynamic buffer allocation
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2779
diff changeset
720 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
721
2767
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
722 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
723
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
724 configure_bbox = gtk_hbutton_box_new();
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
725 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
726 GTK_BUTTONBOX_END);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
727 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
728 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
729 FALSE, FALSE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
730
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
731 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
732 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
733 GTK_SIGNAL_FUNC(gtk_widget_destroy),
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
734 GTK_OBJECT(configure_win));
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
735 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
736 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
737
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
738 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
739 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked",
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
740 GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
741 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
742 TRUE, TRUE, 0);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
743
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
744 gtk_widget_show_all(configure_win);
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
745 }
fa4b58a08f4c started icecast plugin (derived from filewriter)
Andrew O. Shadoura <bugzilla@tut.by>
parents:
diff changeset
746 }