--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: icecast-client: shout won't read from devices (e.g. stdin)
- From: James Ponder <james@stormy.squish.net>
- Date: Sun, 27 Jul 2003 18:36:45 +0100
- Message-id: <20030727173645.E55E4A83@stormy.squish.net>
Package: icecast-client
Version: 1.4.0-4.1
Severity: normal
Tags: patch
shout won't read from stdin, which is quite useful when streaming from
toolame or other encoder.
There is no direct option for reading from stdin, but you can pass in
/dev/stdin. However, because shout uses the file size to work out where
the id3 tag might be, this fails.
Enclosed is a patch to detect devices and enter a "stream" mode where
the file size is not checked.
It also fixes two other bugs:
* if a non-fatal error occurs in read (e.g. EAGAIN) then it is mistakenly
treated as an error.
* there is a double-close when the file is played too quickly (e.g.
no bytes) causing a segmentation fault. The fix is to add a return
after the closes.
--- shout.c.dist Sun Jul 27 17:55:11 2003
+++ shout.c Sun Jul 27 18:21:49 2003
@@ -1154,6 +1154,7 @@
my_long_t deltasleep = 0, start = 0, t = 0, mtv = 0;
char *buf;
struct stat st;
+ int stream = 0;
int tmp=0;
/* Clean the filename from \n */
@@ -1182,8 +1183,10 @@
return;
}
#ifndef _WIN32
- if (S_ISFIFO (st.st_mode)) {
+ if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) ||
+ S_ISFIFO(st.st_mode)) {
set.graphics = 0;
+ stream = 1;
}
#endif /* !win32 */
@@ -1316,7 +1319,7 @@
return;
}
/* The last 128 bytes _MIGHT_ be a id3 tag */
- if ((bytes + n) > (st.st_size - 128)) {
+ if (!stream && (bytes + n) > (st.st_size - 128)) {
char *id3start;
int newreads = 0;
@@ -1363,7 +1366,7 @@
mtv = my_get_time ();
}
}
- if (n <= 0) { /* End of file */
+ if (n == 0) { /* End of file */
my_long_t time_sent;
double avg;
@@ -1376,6 +1379,7 @@
if (!rate || !time_sent) {
nfree (buf);
close (fd);
+ return;
}
#ifdef HAVE_LONG_LONG
scream (NORMAL,
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux stormy 2.4.20-bf2.4 #1 Wed Dec 25 13:17:08 UTC 2002 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages icecast-client depends on:
ii libc6 2.2.5-11.5 GNU C Library: Shared libraries an
--- End Message ---