mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
add new channel map argument to pa_simple_new()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@911 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
5f6d8c9c8b
commit
ee35a063b2
4 changed files with 11 additions and 6 deletions
|
|
@ -140,6 +140,7 @@ pa_simple* pa_simple_new(
|
||||||
const char *dev,
|
const char *dev,
|
||||||
const char *stream_name,
|
const char *stream_name,
|
||||||
const pa_sample_spec *ss,
|
const pa_sample_spec *ss,
|
||||||
|
const pa_channel_map *map,
|
||||||
const pa_buffer_attr *attr,
|
const pa_buffer_attr *attr,
|
||||||
int *rerror) {
|
int *rerror) {
|
||||||
|
|
||||||
|
|
@ -150,6 +151,7 @@ pa_simple* pa_simple_new(
|
||||||
CHECK_VALIDITY_RETURN_ANY(rerror, dir == PA_STREAM_PLAYBACK || dir == PA_STREAM_RECORD, PA_ERR_INVALID, NULL);
|
CHECK_VALIDITY_RETURN_ANY(rerror, dir == PA_STREAM_PLAYBACK || dir == PA_STREAM_RECORD, PA_ERR_INVALID, NULL);
|
||||||
CHECK_VALIDITY_RETURN_ANY(rerror, !dev || *dev, PA_ERR_INVALID, NULL);
|
CHECK_VALIDITY_RETURN_ANY(rerror, !dev || *dev, PA_ERR_INVALID, NULL);
|
||||||
CHECK_VALIDITY_RETURN_ANY(rerror, ss && pa_sample_spec_valid(ss), PA_ERR_INVALID, NULL);
|
CHECK_VALIDITY_RETURN_ANY(rerror, ss && pa_sample_spec_valid(ss), PA_ERR_INVALID, NULL);
|
||||||
|
CHECK_VALIDITY_RETURN_ANY(rerror, !map || (pa_channel_map_valid(map) && map->channels == ss->channels), PA_ERR_INVALID, NULL)
|
||||||
|
|
||||||
p = pa_xnew(pa_simple, 1);
|
p = pa_xnew(pa_simple, 1);
|
||||||
p->context = NULL;
|
p->context = NULL;
|
||||||
|
|
@ -184,7 +186,7 @@ pa_simple* pa_simple_new(
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(p->stream = pa_stream_new(p->context, stream_name, ss, NULL))) {
|
if (!(p->stream = pa_stream_new(p->context, stream_name, ss, map))) {
|
||||||
error = pa_context_errno(p->context);
|
error = pa_context_errno(p->context);
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <polyp/sample.h>
|
#include <polyp/sample.h>
|
||||||
|
#include <polyp/channelmap.h>
|
||||||
#include <polyp/def.h>
|
#include <polyp/def.h>
|
||||||
#include <polyp/cdecl.h>
|
#include <polyp/cdecl.h>
|
||||||
|
|
||||||
|
|
@ -57,6 +58,7 @@
|
||||||
* NULL, // Use the default device.
|
* NULL, // Use the default device.
|
||||||
* "Music", // Description of our stream.
|
* "Music", // Description of our stream.
|
||||||
* &ss, // Our sample format.
|
* &ss, // Our sample format.
|
||||||
|
* NULL, // Use default channel map
|
||||||
* NULL, // Use default buffering attributes.
|
* NULL, // Use default buffering attributes.
|
||||||
* NULL, // Ignore error code.
|
* NULL, // Ignore error code.
|
||||||
* );
|
* );
|
||||||
|
|
@ -116,6 +118,7 @@ pa_simple* pa_simple_new(
|
||||||
const char *dev, /**< Sink (resp. source) name, or NULL for default */
|
const char *dev, /**< Sink (resp. source) name, or NULL for default */
|
||||||
const char *stream_name, /**< A descriptive name for this client (application name, song title, ...) */
|
const char *stream_name, /**< A descriptive name for this client (application name, song title, ...) */
|
||||||
const pa_sample_spec *ss, /**< The sample type to use */
|
const pa_sample_spec *ss, /**< The sample type to use */
|
||||||
|
const pa_channel_map *map, /**< The channel map to use, or NULL for default */
|
||||||
const pa_buffer_attr *attr, /**< Buffering attributes, or NULL for default */
|
const pa_buffer_attr *attr, /**< Buffering attributes, or NULL for default */
|
||||||
int *error /**< A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here. */
|
int *error /**< A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here. */
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new playback stream */
|
/* Create a new playback stream */
|
||||||
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, &error))) {
|
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, NULL, &error))) {
|
||||||
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
|
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Create the recording stream */
|
/* Create the recording stream */
|
||||||
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_RECORD, NULL, "record", &ss, NULL, &error))) {
|
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_RECORD, NULL, "record", &ss, NULL, NULL, &error))) {
|
||||||
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
|
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue