Skip to content

aplay: add support for G.711 A_LAW enconding in AU file format #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions aplay/aplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,12 @@ static int test_au(int fd, void *buffer)
fprintf(stderr, _("Warning: format is changed to S16_BE\n"));
hwparams.format = SND_PCM_FORMAT_S16_BE;
break;
case AU_FMT_ALAW:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_A_LAW)
fprintf(stderr, _("Warning: format is changed to A_LAW\n"));
hwparams.format = SND_PCM_FORMAT_A_LAW;
break;
default:
return -1;
}
Expand Down Expand Up @@ -2787,6 +2793,9 @@ static void begin_au(int fd, size_t cnt)
case SND_PCM_FORMAT_S16_BE:
ah.encoding = BE_INT(AU_FMT_LIN16);
break;
case SND_PCM_FORMAT_A_LAW:
ah.encoding = BE_INT(AU_FMT_ALAW);
break;
default:
error(_("Sparc Audio doesn't support %s format..."), snd_pcm_format_name(hwparams.format));
prg_exit(EXIT_FAILURE);
Expand Down
1 change: 1 addition & 0 deletions aplay/formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ typedef struct {
#define AU_FMT_ULAW 1
#define AU_FMT_LIN8 2
#define AU_FMT_LIN16 3
#define AU_FMT_ALAW 27

typedef struct au_header {
uint32_t magic; /* '.snd' */
Expand Down