aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/oss_output_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/output/oss_output_plugin.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/src/output/oss_output_plugin.c b/src/output/oss_output_plugin.c
index ea15022d9..1b09c4b53 100644
--- a/src/output/oss_output_plugin.c
+++ b/src/output/oss_output_plugin.c
@@ -52,20 +52,14 @@
#endif
#ifdef AFMT_S24_PACKED
-#include "pcm_buffer.h"
-#include "pcm_byteswap.h"
+#include "pcm_export.h"
#endif
struct oss_data {
struct audio_output base;
#ifdef AFMT_S24_PACKED
- /**
- * The buffer used to reverse the byte order.
- *
- * @see #reverse_endian
- */
- struct pcm_buffer reverse_buffer;
+ struct pcm_export_state export;
#endif
int fd;
@@ -76,16 +70,6 @@ struct oss_data {
* the device after cancel().
*/
struct audio_format audio_format;
-
-#ifdef AFMT_S24_PACKED
- /**
- * Does OSS expect samples in reverse byte order? (i.e. not
- * host byte order)
- *
- * This attribute is only valid while the device is open.
- */
- bool reverse_endian;
-#endif
};
/**
@@ -252,7 +236,7 @@ oss_output_enable(struct audio_output *ao, G_GNUC_UNUSED GError **error_r)
{
struct oss_data *od = (struct oss_data *)ao;
- pcm_buffer_init(&od->reverse_buffer);
+ pcm_export_init(&od->export);
return true;
}
@@ -261,7 +245,7 @@ oss_output_disable(struct audio_output *ao)
{
struct oss_data *od = (struct oss_data *)ao;
- pcm_buffer_deinit(&od->reverse_buffer);
+ pcm_export_deinit(&od->export);
}
#endif
@@ -517,7 +501,7 @@ sample_format_from_oss(int format)
static bool
oss_setup_sample_format(int fd, struct audio_format *audio_format,
#ifdef AFMT_S24_PACKED
- bool *reverse_endian_r,
+ struct pcm_export_state *export,
#endif
GError **error_r)
{
@@ -537,8 +521,9 @@ oss_setup_sample_format(int fd, struct audio_format *audio_format,
audio_format->format = mpd_format;
#ifdef AFMT_S24_PACKED
- *reverse_endian_r = oss_format == AFMT_S24_PACKED &&
- G_BYTE_ORDER != G_LITTLE_ENDIAN;
+ pcm_export_open(export, mpd_format,
+ oss_format == AFMT_S24_PACKED &&
+ G_BYTE_ORDER != G_LITTLE_ENDIAN);
#endif
return true;
@@ -583,8 +568,9 @@ oss_setup_sample_format(int fd, struct audio_format *audio_format,
audio_format->format = mpd_format;
#ifdef AFMT_S24_PACKED
- *reverse_endian_r = oss_format == AFMT_S24_PACKED &&
- G_BYTE_ORDER != G_LITTLE_ENDIAN;
+ pcm_export_open(export, mpd_format,
+ oss_format == AFMT_S24_PACKED &&
+ G_BYTE_ORDER != G_LITTLE_ENDIAN);
#endif
return true;
@@ -611,7 +597,7 @@ oss_setup(struct oss_data *od, struct audio_format *audio_format,
oss_setup_sample_rate(od->fd, audio_format, error_r) &&
oss_setup_sample_format(od->fd, audio_format,
#ifdef AFMT_S24_PACKED
- &od->reverse_endian,
+ &od->export,
#endif
error_r);
}
@@ -726,10 +712,7 @@ oss_output_play(struct audio_output *ao, const void *chunk, size_t size,
return 0;
#ifdef AFMT_S24_PACKED
- if (od->reverse_endian)
- chunk = pcm_byteswap(&od->reverse_buffer,
- od->audio_format.format,
- chunk, size);
+ chunk = pcm_export(&od->export, chunk, size, &size);
#endif
while (true) {