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