summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/sample.c16
-rw-r--r--src/pulse/sample.h26
-rw-r--r--src/pulse/stream.c1
3 files changed, 37 insertions, 6 deletions
diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 29501595..8228a9bb 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -48,6 +48,8 @@ size_t pa_sample_size(const pa_sample_spec *spec) {
[PA_SAMPLE_FLOAT32BE] = 4,
[PA_SAMPLE_S32LE] = 4,
[PA_SAMPLE_S32BE] = 4,
+ [PA_SAMPLE_S24LE] = 3,
+ [PA_SAMPLE_S24BE] = 3
};
pa_assert(spec);
@@ -125,6 +127,8 @@ const char *pa_sample_format_to_string(pa_sample_format_t f) {
[PA_SAMPLE_FLOAT32BE] = "float32be",
[PA_SAMPLE_S32LE] = "s32le",
[PA_SAMPLE_S32BE] = "s32be",
+ [PA_SAMPLE_S24LE] = "s24le",
+ [PA_SAMPLE_S24BE] = "s24be",
};
if (f < 0 || f >= PA_SAMPLE_MAX)
@@ -194,8 +198,16 @@ pa_sample_format_t pa_parse_sample_format(const char *format) {
return PA_SAMPLE_S32BE;
else if (strcasecmp(format, "s32ne") == 0 || strcasecmp(format, "s32") == 0 || strcasecmp(format, "32") == 0)
return PA_SAMPLE_S32NE;
- else if (strcasecmp(format, "s32re") == 0)
- return PA_SAMPLE_S32RE;
+ else if (strcasecmp(format, "s24re") == 0)
+ return PA_SAMPLE_S24RE;
+ else if (strcasecmp(format, "s24le") == 0)
+ return PA_SAMPLE_S24LE;
+ else if (strcasecmp(format, "s24be") == 0)
+ return PA_SAMPLE_S24BE;
+ else if (strcasecmp(format, "s24ne") == 0 || strcasecmp(format, "s24") == 0 || strcasecmp(format, "24") == 0)
+ return PA_SAMPLE_S24NE;
+ else if (strcasecmp(format, "s24re") == 0)
+ return PA_SAMPLE_S24RE;
return -1;
}
diff --git a/src/pulse/sample.h b/src/pulse/sample.h
index 3c7dd0e7..8d09d32e 100644
--- a/src/pulse/sample.h
+++ b/src/pulse/sample.h
@@ -51,6 +51,8 @@
* \li PA_SAMPLE_ULAW - 8 bit mu-Law.
* \li PA_SAMPLE_S32LE - Signed 32 bit integer PCM, little endian.
* \li PA_SAMPLE_S32BE - Signed 32 bit integer PCM, big endian.
+ * \li PA_SAMPLE_242LE - Signed 24 bit integer PCM packed, little endian.
+ * \li PA_SAMPLE_242BE - Signed 24 bit integer PCM packed, big endian.
*
* The floating point sample formats have the range from -1.0 to 1.0.
*
@@ -145,7 +147,13 @@ typedef enum pa_sample_format {
/**< Signed 32 Bit PCM, little endian (PC) */
PA_SAMPLE_S32BE,
- /**< Signed 32 Bit PCM, big endian (PC) */
+ /**< Signed 32 Bit PCM, big endian */
+
+ PA_SAMPLE_S24LE,
+ /**< Signed 24 Bit PCM packed, little endian (PC) */
+
+ PA_SAMPLE_S24BE,
+ /**< Signed 24 Bit PCM packed, big endian */
PA_SAMPLE_MAX,
/**< Upper limit of valid sample types */
@@ -161,12 +169,16 @@ typedef enum pa_sample_format {
#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
/** Signed 32 Bit PCM, native endian */
#define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
+/** Signed 24 Bit PCM packed, native endian */
+#define PA_SAMPLE_S24NE PA_SAMPLE_S24BE
/** Signed 16 Bit PCM reverse endian */
#define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
/** 32 Bit IEEE floating point, reverse endian */
#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
-/** Signed 32 Bit PCM reverse endian */
+/** Signed 32 Bit PCM, reverse endian */
#define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
+/** Signed 24 Bit PCM, packed reverse endian */
+#define PA_SAMPLE_S24RE PA_SAMPLE_242LE
#else
/** Signed 16 Bit PCM, native endian */
#define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
@@ -174,12 +186,16 @@ typedef enum pa_sample_format {
#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
/** Signed 32 Bit PCM, native endian */
#define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
-/** Signed 16 Bit PCM reverse endian */
+/** Signed 24 Bit PCM packed, native endian */
+#define PA_SAMPLE_S24NE PA_SAMPLE_S24LE
+/** Signed 16 Bit PCM, reverse endian */
#define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
/** 32 Bit IEEE floating point, reverse endian */
#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
-/** Signed 32 Bit PCM reverse endian */
+/** Signed 32 Bit PCM, reverse endian */
#define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
+/** Signed 24 Bit PCM packed, reverse endian */
+#define PA_SAMPLE_S24RE PA_SAMPLE_S24BE
#endif
/** A Shortcut for PA_SAMPLE_FLOAT32NE */
@@ -196,6 +212,8 @@ typedef enum pa_sample_format {
#define PA_SAMPLE_FLOAT32BE PA_SAMPLE_FLOAT32BE
#define PA_SAMPLE_S32LE PA_SAMPLE_S32LE
#define PA_SAMPLE_S32BE PA_SAMPLE_S32BE
+#define PA_SAMPLE_S24LE PA_SAMPLE_S24LE
+#define PA_SAMPLE_S24BE PA_SAMPLE_S24BE
/** \endcond */
/** A sample format and attribute specification */
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index c0ae4ac2..2a958e04 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -87,6 +87,7 @@ pa_stream *pa_stream_new_with_proplist(
PA_CHECK_VALIDITY_RETURN_NULL(c, ss && pa_sample_spec_valid(ss), PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 12 || (ss->format != PA_SAMPLE_S32LE && ss->format != PA_SAMPLE_S32BE), PA_ERR_NOTSUPPORTED);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 15 || (ss->format != PA_SAMPLE_S24LE && ss->format != PA_SAMPLE_S24BE), PA_ERR_NOTSUPPORTED);
PA_CHECK_VALIDITY_RETURN_NULL(c, !map || (pa_channel_map_valid(map) && map->channels == ss->channels), PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, name || (p && pa_proplist_contains(p, PA_PROP_MEDIA_NAME)), PA_ERR_INVALID);