"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "aplay/aplay.c" between
alsa-utils-1.2.1.tar.bz2 and alsa-utils-1.2.2.tar.bz2

About: ALSA (Advanced Linux Sound Architecture) - Utilities.

aplay.c  (alsa-utils-1.2.1.tar.bz2):aplay.c  (alsa-utils-1.2.2.tar.bz2)
skipping to change at line 47 skipping to change at line 47
#include <fcntl.h> #include <fcntl.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <time.h> #include <time.h>
#include <locale.h> #include <locale.h>
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#include <assert.h> #include <assert.h>
#include <termios.h> #include <termios.h>
#include <signal.h> #include <signal.h>
#include <sys/poll.h> #include <poll.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <endian.h> #include <endian.h>
#include "gettext.h" #include "gettext.h"
#include "formats.h" #include "formats.h"
#include "version.h" #include "version.h"
#define ABS(a) (a) < 0 ? -(a) : (a)
#ifdef SND_CHMAP_API_VERSION #ifdef SND_CHMAP_API_VERSION
#define CONFIG_SUPPORT_CHMAP 1 #define CONFIG_SUPPORT_CHMAP 1
#endif #endif
#ifndef LLONG_MAX #ifndef LLONG_MAX
#define LLONG_MAX 9223372036854775807LL #define LLONG_MAX 9223372036854775807LL
#endif #endif
#ifndef le16toh #ifndef le16toh
#include <asm/byteorder.h> #include <asm/byteorder.h>
skipping to change at line 187 skipping to change at line 189
} fmt_rec_table[] = { } fmt_rec_table[] = {
{ NULL, NULL, N_("raw data"), LLONG_MAX }, { NULL, NULL, N_("raw data"), LLONG_MAX },
{ begin_voc, end_voc, N_("VOC"), 16000000L L }, { begin_voc, end_voc, N_("VOC"), 16000000L L },
/* FIXME: can WAV handle exactly 2GB or less than it? */ /* FIXME: can WAV handle exactly 2GB or less than it? */
{ begin_wave, end_wave, N_("WAVE"), 214748364 8LL }, { begin_wave, end_wave, N_("WAVE"), 214748364 8LL },
{ begin_au, end_au, N_("Sparc Audio"), LLONG_MAX } { begin_au, end_au, N_("Sparc Audio"), LLONG_MAX }
}; };
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define error(...) do {\ #define error(...) do {\
fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \ fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, __VA_ARGS__); \
putc('\n', stderr); \ putc('\n', stderr); \
} while (0) } while (0)
#else #else
#define error(args...) do {\ #define error(args...) do {\
fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \ fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \
fprintf(stderr, ##args); \ fprintf(stderr, ##args); \
putc('\n', stderr); \ putc('\n', stderr); \
} while (0) } while (0)
#endif #endif
static void usage(char *command) static void usage(char *command)
{ {
snd_pcm_format_t k; snd_pcm_format_t k;
printf( printf(
_("Usage: %s [OPTION]... [FILE]...\n" _("Usage: %s [OPTION]... [FILE]...\n"
skipping to change at line 443 skipping to change at line 445
/* /*
* make sure we write all bytes or return an error * make sure we write all bytes or return an error
*/ */
static ssize_t xwrite(int fd, const void *buf, size_t count) static ssize_t xwrite(int fd, const void *buf, size_t count)
{ {
ssize_t written; ssize_t written;
size_t offset = 0; size_t offset = 0;
while (offset < count) { while (offset < count) {
written = write(fd, buf + offset, count - offset); written = write(fd, (char *)buf + offset, count - offset);
if (written <= 0) if (written <= 0)
return written; return written;
offset += written; offset += written;
}; };
return offset; return offset;
} }
static long parse_long(const char *str, int *err) static long parse_long(const char *str, int *err)
skipping to change at line 1211 skipping to change at line 1213
break; break;
default: default:
return -1; return -1;
} }
hwparams.rate = BE_INT(ap->sample_rate); hwparams.rate = BE_INT(ap->sample_rate);
if (hwparams.rate < 2000 || hwparams.rate > 256000) if (hwparams.rate < 2000 || hwparams.rate > 256000)
return -1; return -1;
hwparams.channels = BE_INT(ap->channels); hwparams.channels = BE_INT(ap->channels);
if (hwparams.channels < 1 || hwparams.channels > 256) if (hwparams.channels < 1 || hwparams.channels > 256)
return -1; return -1;
if ((size_t)safe_read(fd, buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) { if ((size_t)safe_read(fd, (char *)buffer + sizeof(AuHeader), BE_INT(ap->h dr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) {
error(_("read error")); error(_("read error"));
prg_exit(EXIT_FAILURE); prg_exit(EXIT_FAILURE);
} }
return 0; return 0;
} }
static void show_available_sample_formats(snd_pcm_hw_params_t* params) static void show_available_sample_formats(snd_pcm_hw_params_t* params)
{ {
snd_pcm_format_t format; snd_pcm_format_t format;
skipping to change at line 1744 skipping to change at line 1746
memset(line + bar_length + 6 + 1, '#', p); memset(line + bar_length + 6 + 1, '#', p);
else else
memset(line + bar_length - p - 1, '#', p); memset(line + bar_length - p - 1, '#', p);
p = maxperc[c] * bar_length / 100; p = maxperc[c] * bar_length / 100;
if (p > bar_length) if (p > bar_length)
p = bar_length; p = bar_length;
if (c) if (c)
line[bar_length + 6 + 1 + p] = '+'; line[bar_length + 6 + 1 + p] = '+';
else else
line[bar_length - p - 1] = '+'; line[bar_length - p - 1] = '+';
if (maxperc[c] > 99) if (ABS(maxperc[c]) > 99)
sprintf(tmp, "MAX"); sprintf(tmp, "MAX");
else else
sprintf(tmp, "%02d%%", maxperc[c]); sprintf(tmp, "%02d%%", maxperc[c]);
if (c) if (c)
memcpy(line + bar_length + 3 + 1, tmp, 3); memcpy(line + bar_length + 3 + 1, tmp, 3);
else else
memcpy(line + bar_length, tmp, 3); memcpy(line + bar_length, tmp, 3);
} }
line[bar_length * 2 + 6 + 2] = 0; line[bar_length * 2 + 6 + 2] = 0;
fputs(line, stderr); fputs(line, stderr);
skipping to change at line 3018 skipping to change at line 3020
*format = '\0'; *format = '\0';
format = formatstring; format = formatstring;
return strftime(s, max, format, tm); return strftime(s, max, format, tm);
} }
static int new_capture_file(char *name, char *namebuf, size_t namelen, static int new_capture_file(char *name, char *namebuf, size_t namelen,
int filecount) int filecount)
{ {
char *s; char *s;
char buf[PATH_MAX+1]; char buf[PATH_MAX-10];
time_t t; time_t t;
struct tm *tmp; struct tm *tmp;
if (use_strftime) { if (use_strftime) {
t = time(NULL); t = time(NULL);
tmp = localtime(&t); tmp = localtime(&t);
if (tmp == NULL) { if (tmp == NULL) {
perror("localtime"); perror("localtime");
prg_exit(EXIT_FAILURE); prg_exit(EXIT_FAILURE);
} }
skipping to change at line 3125 skipping to change at line 3127
fd = open(name, O_WRONLY | O_CREAT, 0644); fd = open(name, O_WRONLY | O_CREAT, 0644);
} }
return fd; return fd;
} }
static void capture(char *orig_name) static void capture(char *orig_name)
{ {
int tostdout=0; /* boolean which describes output stream */ int tostdout=0; /* boolean which describes output stream */
int filecount=0; /* number of files written */ int filecount=0; /* number of files written */
char *name = orig_name; /* current filename */ char *name = orig_name; /* current filename */
char namebuf[PATH_MAX+1]; char namebuf[PATH_MAX+2];
off64_t count, rest; /* number of bytes to capture */ off64_t count, rest; /* number of bytes to capture */
struct stat statbuf; struct stat statbuf;
/* get number of bytes to capture */ /* get number of bytes to capture */
count = calc_count(); count = calc_count();
if (count == 0) if (count == 0)
count = LLONG_MAX; count = LLONG_MAX;
/* compute the number of bytes per file */ /* compute the number of bytes per file */
max_file_size = (long long) max_file_time * max_file_size = (long long) max_file_time *
snd_pcm_format_size(hwparams.format, snd_pcm_format_size(hwparams.format,
skipping to change at line 3349 skipping to change at line 3351
memcpy(format, names[0], len); memcpy(format, names[0], len);
strcpy(format + len, ".%d"); strcpy(format + len, ".%d");
len += 4; len += 4;
names = malloc(sizeof(*names) * channels); names = malloc(sizeof(*names) * channels);
for (channel = 0; channel < channels; ++channel) { for (channel = 0; channel < channels; ++channel) {
names[channel] = malloc(len); names[channel] = malloc(len);
sprintf(names[channel], format, channel); sprintf(names[channel], format, channel);
} }
alloced = 1; alloced = 1;
} else if (count != channels) { } else if (count != channels) {
error(_("You need to specify %d files"), channels); error(_("You need to specify %u files"), channels);
prg_exit(EXIT_FAILURE); prg_exit(EXIT_FAILURE);
} }
for (channel = 0; channel < channels; ++channel) { for (channel = 0; channel < channels; ++channel) {
fds[channel] = open(names[channel], O_RDONLY, 0); fds[channel] = open(names[channel], O_RDONLY, 0);
if (fds[channel] < 0) { if (fds[channel] < 0) {
perror(names[channel]); perror(names[channel]);
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto __end; goto __end;
} }
 End of changes. 10 change blocks. 
9 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)