I am uploading a NMU to DELAYED/10 to fix this. The debdiff is attached.
diff -Nru bplay-0.991/bplay.1 bplay-0.991/bplay.1
--- bplay-0.991/bplay.1 2023-08-17 02:11:04.000000000 +0200
+++ bplay-0.991/bplay.1 2000-02-05 12:26:14.000000000 +0100
@@ -61,10 +61,7 @@
When recording, write Creative Labs VOC sound file.
.TP
.I "\-w"
-When recording write Microsoft Wave sound file. Note that the WAVE file format
is limited to 4GiB filesize. Recording more data is possible, but the length
info won't be consistent.
-.TP
-.I "\-q"
-Quiet mode. No messages are displayed.
+When recording write Microsoft Wave sound file.
.TP
.I "\-D level"
Print debug information to stderr. Debug level ranges from 0 to 2,
@@ -92,4 +89,4 @@
The option parsing code was originally taken from
.B vplay
to maintain
-compatibility.
+compatability.
diff -Nru bplay-0.991/bplay.c bplay-0.991/bplay.c
--- bplay-0.991/bplay.c 2023-08-17 02:11:04.000000000 +0200
+++ bplay-0.991/bplay.c 2000-09-18 23:57:05.000000000 +0200
@@ -5,16 +5,13 @@
**
**
*/
-#define _FILE_OFFSET_BITS 64
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <stdint.h>
+#include <limits.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
@@ -27,30 +24,6 @@
#include <sys/soundcard.h>
-/* Needed for BYTE_ORDER and BIG/LITTLE_ENDIAN macros. */
-#ifndef _BSD_SOURCE
-# define _BSD_SOURCE
-# include <endian.h>
-# undef _BSD_SOURCE
-#else
-# include <endian.h>
-#endif
-
-#include <sys/types.h>
-#include <byteswap.h>
-
-/* Adapted from the byteorder macros in the Linux kernel. */
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define cpu_to_le32(x) (x)
-#define cpu_to_le16(x) (x)
-#else
-#define cpu_to_le32(x) bswap_32((x))
-#define cpu_to_le16(x) bswap_16((x))
-#endif
-
-#define le32_to_cpu(x) cpu_to_le32((x))
-#define le16_to_cpu(x) cpu_to_le16((x))
-
#include "fmtheaders.h"
/* Types and constants */
@@ -66,7 +39,6 @@
pid_t pid;
int recorder = 0;
int debug = 0;
-int verbose = 1;
/* Prototypes */
@@ -80,14 +52,10 @@
void ErrDie(char *err);
void Die(char *err);
-void cleanup(int val, void *arg);
-
-void getbcount(int speed, int bits, int stereo, long long int *bcount,
+void getbcount(int speed, int bits, int stereo, int *bcount,
int timelim, int samplim, int timejmp, int sampjmp, int *bjump);
-void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo,
- int jump, int secs);
-void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits,
- int stereo, int jump, int secs);
+void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo);
+void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits, int
stereo);
void playvoc(int thefd, char hd_buf[20]);
/* extern globals */
@@ -99,9 +67,9 @@
extern void init_sound(int recorder);
extern void snd_parm(int speed, int bits, int stereo);
extern void init_shm(void);
-extern void shmrec(int outfd, long long int bcount, int terminate);
-extern void diskread(int outfd, long long int bcount, char hd_buf[20], int
terminate,
- int speed, int bits, int stereo, int jump);
+extern void shmrec(int outfd, int bcount, int terminate);
+extern void diskread(int outfd, int bcount, char hd_buf[20], int terminate,
+ int speed, int bits, int stereo);
extern volatile void audiowrite(void);
extern void initsems(int disks, int snds);
extern void cleanupsems(void);
@@ -109,14 +77,14 @@
int main(int argc, char *argv[])
{
-
+
int thefd; /* The file descriptor */
int speed, bits, stereo; /* Audio parameters */
int timelim; /* Recording time in secs */
int samplim; /* Recording time in samples */
int timejmp; /* Skip time in secs */
int sampjmp; /* Skip time in samples */
- long long int bcount; /* Number of bytes to record */
+ int bcount; /* Number of bytes to record */
int bjump; /* Number of bytes to skip */
int themask; /* Permission mask for file */
sndf_t filetype; /* The file type */
@@ -142,7 +110,7 @@
filetype = F_UNKNOWN;
mods = 0;
/* Parse the options */
- while ((optc = getopt(argc, argv, "Ss:b:t:T:j:J:rvwd:B:D:q")) != -1)
+ while ((optc = getopt(argc, argv, "Ss:b:t:T:j:J:rvwd:B:D:")) != -1)
{
switch(optc)
{
@@ -174,9 +142,6 @@
case 'J':
sampjmp = atoi(optarg);
break;
- case 'q':
- verbose = 0;
- break;
case 'r':
filetype = F_RAW;
break;
@@ -207,7 +172,7 @@
"%s: setpriority: %s: continuing anyway\n",
progname, strerror(errno));
}
-
+
#endif
/* Drop out of suid mode before we open any files */
if(setreuid(geteuid(), getuid()) == -1)
@@ -234,12 +199,12 @@
/* Ok, get the mask for the opening the file */
themask = umask(0);
umask(themask);
- if ((thefd = open(argv[optind], O_CREAT | O_TRUNC | O_WRONLY |
O_LARGEFILE,
+ if ((thefd = open(argv[optind], O_CREAT | O_TRUNC | O_WRONLY,
(~themask) & 0666)) == -1)
ErrDie(argv[optind]);
}
else
- if ((thefd = open(argv[optind], O_RDONLY | O_LARGEFILE)) == -1)
+ if ((thefd = open(argv[optind], O_RDONLY)) == -1)
ErrDie(argv[optind]);
}
@@ -258,21 +223,20 @@
#endif
/* Set up the shared buffers and semaphore blocks */
- on_exit(cleanup, 0);
init_shm(); /* MUST be called after init_sound() */
/* Call the appropriate routine */
if (recorder)
{
if ((timelim == 0) && (samplim == 0)) {
- bcount = INT64_MAX - 1;
+ bcount = INT_MAX;
} else {
getbcount(speed, bits, stereo, &bcount, timelim,
samplim, timejmp, sampjmp,
&bjump);
}
if (debug)
- fprintf(stderr, "bcount: %lld\n", bcount);
+ fprintf(stderr, "bcount: %d\n", bcount);
if (filetype == F_UNKNOWN)
filetype = F_RAW; /* Change to change default */
@@ -280,11 +244,9 @@
{
case F_WAV:
/* Spit out header here... */
- if (verbose)
- fprintf(stdout, "Writing MS WAV sound file");
+ fprintf(stderr, "Writing MS WAV sound file");
{
wavhead header;
- unsigned long long int tmp;
char *riff = "RIFF";
char *wave = "WAVE";
@@ -292,45 +254,34 @@
char *data = "data";
memcpy(&(header.main_chunk), riff, 4);
- if ( (tmp = sizeof(wavhead) - 8 + bcount) >> 32
) {
- header.length = 0xFFFFFFFF; // do not
overload the header
- fprintf(stderr, " (WARNING: Resulting file
size is larger than 4GiB, violating the WAVE format specification!)");
- }
- else
- header.length = cpu_to_le32(tmp);
-
+ header.length = sizeof(wavhead) - 8 + bcount;
memcpy(&(header.chunk_type), wave, 4);
memcpy(&(header.sub_chunk), fmt, 4);
- header.sc_len = cpu_to_le32(16);
- header.format = cpu_to_le16(1);
- header.modus = cpu_to_le16(stereo + 1);
- header.sample_fq = cpu_to_le32(speed);
- header.byte_p_sec = cpu_to_le32(((bits > 8)?
- 2:1)*(stereo+1)*speed);
- header.byte_p_spl = cpu_to_le16(((bits > 8)?
- 2:1)*(stereo+1));
- header.bit_p_spl = cpu_to_le16(bits);
+ header.sc_len = 16;
+ header.format = 1;
+ header.modus = stereo + 1;
+ header.sample_fq = speed;
+ header.byte_p_sec = ((bits > 8)?
2:1)*(stereo+1)*speed;
+ header.byte_p_spl = ((bits > 8)?
2:1)*(stereo+1);
+ header.bit_p_spl = bits;
memcpy(&(header.data_chunk), data, 4);
- header.data_length = ( bcount >> 32 ) ?
0xFFFFFFFF : cpu_to_le32(bcount) ; //FIXME see above, make sure that it works
cleanly
+ header.data_length = bcount;
write(thefd, &header, sizeof(header));
}
case F_RAW:
if (filetype == F_RAW)
- if (verbose) {
- fprintf(stdout, "Writing raw sound file");
- fprintf(stdout, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");
- }
+ fprintf(stderr, "Writing raw sound file");
+ fprintf(stderr, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");
snd_parm(speed, bits, stereo);
initsems(0, 1);
shmrec(thefd, bcount, 1);
break;
case F_VOC:
/* Spit out header here... */
- if (verbose) {
- fprintf(stdout, "Writing CL VOC sound file");
- fprintf(stdout, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");}
+ fprintf(stderr, "Writing CL VOC sound file");
+ fprintf(stderr, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");
{
vochead header;
blockTC ablk;
@@ -340,29 +291,23 @@
for (i=0;i<20;i++)
header.Magic[i] = VOC_MAGIC[i];
- header.BlockOffset = cpu_to_le16(0x1a);
- header.Version = cpu_to_le16(0x0114);
- header.IDCode = cpu_to_le16(0x111F);
+ header.BlockOffset = 0x1a;
+ header.Version = 0x0114;
+ header.IDCode = 0x111F;
write(thefd, &header, sizeof(vochead));
snd_parm(speed, bits, stereo);
initsems(0, 1);
- i = bcount;
- if (bcount >= 0xFFFFF2)
- {
- i = 0xFFFFF2 + 12;
- fprintf(stderr, "Warning: length is out of
allowed range, consider using another sound format!\n");
- }
-
+ i = (bcount >= 0xFFFFF2)? 0xFFFFF2 + 12 :
bcount;
ablk.BlockID = 9;
ablk.BlockLen[0] = (i + 12) & 0xFF;
ablk.BlockLen[1] = ((i + 12) >> 8) & 0xFF;
ablk.BlockLen[2] = ((i + 12) >> 16) & 0xFF;
- bblk.SamplesPerSec = cpu_to_le32(speed);
+ bblk.SamplesPerSec = speed;
bblk.BitsPerSample = bits;
bblk.Channels = stereo + 1;
- bblk.Format = cpu_to_le16((bits == 8)? 0 : 4);
+ bblk.Format = (bits == 8)? 0 : 4;
write(thefd, &ablk, sizeof(ablk));
write(thefd, &bblk, sizeof(bblk));
shmrec(thefd, i, 1);
@@ -393,18 +338,9 @@
if(strstr(hd_buf, VOC_MAGIC) != NULL)
playvoc(thefd, hd_buf);
else if(strstr(hd_buf, "RIFF") != NULL)
- {
- if (sampjmp)
- playwav(thefd, hd_buf, mods, speed, bits, stereo, sampjmp, 0);
- else
- playwav(thefd, hd_buf, mods, speed, bits, stereo, timejmp, 1);
- }
+ playwav(thefd, hd_buf, mods, speed, bits, stereo);
else /* Assume raw data */
- if (sampjmp)
- playraw(thefd, hd_buf, speed, bits, stereo, sampjmp, 0);
- else
- playraw(thefd, hd_buf, speed, bits, stereo, timejmp, 1);
-
+ playraw(thefd, hd_buf, speed, bits, stereo);
wait(NULL);
cleanupsems();
@@ -416,7 +352,7 @@
void Usage(void)
{
fprintf(stderr,
- "Usage: %s [-d device] [-B buffersize] [-S] [-s Hz] [-b 8|16]
[-t secs] [-q] [-D level] [-r|-v|-w] [filename]\n",
+ "Usage: %s [-d device] [-B buffersize] [-S] [-s Hz] [-b 8|16]
[-t secs] [-D level] [-r|-v|-w] [filename]\n",
progname);
exit(1);
}
@@ -434,17 +370,12 @@
exit(-1);
}
-void cleanup(int val, void *arg)
-{
- cleanupsems();
-}
-
-void getbcount(int speed, int bits, int stereo, long long int *bcount,
+void getbcount(int speed, int bits, int stereo, int *bcount,
int timelim, int samplim, int timejmp, int sampjmp, int *bjump)
{
if(timelim)
{
- *bcount = (long long) speed * (long long) timelim * (bits/8);
+ *bcount = speed*timelim*(bits/8);
if (stereo) *bcount <<= 1;
}
if(samplim)
@@ -464,20 +395,14 @@
}
}
-void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo, int
jump, int secs)
+void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo)
{
- if (verbose) {
- fprintf(stdout, "Playing raw data : %d bit, Speed %d %s ...\n",
- bits, speed, (stereo)? "Stereo" : "Mono");
- }
-
- if (secs == 0)
- jump = jump / speed;
-
- diskread(thefd, 0, hd_buf, 1, speed, bits, stereo, jump);
+ fprintf(stderr, "Playing raw data : %d bit, Speed %d %s ...\n",
+ bits, speed, (stereo)? "Stereo" : "Mono");
+ diskread(thefd, 0, hd_buf, 1, speed, bits, stereo);
}
-void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits, int
stereo, int jump, int secs)
+void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits, int
stereo)
{
wavhead wavhd;
int count;
@@ -485,20 +410,24 @@
memcpy((void*)&wavhd, (void*)hd_buf, 20);
count = read(thefd, ((char*)&wavhd)+20, sizeof(wavhd) - 20);
-wavhd.length = le32_to_cpu (wavhd.length);
-wavhd.sc_len = le32_to_cpu (wavhd.sc_len);
-wavhd.format = le16_to_cpu (wavhd.format);
-wavhd.modus = le16_to_cpu (wavhd.modus);
-
-wavhd.sample_fq = le32_to_cpu (wavhd.sample_fq);
-wavhd.byte_p_sec = le32_to_cpu (wavhd.byte_p_sec);
-
-wavhd.byte_p_spl = le16_to_cpu (wavhd.byte_p_spl);
-wavhd.bit_p_spl = le16_to_cpu (wavhd.bit_p_spl);
-
-wavhd.data_chunk = le32_to_cpu (wavhd.data_chunk);
-wavhd.data_length = le32_to_cpu (wavhd.data_length);
-
+#if __BYTE_ORDER == __BIG_ENDIAN
+#include<byteswap.h>
+ /* let's do a bit of reordering */
+ wavhd.length = bswap_32 (wavhd.length);
+ wavhd.sc_len = bswap_32 (wavhd.sc_len);
+ wavhd.format = bswap_16 (wavhd.format);
+ wavhd.modus = bswap_16 (wavhd.modus);
+
+ wavhd.sample_fq = bswap_32 (wavhd.sample_fq);
+ wavhd.byte_p_sec = bswap_32 (wavhd.byte_p_sec);
+
+ wavhd.byte_p_spl = bswap_16 (wavhd.byte_p_spl);
+ wavhd.bit_p_spl = bswap_16 (wavhd.bit_p_spl);
+
+ wavhd.data_chunk = bswap_32 (wavhd.data_chunk);
+ wavhd.data_length = bswap_32 (wavhd.data_length);
+#endif
+
if(wavhd.format != 1) Die("input is not a PCM WAV file");
if (! (mods&MSPEED))
speed = wavhd.sample_fq;
@@ -506,15 +435,9 @@
bits = wavhd.bit_p_spl;
if (! (mods&MSTEREO))
stereo = wavhd.modus - 1;
- if (verbose) {
- fprintf(stdout, "Playing WAVE : %d bit, Speed %d %s ...\n",
+ fprintf(stderr, "Playing WAVE : %d bit, Speed %d %s ...\n",
bits, speed, (stereo)? "Stereo" : "Mono");
- }
-
- if (secs == 0)
- jump = jump / speed;
-
- diskread(thefd, 0, NULL, 1, speed, bits, stereo, jump);
+ diskread(thefd, 0, NULL, 1, speed, bits, stereo);
}
void playvoc(int thefd, char hd_buf[20])
@@ -522,24 +445,17 @@
int count;
int speed=0, bits=0, stereo=0;
int inloop=0, loop_times;
- long long bytecount, loop_pos=0;
+ long bytecount, loop_pos=0;
vochead vochd;
blockTC ccblock;
int lastblocktype = -1;
int quit = 0;
- if (verbose) fprintf(stdout, "Playing Creative Labs Voice file ...\n");
+ fprintf(stderr, "Playing Creative Labs Voice file ...\n");
memcpy((void*)&vochd, (void*)hd_buf, 20);
count = read(thefd, ((char*)&vochd)+20, sizeof(vochd) - 20);
-
- vochd.BlockOffset = le16_to_cpu(vochd.BlockOffset);
- vochd.Version = le16_to_cpu(vochd.Version);
- vochd.IDCode = le16_to_cpu(vochd.IDCode);
-
- if (verbose) {
- fprintf(stdout, "Format version %d.%d\n", vochd.Version>>8,
+ fprintf(stderr, "Format version %d.%d\n", vochd.Version>>8,
vochd.Version&0xFF);
- }
if (vochd.IDCode != (~vochd.Version+0x1234))
fprintf(stderr, "Odd - version mismatch - %d != %d\n",
vochd.IDCode, ~vochd.Version+0x1234);
@@ -547,7 +463,7 @@
{
int off = vochd.BlockOffset - sizeof(vochd);
char *junk;
- junk = (char*) malloc(off);
+ junk = (char*) malloc(off);
read(thefd, junk, off);
}
while(!quit)
@@ -557,7 +473,7 @@
if (debug)
fprintf(stderr, "Terminating\n");
- diskread(thefd, -1, NULL, 1, speed, bits, stereo, 0);
+ diskread(thefd, -1, NULL, 1, speed, bits, stereo);
quit = 1;
continue;
}
@@ -578,7 +494,7 @@
stereo = 0;
}
bytecount = DATALEN(ccblock) -2;
- diskread(thefd, bytecount, NULL, 0, speed, bits, stereo, 0);
+ diskread(thefd, bytecount, NULL, 0, speed, bits, stereo);
lastblocktype = 1;
}
break;
@@ -586,9 +502,6 @@
{
blockT8 tblock;
read(thefd, (char*)&tblock, sizeof(tblock));
-
- tblock.TimeConstant = le16_to_cpu(tblock.TimeConstant);
-
if(tblock.PackMethod != 0) Die("Non PCM VOC block");
speed = 256000000/(65536 - tblock.TimeConstant);
bits = 8;
@@ -601,17 +514,13 @@
{
blockT9 tblock;
read(thefd, (char*)&tblock, sizeof(tblock));
-
- tblock.SamplesPerSec = le32_to_cpu(tblock.SamplesPerSec);
- tblock.Format = le16_to_cpu(tblock.Format);
-
if(tblock.Format != 0 && tblock.Format != 4)
Die("Non PCM VOC block");
speed = tblock.SamplesPerSec;
bits = tblock.BitsPerSample;
stereo = tblock.Channels - 1;
bytecount = DATALEN(ccblock) - 12;
- diskread(thefd, bytecount, NULL, 0, speed, bits, stereo, 0);
+ diskread(thefd, bytecount, NULL, 0, speed, bits, stereo);
lastblocktype = 9;
}
break;
@@ -619,7 +528,7 @@
if (debug)
fprintf(stderr, "Terminating\n");
- diskread(thefd, -1, NULL, 1, speed, bits, stereo, 0);
+ diskread(thefd, -1, NULL, 1, speed, bits, stereo);
quit = 1;
break;
case 6:
@@ -659,11 +568,11 @@
{
int rd = 0, trgt = BUFSIZ;
char junkbuf[BUFSIZ];
-
+
fprintf(stderr, "Ignored\n");
bytecount = DATALEN(ccblock);
while(rd < bytecount)
- {//FIXME rd, trgt, not sure what this has to do with bytecount
+ {
if (rd + trgt > bytecount)
trgt = bytecount - rd;
count = read(thefd, junkbuf, trgt);
diff -Nru bplay-0.991/debian/changelog bplay-0.991/debian/changelog
--- bplay-0.991/debian/changelog 2023-08-17 02:11:04.000000000 +0200
+++ bplay-0.991/debian/changelog 2023-08-17 00:21:31.000000000 +0200
@@ -1,3 +1,10 @@
+bplay (0.991-10.2) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Convert to source format 3.0. (Closes: #1036419)
+
+ -- Bastian Germann <b...@debian.org> Wed, 16 Aug 2023 22:21:31 +0000
+
bplay (0.991-10.1) unstable; urgency=medium
* Non-maintainer upload.
diff -Nru bplay-0.991/debian/patches/debian.patch
bplay-0.991/debian/patches/debian.patch
--- bplay-0.991/debian/patches/debian.patch 1970-01-01 01:00:00.000000000
+0100
+++ bplay-0.991/debian/patches/debian.patch 2023-08-17 00:21:31.000000000
+0200
@@ -0,0 +1,799 @@
+--- bplay-0.991.orig/bplay.1
++++ bplay-0.991/bplay.1
+@@ -61,7 +61,10 @@ When recording, write raw sound file.
+ When recording, write Creative Labs VOC sound file.
+ .TP
+ .I "\-w"
+-When recording write Microsoft Wave sound file.
++When recording write Microsoft Wave sound file. Note that the WAVE file
format is limited to 4GiB filesize. Recording more data is possible, but the
length info won't be consistent.
++.TP
++.I "\-q"
++Quiet mode. No messages are displayed.
+ .TP
+ .I "\-D level"
+ Print debug information to stderr. Debug level ranges from 0 to 2,
+@@ -89,4 +92,4 @@ David Monro (dav...@amberdata.demon.co.u
+ The option parsing code was originally taken from
+ .B vplay
+ to maintain
+-compatability.
++compatibility.
+--- bplay-0.991.orig/bplay.c
++++ bplay-0.991/bplay.c
+@@ -5,13 +5,16 @@
+ **
+ **
+ */
++#define _FILE_OFFSET_BITS 64
++#define _LARGEFILE_SOURCE
++#define _LARGEFILE64_SOURCE
+
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <limits.h>
++#include <stdint.h>
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+@@ -24,6 +27,30 @@
+
+ #include <sys/soundcard.h>
+
++/* Needed for BYTE_ORDER and BIG/LITTLE_ENDIAN macros. */
++#ifndef _BSD_SOURCE
++# define _BSD_SOURCE
++# include <endian.h>
++# undef _BSD_SOURCE
++#else
++# include <endian.h>
++#endif
++
++#include <sys/types.h>
++#include <byteswap.h>
++
++/* Adapted from the byteorder macros in the Linux kernel. */
++#if BYTE_ORDER == LITTLE_ENDIAN
++#define cpu_to_le32(x) (x)
++#define cpu_to_le16(x) (x)
++#else
++#define cpu_to_le32(x) bswap_32((x))
++#define cpu_to_le16(x) bswap_16((x))
++#endif
++
++#define le32_to_cpu(x) cpu_to_le32((x))
++#define le16_to_cpu(x) cpu_to_le16((x))
++
+ #include "fmtheaders.h"
+
+ /* Types and constants */
+@@ -39,6 +66,7 @@ int forked;
+ pid_t pid;
+ int recorder = 0;
+ int debug = 0;
++int verbose = 1;
+
+ /* Prototypes */
+
+@@ -52,10 +80,14 @@ void Usage(void);
+ void ErrDie(char *err);
+ void Die(char *err);
+
+-void getbcount(int speed, int bits, int stereo, int *bcount,
++void cleanup(int val, void *arg);
++
++void getbcount(int speed, int bits, int stereo, long long int *bcount,
+ int timelim, int samplim, int timejmp, int sampjmp, int *bjump);
+-void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo);
+-void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits, int
stereo);
++void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo,
++ int jump, int secs);
++void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits,
++ int stereo, int jump, int secs);
+ void playvoc(int thefd, char hd_buf[20]);
+
+ /* extern globals */
+@@ -67,9 +99,9 @@ extern int bigbuffsize;
+ extern void init_sound(int recorder);
+ extern void snd_parm(int speed, int bits, int stereo);
+ extern void init_shm(void);
+-extern void shmrec(int outfd, int bcount, int terminate);
+-extern void diskread(int outfd, int bcount, char hd_buf[20], int terminate,
+- int speed, int bits, int stereo);
++extern void shmrec(int outfd, long long int bcount, int terminate);
++extern void diskread(int outfd, long long int bcount, char hd_buf[20], int
terminate,
++ int speed, int bits, int stereo, int jump);
+ extern volatile void audiowrite(void);
+ extern void initsems(int disks, int snds);
+ extern void cleanupsems(void);
+@@ -77,14 +109,14 @@ extern void cleanupsems(void);
+
+ int main(int argc, char *argv[])
+ {
+-
++
+ int thefd; /* The file descriptor */
+ int speed, bits, stereo; /* Audio parameters */
+ int timelim; /* Recording time in secs */
+ int samplim; /* Recording time in samples */
+ int timejmp; /* Skip time in secs */
+ int sampjmp; /* Skip time in samples */
+- int bcount; /* Number of bytes to record */
++ long long int bcount; /* Number of bytes to record */
+ int bjump; /* Number of bytes to skip */
+ int themask; /* Permission mask for file */
+ sndf_t filetype; /* The file type */
+@@ -110,7 +142,7 @@ int main(int argc, char *argv[])
+ filetype = F_UNKNOWN;
+ mods = 0;
+ /* Parse the options */
+- while ((optc = getopt(argc, argv, "Ss:b:t:T:j:J:rvwd:B:D:")) != -1)
++ while ((optc = getopt(argc, argv, "Ss:b:t:T:j:J:rvwd:B:D:q")) != -1)
+ {
+ switch(optc)
+ {
+@@ -142,6 +174,9 @@ int main(int argc, char *argv[])
+ case 'J':
+ sampjmp = atoi(optarg);
+ break;
++ case 'q':
++ verbose = 0;
++ break;
+ case 'r':
+ filetype = F_RAW;
+ break;
+@@ -172,7 +207,7 @@ int main(int argc, char *argv[])
+ "%s: setpriority: %s: continuing anyway\n",
+ progname, strerror(errno));
+ }
+-
++
+ #endif
+ /* Drop out of suid mode before we open any files */
+ if(setreuid(geteuid(), getuid()) == -1)
+@@ -199,12 +234,12 @@ int main(int argc, char *argv[])
+ /* Ok, get the mask for the opening the file */
+ themask = umask(0);
+ umask(themask);
+- if ((thefd = open(argv[optind], O_CREAT | O_TRUNC | O_WRONLY,
++ if ((thefd = open(argv[optind], O_CREAT | O_TRUNC | O_WRONLY |
O_LARGEFILE,
+ (~themask) & 0666)) == -1)
+ ErrDie(argv[optind]);
+ }
+ else
+- if ((thefd = open(argv[optind], O_RDONLY)) == -1)
++ if ((thefd = open(argv[optind], O_RDONLY | O_LARGEFILE)) == -1)
+ ErrDie(argv[optind]);
+ }
+
+@@ -223,20 +258,21 @@ int main(int argc, char *argv[])
+ #endif
+
+ /* Set up the shared buffers and semaphore blocks */
++ on_exit(cleanup, 0);
+ init_shm(); /* MUST be called after init_sound() */
+
+ /* Call the appropriate routine */
+ if (recorder)
+ {
+ if ((timelim == 0) && (samplim == 0)) {
+- bcount = INT_MAX;
++ bcount = INT64_MAX - 1;
+ } else {
+ getbcount(speed, bits, stereo, &bcount, timelim,
+ samplim, timejmp, sampjmp,
+ &bjump);
+ }
+ if (debug)
+- fprintf(stderr, "bcount: %d\n", bcount);
++ fprintf(stderr, "bcount: %lld\n", bcount);
+
+ if (filetype == F_UNKNOWN)
+ filetype = F_RAW; /* Change to change default */
+@@ -244,9 +280,11 @@ int main(int argc, char *argv[])
+ {
+ case F_WAV:
+ /* Spit out header here... */
+- fprintf(stderr, "Writing MS WAV sound file");
++ if (verbose)
++ fprintf(stdout, "Writing MS WAV sound file");
+ {
+ wavhead header;
++ unsigned long long int tmp;
+
+ char *riff = "RIFF";
+ char *wave = "WAVE";
+@@ -254,34 +292,45 @@ int main(int argc, char *argv[])
+ char *data = "data";
+
+ memcpy(&(header.main_chunk), riff, 4);
+- header.length = sizeof(wavhead) - 8 + bcount;
++ if ( (tmp = sizeof(wavhead) - 8 + bcount) >> 32
) {
++ header.length = 0xFFFFFFFF; // do not
overload the header
++ fprintf(stderr, " (WARNING: Resulting file
size is larger than 4GiB, violating the WAVE format specification!)");
++ }
++ else
++ header.length = cpu_to_le32(tmp);
++
+ memcpy(&(header.chunk_type), wave, 4);
+
+ memcpy(&(header.sub_chunk), fmt, 4);
+- header.sc_len = 16;
+- header.format = 1;
+- header.modus = stereo + 1;
+- header.sample_fq = speed;
+- header.byte_p_sec = ((bits > 8)?
2:1)*(stereo+1)*speed;
+- header.byte_p_spl = ((bits > 8)?
2:1)*(stereo+1);
+- header.bit_p_spl = bits;
++ header.sc_len = cpu_to_le32(16);
++ header.format = cpu_to_le16(1);
++ header.modus = cpu_to_le16(stereo + 1);
++ header.sample_fq = cpu_to_le32(speed);
++ header.byte_p_sec = cpu_to_le32(((bits > 8)?
++ 2:1)*(stereo+1)*speed);
++ header.byte_p_spl = cpu_to_le16(((bits > 8)?
++ 2:1)*(stereo+1));
++ header.bit_p_spl = cpu_to_le16(bits);
+
+ memcpy(&(header.data_chunk), data, 4);
+- header.data_length = bcount;
++ header.data_length = ( bcount >> 32 ) ?
0xFFFFFFFF : cpu_to_le32(bcount) ; //FIXME see above, make sure that it works
cleanly
+ write(thefd, &header, sizeof(header));
+ }
+ case F_RAW:
+ if (filetype == F_RAW)
+- fprintf(stderr, "Writing raw sound file");
+- fprintf(stderr, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");
++ if (verbose) {
++ fprintf(stdout, "Writing raw sound file");
++ fprintf(stdout, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");
++ }
+ snd_parm(speed, bits, stereo);
+ initsems(0, 1);
+ shmrec(thefd, bcount, 1);
+ break;
+ case F_VOC:
+ /* Spit out header here... */
+- fprintf(stderr, "Writing CL VOC sound file");
+- fprintf(stderr, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");
++ if (verbose) {
++ fprintf(stdout, "Writing CL VOC sound file");
++ fprintf(stdout, ", %dHz, %dbit, %s\n", speed, bits,
(stereo)? "stereo":"");}
+ {
+ vochead header;
+ blockTC ablk;
+@@ -291,23 +340,29 @@ int main(int argc, char *argv[])
+
+ for (i=0;i<20;i++)
+ header.Magic[i] = VOC_MAGIC[i];
+- header.BlockOffset = 0x1a;
+- header.Version = 0x0114;
+- header.IDCode = 0x111F;
++ header.BlockOffset = cpu_to_le16(0x1a);
++ header.Version = cpu_to_le16(0x0114);
++ header.IDCode = cpu_to_le16(0x111F);
+ write(thefd, &header, sizeof(vochead));
+
+ snd_parm(speed, bits, stereo);
+ initsems(0, 1);
+
+- i = (bcount >= 0xFFFFF2)? 0xFFFFF2 + 12 :
bcount;
++ i = bcount;
++ if (bcount >= 0xFFFFF2)
++ {
++ i = 0xFFFFF2 + 12;
++ fprintf(stderr, "Warning: length is out of
allowed range, consider using another sound format!\n");
++ }
++
+ ablk.BlockID = 9;
+ ablk.BlockLen[0] = (i + 12) & 0xFF;
+ ablk.BlockLen[1] = ((i + 12) >> 8) & 0xFF;
+ ablk.BlockLen[2] = ((i + 12) >> 16) & 0xFF;
+- bblk.SamplesPerSec = speed;
++ bblk.SamplesPerSec = cpu_to_le32(speed);
+ bblk.BitsPerSample = bits;
+ bblk.Channels = stereo + 1;
+- bblk.Format = (bits == 8)? 0 : 4;
++ bblk.Format = cpu_to_le16((bits == 8)? 0 : 4);
+ write(thefd, &ablk, sizeof(ablk));
+ write(thefd, &bblk, sizeof(bblk));
+ shmrec(thefd, i, 1);
+@@ -338,9 +393,18 @@ int main(int argc, char *argv[])
+ if(strstr(hd_buf, VOC_MAGIC) != NULL)
+ playvoc(thefd, hd_buf);
+ else if(strstr(hd_buf, "RIFF") != NULL)
+- playwav(thefd, hd_buf, mods, speed, bits, stereo);
++ {
++ if (sampjmp)
++ playwav(thefd, hd_buf, mods, speed, bits, stereo, sampjmp, 0);
++ else
++ playwav(thefd, hd_buf, mods, speed, bits, stereo, timejmp, 1);
++ }
+ else /* Assume raw data */
+- playraw(thefd, hd_buf, speed, bits, stereo);
++ if (sampjmp)
++ playraw(thefd, hd_buf, speed, bits, stereo, sampjmp, 0);
++ else
++ playraw(thefd, hd_buf, speed, bits, stereo, timejmp, 1);
++
+
+ wait(NULL);
+ cleanupsems();
+@@ -352,7 +416,7 @@ int main(int argc, char *argv[])
+ void Usage(void)
+ {
+ fprintf(stderr,
+- "Usage: %s [-d device] [-B buffersize] [-S] [-s Hz] [-b 8|16]
[-t secs] [-D level] [-r|-v|-w] [filename]\n",
++ "Usage: %s [-d device] [-B buffersize] [-S] [-s Hz] [-b 8|16]
[-t secs] [-q] [-D level] [-r|-v|-w] [filename]\n",
+ progname);
+ exit(1);
+ }
+@@ -370,12 +434,17 @@ void Die(char * err)
+ exit(-1);
+ }
+
+-void getbcount(int speed, int bits, int stereo, int *bcount,
++void cleanup(int val, void *arg)
++{
++ cleanupsems();
++}
++
++void getbcount(int speed, int bits, int stereo, long long int *bcount,
+ int timelim, int samplim, int timejmp, int sampjmp, int *bjump)
+ {
+ if(timelim)
+ {
+- *bcount = speed*timelim*(bits/8);
++ *bcount = (long long) speed * (long long) timelim * (bits/8);
+ if (stereo) *bcount <<= 1;
+ }
+ if(samplim)
+@@ -395,14 +464,20 @@ void getbcount(int speed, int bits, int
+ }
+ }
+
+-void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo)
++void playraw(int thefd, char hd_buf[20], int speed, int bits, int stereo, int
jump, int secs)
+ {
+- fprintf(stderr, "Playing raw data : %d bit, Speed %d %s ...\n",
+- bits, speed, (stereo)? "Stereo" : "Mono");
+- diskread(thefd, 0, hd_buf, 1, speed, bits, stereo);
++ if (verbose) {
++ fprintf(stdout, "Playing raw data : %d bit, Speed %d %s ...\n",
++ bits, speed, (stereo)? "Stereo" : "Mono");
++ }
++
++ if (secs == 0)
++ jump = jump / speed;
++
++ diskread(thefd, 0, hd_buf, 1, speed, bits, stereo, jump);
+ }
+
+-void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits, int
stereo)
++void playwav(int thefd, char hd_buf[20], int mods, int speed, int bits, int
stereo, int jump, int secs)
+ {
+ wavhead wavhd;
+ int count;
+@@ -410,24 +485,20 @@ void playwav(int thefd, char hd_buf[20],
+ memcpy((void*)&wavhd, (void*)hd_buf, 20);
+ count = read(thefd, ((char*)&wavhd)+20, sizeof(wavhd) - 20);
+
+-#if __BYTE_ORDER == __BIG_ENDIAN
+-#include<byteswap.h>
+- /* let's do a bit of reordering */
+- wavhd.length = bswap_32 (wavhd.length);
+- wavhd.sc_len = bswap_32 (wavhd.sc_len);
+- wavhd.format = bswap_16 (wavhd.format);
+- wavhd.modus = bswap_16 (wavhd.modus);
+-
+- wavhd.sample_fq = bswap_32 (wavhd.sample_fq);
+- wavhd.byte_p_sec = bswap_32 (wavhd.byte_p_sec);
+-
+- wavhd.byte_p_spl = bswap_16 (wavhd.byte_p_spl);
+- wavhd.bit_p_spl = bswap_16 (wavhd.bit_p_spl);
+-
+- wavhd.data_chunk = bswap_32 (wavhd.data_chunk);
+- wavhd.data_length = bswap_32 (wavhd.data_length);
+-#endif
+-
++wavhd.length = le32_to_cpu (wavhd.length);
++wavhd.sc_len = le32_to_cpu (wavhd.sc_len);
++wavhd.format = le16_to_cpu (wavhd.format);
++wavhd.modus = le16_to_cpu (wavhd.modus);
++
++wavhd.sample_fq = le32_to_cpu (wavhd.sample_fq);
++wavhd.byte_p_sec = le32_to_cpu (wavhd.byte_p_sec);
++
++wavhd.byte_p_spl = le16_to_cpu (wavhd.byte_p_spl);
++wavhd.bit_p_spl = le16_to_cpu (wavhd.bit_p_spl);
++
++wavhd.data_chunk = le32_to_cpu (wavhd.data_chunk);
++wavhd.data_length = le32_to_cpu (wavhd.data_length);
++
+ if(wavhd.format != 1) Die("input is not a PCM WAV file");
+ if (! (mods&MSPEED))
+ speed = wavhd.sample_fq;
+@@ -435,9 +506,15 @@ void playwav(int thefd, char hd_buf[20],
+ bits = wavhd.bit_p_spl;
+ if (! (mods&MSTEREO))
+ stereo = wavhd.modus - 1;
+- fprintf(stderr, "Playing WAVE : %d bit, Speed %d %s ...\n",
++ if (verbose) {
++ fprintf(stdout, "Playing WAVE : %d bit, Speed %d %s ...\n",
+ bits, speed, (stereo)? "Stereo" : "Mono");
+- diskread(thefd, 0, NULL, 1, speed, bits, stereo);
++ }
++
++ if (secs == 0)
++ jump = jump / speed;
++
++ diskread(thefd, 0, NULL, 1, speed, bits, stereo, jump);
+ }
+
+ void playvoc(int thefd, char hd_buf[20])
+@@ -445,17 +522,24 @@ void playvoc(int thefd, char hd_buf[20])
+ int count;
+ int speed=0, bits=0, stereo=0;
+ int inloop=0, loop_times;
+- long bytecount, loop_pos=0;
++ long long bytecount, loop_pos=0;
+ vochead vochd;
+ blockTC ccblock;
+ int lastblocktype = -1;
+ int quit = 0;
+
+- fprintf(stderr, "Playing Creative Labs Voice file ...\n");
++ if (verbose) fprintf(stdout, "Playing Creative Labs Voice file ...\n");
+ memcpy((void*)&vochd, (void*)hd_buf, 20);
+ count = read(thefd, ((char*)&vochd)+20, sizeof(vochd) - 20);
+- fprintf(stderr, "Format version %d.%d\n", vochd.Version>>8,
++
++ vochd.BlockOffset = le16_to_cpu(vochd.BlockOffset);
++ vochd.Version = le16_to_cpu(vochd.Version);
++ vochd.IDCode = le16_to_cpu(vochd.IDCode);
++
++ if (verbose) {
++ fprintf(stdout, "Format version %d.%d\n", vochd.Version>>8,
+ vochd.Version&0xFF);
++ }
+ if (vochd.IDCode != (~vochd.Version+0x1234))
+ fprintf(stderr, "Odd - version mismatch - %d != %d\n",
+ vochd.IDCode, ~vochd.Version+0x1234);
+@@ -463,7 +547,7 @@ void playvoc(int thefd, char hd_buf[20])
+ {
+ int off = vochd.BlockOffset - sizeof(vochd);
+ char *junk;
+- junk = (char*) malloc(off);
++ junk = (char*) malloc(off);
+ read(thefd, junk, off);
+ }
+ while(!quit)
+@@ -473,7 +557,7 @@ void playvoc(int thefd, char hd_buf[20])
+ if (debug)
+ fprintf(stderr, "Terminating\n");
+
+- diskread(thefd, -1, NULL, 1, speed, bits, stereo);
++ diskread(thefd, -1, NULL, 1, speed, bits, stereo, 0);
+ quit = 1;
+ continue;
+ }
+@@ -494,7 +578,7 @@ void playvoc(int thefd, char hd_buf[20])
+ stereo = 0;
+ }
+ bytecount = DATALEN(ccblock) -2;
+- diskread(thefd, bytecount, NULL, 0, speed, bits, stereo);
++ diskread(thefd, bytecount, NULL, 0, speed, bits, stereo, 0);
+ lastblocktype = 1;
+ }
+ break;
+@@ -502,6 +586,9 @@ void playvoc(int thefd, char hd_buf[20])
+ {
+ blockT8 tblock;
+ read(thefd, (char*)&tblock, sizeof(tblock));
++
++ tblock.TimeConstant = le16_to_cpu(tblock.TimeConstant);
++
+ if(tblock.PackMethod != 0) Die("Non PCM VOC block");
+ speed = 256000000/(65536 - tblock.TimeConstant);
+ bits = 8;
+@@ -514,13 +601,17 @@ void playvoc(int thefd, char hd_buf[20])
+ {
+ blockT9 tblock;
+ read(thefd, (char*)&tblock, sizeof(tblock));
++
++ tblock.SamplesPerSec = le32_to_cpu(tblock.SamplesPerSec);
++ tblock.Format = le16_to_cpu(tblock.Format);
++
+ if(tblock.Format != 0 && tblock.Format != 4)
+ Die("Non PCM VOC block");
+ speed = tblock.SamplesPerSec;
+ bits = tblock.BitsPerSample;
+ stereo = tblock.Channels - 1;
+ bytecount = DATALEN(ccblock) - 12;
+- diskread(thefd, bytecount, NULL, 0, speed, bits, stereo);
++ diskread(thefd, bytecount, NULL, 0, speed, bits, stereo, 0);
+ lastblocktype = 9;
+ }
+ break;
+@@ -528,7 +619,7 @@ void playvoc(int thefd, char hd_buf[20])
+ if (debug)
+ fprintf(stderr, "Terminating\n");
+
+- diskread(thefd, -1, NULL, 1, speed, bits, stereo);
++ diskread(thefd, -1, NULL, 1, speed, bits, stereo, 0);
+ quit = 1;
+ break;
+ case 6:
+@@ -568,11 +659,11 @@ void playvoc(int thefd, char hd_buf[20])
+ {
+ int rd = 0, trgt = BUFSIZ;
+ char junkbuf[BUFSIZ];
+-
++
+ fprintf(stderr, "Ignored\n");
+ bytecount = DATALEN(ccblock);
+ while(rd < bytecount)
+- {
++ {//FIXME rd, trgt, not sure what this has to do with bytecount
+ if (rd + trgt > bytecount)
+ trgt = bytecount - rd;
+ count = read(thefd, junkbuf, trgt);
+--- bplay-0.991.orig/fmtheaders.h
++++ bplay-0.991/fmtheaders.h
+@@ -2,44 +2,51 @@
+ #define _FMTHEADERS_H 1
+
+ #include <sys/types.h>
++#include <inttypes.h>
++
++#ifdef __GNUC__
++# define PACKED(x) __attribute__((packed)) x
++#else
++# define PACKED(x) x
++#endif
+
+ /* Definitions for .VOC files */
+
+ #define VOC_MAGIC "Creative Voice File\032"
+
+-#define DATALEN(bp) ((u_int)(bp.BlockLen[0]) | \
+- ((u_int)(bp.BlockLen[1]) << 8) | \
+- ((u_int)(bp.BlockLen[2]) << 16) )
++#define DATALEN(bp) ((u_int32_t)(bp.BlockLen[0]) | \
++ ((u_int32_t)(bp.BlockLen[1]) << 8) | \
++ ((u_int32_t)(bp.BlockLen[2]) << 16) )
+
+ typedef struct vochead {
+- u_char Magic[20]; /* must be VOC_MAGIC */
+- u_short BlockOffset; /* Offset to first block from top of file */
+- u_short Version; /* VOC-file version */
+- u_short IDCode; /* complement of version + 0x1234 */
++ u_int8_t Magic[20]; /* must be VOC_MAGIC */
++ u_int16_t BlockOffset; /* Offset to first block from top of file */
++ u_int16_t Version; /* VOC-file version */
++ u_int16_t IDCode; /* complement of version + 0x1234 */
+ } vochead;
+
+ typedef struct blockTC {
+- u_char BlockID;
+- u_char BlockLen[3]; /* low, mid, high byte of length of rest of
block */
++ u_int8_t BlockID;
++ u_int8_t BlockLen[3]; /* low, mid, high byte of length of rest of
block */
+ } blockTC;
+
+ typedef struct blockT1 {
+- u_char TimeConstant;
+- u_char PackMethod;
++ u_int8_t TimeConstant;
++ u_int8_t PackMethod;
+ } blockT1;
+
+ typedef struct blockT8 {
+- u_short TimeConstant;
+- u_char PackMethod;
+- u_char VoiceMode;
++ u_int16_t TimeConstant;
++ u_int8_t PackMethod;
++ u_int8_t VoiceMode;
+ } blockT8;
+
+ typedef struct blockT9 {
+ u_int SamplesPerSec;
+- u_char BitsPerSample;
+- u_char Channels;
+- u_short Format;
+- u_char reserved[4];
++ u_int8_t BitsPerSample;
++ u_int8_t Channels;
++ u_int16_t Format;
++ u_int8_t reserved[4];
+ } blockT9;
+
+
+@@ -51,21 +58,21 @@ typedef struct blockT9 {
+ it works on all WAVE-file I have
+ */
+ typedef struct wavhead {
+- u_int main_chunk; /* 'RIFF' */
+- u_int length; /* Length of rest of file */
+- u_int chunk_type; /* 'WAVE' */
+-
+- u_int sub_chunk; /* 'fmt ' */
+- u_int sc_len; /* length of sub_chunk, =16 (rest of chunk) */
+- u_short format; /* should be 1 for PCM-code */
+- u_short modus; /* 1 Mono, 2 Stereo */
+- u_int sample_fq; /* frequence of sample */
+- u_int byte_p_sec;
+- u_short byte_p_spl; /* samplesize; 1 or 2 bytes */
+- u_short bit_p_spl; /* 8, 12 or 16 bit */
++ u_int32_t main_chunk; /* 'RIFF' */
++ u_int32_t length; /* Length of rest of file */
++ u_int32_t chunk_type; /* 'WAVE' */
++
++ u_int32_t sub_chunk; /* 'fmt ' */
++ u_int32_t sc_len; /* length of sub_chunk, =16 (rest of chunk) */
++ u_int16_t format; /* should be 1 for PCM-code */
++ u_int16_t modus; /* 1 Mono, 2 Stereo */
++ u_int32_t sample_fq; /* frequence of sample */
++ u_int32_t byte_p_sec;
++ u_int16_t byte_p_spl; /* samplesize; 1 or 2 bytes */
++ u_int16_t bit_p_spl; /* 8, 12 or 16 bit */
+
+- u_int data_chunk; /* 'data' */
+- u_int data_length; /* samplecount (lenth of rest of block?)*/
++ u_int32_t data_chunk; /* 'data' */
++ u_int32_t data_length; /* samplecount (lenth of rest of block?)*/
+ } wavhead;
+
+ #endif
+--- bplay-0.991.orig/shmbuf.c
++++ bplay-0.991/shmbuf.c
+@@ -57,7 +57,7 @@ union semun
+ int bigbuffsize = DEFAULTBUFFSIZE;
+
+ /* Statics - mostly shared memory etc */
+-static int shmid, shmid2, *disksemid, *sndsemid;
++static int shmid, shmid2, *disksemid = 0, *sndsemid = 0;
+ static char *bigbuff;
+ static char **buffarr;
+ static int numbuffs, numsemblks;
+@@ -165,8 +165,12 @@ void init_shm(void)
+ /* Malloc arrays of semaphore ids (ints) for the semaphores */
+ if ((disksemid = (int*)malloc(sizeof(int)*numsemblks)) == NULL)
+ ErrDie("malloc");
++ for (i=0;i<numsemblks;i++)
++ disksemid[i] = -1;
+ if ((sndsemid = (int*)malloc(sizeof(int)*numsemblks)) == NULL)
+ ErrDie("malloc");
++ for (i=0;i<numsemblks;i++)
++ sndsemid[i] = -1;
+ /* Create the semaphores */
+ for (i=0;i<numsemblks;i++)
+ {
+@@ -191,8 +195,11 @@ void up(int *semblk, int xsemnum)
+ sbuf.sem_op = 1;
+ sbuf.sem_flg = 0;
+
+- if (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
++ while (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
++ if (errno != EINTR) {
+ perror("semop");
++ break;
++ }
+ }
+
+ /* Does a down on the appropriate semaphore */
+@@ -204,12 +211,15 @@ void down(int *semblk, int xsemnum)
+ sbuf.sem_op = -1;
+ sbuf.sem_flg = 0;
+
+- if (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
++ while (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
++ if (errno != EINTR) {
+ perror("semop");
++ break;
++ }
+ }
+
+ /* The recording function */
+-void shmrec(int outfd, int totalcount, int terminate)
++void shmrec(int outfd, long long int totalcount, int terminate)
+ {
+
+ sync();
+@@ -217,7 +227,7 @@ void shmrec(int outfd, int totalcount, i
+ pid = fork();
+ if (pid == 0)
+ {
+- int cbuff = 0;
++ long int cbuff = 0;
+
+ /* Uncatch the signals */
+ signal(SIGINT, SIG_DFL);
+@@ -225,7 +235,7 @@ void shmrec(int outfd, int totalcount, i
+ /* Child process writes the disk */
+ while(1)
+ {
+- int count, numwr, trgt;
++ long int count, numwr, trgt;
+ char *tmpptr;
+
+ /* Grab the buffer. Blocks till it is OK to do so. */
+@@ -256,10 +266,10 @@ void shmrec(int outfd, int totalcount, i
+ else
+ {
+ /* Parent reads audio */
+- int cbuff = 0, totalrd = 0;
++ long long int cbuff = 0, totalrd = 0;
+ while (totalrd < totalcount)
+ {
+- int trgt, count, numrd;
++ long long int trgt, count, numrd;
+ char *tmpptr;
+ trgt = totalcount - totalrd;
+ if (trgt > abuf_size)
+@@ -297,18 +307,27 @@ void shmrec(int outfd, int totalcount, i
+ }
+ }
+
+-void diskread(int infd, int totalplay, char hd_buf[20], int terminate,
+- int speed, int bits, int stereo)
++void diskread(int infd, long long int totalplay, char hd_buf[20],
++ int terminate, int speed, int bits, int stereo, int jump)
+ {
+
+ int count, i, limited = 0;
+ char *tmppt;
+- int numread, totalread = 0;
++ int numread;
++ long long int totalread = 0;
+ int first = 1;
+
+ static int triggered = 0; /* Have we let the writer go? */
+ static int cbuff = 0; /* Which buffer */
+
++ if (jump)
++ {
++ jump = jump * speed * (bits/8) * (stereo * 2);
++
++ if (lseek (infd, jump, SEEK_CUR) < jump)
++ fprintf(stderr, "couldn't jump %d bytes\n", jump);
++ }
++
+ if (totalplay) limited = 1;
+ if (totalplay == -1)
+ {
+@@ -476,11 +495,14 @@ void cleanupsems(void)
+
+ s.val = 0;
+
+- for (i = 0; i < numsemblks; i++)
+- {
+- semctl(disksemid[i], 0, IPC_RMID, s);
+- semctl(sndsemid[i], 0, IPC_RMID, s);
+- }
++ if (disksemid)
++ for (i = 0; i < numsemblks; i++)
++ if (disksemid[i] != -1)
++ semctl(disksemid[i], 0, IPC_RMID, s);
++ if (sndsemid)
++ for (i = 0; i < numsemblks; i++)
++ if (sndsemid[i] != -1)
++ semctl(sndsemid[i], 0, IPC_RMID, s);
+ }
+
+ static void sighandler(int i)
+--- bplay-0.991.orig/sndfunc.c
++++ bplay-0.991/sndfunc.c
+@@ -69,6 +69,9 @@ void snd_parm(int speed, int bits, int s
+ sync_audio();
+
+ /* Set the sample speed, size and stereoness */
++ /* We only use values of 8 and 16 for bits. This implies
++ * unsigned data for 8 bits, and little-endian signed for 16 bits.
++ */
+ if (ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &bits) < 0)
+ ErrDie(audev);
+ if (ioctl(audio, SNDCTL_DSP_STEREO, &stereo) < 0)
diff -Nru bplay-0.991/debian/patches/series bplay-0.991/debian/patches/series
--- bplay-0.991/debian/patches/series 1970-01-01 01:00:00.000000000 +0100
+++ bplay-0.991/debian/patches/series 2023-08-17 00:21:31.000000000 +0200
@@ -0,0 +1 @@
+debian.patch
diff -Nru bplay-0.991/debian/source/format bplay-0.991/debian/source/format
--- bplay-0.991/debian/source/format 1970-01-01 01:00:00.000000000 +0100
+++ bplay-0.991/debian/source/format 2023-08-17 00:21:31.000000000 +0200
@@ -0,0 +1 @@
+3.0 (quilt)
diff -Nru bplay-0.991/fmtheaders.h bplay-0.991/fmtheaders.h
--- bplay-0.991/fmtheaders.h 2023-08-17 02:11:04.000000000 +0200
+++ bplay-0.991/fmtheaders.h 2000-02-05 12:26:14.000000000 +0100
@@ -2,51 +2,44 @@
#define _FMTHEADERS_H 1
#include <sys/types.h>
-#include <inttypes.h>
-
-#ifdef __GNUC__
-# define PACKED(x) __attribute__((packed)) x
-#else
-# define PACKED(x) x
-#endif
/* Definitions for .VOC files */
#define VOC_MAGIC "Creative Voice File\032"
-#define DATALEN(bp) ((u_int32_t)(bp.BlockLen[0]) | \
- ((u_int32_t)(bp.BlockLen[1]) << 8) | \
- ((u_int32_t)(bp.BlockLen[2]) << 16) )
+#define DATALEN(bp) ((u_int)(bp.BlockLen[0]) | \
+ ((u_int)(bp.BlockLen[1]) << 8) | \
+ ((u_int)(bp.BlockLen[2]) << 16) )
typedef struct vochead {
- u_int8_t Magic[20]; /* must be VOC_MAGIC */
- u_int16_t BlockOffset; /* Offset to first block from top of file */
- u_int16_t Version; /* VOC-file version */
- u_int16_t IDCode; /* complement of version + 0x1234 */
+ u_char Magic[20]; /* must be VOC_MAGIC */
+ u_short BlockOffset; /* Offset to first block from top of file */
+ u_short Version; /* VOC-file version */
+ u_short IDCode; /* complement of version + 0x1234 */
} vochead;
typedef struct blockTC {
- u_int8_t BlockID;
- u_int8_t BlockLen[3]; /* low, mid, high byte of length of rest of
block */
+ u_char BlockID;
+ u_char BlockLen[3]; /* low, mid, high byte of length of rest of block */
} blockTC;
typedef struct blockT1 {
- u_int8_t TimeConstant;
- u_int8_t PackMethod;
+ u_char TimeConstant;
+ u_char PackMethod;
} blockT1;
typedef struct blockT8 {
- u_int16_t TimeConstant;
- u_int8_t PackMethod;
- u_int8_t VoiceMode;
+ u_short TimeConstant;
+ u_char PackMethod;
+ u_char VoiceMode;
} blockT8;
typedef struct blockT9 {
u_int SamplesPerSec;
- u_int8_t BitsPerSample;
- u_int8_t Channels;
- u_int16_t Format;
- u_int8_t reserved[4];
+ u_char BitsPerSample;
+ u_char Channels;
+ u_short Format;
+ u_char reserved[4];
} blockT9;
@@ -58,21 +51,21 @@
it works on all WAVE-file I have
*/
typedef struct wavhead {
- u_int32_t main_chunk; /* 'RIFF' */
- u_int32_t length; /* Length of rest of file */
- u_int32_t chunk_type; /* 'WAVE' */
-
- u_int32_t sub_chunk; /* 'fmt ' */
- u_int32_t sc_len; /* length of sub_chunk, =16 (rest of chunk) */
- u_int16_t format; /* should be 1 for PCM-code */
- u_int16_t modus; /* 1 Mono, 2 Stereo */
- u_int32_t sample_fq; /* frequence of sample */
- u_int32_t byte_p_sec;
- u_int16_t byte_p_spl; /* samplesize; 1 or 2 bytes */
- u_int16_t bit_p_spl; /* 8, 12 or 16 bit */
+ u_int main_chunk; /* 'RIFF' */
+ u_int length; /* Length of rest of file */
+ u_int chunk_type; /* 'WAVE' */
+
+ u_int sub_chunk; /* 'fmt ' */
+ u_int sc_len; /* length of sub_chunk, =16 (rest of chunk) */
+ u_short format; /* should be 1 for PCM-code */
+ u_short modus; /* 1 Mono, 2 Stereo */
+ u_int sample_fq; /* frequence of sample */
+ u_int byte_p_sec;
+ u_short byte_p_spl; /* samplesize; 1 or 2 bytes */
+ u_short bit_p_spl; /* 8, 12 or 16 bit */
- u_int32_t data_chunk; /* 'data' */
- u_int32_t data_length; /* samplecount (lenth of rest of block?)*/
+ u_int data_chunk; /* 'data' */
+ u_int data_length; /* samplecount (lenth of rest of block?)*/
} wavhead;
#endif
diff -Nru bplay-0.991/semantic.cache bplay-0.991/semantic.cache
--- bplay-0.991/semantic.cache 2023-08-17 02:11:04.000000000 +0200
+++ bplay-0.991/semantic.cache 1970-01-01 01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-;; Object bplay-0.991/
-;; SEMANTICDB Tags save file
-(semanticdb-project-database-file "bplay-0.991/"
- :tables (list
- (semanticdb-table "bplay.c"
- :major-mode 'c-mode
- :tags '(("_FILE_OFFSET_BITS" variable (:constant-flag t :default-value
(nil)) nil [121 149]) ("_LARGEFILE_SOURCE" variable (:constant-flag t) nil [150
177]) ("_LARGEFILE64_SOURCE" variable (:constant-flag t) nil [176 206])
("stdio.h" include (:system-flag t) nil [205 223]) ("unistd.h" include
(:system-flag t) nil [224 243]) ("errno.h" include (:system-flag t) nil [244
262]) ("stdlib.h" include (:system-flag t) nil [263 282]) ("string.h" include
(:system-flag t) nil [283 302]) ("stdint.h" include (:system-flag t) nil [303
322]) ("sys/types.h" include (:system-flag t) nil [323 345]) ("fcntl.h" include
(:system-flag t) nil [346 364]) ("unistd.h" include (:system-flag t) nil [365
384]) ("signal.h" include (:system-flag t) nil [385 404]) ("sys/stat.h" include
(:system-flag t) nil [405 426]) ("sys/wait.h" include (:system-flag t) nil [427
448]) ("sys/time.h" include (:system-flag t) nil [450 471]) ("sys/resource.h"
include (:system-flag t) nil [472 497]) ("sys/soundcard.h" include
(:system-flag t) nil [499 525]) ("_BSD_SOURCE" variable (:constant-flag t) nil
[605 627]) ("endian.h" include (:system-flag t) nil [626 646]) ("endian.h"
include (:system-flag t) nil [674 694]) ("sys/types.h" include (:system-flag t)
nil [703 725]) ("byteswap.h" include (:system-flag t) nil [726 747])
("cpu_to_le32" variable (:constant-flag t :default-value (nil)) nil [842 868])
("cpu_to_le16" variable (:constant-flag t :default-value (nil)) nil [869 895])
("cpu_to_le32" variable (:constant-flag t :default-value (nil)) nil [902 938])
("cpu_to_le16" variable (:constant-flag t :default-value (nil)) nil [939 975])
("le32_to_cpu" variable (:constant-flag t :default-value (nil)) nil [984 1023])
("le16_to_cpu" variable (:constant-flag t :default-value (nil)) nil [1024
1063]) ("fmtheaders.h" include nil nil [1065 1088]) ("sndf_t" type (:typedef
("sndf_t" type (:members (("F_UNKNOWN" variable (:constant-flag t :type "int")
(reparse-symbol enumsubparts) [1138 1148]) ("F_WAV" variable (:constant-flag t
:type "int") (reparse-symbol enumsubparts) [1149 1155]) ("F_VOC" variable
(:constant-flag t :type "int") (reparse-symbol enumsubparts) [1156 1162])
("F_RAW" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts)
[1163 1169])) :type "enum") nil nil) :superclasses "sndf_t" :type "typedef")
nil [1116 1176]) ("MSPEED" variable (:constant-flag t :default-value (nil)) nil
[1178 1194]) ("MBITS" variable (:constant-flag t :default-value (nil)) nil
[1195 1210]) ("MSTEREO" variable (:constant-flag t :default-value (nil)) nil
[1211 1228]) ("progname" variable (:pointer 1 :type "char") nil [1244 1259])
("forked" variable (:type "int") nil [1260 1271]) ("pid" variable (:type
("pid_t" type (:type "class") nil nil)) nil [1272 1282]) ("recorder" variable
(:default-value "0" :type "int") nil [1283 1300]) ("debug" variable
(:default-value "0" :type "int") nil [1301 1315]) ("verbose" variable
(:default-value "1" :type "int") nil [1316 1332]) ("basename" function
(:prototype-flag t :pointer 1 :typemodifiers ("extern") :type "char") nil [1417
1472]) ("Usage" function (:prototype-flag t :arguments (("" variable (:type
"void") (reparse-symbol arg-sub-list) [1487 1492])) :type "void") nil [1476
1493]) ("ErrDie" function (:prototype-flag t :arguments (("err" variable
(:pointer 1 :type "char") (reparse-symbol arg-sub-list) [1506 1516])) :type
"void") nil [1494 1517]) ("Die" function (:prototype-flag t :arguments (("err"
variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [1527 1537]))
:type "void") nil [1518 1538]) ("cleanup" function (:prototype-flag t
:arguments (("val" variable (:type "int") (reparse-symbol arg-sub-list) [1553
1561]) ("arg" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list)
[1562 1572])) :type "void") nil [1540 1573]) ("getbcount" function
(:prototype-flag t :arguments (("speed" variable (:type "int") (reparse-symbol
arg-sub-list) [1590 1600]) ("bits" variable (:type "int") (reparse-symbol
arg-sub-list) [1601 1610]) ("stereo" variable (:type "int") (reparse-symbol
arg-sub-list) [1611 1622]) ("" variable (:type "long long") (reparse-symbol
arg-sub-list) [1623 1636]) ("bcount" variable (:pointer 1 :type "int")
(reparse-symbol arg-sub-list) [1633 1645]) ("timelim" variable (:type "int")
(reparse-symbol arg-sub-list) [1647 1659]) ("samplim" variable (:type "int")
(reparse-symbol arg-sub-list) [1660 1672]) ("timejmp" variable (:type "int")
(reparse-symbol arg-sub-list) [1673 1685]) ("sampjmp" variable (:type "int")
(reparse-symbol arg-sub-list) [1686 1698]) ("bjump" variable (:pointer 1 :type
"int") (reparse-symbol arg-sub-list) [1699 1710])) :type "void") nil [1575
1711]) ("playraw" function (:prototype-flag t :arguments (("thefd" variable
(:type "int") (reparse-symbol arg-sub-list) [1725 1735]) ("hd_buf" variable
(:dereference 1 :type "char") (reparse-symbol arg-sub-list) [1736 1752])
("speed" variable (:type "int") (reparse-symbol arg-sub-list) [1753 1763])
("bits" variable (:type "int") (reparse-symbol arg-sub-list) [1764 1773])
("stereo" variable (:type "int") (reparse-symbol arg-sub-list) [1774 1785])
("jump" variable (:type "int") (reparse-symbol arg-sub-list) [1787 1796])
("secs" variable (:type "int") (reparse-symbol arg-sub-list) [1797 1806]))
:type "void") nil [1712 1807]) ("playwav" function (:prototype-flag t
:arguments (("thefd" variable (:type "int") (reparse-symbol arg-sub-list) [1821
1831]) ("hd_buf" variable (:dereference 1 :type "char") (reparse-symbol
arg-sub-list) [1832 1848]) ("mods" variable (:type "int") (reparse-symbol
arg-sub-list) [1849 1858]) ("speed" variable (:type "int") (reparse-symbol
arg-sub-list) [1859 1869]) ("bits" variable (:type "int") (reparse-symbol
arg-sub-list) [1870 1879]) ("stereo" variable (:type "int") (reparse-symbol
arg-sub-list) [1881 1892]) ("jump" variable (:type "int") (reparse-symbol
arg-sub-list) [1893 1902]) ("secs" variable (:type "int") (reparse-symbol
arg-sub-list) [1903 1912])) :type "void") nil [1808 1913]) ("playvoc" function
(:prototype-flag t :arguments (("thefd" variable (:type "int") (reparse-symbol
arg-sub-list) [1927 1937]) ("hd_buf" variable (:dereference 1 :type "char")
(reparse-symbol arg-sub-list) [1938 1954])) :type "void") nil [1914 1955])
("audio" variable (:typemodifiers ("extern") :type "int") nil [1978 2016])
("abuf_size" variable (:typemodifiers ("extern") :type "int") nil [1978 2016])
("fmt_mask" variable (:typemodifiers ("extern") :type "int") nil [1978 2016])
("audev" variable (:pointer 1 :typemodifiers ("extern") :type "char") nil [2017
2036]) ("bigbuffsize" variable (:typemodifiers ("extern") :type "int") nil
[2037 2060]) ("init_sound" function (:prototype-flag t :typemodifiers
("extern") :arguments (("recorder" variable (:type "int") (reparse-symbol
arg-sub-list) [2109 2122])) :type "void") nil [2086 2123]) ("snd_parm" function
(:prototype-flag t :typemodifiers ("extern") :arguments (("speed" variable
(:type "int") (reparse-symbol arg-sub-list) [2145 2155]) ("bits" variable
(:type "int") (reparse-symbol arg-sub-list) [2156 2165]) ("stereo" variable
(:type "int") (reparse-symbol arg-sub-list) [2166 2177])) :type "void") nil
[2124 2178]) ("init_shm" function (:prototype-flag t :typemodifiers ("extern")
:arguments (("" variable (:type "void") (reparse-symbol arg-sub-list) [2200
2205])) :type "void") nil [2179 2206]) ("shmrec" function (:prototype-flag t
:typemodifiers ("extern") :arguments (("outfd" variable (:type "int")
(reparse-symbol arg-sub-list) [2226 2236]) ("" variable (:type "long long")
(reparse-symbol arg-sub-list) [2237 2250]) ("bcount" variable (:type "int")
(reparse-symbol arg-sub-list) [2247 2258]) ("terminate" variable (:type "int")
(reparse-symbol arg-sub-list) [2259 2273])) :type "void") nil [2207 2274])
("diskread" function (:prototype-flag t :typemodifiers ("extern") :arguments
(("outfd" variable (:type "int") (reparse-symbol arg-sub-list) [2296 2306]) (""
variable (:type "long long") (reparse-symbol arg-sub-list) [2307 2320])
("bcount" variable (:type "int") (reparse-symbol arg-sub-list) [2317 2328])
("hd_buf" variable (:dereference 1 :type "char") (reparse-symbol arg-sub-list)
[2329 2345]) ("terminate" variable (:type "int") (reparse-symbol arg-sub-list)
[2346 2360]) ("speed" variable (:type "int") (reparse-symbol arg-sub-list)
[2365 2375]) ("bits" variable (:type "int") (reparse-symbol arg-sub-list) [2376
2385]) ("stereo" variable (:type "int") (reparse-symbol arg-sub-list) [2386
2397]) ("jump" variable (:type "int") (reparse-symbol arg-sub-list) [2398
2407])) :type "void") nil [2275 2408]) ("audiowrite" function (:prototype-flag
t :typemodifiers ("extern" "volatile") :arguments (("" variable (:type "void")
(reparse-symbol arg-sub-list) [2441 2446])) :type "void") nil [2409 2447])
("initsems" function (:prototype-flag t :typemodifiers ("extern") :arguments
(("disks" variable (:type "int") (reparse-symbol arg-sub-list) [2469 2479])
("snds" variable (:type "int") (reparse-symbol arg-sub-list) [2480 2489]))
:type "void") nil [2448 2490]) ("cleanupsems" function (:prototype-flag t
:typemodifiers ("extern") :arguments (("" variable (:type "void")
(reparse-symbol arg-sub-list) [2515 2520])) :type "void") nil [2491 2521])
("main" function (:arguments (("argc" variable (:type "int") (reparse-symbol
arg-sub-list) [2533 2542]) ("argv" variable (:pointer 1 :dereference 1 :type
"char") (reparse-symbol arg-sub-list) [2543 2556])) :type "int") nil [2524
10372]) ("Usage" function (:arguments (("" variable (:type "void")
(reparse-symbol arg-sub-list) [10385 10390])) :type "void") nil [10374 10550])
("ErrDie" function (:arguments (("err" variable (:pointer 1 :type "char")
(reparse-symbol arg-sub-list) [10564 10575])) :type "void") nil [10552 10656])
("Die" function (:arguments (("err" variable (:pointer 1 :type "char")
(reparse-symbol arg-sub-list) [10667 10678])) :type "void") nil [10658 10768])
("cleanup" function (:arguments (("val" variable (:type "int") (reparse-symbol
arg-sub-list) [10783 10791]) ("arg" variable (:pointer 1 :type "void")
(reparse-symbol arg-sub-list) [10792 10802])) :type "void") nil [10770 10822])
("getbcount" function (:arguments (("speed" variable (:type "int")
(reparse-symbol arg-sub-list) [10839 10849]) ("bits" variable (:type "int")
(reparse-symbol arg-sub-list) [10850 10859]) ("stereo" variable (:type "int")
(reparse-symbol arg-sub-list) [10860 10871]) ("" variable (:type "long long")
(reparse-symbol arg-sub-list) [10872 10885]) ("bcount" variable (:pointer 1
:type "int") (reparse-symbol arg-sub-list) [10882 10894]) ("timelim" variable
(:type "int") (reparse-symbol arg-sub-list) [10896 10908]) ("samplim" variable
(:type "int") (reparse-symbol arg-sub-list) [10909 10921]) ("timejmp" variable
(:type "int") (reparse-symbol arg-sub-list) [10922 10934]) ("sampjmp" variable
(:type "int") (reparse-symbol arg-sub-list) [10935 10947]) ("bjump" variable
(:pointer 1 :type "int") (reparse-symbol arg-sub-list) [10948 10959])) :type
"void") nil [10824 11311]) ("playraw" function (:arguments (("thefd" variable
(:type "int") (reparse-symbol arg-sub-list) [11326 11336]) ("hd_buf" variable
(:dereference 1 :type "char") (reparse-symbol arg-sub-list) [11337 11353])
("speed" variable (:type "int") (reparse-symbol arg-sub-list) [11354 11364])
("bits" variable (:type "int") (reparse-symbol arg-sub-list) [11365 11374])
("stereo" variable (:type "int") (reparse-symbol arg-sub-list) [11375 11386])
("jump" variable (:type "int") (reparse-symbol arg-sub-list) [11387 11396])
("secs" variable (:type "int") (reparse-symbol arg-sub-list) [11397 11406]))
:type "void") nil [11313 11659]) ("playwav" function (:arguments (("thefd"
variable (:type "int") (reparse-symbol arg-sub-list) [11674 11684]) ("hd_buf"
variable (:dereference 1 :type "char") (reparse-symbol arg-sub-list) [11685
11701]) ("mods" variable (:type "int") (reparse-symbol arg-sub-list) [11702
11711]) ("speed" variable (:type "int") (reparse-symbol arg-sub-list) [11712
11722]) ("bits" variable (:type "int") (reparse-symbol arg-sub-list) [11723
11732]) ("stereo" variable (:type "int") (reparse-symbol arg-sub-list) [11733
11744]) ("jump" variable (:type "int") (reparse-symbol arg-sub-list) [11745
11754]) ("secs" variable (:type "int") (reparse-symbol arg-sub-list) [11755
11764])) :type "void") nil [11661 12885]) ("playvoc" function (:arguments
(("thefd" variable (:type "int") (reparse-symbol arg-sub-list) [12900 12910])
("hd_buf" variable (:dereference 1 :type "char") (reparse-symbol arg-sub-list)
[12911 12927])) :type "void") nil [12887 16770]))
- :file "bplay.c"
- :pointmax 16771
- :unmatched-syntax 'nil
- )
- (semanticdb-table "shmbuf.c"
- :major-mode 'c-mode
- :tags '(("stdio.h" include (:system-flag t) nil [184 202]) ("stdlib.h"
include (:system-flag t) nil [203 222]) ("unistd.h" include (:system-flag t)
nil [223 242]) ("string.h" include (:system-flag t) nil [243 262]) ("errno.h"
include (:system-flag t) nil [263 281]) ("signal.h" include (:system-flag t)
nil [282 301]) ("sys/types.h" include (:system-flag t) nil [302 324])
("sys/ipc.h" include (:system-flag t) nil [325 345]) ("sys/sem.h" include
(:system-flag t) nil [346 366]) ("sys/shm.h" include (:system-flag t) nil [367
387]) ("sys/wait.h" include (:system-flag t) nil [388 409]) ("SEMMSL" variable
(:constant-flag t :default-value (nil)) nil [460 477]) ("DEFAULTBUFFSIZE"
variable (:constant-flag t :default-value (nil)) nil [585 617]) ("blockinf_t"
type (:typedef ("blockinf_t" type (:members (("count" variable (:type "int")
(reparse-symbol classsubparts) [663 673]) ("last" variable (:type "int")
(reparse-symbol classsubparts) [714 723]) ("setit" variable (:type "int")
(reparse-symbol classsubparts) [773 783]) ("speed" variable (:type "int")
(reparse-symbol classsubparts) [853 863]) ("bits" variable (:type "int")
(reparse-symbol classsubparts) [868 877]) ("stereo" variable (:type "int")
(reparse-symbol classsubparts) [882 893])) :type "struct") nil nil)
:superclasses "blockinf_t" :type "typedef") nil [631 907]) ("semun" type
(:members (("val" variable (:type "int") (reparse-symbol classsubparts) [992
1000]) ("buf" variable (:pointer 1 :type ("semid_ds" type (:type "struct") nil
nil)) (reparse-symbol classsubparts) [1027 1048]) ("array" variable (:pointer 1
:type "unsigned short int") (reparse-symbol classsubparts) [1087 1113])
("__buf" variable (:pointer 1 :type ("seminfo" type (:type "struct") nil nil))
(reparse-symbol classsubparts) [1147 1169])) :type "union") nil [977 1199])
("bigbuffsize" variable (:default-value "DEFAULTBUFFSIZE;" :type "int") nil
[1223 1257]) ("shmid" variable (:typemodifiers ("static") :type "int") nil
[1300 1356]) ("shmid2" variable (:typemodifiers ("static") :type "int") nil
[1300 1356]) ("disksemid" variable (:pointer 1 :typemodifiers ("static")
:default-value "0" :type "int") nil [1300 1356]) ("sndsemid" variable (:pointer
1 :typemodifiers ("static") :default-value "0" :type "int") nil [1300 1356])
("bigbuff" variable (:pointer 1 :typemodifiers ("static") :type "char") nil
[1357 1378]) ("buffarr" variable (:pointer 2 :typemodifiers ("static") :type
"char") nil [1379 1401]) ("numbuffs" variable (:typemodifiers ("static") :type
"int") nil [1402 1434]) ("numsemblks" variable (:typemodifiers ("static") :type
"int") nil [1402 1434]) ("buffinf" variable (:pointer 1 :typemodifiers
("static") :type ("blockinf_t" type (:type "class") nil nil)) nil [1435 1462])
("cleanupsems" function (:prototype-flag t :arguments (("" variable (:type
"void") (reparse-symbol arg-sub-list) [1498 1503])) :type "void") nil [1481
1504]) ("sighandler" function (:prototype-flag t :typemodifiers ("static")
:arguments (("i" variable (:type "int") (reparse-symbol arg-sub-list) [1528
1534])) :type "void") nil [1505 1535]) ("abuf_size" variable (:typemodifiers
("extern") :type "int") nil [1558 1579]) ("audio" variable (:typemodifiers
("extern") :type "int") nil [1580 1597]) ("progname" variable (:pointer 1
:typemodifiers ("extern") :type "char") nil [1598 1620]) ("pid" variable
(:typemodifiers ("extern") :type ("pid_t" type (:type "class") nil nil)) nil
[1621 1638]) ("recorder" variable (:typemodifiers ("extern") :type "int") nil
[1639 1659]) ("debug" variable (:typemodifiers ("extern") :type "int") nil
[1660 1677]) ("ErrDie" function (:prototype-flag t :typemodifiers ("extern")
:arguments (("err" variable (:pointer 1 :type "char") (reparse-symbol
arg-sub-list) [1722 1732])) :type "void") nil [1703 1733]) ("snd_parm" function
(:prototype-flag t :typemodifiers ("extern") :arguments (("speed" variable
(:type "int") (reparse-symbol arg-sub-list) [1755 1765]) ("bits" variable
(:type "int") (reparse-symbol arg-sub-list) [1766 1775]) ("stereo" variable
(:type "int") (reparse-symbol arg-sub-list) [1776 1787])) :type "void") nil
[1734 1788]) ("sync_audio" function (:prototype-flag t :typemodifiers
("extern") :arguments (("" variable (:type "void") (reparse-symbol
arg-sub-list) [1812 1817])) :type "void") nil [1789 1818]) ("cleanup_audio"
function (:prototype-flag t :typemodifiers ("extern") :arguments (("" variable
(:type "void") (reparse-symbol arg-sub-list) [1845 1850])) :type "void") nil
[1819 1851]) ("init_shm" function (:arguments (("" variable (:type "void")
(reparse-symbol arg-sub-list) [1867 1872])) :type "void") nil [1853 4841])
("up" function (:arguments (("semblk" variable (:pointer 1 :type "int")
(reparse-symbol arg-sub-list) [4898 4910]) ("xsemnum" variable (:type "int")
(reparse-symbol arg-sub-list) [4911 4923])) :type "void") nil [4890 5151])
("down" function (:arguments (("semblk" variable (:pointer 1 :type "int")
(reparse-symbol arg-sub-list) [5210 5222]) ("xsemnum" variable (:type "int")
(reparse-symbol arg-sub-list) [5223 5235])) :type "void") nil [5200 5464])
("shmrec" function (:arguments (("outfd" variable (:type "int") (reparse-symbol
arg-sub-list) [5507 5517]) ("" variable (:type "long long") (reparse-symbol
arg-sub-list) [5518 5531]) ("totalcount" variable (:type "int") (reparse-symbol
arg-sub-list) [5528 5543]) ("terminate" variable (:type "int") (reparse-symbol
arg-sub-list) [5544 5558])) :type "void") nil [5495 7486]) ("diskread" function
(:arguments (("infd" variable (:type "int") (reparse-symbol arg-sub-list) [7502
7511]) ("" variable (:type "long long") (reparse-symbol arg-sub-list) [7512
7525]) ("totalplay" variable (:type "int") (reparse-symbol arg-sub-list) [7522
7536]) ("hd_buf" variable (:dereference 1 :type "char") (reparse-symbol
arg-sub-list) [7537 7553]) ("terminate" variable (:type "int") (reparse-symbol
arg-sub-list) [7558 7572]) ("speed" variable (:type "int") (reparse-symbol
arg-sub-list) [7573 7583]) ("bits" variable (:type "int") (reparse-symbol
arg-sub-list) [7584 7593]) ("stereo" variable (:type "int") (reparse-symbol
arg-sub-list) [7594 7605]) ("jump" variable (:type "int") (reparse-symbol
arg-sub-list) [7606 7615])) :type "void") nil [7488 9963]) ("audiowrite"
function (:typemodifiers ("volatile") :arguments (("" variable (:type "void")
(reparse-symbol arg-sub-list) [9990 9995])) :type "void") nil [9965 11065])
("initsems" function (:arguments (("disks" variable (:type "int")
(reparse-symbol arg-sub-list) [11081 11091]) ("snds" variable (:type "int")
(reparse-symbol arg-sub-list) [11092 11101])) :type "void") nil [11067 11391])
("cleanupsems" function (:arguments (("" variable (:type "void")
(reparse-symbol arg-sub-list) [11411 11416])) :type "void") nil [11394 11708])
("sighandler" function (:typemodifiers ("static") :arguments (("i" variable
(:type "int") (reparse-symbol arg-sub-list) [11733 11739])) :type "void") nil
[11710 11925]))
- :file "shmbuf.c"
- :pointmax 11926
- )
- )
- :file "semantic.cache"
- :semantic-tag-version "2.0beta3"
- :semanticdb-version "2.0beta3"
- )
diff -Nru bplay-0.991/shmbuf.c bplay-0.991/shmbuf.c
--- bplay-0.991/shmbuf.c 2023-08-17 02:11:04.000000000 +0200
+++ bplay-0.991/shmbuf.c 2000-02-05 12:26:14.000000000 +0100
@@ -57,7 +57,7 @@
int bigbuffsize = DEFAULTBUFFSIZE;
/* Statics - mostly shared memory etc */
-static int shmid, shmid2, *disksemid = 0, *sndsemid = 0;
+static int shmid, shmid2, *disksemid, *sndsemid;
static char *bigbuff;
static char **buffarr;
static int numbuffs, numsemblks;
@@ -165,12 +165,8 @@
/* Malloc arrays of semaphore ids (ints) for the semaphores */
if ((disksemid = (int*)malloc(sizeof(int)*numsemblks)) == NULL)
ErrDie("malloc");
- for (i=0;i<numsemblks;i++)
- disksemid[i] = -1;
if ((sndsemid = (int*)malloc(sizeof(int)*numsemblks)) == NULL)
ErrDie("malloc");
- for (i=0;i<numsemblks;i++)
- sndsemid[i] = -1;
/* Create the semaphores */
for (i=0;i<numsemblks;i++)
{
@@ -195,11 +191,8 @@
sbuf.sem_op = 1;
sbuf.sem_flg = 0;
- while (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
- if (errno != EINTR) {
+ if (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
perror("semop");
- break;
- }
}
/* Does a down on the appropriate semaphore */
@@ -211,15 +204,12 @@
sbuf.sem_op = -1;
sbuf.sem_flg = 0;
- while (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
- if (errno != EINTR) {
+ if (semop(semblk[xsemnum/SEMMSL], &sbuf, 1) == -1)
perror("semop");
- break;
- }
}
/* The recording function */
-void shmrec(int outfd, long long int totalcount, int terminate)
+void shmrec(int outfd, int totalcount, int terminate)
{
sync();
@@ -227,7 +217,7 @@
pid = fork();
if (pid == 0)
{
- long int cbuff = 0;
+ int cbuff = 0;
/* Uncatch the signals */
signal(SIGINT, SIG_DFL);
@@ -235,7 +225,7 @@
/* Child process writes the disk */
while(1)
{
- long int count, numwr, trgt;
+ int count, numwr, trgt;
char *tmpptr;
/* Grab the buffer. Blocks till it is OK to do so. */
@@ -266,10 +256,10 @@
else
{
/* Parent reads audio */
- long long int cbuff = 0, totalrd = 0;
+ int cbuff = 0, totalrd = 0;
while (totalrd < totalcount)
{
- long long int trgt, count, numrd;
+ int trgt, count, numrd;
char *tmpptr;
trgt = totalcount - totalrd;
if (trgt > abuf_size)
@@ -307,27 +297,18 @@
}
}
-void diskread(int infd, long long int totalplay, char hd_buf[20],
- int terminate, int speed, int bits, int stereo, int jump)
+void diskread(int infd, int totalplay, char hd_buf[20], int terminate,
+ int speed, int bits, int stereo)
{
int count, i, limited = 0;
char *tmppt;
- int numread;
- long long int totalread = 0;
+ int numread, totalread = 0;
int first = 1;
static int triggered = 0; /* Have we let the writer go? */
static int cbuff = 0; /* Which buffer */
- if (jump)
- {
- jump = jump * speed * (bits/8) * (stereo * 2);
-
- if (lseek (infd, jump, SEEK_CUR) < jump)
- fprintf(stderr, "couldn't jump %d bytes\n", jump);
- }
-
if (totalplay) limited = 1;
if (totalplay == -1)
{
@@ -495,14 +476,11 @@
s.val = 0;
- if (disksemid)
- for (i = 0; i < numsemblks; i++)
- if (disksemid[i] != -1)
- semctl(disksemid[i], 0, IPC_RMID, s);
- if (sndsemid)
- for (i = 0; i < numsemblks; i++)
- if (sndsemid[i] != -1)
- semctl(sndsemid[i], 0, IPC_RMID, s);
+ for (i = 0; i < numsemblks; i++)
+ {
+ semctl(disksemid[i], 0, IPC_RMID, s);
+ semctl(sndsemid[i], 0, IPC_RMID, s);
+ }
}
static void sighandler(int i)
diff -Nru bplay-0.991/sndfunc.c bplay-0.991/sndfunc.c
--- bplay-0.991/sndfunc.c 2023-08-17 02:11:04.000000000 +0200
+++ bplay-0.991/sndfunc.c 2000-03-01 18:48:53.000000000 +0100
@@ -69,9 +69,6 @@
sync_audio();
/* Set the sample speed, size and stereoness */
- /* We only use values of 8 and 16 for bits. This implies
- * unsigned data for 8 bits, and little-endian signed for 16 bits.
- */
if (ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &bits) < 0)
ErrDie(audev);
if (ioctl(audio, SNDCTL_DSP_STEREO, &stereo) < 0)