mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
allow the user to specify an alternative channel map in paplay too
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@809 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
d78e466a28
commit
c27b1407f8
1 changed files with 25 additions and 4 deletions
|
|
@ -54,6 +54,8 @@ static pa_volume_t volume = PA_VOLUME_NORM;
|
|||
static SNDFILE* sndfile = NULL;
|
||||
|
||||
static pa_sample_spec sample_spec = { 0, 0, 0 };
|
||||
static pa_channel_map channel_map;
|
||||
static int channel_map_set = 0;
|
||||
|
||||
static sf_count_t (*readf_function)(SNDFILE *_sndfile, void *ptr, sf_count_t frames);
|
||||
|
||||
|
|
@ -161,7 +163,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
if (verbose)
|
||||
fprintf(stderr, "Connection established.\n");
|
||||
|
||||
stream = pa_stream_new(c, stream_name, &sample_spec, NULL);
|
||||
stream = pa_stream_new(c, stream_name, &sample_spec, channel_map_set ? &channel_map : NULL);
|
||||
assert(stream);
|
||||
|
||||
pa_stream_set_state_callback(stream, stream_state_callback, NULL);
|
||||
|
|
@ -200,14 +202,16 @@ static void help(const char *argv0) {
|
|||
" -d, --device=DEVICE The name of the sink/source to connect to\n"
|
||||
" -n, --client-name=NAME How to call this client on the server\n"
|
||||
" --stream-name=NAME How to call this stream on the server\n"
|
||||
" --volume=VOLUME Specify the initial (linear) volume in range 0...256\n",
|
||||
" --volume=VOLUME Specify the initial (linear) volume in range 0...65536\n"
|
||||
" --channel-map=CHANNELMAP Set the channel map to the use\n",
|
||||
argv0);
|
||||
}
|
||||
|
||||
enum {
|
||||
ARG_VERSION = 256,
|
||||
ARG_STREAM_NAME,
|
||||
ARG_VOLUME
|
||||
ARG_VOLUME,
|
||||
ARG_CHANNELMAP
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
|
@ -226,6 +230,7 @@ int main(int argc, char *argv[]) {
|
|||
{"help", 0, NULL, 'h'},
|
||||
{"verbose", 0, NULL, 'v'},
|
||||
{"volume", 1, NULL, ARG_VOLUME},
|
||||
{"channel-map", 1, NULL, ARG_CHANNELMAP},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
|
|
@ -277,6 +282,15 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
}
|
||||
|
||||
case ARG_CHANNELMAP:
|
||||
if (!pa_channel_map_parse(&channel_map, optarg)) {
|
||||
fprintf(stderr, "Invalid channel map\n");
|
||||
goto quit;
|
||||
}
|
||||
|
||||
channel_map_set = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
goto quit;
|
||||
}
|
||||
|
|
@ -322,6 +336,13 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
}
|
||||
|
||||
assert(pa_sample_spec_valid(&sample_spec));
|
||||
|
||||
if (channel_map_set && channel_map.channels != sample_spec.channels) {
|
||||
fprintf(stderr, "Channel map doesn't match file.\n");
|
||||
goto quit;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
char t[PA_SAMPLE_SPEC_SNPRINT_MAX];
|
||||
pa_sample_spec_snprint(t, sizeof(t), &sample_spec);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue