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